I was recently asked if there was a way to control three unique outputs separately from eachother using a rotary switch as well as turning on outputs two and three on the fourth position of the switch without interfering with the other outputs during the individual switching of each output. My initial solution to accomplish this used one 4 position rotary switch, one npn transistor, two Schottky diodes, one 12VDC relay, three unique LEDs with the appropriate resistors, a single 1000 ohm resistor, one 12VDC 500mA power supply, and a 2.1x5.5mm barrel connector.
Circuit Behavior: Design Explanation
Fully designed circuits can be confusing to look at without a breakdown of what happens. The above circuit has all the part numbers I used. Below I will go through each “step” when activating the rotary switch to show how this circuit works.
- Position 1: LED 1 by itself
- Position 2: LED 2 by itself
- Position 3: LED 3 by itself
- Position 4: LED 2 and LED 3 on together
The “X’s” I drew show that current cannot pass in a certain direction due to a lack of continuity. In this case there is only one X where the NPN transistor is. The transistor cannot be on because there is no voltage or current present on R4; therefor, no current can travel back through the NPN to the relay.
There are more “X’s” to show where current cannot flow. In this case the NPN isn’t on again and current cannot flow through the open switch because the relay cannot receive any power in this position.
This time the branching path goes to the other side of the open relay switch. There still isn’t any power going to the relay and the NPN is blocking current backward again since it isn’t on. Also, diode D2 blocks current from going backward to the relay (the diode has a breakdown reverse voltage of 20V, so no problems there).
Position four has a lot more going on, but it is still simple to explain. Path four turns on the NPN transistor by saturating the transistor via the gate (the one I chose has a gain of 60 at 10mA, the 1K resistor before it limits the current to 12mA guaranteeing saturation). Since the transistor is now on, current can pass through the relay and the relay functions at 12VDC which is present from J1. The diode D1 is just for protection since relay coils tend to kickback after turning off. Current can pass through the NPN transistor back to ground allowing a complete path. The current also splits off to diode D2 and moves forward because there is enough voltage (the diode has a Vf of 450mV at 1A) which will reduce the available voltage to LEDs 2 and 3. The relay switch is now closed since the relay is functioning which allows current to travel to LED 2. The current also is split back up to LED 3 after diode D2 allowing that light to be on as well.
Photos of Circuit Functioning
Position one of rotary switch :
Position two of rotary switch :
Position three of rotary switch :
Position four of rotary switch :
Bill of Materials and Shared Cart Link
|Quantity||Digi-Key Part Number||Manufacturer Part Number||Price Per Unit|
The total cost is $23.66 with all the parts above. I used basic 22AWG solid core wire to hook everything up. Here is the link for the list of parts I used for convenience: https://www.digikey.com/short/zcpt47
Quick Notes on Selecting Parts for the Design
I have a few closing statements on choosing certain parts. I selected a 12V supply with at least 500mA of current to account for all the losses in the circuit. This is well over the amount actually used in the circuit. I knew I would be pushing limits if I did anything close to 75mA since two LEDs draw 48mA and the 1K resistor draws 12mA. The diodes will have very low current draw so I’ve ignored their potential drop. The relay draws about 15mA on the coil, which brings the total to 75mA and the transistor can only handle about 625mW max (I am certainly not maxing out the power either by any measure from collector to emitter). The power consumption will be very low for the transistor as well, which I’ve also ignored. The supply I’ve chosen leaves plenty of excess available power for further additions if I chose to experiment. I also know that we don’t really have a lot of supplies at a low maximum current with the specific connector I need (did filtering check on a few parameters).
The NPN I chose was somewhat new to me since I don’t design a lot of circuits with transistors. This piece is more of a redundant safety choice. Technically, the circuit drops current and voltage enough to where it doesn’t activate the relay even if it did flow backward. I just wanted to expressly prohibit any current (or extremely miniscule) flowing backward into the relay coil. I needed something convenient because I had a lot of extra resistors. 1K ohms seemed decent and 12mA certainly seemed within the realm of what amount of current would be typical to saturate a typical NPN transistor. I did some searching to find a transistor with a gain at a current level that was close to the 12mA level. The one I found has a gain of 60 @ 10mA, 5V. I am well over this requirement: 12mA from 12V will certainly saturate the transistor. All the other ratings are well over the 12V max and max current drawn (Vce, Vce breakdown, and 600mA collector current).
The diode I used for protecting the circuit from kick-back is a general schottky diode. The only thing to watch for is the reverse voltage, you don’t want it to conduct the wrong way and cause a short if too much voltage is present. The kick-back of a coil is usually very high in voltage, but it is too fast to cause much damage to the diode itself. The diode limits the kick-back to the voltage present in the circuit instead of a dangerous level that will damage other sensitive parts.
The other diode took more thought for providing a path to LED 2 and 3. I had to be mindful of the current and reverse voltage. Obviously I needed more current for two LEDs and I did not need headaches from a low reverse voltage. I also didn’t want too much of a forward voltage drop to make sure the LEDs were about the same brightness. The Schottky diode I chose has a average forward current is 1A (way more than I need), 20V reverse which is ample above 12V, and finally the forward voltage is only 450mV at 1A.
For the switch and jack, I just needed to make sure they could handle the current and voltage present. They both have plenty of capacity for this circuit.