60+ Button Input - Best Approach?

Status
Not open for further replies.

djex81

Active member
Hello All, I am currently building a MIDI sequencer and have the code pretty well complete. I am better with programming than the electronics side of things. However this has not stopped me yet. I'm going to have about 60 or so button inputs and to save digital pins on the teensy I originally thought of using a few 74HC165 shift registers. However this chip will only handle 8 inputs and I will need 8 x 74HC165 which seems like a lot and also seems like there has to be a better way to handle this many inputs. I thought of maybe using matrix for all the buttons but that could get messy as the buttons will not be in a nice grid and each with different functions. Any suggestions as to how I could achieve 60+ inputs without using every pin on the teensy?

In total I'll have about 60 buttons, 6 rotary encoders and 3 digit 7 segment display and a switch and so I need a few digital pins left for encoders, switch and display. Maybe I could use SPI to save on pins?

I found Paul's 128 buttons, 6 axes, 17 sliders and 4 hats joystick here: https://forum.pjrc.com/threads/23681-Many-axis-joystick?p=41942&viewfull=1#post41942 and am wondering how he achieved 128 buttons hardware wise.
 
I have done several buttons before 20+ using a keyboard matrix, which you can read with libraries such as the keypad library that ships with Teensyduino.
There are lots of web sites that describe this such as: https://www.embeddedrelated.com/showarticle/519.php

I have also played around some with multiple buttons (like 3 or 4) connect up to one analog pin using a resistor ladder. So you know which pin or pins that are pressed by which analog voltage is read in.

I have done this before also using a MUX circuit such as I think you are mentioning.

Sometimes it may depend on things like, do you need to handle multiple buttons pressed at the same time or not.

Sounds like fun.
 
I have done several buttons before 20+ using a keyboard matrix, which you can read with libraries such as the keypad library that ships with Teensyduino.
There are lots of web sites that describe this such as: https://www.embeddedrelated.com/showarticle/519.php

I have also played around some with multiple buttons (like 3 or 4) connect up to one analog pin using a resistor ladder. So you know which pin or pins that are pressed by which analog voltage is read in.

I have done this before also using a MUX circuit such as I think you are mentioning.

Sometimes it may depend on things like, do you need to handle multiple buttons pressed at the same time or not.

Sounds like fun.

Thanks for the ideas! and yes I will need to be able to detect multiple button presses at once. There are many functions that will be hold one button while pressing another.
 
I have done a 80key velocity sensitive piano keyboard scanner using 2x10 74hc165.
So 8x 74hc164 is not that much,
and you could read them in parallel by using 8data+clk+latch=10 pins of the teensy.
You can read this thread where there are a similar problem.
https://forum.pjrc.com/threads/64473-Re-doing-my-Hammond-MIDI-controller-ideas-and-suggestion-needed

That is a great idea. Never thought of reading all 8 in parallel. I would guess that handling multi button hold / presses should work? At max I would need to detect two buttons pressed / held at the same time.
 
Status
Not open for further replies.
Back
Top