Summary of How to Read Many Switches with One MCU Pin
This article explains how to read multiple switches using a single microcontroller pin by employing a voltage divider circuit. The author describes a scenario where a project grew too large, necessitating a solution without shift registers or specific ICs. By arranging resistors in series and connecting switches to tap different voltage points, the system generates unique analog voltages for each switch activation, allowing an ADC-equipped microcontroller (like an AVR) to identify which switch was pressed.
Parts used in the Voltage Divider Switch Reader:
- Multiple switches
- Resistors
- Microcontroller with ADC (Analog-to-Digital Conversion)
- Voltage controlled oscillator (Optional alternative indicator)
- Blinken lights (Optional alternative indicator)
- Sound output (Optional alternative indicator)
Have you ever been chugging away at a project(s) and the project keeps growing and growing, while you add more things to it (we call that a Feaping Creaturism)? On a recent project, I was building a frequency meter and added a five function signal generator/frequency synthesizer. I soon wound up with more switches than I had available pins left, so what’s a guy to do?
However, I soon had seven more switches on my Funbox (yeah, that’s what I called my function generator…I know, I have no creativity) and here’s a short instructable showing you how you can do the same. It doesn’t require any shift registers or specific IC’s. In fact, it doesn’t require a microcontroller, either, if discrete semiconductors is how you roll.
Here’s one way you can read/manage multiple switches using a single pin on your AVR (or other microcontroller…I’ve heard there are other microcontrollers besides AVR‘s, but I can’t imagine…)

Step 1 The Essentials
In order to accomplish this, you’ll need a few components. It helps to have a multitude of switches that you have to manage. You’ll also need some resistors and either a microcontroller that has ADC (Analog-to-Digital Conversion) or some other way you’d like to indicate that there was a switch activated and which switch it was.
If you wanted you could use a voltage controlled oscillator to indicate this, maybe with some blinken lights, or alternatively, with sound. In this ‘ible, I’m going to pretend we’re using an AVR, but in your world you can pretend whatever makes you happy. I miss Bob Ross.
Step 2 The Voltage Divider
Essentially, the way we’re going to do this is by using a technique and circuit called a voltage divider. Voltage dividers do, as you may have guessed, divide the V,,in,, voltage by some value that you determine. You can divide voltage with several components, including capacitors and inductors, but here I’m going to do it with the good ‘ol resistor.
The Idea
What we are doing is putting two components in series that will cause, each individually, a drop in voltage across the component. Look at the first picture if I’m not making sense. There is a potential difference of 9V from rail to rail. Between 9V and 0V there are two resistors in series. Each of these will experience a voltage drop across itself, depending on the resistance, as you probably recall from V = IR. If you take a voltage measurement between the two resistors, you’ll get some value between 9V and 0V, depending on how much voltage has dropped across the first resistor and how much is left to drop over the 2nd resistor, before 0V.
There is a straightforward formula for calculating the voltage drop across a resistor in this situation and it looks like this. Let the voltage over resistor 1 (R1) be V1 and the voltage over resistor two (R2) be V2.
Since I can’t use formatting anymore, look at picture 2 below for the formula…
So, in our resistive divider, the Vout voltage can be determined by our formula for V2 (since we’ll be referencing GND to 0V).
What does this have to do with having a bunch of switches being detected from one pin? Well, turn the page and I’ll show you!
For more details, click: How to Read Many Switches with One MCU Pin
- How can I manage multiple switches using a single pin?
You can use a voltage divider technique with resistors and switches to generate unique voltage levels for each switch. - Does this method require shift registers?
No, the described method does not require any shift registers or specific ICs. - Can I use a microcontroller other than an AVR?
Yes, the technique works with any microcontroller that has an Analog-to-Digital Conversion feature. - What is the basic principle behind reading many switches with one pin?
The principle relies on creating a potential difference across series resistors where each switch taps a specific voltage value between 9V and 0V. - What formula determines the voltage drop in this circuit?
The voltage drop is determined by the standard resistor voltage divider formula involving the resistance values of the two components. - What are some alternative ways to indicate a switch activation besides a microcontroller?
You can use a voltage controlled oscillator with blinken lights or sound output to indicate activation. - Do capacitors or inductors work for this voltage division?
While they can divide voltage, this specific guide uses resistors for the implementation. - What happens if you measure voltage between two series resistors?
You will get a value between the rail voltage and ground depending on the voltage drop across the first resistor.

