I found this lovely decade box in a demolished house recently and want to turn it into an Ableton controller. As you see, there are 18 knobs, each with 12 individual states.

I'd like to have a program which can access the states of all the knobs at any time, and I have an arduino which I can use. Is this possible to do without a shield?

My first thought is that, since many of the leads on the back already have resistors on them, I could use a sort of total-resistance-across-the-connection approach which would suit itself to the analog inputs. But I'm not sure that's the way to go, especially if I want very low latency.

How can I wire up a board that has digital access to all the pins here? How does a multiplexer play into this? How many inputs would I need? I am super new to this kind of stuff, so I imagine this must be a pretty simple answer.

Thanks for your help.

enter image description hereenter image description here


The other answers are excellent, however I want to address this question:

How does a multiplexer play into this?

Just as an example of how multiplexing helps, I opened up a scrolling LED sign which has 504 individual LEDs which "appear" to be all on at once (if wanted).

Internally were 10 x 74HC595 serial shift registers. 9 of them were hooked up to the individual columns (giving 72 columns), and the last one was connected to the 7 rows.

 9 * 8 =  72    columns
72 * 7 = 504    LEDs

Thus we could turn on 504 LEDs. However to have individual LEDs appear to come on the code has to turn on one row (out of the 7) and then output the pattern for that row to the 72 columns. Then it switches to another row, does the next pattern, and so on.

I have a video of this effect on Vimeo.

If you do it fast enough, all the LEDs appear to be one at once.

Now you can do this for switches too, just connect all the individual positions together, and then apply "power" to each switch in sequence, and read the results. This time you want an input shift register, eg. the 74HC165 for the reading, and an output register for powering each switch.

The problem is with switches though, that you would get "phantom" reads because switches aren't diodes (or, worse, the inactive switches would short the power to ground). So you would need a diode in series with each switch to prevent that. Ah well, diodes are cheap.

This is exactly the same concept as the way keypads work. Say, a 16-key keypad will have 8 wires: 4 rows and 4 columns.

Having said all that, you will still need quite a few chips unless you set up quite a complex "simulated" keypad array. Maybe it wouldn't be too bad.

You have 17 switches so that would be 2 x 74HC595 for activating each switch, plus one spare pin on the Arduino. And the switches seem to have around 12 positions, so that would be 2 x 74HC165 to read which position it was at.

So, for each switch, you make that one HIGH and the others LOW. Current will flow through the diodes and the rotary switch, presenting a HIGH on one of the 12 "reading" pins. The diodes stop the current from shorting the HIGH to the LOW through other switches.

You take a reading, and move onto the next switch. This can be done quickly, in the same way the LED sign scrolls so fast you can't spot any flickering.

This schematic illustrates the idea:

Rotary switch example

In this example we apply a HIGH to the common part (rotor) of the left switch. It goes through the diode, and the selected position, to make input "read 1" high. The diode on the other switch prevents the HIGH from being shorted to the LOW, even though both switches are in the same position.

You would need a pull-down resistor for each of the 12 "reading" lines, so that if they weren't being forced HIGH, they would read LOW. And one diode per rotary switch. So, not too many extra parts. And the wiring is simple, just connect each corresponding switch pin together (except for the common one, of course).

I think this will work, unless anyone can see a major flaw. :)

  • Wow, this is great! Thanks so much. The LED example really helps to illustrate the point. I think this idea is workable, and seems like it would be pretty cheap. – bealbrown Jul 30 '15 at 6:41
  • I'm beginning to think Nick is some sort of super human. How else do you explain being able to generate so many high quality, educational solutions? :D – linhartr22 Jul 31 '15 at 21:15

The hard part here is that you essentially have 216 inputs you need to read.

You could multiplex the analog pins using two 74HC4051. Analogread takes around 0.1ms, so around 2ms for all 18 knobs. Debouncing would however be pretty hard.

I'd probably go with input shift registers, and remove all the resistors. You would however need 27 8-bit shift register (3 registers per 2 knobs).

To reduce this you could encode the rotary position into 4-bit using a diode network. That way you can use only 1 shift register per 2 knobs. So 9 in total.


You can use the analog route by using a CD74HC4067, then you can hook it up to a analog demultiplexer, such as the CD74HC4067(breakout from SFE) which has 16 analog/digital inputs. You would use one of these and two analog pins, one from the breakout and one from the panel, as there are 17 dials from what I can see.

An example of a resistor ladder: enter image description here

The 4067 is addressed using 4 digital pins to make up a binary address relating to each input. You would put this into a for loop and read from each address and put in an array of values each time you loop. And when leaving the loop read the last analog value. I would use port manipulation to write the address as it would speed up the operation.

Once you have the values in the array you can then do the math require to get where the dial is or you can do that as you read the analog pin the the for loop, kind of keep it all in one function. You can find the calculation for converting in the Wikipedia article, the R-2R style.

Bildr have a nice write up with some code, an image of the basic setup:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.