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.


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.

<p>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.</p>
<p>I saw an instructable that used that arrangement with a 555 timer to make a simple synthesizer, each button would play a different pitch.</p>
<p>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.</p>
<p>I have shown very similar approach in <a href="https://www.instructables.com/id/Arduino-MobilePhone/" rel="nofollow"> https://www.instructables.com/id/Arduino-MobilePh...</a></p><p>I had 16 buttons and adding more would be already difficult due to the voltage and resistance variations...</p>
<p>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.</p>
<p>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.</p>
This is wonderful. I did not think about this. what a clever fix.

About This Instructable



Bio: Life learner
More by Fer Cuesta:HUNDREDS OF PUSH BUTTONS WITH ONE PIN - Arduino 1$ wire peeler 
Add instructable to: