![]() |
LED Switch
I wanted to create a circuit out of a keyswitch. When the key is in position 1, the green light is on. When the key is turned to position 2, the green light turns off, and a red light turns on. I drew up a mock up of how this is supposed to work. The lower left would be the power supply.
But I don't know how to turn off the green light when the key is in position 2. Does anyone know how? http://www.gamesaints.com/circuit.gif |
Well, two things. First of all, do you have the proper resistors in series with the LEDs? Otherwise they'll burn out pretty quickly.
Second, if you just connect a wire from the positive terminal of your power supply to the LED, and the negative terminal of the LED to position 2 on the switch, it should work fine...I'll sketch a circuit for you and see if I can find a spot to upload it. Edit: There ya go...make sense? Your just switching which LED gets to see the complete circuit. http://img62.echo.cx/img62/1258/circuit4ko.gif |
That's really ingenious, but the keyswitch doesn't quite work like that.
Here's what it looks like... http://i20.ebayimg.com/01/i/01/68/18/b7_1_b.JPG Basically all the keyswitch does is complete the circuit between the two nodes, not switch which node gets active. Do you think it's still possible? |
This is what you want, excuse the poorly drawn resistors
http://img19.imagevenue.com/img.php?..._schematic.JPG http://img19.imagevenue.com/img.php?..._schematic.JPG |
How would that shut off the green light once the keyswitch is flipped?
|
nevermind for now, perhaps will post later
|
catback's circuit should work if you get the resistor values right. It might work better if the LED with two resistors in the path has a diode added in series.
Idea is when the LED with one resistor is on (the LED with the switch in the path) the current is high enough to cause a voltage drop large enough to not allow the other LED to light. Adding a diode in series with this leg of the circuit might allow the two LEDs to have a similar brightness by not requiring the first resistor to be so large. |
Utilizing pull-down/pull-up resistors like this can be very tricky. You might be better off using a TTL or CMOS inverter. The circuit would be pretty simple:
http://www.djskaven.com/yatta/red_green_t.jpg Click for big version The basic idea is that when the switch is in position 1 (and presumably closed), the inverter gets a high signal, so it outputs "0", and the red light goes off. At the same time, the green light is getting a signal, so it turns on. When the switch is in position 2 (and presumably open), the inverter is getting a low signal, so it outputs "1", and the red light turns on. At the same time, the green light is getting no signal, so it turns off. 3.3V TTL inverters are pretty cheap (you can get them on www.digikey.com for under a dollar, and probably from Radio Shack for under 5.) Power the circuit with two AA batteries and use some 240 ohm resistors to prevent the LEDs from burning out. If you can only find CMOS (5V) inverters, then power the circuit with three AA batteries (4.5V) and use 470 ohm resistors. The resistor values are approximations based on what I've acutally built before...I could be way off so be careful. |
Nice one Skaven!
This may not be as good but might be something to play with. Values are not critical. R3 should be as large as possible but still allow Q1 to saturate. Untested! If anyone wants the circuit explained, I'd be happy to tell my version. http://s1.simpload.com/080842f741609fd8f.gif |
Honestly they are all great ways to accomplish the basic task but the best way would be to use a SPDT relay. Of course if this switch controls something electronic or something with high impedance one of our ways would be quieter. But if the switch controls something that needs a good amount of current a simple SPDT relay would be easiest. To each his own, the possibilities are endless.
|
Diplomacy aside:
The problem as stated is to switch between two LEDs. 20ma or less is typical. I happen to think (at this time) that my circuit is best because it will work off of a single supply voltage of 3 to 24 volts by changing the resistors (at the extreme voltage ends), and not requiring any extra current, to drive a relay, for example. For switching AC or dirty voltages and/or high current loads, yes, a relay is a very good choice. If you have a small low current relay handy and this is an automotive application then a relay is a good solution to the problem. |
I agree with flat5; a low-voltage, low-current circuit will be needed to drive the LEDs anyway...why not use a simple resistor/transistor network or a CMOS/TTL inverter to make the LEDs all part of one circuit with one input voltage requirement.
|
Quote:
|
You're right, why just switch LEDs? But that was the stated problem.
You suggested two resistors. Which is very tricky to get right. (have you tried it) :-) I added one transistor but was unsure if it would work so added another resistor. |
Quote:
|
yes variable resistors would be the only way I could find the values.
cool that you tried it. in the dark? :-) edit: what voltage, resistor values worked? |
This is a pretty cool thread, do you guys know of other places that have schematics online for different types of things?
|
Just Google on "circuits".
Or be more specific. Here was the first hit. http://www.aaroncake.net/circuits/index.asp another good site: http://users.pandora.be/educypedia/e...icaopening.htm |
All times are GMT -8. The time now is 12:53 AM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2
© 2002-2012 Tilted Forum Project