Let's Make Robots! | RobotShop

Reading out multiple buttons with a single ADC pin

In this video I show you how to read out multiple buttons using only one ADC pin.

I hope this is helpful to all of you who have not enough I/O pins left or to those you want to control loads of switches!


The resistor value you will generally use will be 10k or more so you don't draw loads of current, forgot to mention that in the video :)


If you like it leave me a comment and give me a thumbs up on youtube ;)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

If I remember right, this principle is described in the book 'Extreme NXT'.

Didn't know that :) Never had an NXT, started off the hard way of trial and error :P

It works in principle fine as long as only one button is pushed at a time.

If multiple buttons are pressed eithr by purpose or accident the measure result is not predictable since the whole resistor divider changes.

Just an important thing to consider.

The below method is 'safer' since by selecting the correct resistor values it should be possible to detect multiple buttons.

In embedded systems, the only time I can think of ever needing to detect multiple button presses is for going into diagnostic modes. If a diagnostic mode is not required then you can easily program out the incidence of multiple button presses as invalid response.

I think I prefer your circuit though.

The advantage of this circuit is that it draws no current when no switches are activated. Otherwise my other comments apply to this circuit as well.


It is called as a frame from the following page.

While the pages are more generally slanted towards PICs and JAL, some of the hardware links should be fairly universal.

I thought about this a while ago, never got round to doing it)can't remember to be honest) nice job.

I think this could be useful for implementing with small micros, its a different approach from the matrix keypad configuration typically used to reduce the number of pins used.  The number of pins a matrix keypads uses is at least 2*sqrt(#_of_buttons).

Has this idea been tested in real life?

When suggesting the 10K value for each resistor has you taken in account the maximum recomended output impedance according to the selected microprocessor specification? A PIC processor (PICAXE also) recommend a maximum value of 2.5k (the impedance/ohm resistance) going to V+ (5 VDC). This is important in order to charge the internal measuring capasitor in the mircoprocessor wtihin the in the microprocessor specified timeframe.

Let me know if more explanation is required.

Note: The similar circuit that birdmum has linked to is using an analog comparator as measuring device which does not have the capacitor issue.

Anyone who maybe know better and disagree please comment on this.

Yep, you're right. 10k may be a little much for the ADC.

Tested this with 1k resistors and it works a treat, but anyway depending on which button you press the impedance to VCC is going to exceed 2.5k when you press button 3 or higher.