2 LED choice display with 1 switch. (electronic)
Or you can use 1 Arduino GPIO to control 2 LED’s.
2 LED choice display: How to turn 1 led on and the other LED off, using 1 switch or 1 Arduino or Raspberry-pi digital output? You can of course just use a 3 pin switch. But the intention here is to do this electronically. Because this then forms the basis for integrating this small electronic scheme into another expanded electronics scheme.
To calculate the series resistance of the LED’s I made a simple calculator.
LED series resistance calculator This not only calculates the ballast series resistor. But it automatically searches for the next existing resistor in the E12-series collection. It would be crazy to ask for a non-existent value in the store 😉
This calculator also draws a resistor with the correct color band code. That way you can see in your collection resistors, if you have them, without having to measure them with your multi-meter. Or count all those colors all the time 🙂
Working of the 2 LED choice display:
This is quite simple. In this 2 LED choice display, I use 2 different transistors. 1 of the NPN type. And 1 of the PNP type. The base of these 2 transistors is connected to the plus of your power supply via the resistor. I use only 1 switch to turn 1 LED on and the other LED off. (and vica versa)
This ensures that the BC547 NPN transistor is active. And so LED 1 is lit. If you close switch S1, the situation changes. The pins of the transistors now hang via the lowest resistance on the negative pole of the battery. And so the second transistor BC557 PNP will be active. And so only the second LED lights up.
If you want to use a digital output. Then replace S1 also with a NPN transistor type BC547. (And a 1 kilo ohm resistor connecting your digital output to the base-pin of the transistor. And also connecting the mass (0 Volt) of the Arduino and this circuit.)
Model train switch light.
This is an example for the use of this electronic circuit. If you use a double pole changeover switch. (6 pins) These are actually 2 single pole switches in 1 housing. Then you use one half as S1 (1 contact remains unused) And the other half you can use to operate the track switch. The 2 LED lights can then be placed as a signal next to the track.
This is just a simple schematic. You actualy need of course 4 wires to your train traffic light. They are sold with 1 common ground. So you have to de-solder this unit and rewire it internally. (Or you can build your own train traffic light of course.) (You can simply cut this out of wood or plastic and drill some holes to put the LED’s thru and glue the wires to the back. And then paint it black)
In the scheme I had used a 4.5 Volt battery, but this also works with 12 Volt. Therefore, there is no value at the resistances of the LED lights. You have to calculate this yourself because it depends on which LED lights you use.
Arduino – Raspberry pi – 2 LED’s on one output.
You can also use the schematic to double your outputs on your Arduino UNO (or Raspberry pi). If you replace S1-switch with another transistor type BC547. Then you can use the base of that transistor as an input from your Arduino.
Or you can connect the 2 LED choice display circuit to the output of an IC-555 circuit that you use as an oscillator (A.M.V.: a-stabilize-multi-vibrator) Then you can use this in your model train crossing traffic light. See YouTube video: