Connect with us

transistor switch for LED's

Discussion in 'LEDs and Optoelectronics' started by OldHat, Apr 24, 2013.

Scroll to continue with content
  1. OldHat

    OldHat

    11
    0
    Apr 24, 2013
    Hi all,

    I'm building a prop for a childrens event. It's a sort of fake decoding machine. When a card (with an irrelevant code on) is slid into a slot I want it to open a switch and turn on 3 LEDs inside a box, while simultaneously turning off an LED outside the box. I want to run it from a battery (9v?).

    Here is a summary of the functions:
    http://www.flickr.com/photos/[email protected]/8675815551/

    I have googled around and have come up with the following solution:
    http://www.flickr.com/photos/[email protected]/8675813959/in/photostream/


    Is this a good solution?

    Can anyone help me calculate the resistors/ tansistors needed?

    I need to produce this quickly and cheaply and I'm going to solder it all up with my own inexpert hands (not literally - I don't have soldering-iron-fingers or anything)

    All help much appreciated
     
  2. OldHat

    OldHat

    11
    0
    Apr 24, 2013
    oh just realised that in the circuit finctions picture I have accidentally reversed the master switch functions... oops.
     
  3. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    25,389
    2,774
    Jan 21, 2010
    Looking at the circuit diagram you have, the LED marked "Set 1" will never illuminate, and the LEDs marked "Set 2" are going to always be illuminated as long as the master power switch is on.

    I presume you want the card switch to toggle "Set1" and "Set 2"?

    And that the master switch turns everything on and off?

    I'll try to draw you a circuit to do that... (It's not pretty)

    R1 can be something like 10k
    R2 and R4 are chosen appropriately for the LEDs
    R3 should be as high as possible so that the LED on the left doesn't appear to be lit. I would start with 10k.

    When the switch CS is open the single LED will be off (actually it will have a VERY dim glow) and the three LEDs will be ON.

    When the CS switch is closed, the single LED will be ON and the three LEDs will turn off.

    If the LEDs don't turn fully on or fully off, some twiddling of component values (chiefly R1 and R3) may be required. The two LED sets can be swapped over if you need to.

    If this is not what you need, let me know :)
     

    Attached Files:

  4. BobK

    BobK

    7,682
    1,686
    Jan 5, 2010
    Easiest way is to use a SPDT switch. Common contact to the power, NC contact to the string of LEDs that should be normally on, NO contact to the string of LEDS that should be normally off, with resistor in each string to ground.

    Bob
     
  5. OldHat

    OldHat

    11
    0
    Apr 24, 2013
    Thanks

    Thanks Steve
    That looks like you have hit the nail on the head.

    I based my circuit on one that used a LDR in place of the card switch and no 'set1' LED - its on this page if you are interested (about 4/5 of the way down):

    http://electronicsclub.info/transistorcircuits.htm

    I guess the LDR and simple switch are not interchangeable. I'm struggling to get my head arround it all to be honest havin no real electronics knowledge...


    Couple more questions.
    1. do transistors come in a a range of types - how do I work out which to use (I guess its NPN but do they vary?)

    2. if I am powering 3 LED's in series will a 9v cell be too little? (i think they normally drop about 3v?). Should I connect them in parallel to one another?

    3. Do you think a single 9v cell will run this set up all day or should I put a couple in parrallel?


    Hi bob
    Thanks for your suggestion - that would be much simpler.
    Unfortunately because my prop will be controlled by a card sliding between two contacts I can't use a togglilng switch - only open or closed...
     
  6. OldHat

    OldHat

    11
    0
    Apr 24, 2013
    Oh balls. Ok thanks for the heads up Bob - it does say there is a moderator when you hit submit reply... I wonder where those two messages went then.

    well I'll do it all again then (must remember to copy messages before posting...) :

    Steve: thanks of your post I think you have hit the nail on the head.

    I based my circuit on light sensing circuit which had an LDR in place of my card switch and which switched the LED on when the LDR was dark.

    It's here if you are interested (about 4/5 of the way down):
    http://electronicsclub.info/transistorcircuits.htm

    I guess the LDR is not replaceable with a simple switch. I am struggling to get my head around all this as I dont have any real electronics knowledge...:eek:

    I still have a couple of questions:

    1. I figure the transistors are NPN, but are there different types of NPN transistor, how do I choose.

    2. Will the 9v cell power all three LEDs in series well? I read that LEDs normally drop about 3v each. Should I be wiring them in parrallel to eachother?

    3. Do you think a 9v cell will run this set up all day or should I put a couple in parrallel to extend their life?

    Thanks again.

    Bob: Thanks for your suggestion - it definitely seems simpler. Unfortunately the prop I am making relies on a card sliding into a slot and breaking a contact so the switch can only be open or closed...
     
  7. OldHat

    OldHat

    11
    0
    Apr 24, 2013
    Oh. Ok thanks for the heads up Bob - it does say there is a moderator when you hit submit reply... I wonder where those two messages went then.

    well I'll do it all again then (must remember to copy messages before posting...) :

    Steve: thanks of your post I think you have hit the nail on the head.

    I based my circuit on light sensing circuit which had an LDR in place of my card switch and which switched the LED on when the LDR was dark.

    I guess the LDR is not replaceable with a simple switch. I am struggling to get my head around all this as I dont have any real electronics knowledge...:eek:
     
  8. OldHat

    OldHat

    11
    0
    Apr 24, 2013
  9. OldHat

    OldHat

    11
    0
    Apr 24, 2013
    Bob: Thanks for your suggestion - it definitely seems simpler. Unfortunately the prop I am making relies on a card sliding into a slot and breaking a contact so the switch can only be open or closed...
     
  10. OldHat

    OldHat

    11
    0
    Apr 24, 2013
    I still have a couple of questions:

    1. I figure the transistors are NPN, but are there different types of NPN transistor, how do I choose.

    2. Will the 9v cell power all three LEDs in series well? I read that LEDs normally drop about 3v each. Should I be wiring them in parrallel to eachother?

    3. Do you think a 9v cell will run this set up all day or should I put a couple in parrallel to extend their life?

    Thnaks again.
     
  11. OldHat

    OldHat

    11
    0
    Apr 24, 2013
    (by the way if anyone has managed to stick through this cloud of wierd accidental self-trolling I've ended up doing then you are trojans, thanks a load)
     
  12. OldHat

    OldHat

    11
    0
    Apr 24, 2013
    The circuit I copied is here in case anyone is interested - I think the forum didn't like the link to it.
     

    Attached Files:

  13. davenn

    davenn Moderator

    13,589
    1,872
    Sep 5, 2009
    Hi OldHat

    because you are a new member and a lot of you posts contained links to www sites
    your posts were ( by the forum software) automatically placed into moderation as possible spam. That means a moderator like steve or myself had to review them to see if they were spam or not. I have allowed your posts and deleted any double ups and done a general tidy up of the thread. :)

    Regards
    Dave
     
  14. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    25,389
    2,774
    Jan 21, 2010
    That circuit will suit any small NPN transistor. BC548, 2N2222, or almost whatever else you have on hand or can buy cheaply.

    There are also PNP transistors (which won't work in the circuit as drawn) and mosfets (which are another type of transistor). An N channel mosfet could be used, but there are issues with the sensitivity of the gate to stray voltages which mean I probably wouldn't advise them for a first circuit.

    Well spotted, and yes, top marks for that solution. The only thing is that you should have a resistor for each LED if you place them in parallel. (See the tutorial on driving LEDs in the tutorial section above for more information).

    The live depends on the current drawn. In daylight you may need the full 20mA to make the light from the LED visible. Let's assume that. If you have three LEDs in parallel, then that's 60mA. Let's go with 60mA as the load. A typical (good) small 9V battery will last about an hour under that load, with the LEDs getting quite a bit dimmer toward the end.

    Paralleling batteries would be better, but using larger batteries (say AA C, or even D in series) would be even better. 6 AA batteries would last a lot longer (maybe take a spare set) and probably be cheaper (I can get a pack of 12 or so good AA batteries for the same price as a pair of 9 volt batteries.

    You need to test to make sure the LEDs are visible with the ambient light expected, and I'd probably also see how long the batteries lasted (since the LEDs will get dimmer as the batteries go flat). That will give you a good idea about how many batteries you'll need and how often to change them.
     
  15. BobK

    BobK

    7,682
    1,686
    Jan 5, 2010
    Use a lever switch. The card would simply hit the lever when fully inserted. These can be found in SPDT easily.

    Here is one that might work:

    http://www.digikey.com/product-detail/en/ZMA00A150L04PC/CKN10157-ND/2044493

    Bob
     
    Last edited: Apr 29, 2013
  16. OldHat

    OldHat

    11
    0
    Apr 24, 2013
    Thanks All

    Want to say thanks for all the help fellas

    I used Steves circuit and soldered it up yesterday and it works great (tinkered about with the resistors a bit to get the red LED to be propperly dim when "off")

    It was fun to do.

    Bob that lever switch looks like a good solution. If I hadn't already bought all the bits I reckon that would have been a simpler way to go. Ah, in the perfect world of next time eh...

    Any way thanks again.

    I'll post a picture of the completed "decoding machine" when its done (It should ready by friday - the event is on Monday)

    O
     
  17. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    25,389
    2,774
    Jan 21, 2010
    Glad to hear you got it working, and even more glad to hear it was fun :)
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-