1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Electronics Changing LEDs with a switch

Discussion in 'Modding' started by MrSaLTy, 20 Jun 2004.

  1. MrSaLTy

    MrSaLTy What's a Dremel?

    Joined:
    13 May 2002
    Posts:
    50
    Likes Received:
    0
    OK, I have a switch that I want to have LEDs light up depending on the position of the switch. I know its easy to control 2 of them but I want to throw a monkeywrench into the mix. Let me clarify....

    I have a on-off-on switch thats DPDT. Half will control fan output and that part is easy. I have 3 LEDs. I want one to go on for one ON position and one to go on for the other ON position. I can do this and I understand how but..... I want one to go on when the switch is in the OFF position also. So basically I want a LED to go on for each position of the switch.

    I'm sure this can be done but havn't been able to wrap my head around how to do it. Anyone got any ideas? Thanks in advance, I know someone here will know how.
     
  2. mattg2k4

    mattg2k4 What's a Dremel?

    Joined:
    4 Jun 2003
    Posts:
    61
    Likes Received:
    0
    I'm assuming 12v and 5v are the two on positions?

    There might be a simpler way I can't think of, but you could use a comparator, such as lm339, with the + pin on the common terminal, the - pin on a fixed voltage less than 5v (either 3.3v line or between two resistors connecting 5v to 0v - a voltage divider). You also want a pull-down resistor on the common terminal for reliable operation, say a 10k or higher resistor connecting the common terminal to ground. Then connect the "off" led with anode on a 5v source and cathode to the output of the comparator, with a series resistor.
     
  3. whypick1

    whypick1 The über-Pick

    Joined:
    17 Oct 2002
    Posts:
    2,014
    Likes Received:
    2
    Just a sec, realized an easier way to do it than previously posted, schem will be up shortly.
     
  4. MrSaLTy

    MrSaLTy What's a Dremel?

    Joined:
    13 May 2002
    Posts:
    50
    Likes Received:
    0
    Lets say the switch looks like this.....

    00
    00
    00

    IF these are the solder tabs, One column is used for the fan switching. That leaves the other column. So I have 3 tabs, the top 2 in one column are connected when the switch is in the 1st on position, and the bottom 2 are connected when its in the 2nd on position and none are connected when its in the off position.

    Since one column is being used by the fan switching lets think if the switch as SPDT for this app.

    more ascii art...

    1st on

    C
    C
    O

    2nd on

    O
    C
    C

    off

    O
    O
    O

    where C is connected and O is open.

    So its not a matter of 12v or 5 v etc. there will be one voltage attached to the middle solder tab and the swith connects it to the top and bottom one.

    If it was just a matter of swithing the 2 leds on with the switch.... thats easy. It just that i want one more led lit when the switch has no connects.
     
  5. whypick1

    whypick1 The über-Pick

    Joined:
    17 Oct 2002
    Posts:
    2,014
    Likes Received:
    2
    Ok, I made three different schematics after I realized I got them all wrong, so you're getting text.

    Assume switch contacts go like so:

    AB
    CD
    EF

    ACE will be for the fan, BDF for the LEDs. A gets +5v, E gets GND, C goes to Fan -. D gets +5v, B goes to low LED anode. F goes to high LED anode. Now, for the off LED, you need 3 resistors and two diodes. The anode of each diode goes to the anode of each LED, with a pulldown resistor connecting the two. Combine the two diodes cathodes together, and connect a resistor appropriate for the LED to ground. At the junction between diode cathodes and resistor, put the cathode of another diode in series with your LED, then tie the LED's anode to whatever supply is appropriate for the resistor picked previously.

    Basically, you're creating an OR gate out of diodes, the inputs of which are B and F. The pulldown resistors at the inputs are needed because when the switch goes off, there's not voltage at either, so the pulldown resistor makes sure those inputs see LOW. When both are low, the path of least resistance for the LED is through the the resistor connected to ground. If either of the two on LEDs is lit, then the diode in series with the off LED makes sure it stays off no matter what.
     
  6. cpemma

    cpemma Ecky thump

    Joined:
    27 Nov 2001
    Posts:
    12,328
    Likes Received:
    55
    I can see a way if the "off" led is a 3.5V led and the others are 2V leds. The 3.5Ver would always be connected but moving the switch would put another led on & drop the voltage across it to 2V so it would go out. :cooldude:

    :idea: Come to that, you could use any colours, adding diodes to the "Off" one to raise the forward voltage to more than the others.

    [​IMG]

    All 3 leds share the same resistor to ground, so my parts count is lowest :p
     
    Last edited: 21 Jun 2004
  7. MrSaLTy

    MrSaLTy What's a Dremel?

    Joined:
    13 May 2002
    Posts:
    50
    Likes Received:
    0
    Thanks for the reply guys.... I will set to digesting what you said and see if I can understand all this. Thanks a bunch.
     
  8. MrSaLTy

    MrSaLTy What's a Dremel?

    Joined:
    13 May 2002
    Posts:
    50
    Likes Received:
    0
    Thanks cpemma, that pic helped. It does seem to work in testing. If I use 3 leds of the same voltage rating I need 2 diodes to extinguish the one led completely but it does seem to work. Thanks all for the help. :D
     

Share This Page