0

I'm building an instrument that has 72 buttons that can be pressed. Now I'm planning on using Arduino to send data to computer via USB cable about which buttons are pressed. So I figured I'd need 72 different input pins, one for each button(the button is connected to the Arduino via a wire). But, the Arduino doesn't have 72 input pins, so this seems kind of impossible. So what I'm looking for is a way to somehow extend the number of pins on the Arduino or another way to solve my problem. Maybe it would be better to use another micro-controller? Maybe using analog inputs for this is better?

If it makes any difference, the max number of buttons that can be pressed at once is 10.

  • Look into multiplexing. Create a grid of 8x9 buttons. Energize only one row at a time, and measure all the columns. The energize the next row, and repeat. To reduce the number of pins you could use a shift-register to drive the rows. – Gerben Oct 24 '15 at 18:22
2

There is a whole concept you need to learn:

Matrix

By using a matrix arrangement you can, using (8 + 9 = ) 17 IO pins you can create a grid of 8 × 9 buttons, which is 72 buttons.

This method is used all the time for keypads, and you can read more here: http://playground.arduino.cc/Main/KeypadTutorial

To further reduce the number of IO pins used you can replace the 8 IO pins for one dimension of the matrix with a 3-to-8 decoder, since only one pin is ever active at a time. That reduces it down to just 12 IO pins for the whole shebang.

  • Thank you very much! This was very helpful and I'm going to use the concept of matrix to solve my problem. – user3071028 Oct 25 '15 at 10:55
2

There are quite a few GPIO expanders available that you could use to increase IO lines in your circuit, mostly running off I2C. Just search "I2C GPIO" on your favorite electronics site/google/ebay

Examples: https://www.sparkfun.com/products/8130 [No affiliation]

If every sensed key has to be on a GPIO, then this is the way to go.

Having said that, with IO expanders, you will find that sensing large number of keys still takes lots of code on your uC. With some extra software effort, you could eliminate expanders, and rather scan a key matrix as suggested by Majenko

  • I'm going to stick with key matrix as it seems much easier than any other way. But thanks for suggesting GPIO expanders, I'm sure I'll run out of input pins some day and knowing this beforehand will save me a lot of time. – user3071028 Oct 25 '15 at 11:01
-1

You may try making something like a button grid, Like the ways Leds are connected in a Led cube, For example - In a 4*4*4 led cube, u don't need 64 pins, but a smart connection of all on x and y axis,

what i mean to say is, you need to make rows and columns of button, But i don't think this idea would work cause buttons are totally different from leds, But then also try searching for led cube circuit, let it spark a new idea in your mind.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.