PDA

View Full Version : Circuit needed to allow a PIC to turn something on or off



Tom Gonser
- 12th October 2005, 14:40
Hi folks:

I would like to make a really simple thing happen. I'd like to have a PIC control an on-off switch for a battery operated fan. The power switch on the fan is simple, it simply completes the circuit to power the fan from 4xAA batteries (~6V).

Question is - how do I link an output pin of a PIC to some device which can switch this on and off. I've never used a relay, but suspect that might be what is needed? Is there anything simpler given the relatively low voltage and amperages?

What if I wanted to turn on a household light?

I think the PBP command might be the same as turning on or off an LED, but rather than an LED going HIGH or LOW it would be this exernal device which controls the power to the other device?

Any ideas would be appreciated.

Tom

CocaColaKid
- 12th October 2005, 15:24
You can opto-isolators for high voltage, transistors for lower voltage and medium current, mosfets for higher voltages and higher currents, relays for high currents and high voltages. I'm sure there are more that I can't think of right now. I would just use a PNP transistor to switch the fan on and off. You will lose about 0.6v across the transistor though. If this is not acceptable then use a relay. This allows 100% of the source voltage to be appied to the load.

Dwayne
- 12th October 2005, 16:17
Hello Tom,

Tom>>I would like to make a really simple thing happen. I'd like to have a PIC control an on-off switch for a battery operated fan. The power switch on the fan is simple, it simply completes the circuit to power the fan from 4xAA batteries (~6V).<<

Many ways to do this...Depending upon the current... a simple Transister will do this for you... If more current is needed, purchase a N or P type Mosfet... then your PIC can "Tickle" the gate (like the base of a transistor), and pesto... Mosfets are CHEAP, and they can carry 12 amps of current... They can carry about 2 amps without a heat sink. I can't remember the cost of them... but I am guessing about 1.00 a piece


Tom>>Question is - how do I link an output pin of a PIC to some device which can switch this on and off. I've never used a relay, but suspect that might be what is needed? Is there anything simpler given the relatively low voltage and amperages?<<

Relays that will work perfectly with your PIC can be found at All Electronics... for about 50 cents a piece. Your max current on your PIC leg is 20 mills. Voltate is 5 volts, Thus you can choose the correct Relay quite easily...(if you go relay method).

Mosfet is also really nice...just as easy...tickle the gate, it acts like a relay... put a heat sink on it, and operate 12 amps through it.

Tom>>What if I wanted to turn on a household light?<<

Use a Relay or Triac...

Tom >>I think the PBP command might be the same as turning on or off an LED, but rather than an LED going HIGH or LOW it would be this exernal device which controls the power to the other device?<<

Absolutely correct...


Try a relay...and turn a light on and off via a relay (a diode will be fine).

Dwayne

picnaut
- 12th October 2005, 20:52
Hi,

This is pretty simple.

Take an NPN transistor and do the following:

1) Connect the Emitter to ground
2) Connect the Collector to the 6v rail through a 1K resistor
3) Connect the Base to the PIC control pin through a 500 Ohm resistor
4) Connect the fan's Power+ to the 6 volt rail
5) Connect the fan's Power- to the transistor's collector pin

When the PIC control pin state is logic high, the fan will turn on. If it is logic low, the fan will turn off.

Just make sure the the transistor's maximum collector current can handle what the fan will be drawing. You may want to go to a mosfet, but for a lot of little fans, a transistor should be just fine.

Good luck.

picnaut
- 12th October 2005, 20:53
Hello again,

Solid state relays work great for turning lights on and off.
Crydom makes some nice ones.

:)

Cheers!

Darrel Taylor
- 12th October 2005, 21:17
I've always wanted to try out the X-10 commands, and buy a couple of those wall-wart type modules to turn on/off/dim the lights.

Alas, never have though.
<br>