Instructables

Accessing 5 buttons through 1 Arduino pin - Revisited

I made the original Instructible that this is based on over a year ago (You can see it here to see some of the theory around how this works:http://www.instructables.com/id/How-to-access-5-buttons-through-1-Arduino-input ). To make a long story short, I moved to a different country a few weeks after that and have not played with any electronics since.

I'm starting a project to build a clock that will display multiple timezones (And a bunch of other stuff too), and I need some inputs to set the time and manage the menu options. Since I'd already done the research (Albeit a year ago..) I figured I'll use the same setup to create a 4 or 5 button panel to navigate the settings and change the relevant values.

What I found though is that the original Instructable was a good proof of concept, but it wasn't good enough to put in practice. After working on this the whole night I now have a more practical solution.
 
Remove these adsRemove these ads by Signing Up

Step 1: Parts list

1 x Arduino (Or Arduino compatible board. I use the BBB from moderndevice.com)
1 x 100K Resistor (Brown Black Yellow)
1 x 1K Resistor (Brown Black Red)
1 x 10K Resistor (Brown Black Orange)
1 x 22K Resistor (Red Red Orange)
1 x 33K Resistor (Orange Orange Orange)
1 x 68K Resistor (Blue Gray Orange)
5 x Push button switches
A Breadboard
Some wires to connect it all
skylarsa1 year ago
Hi Riaan
Thanks for this Instructable. It makes a lot of sense, and I'd like to try it since the Uno (which I'm using) only supports 2 interrupts via the Arduino IDE. My project requires 3 buttons and a rotary encoder. The latter uses both interrupts and I really needed a dependable solution for the 3 buttons.
My question is this: will your system work with hardware debouncing? I have used the 74HC14 Schmitt Trigger very successfully for debouncing in the past and wondered if I can still use it when using your system to detect button presses.
Thanks
Christo (Pretoria)
chrisf11 year ago
Really useful thank you. Just the line of thinking I was looking for. Now to see if i can extend that to read any combination of three buttons.
smyastat2 years ago
I have added 8 buttons. The resistors used are 1k, 2k2, 3k3, 4k7, 5k6, 6k8, 8k2,10k and a 10k pull down, The readings are:
1> 517
2> 566
3> 610
4> 660
5> 701
6> 773
7> 843
8> 930

I know things can be better but it works great (for me). Thank you again.
foobear3 years ago
wow, nice way to get a lot more i/o pins
riaancornelius (author)  foobear3 years ago
Thanks :) The cool thing is that it is so simple. It's no harder than wiring up a multiplexer of some kind.
Thanks, I just needed this.
jensenr303 years ago
This is Neat! Where do you get your schematic software?
riaancornelius (author)  jensenr303 years ago
Thanks. The software is Cadsoft Eagle Light. The freeware version works well enough for most hobby projects. The only real limitation is that you can only design boards smaller than 10 x 8 CM.

You can download it here:
http://www.cadsoft.de/freeware.htm
Cool! thanks for the prompt reply, man!
zingberra3 years ago
This article could benefit of a discussion in what direction this could go.

How many different buttons could you detect with this? What is the practical resolution of the AD-input (i.e. in how many practical segments would you be able to divide the digital input and still be sure).

In some projects, maybe you don't need to be completely sure.
riaancornelius (author)  zingberra3 years ago
I mention in Step 4 that you should be able to scale this up to 12 buttons fairly easily (and still be sure). I've also added that into the final thoughts (Step 6).

With the analog inputs having a 10 bit resolution, that gives us 1023 values between 0V and the reference voltage. If you divide that by 12 buttons, you can see that each button would have to be within a unique range of 85 points. I would call it no more than 40 - 50 to be safe.

If you do this, you would have to use fairly accurate resistors (Or measure them and use the ones that are close to the E12 vaues) and you would quite possibly need a better way to debounce the buttons.
riaancornelius (author)  riaancornelius3 years ago
I also added this information into a new step (Step 6: Extending it).