# Rotary switch to turn LEDs on cumulatively

Problem: I have a 12 position rotary switch and 11 LEDs that I want to switch on one after the other until they are all on (on pos 12).

Limitations: It would be easy to use a μC, but I wanted to keep this simple and the part count as low as possible

Things I tried: In my head I planned on using a diode for each pin of the switch to connect it to the previous (works for about 2 leds) but forgot about the diode voltage drop that adds up. And using a diode for every connection (about 66) is just to much of a mess… @jonk explains this approach perfectly in his answer below.

Question: Any elegant ideas what I could do to archive that? I'm a beginner and probably miss something :)

Other ideas

• I found cumulative rotary switches but they seem to be quite rare and I did not find one with 12 positions

• Using an incremental rotary encoder to feed a two shift registers instead (would this work? / might be easier to cave and use a μC)

• What voltage is available and what colour or forward voltage are the LEDs? Jul 27 '19 at 8:54
• If I remember right voltage is be 2.4V (amber leds) and currently I use a 3.2V power supply but more is possible. Jul 27 '19 at 10:05
• @jonk as far is I can tell the part you linked to is equivalent to the one I'm using! Jul 27 '19 at 10:24
• @elpoto Thanks. I may try an answer in a few hours unless you are already good.
– jonk
Jul 27 '19 at 10:56
• @elpoto Mouser carries this. Apparently, you tried a switch very much like that one. So a diode-OR works just fine. I've written an answer for you.
– jonk
Jul 27 '19 at 21:13

This answer was written before the OP commented that s/he is using a 3.2 V supply.

simulate this circuit – Schematic created using CircuitLab

Figure 1. The simplest option if a high enough voltage supply is available. With SW8 closed D1 to D7 will light.

simulate this circuit

Figure 2. For lower supply voltages the chain can be split. In this case SW8 being closed lights D7 but also provides a ground to light all the LEDs in the upper chain.

You can further refine Figure 2 for lower supply voltages but would require more and more diodes.

Figure 3. A single-pole 12-way switch will suffice.

Constant current sources (by me):

• thank you, this looks very promising! probably easier to increase the supply voltage. will try and then probably accept your answer. Jul 27 '19 at 10:26
• I don't think so. It will probably be much higher than you have available. Jul 27 '19 at 10:42
• Use an LED DCDC boost converter to make the voltage. They also have current limiting. Jul 27 '19 at 18:28
• @Transistor I'm using a wall power supply and chose low Voltage because my LEDs were parallel before and I did not want to loose a lot of power on my limiting resistors. I might just as well find a 15V supply or try to add a third chain to get to 12V Will do some reading up on putting LEDs in series now. Love the simplicity of your approach. Jul 28 '19 at 9:45
• See the links I've added to the end of my answer. Jul 28 '19 at 9:51

From this datasheet I find the following diagram for your rotary switch:

It's very simple. Rotation simply moves the line from one position at the bottom of the above diagram to another. So you can connect A to any one of the bottom, numbered terminals. (But no more than one, of course.)

You mentioned the idea of diodes and because of that I'll take that approach and run with it. I think you understand it, already. So I'll capitalize on that fact. Transistor in his answer already gave a nod in the following direction and I think I'd like to elaborate it out a bit so you can see why he wrote, "...would require more and more diodes."

Here's the schematic diagram. Notice the pattern? Notice a whole lot of diodes?

simulate this circuit – Schematic created using CircuitLab

In the above diagram, I've numbered your LEDs and their current-limit resistors from #2 to #12 (holding #1 in reserve as that LED you are not implementing.) The wire-OR diodes are numbered from #13 to #78, so you'll need 66 of them. These are likely just 1N4148 diodes (cheap and available.)

Note that switch position #2 has only one diode going away from it and towards LED #2. But switch position #3 has two diodes going away from it, one towards LED #2 and one towards LED #3. Etc., until you reach switch position #12 where there are 11 diodes going to each of the LEDs.

You can work out the resistor value based upon your supply voltage rail's value ($$\+V\$$), the estimated voltage drop across the LED ($$\V_\text{LED}\$$), the estimated voltage drop across a 1N4148 diode ($$\V_\text{D}\$$), and the desired LED current ($$\I_\text{LED}\$$) as: $$\R\approx \frac{+V-V_\text{LED}-V_\text{D}}{I_\text{LED}}\$$. (Select a nearby standard value.)

This is probably why it would be cheaper/better to just get an MCU to do this for you. All those diodes are then just some internally computed logic expression. And you can even handle subtle things like whether or not your rotary switch is a make before break or break before make type and any appropriate debouncing issues that may "clean up" any noticeable issues you find.

• Thank you @jonk for the clear and detailed description! Sorry if I was not clear enough in my own answer, this approach is what I was pointing to with "And using a diode for every connection (about 66) is just to much of a mess…". I will edit my question and point your description so it will help other ppl. Jul 28 '19 at 8:51
• @elpoto The elegant idea is to use a cheap MCU with sufficient I/O pins. ATtiny20, for example? (Cheap.) Problem will be in programming the device. Compilers are free. But programming time is what it is. You could also consider a PAL, GAL, or CPLD; but I suspect they are more expensive and have too many I/Os and pins.
– jonk
Jul 28 '19 at 9:10

Instead of a sack full of diodes you could use logic gates from the 3.3v family. For example OR gates and AND gates would work. These standard chip packages contain 4 gates, so it would require 3 chips to drive 11 lines. If you were to step up a 5v system you could use the standard 5v TTL versions that are fairly low cost. Two types that should work would be 7432 (quad OR gates) or 7408 (quad AND gates). Examples part numbers of the 3.3v logic equivalents are: MC74VHCT32A and 74LVT08. Note that if you were to use 3.3v logic parts then later wanted to move up to a 5v system some 3.3v logic parts are not compatible with a 5v Vcc.

Alternately a standard CMOS non-inverting buffer might work too, some of these are rated for a 3v Vcc minimum. The CD4050 type has 6 gates per chip so only 2 chips would be needed.

The 3 circuits below show only 3 lines of each type. You would need 11 total lines for the 11 active switch positions and LEDs. Note that for the 2 input gates the last gate (line 11) would have both inputs shorted together.

. . . .

simulate this circuit – Schematic created using CircuitLab

• your buffer circuit has many extra resistors, the pull-up is only needed on the #11 buffer, all others are pulled up buy the output of buffer numbered above them Jul 28 '19 at 2:52
• CD4050 looks like a good candidate for the buffer, two chips get you 12 buffers. Jul 28 '19 at 3:03
• since I never worked with gates/buffers (only μC) this would be quite interesting, thank you. Jul 28 '19 at 8:59
• @Jasen, thanks for catching that. Seems I got a bit carried away with the copy/paste. Schematic revised.
– Nedd
Jul 29 '19 at 9:39