Circuit needed to allow a PIC to turn something on or off


Closed Thread
Results 1 to 6 of 6

Hybrid View

  1. #1
    Join Date
    Feb 2005
    Location
    Bellevue
    Posts
    125

    Question Circuit needed to allow a PIC to turn something on or off

    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

  2. #2


    Did you find this post helpful? Yes | No

    Default

    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.

  3. #3
    Join Date
    Dec 2003
    Location
    Wichita KS
    Posts
    511


    Did you find this post helpful? Yes | No

    Default

    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
    Ability to Fly:
    Hurling yourself towards the ground, and missing.

    Engineers that Contribute to flying:
    Both optimists and pessimists contribute to the society. The optimist invents the aeroplane, the pessimist the parachute

    Pilots that are Flying:
    Those who know their limitations, and respect the green side of the grass...

  4. #4


    Did you find this post helpful? Yes | No

    Lightbulb

    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

  5. #5


    Did you find this post helpful? Yes | No

    Default

    Hello again,

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



    Cheers!
    ---> picnaut

  6. #6
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    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>
    DT

Similar Threads

  1. Midi, Interrupts and Pic better than SX28?
    By Lajko in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 27th September 2008, 00:26
  2. Can a pic do several things at once?
    By karenhornby in forum mel PIC BASIC Pro
    Replies: 31
    Last Post: - 10th May 2008, 00:09
  3. Interface for 16f818
    By davekav in forum Serial
    Replies: 4
    Last Post: - 17th April 2008, 11:33
  4. Two PIC 16F877A fried in two days!
    By manumenzella in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 18th January 2007, 10:38
  5. PIC Basic Pro Help Needed.
    By Panash in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 28th October 2003, 09:29

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts