# HUNDREDS OF PUSH BUTTONS WITH ONE PIN - Arduino

7,588

98

8

Don't waste more pins in buttons!

### Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

## Step 1: INTRO

The idea is simple. Use the analog pin A0 for read different push buttons with different resistance values. Then is about setting an interval for each button to use each one.

I prefer to use pull down resistors which force LOW when the button is off, and prevent from strange analog reading values.

## Step 2: CIRCUIT

You can put as many buttons as you need with different resistors.

## Step 3: Calibrate

For this step you have to associate each button for each analog read value of arduino. You could use a multimeter or the following sketch.

As the Arduino IDE doesn't allows you to create .txt files, just copy the interval (ctrl+C) from the serial monitor for then use them in your program.

## Recommendations

• ### Internet of Things Class

22,771 Enrolled

## 8 Discussions

You cannot detect multiple pushes. Anyway this can't be used for prof devices due to the lack of accuracy and the sensivity to noises. I guess you know these solutions were explored far behind digital processes.

2 replies

It's not exact, because this approach can surely detect more than just one switch closed. Obviously that if we want get this capability, we need to chose the value of the resistors with an amount of complexity.

Anyway, just to have an idea, with 4 switches we can combine only 16 values zero included. If we want use this way with 5VDC, we need to appreciate 15 step of 0.33V.

Further, I think that can be useful to consider the possibility to push 2 at maximum switch together.

More than 2 switches closed, appears to me as very little useful in this case, so the number of combination decrease from 16 to 12.

this is true. while you cannot detect multiple presses, this would be a nice easy solution for a rotary switch. as has been said, multiple presses would give some strange results. if you thought about it, you may be able to make some kind of a puzzle game, where multiple presses are required! good luck.

One way to simplify this is to use the DAC arrangement, instead of switching in resistor dividers like here, you would put a bunch of resistors in series and in between each resistor have a switch to ground. All resistors can be the same value, in that case, and the analog values would end up more consistent.

1 reply

I saw an instructable that used that arrangement with a 555 timer to make a simple synthesizer, each button would play a different pitch.

You must remember that afte rsome time switches can gain their own resistance (on contact), so when you push one switch, it can be read as another one.

This is wonderful. I did not think about this. what a clever fix.