# HUNDREDS OF PUSH BUTTONS WITH ONE PIN - Arduino

7,851

99

8

## Introduction: HUNDREDS OF PUSH BUTTONS WITH ONE PIN - Arduino

Don't waste more pins in buttons!

## 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.

## 8 Discussions

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.