afterwards
Member
Help needed: debouncing a button matrix
Dear forum users,
I want to build a button based MIDI/Ableton Live controller and need some project guidance, especially regarding debouncing. I am in an early planning and breadboarding/prototyping phase in order to check the technical possibilities.
My MIDI/Ableton Live controller should have the following outline:
- first stage: round about 32 buttons/keys, maybe up to 64 (not sure about it yet). The whole controller should be polyphonic (play multiple notes simultaneously) and have a low latency.
- later stage: maybe add in some more features (e.g. RGB LEDs via WS2812B in order to represent Ableton Live status or add in some potentiometers)
My main focus for now are the buttons/keys: based on the OpenMusicLabs article
http://www.openmusiclabs.com/learning/digital/input-scanning-matrix/shift-out-mux/index.html
, I have breadboarded basically the circuit described in the article in order to scan the button matrix (see attached: my schema and the picture of my breadboard; hopefully the schema is ok, it’s my first KiCad project).
One difference to circuit of the article exists: instead of driving the columns LOW to read the rows (and use PullUps), I’m using the 74HC595 shift register to drive the columns HIGH to read the rows (and use PullDowns). As I learned, it’s easier to close circuits on the breadboard than to have them normally closed as the buttons tend to slip out of the breadboard holes...
My question is: what is the best way to debounce the big amount of switches in order to reach polyphony and low latency? In a nutshell: I want to build a polyphonic MIDI keyboard.
In another project, I have used an RC filter and a Schmitt trigger to debounce a few switches in hardware. But in the button matrix, I do not see how this would work as the rows are not permanently connected to the RC filter/Schmitt trigger.
I looked into the Teensy USB MIDI buttons example (Examples > Teensy > USB_MIDI > Buttons), but I am not sure if the code can be adapted to the input matrix as the single buttons are not permanently connected to the Teensy input pins.
I have read the Ganssle article regarding software debouncing ( http://www.ganssle.com/debouncing-pt2.htm ) and I like the referenced approach by “tcleg” ( https://github.com/tcleg/Button_Debouncer ) as the state based algorithm is quite short and effective. But same here: can it be applied to a button matrix?
Any help would be greatly appreciated!
Best wishes,
afterwards
Dear forum users,
I want to build a button based MIDI/Ableton Live controller and need some project guidance, especially regarding debouncing. I am in an early planning and breadboarding/prototyping phase in order to check the technical possibilities.
My MIDI/Ableton Live controller should have the following outline:
- first stage: round about 32 buttons/keys, maybe up to 64 (not sure about it yet). The whole controller should be polyphonic (play multiple notes simultaneously) and have a low latency.
- later stage: maybe add in some more features (e.g. RGB LEDs via WS2812B in order to represent Ableton Live status or add in some potentiometers)
My main focus for now are the buttons/keys: based on the OpenMusicLabs article
http://www.openmusiclabs.com/learning/digital/input-scanning-matrix/shift-out-mux/index.html
, I have breadboarded basically the circuit described in the article in order to scan the button matrix (see attached: my schema and the picture of my breadboard; hopefully the schema is ok, it’s my first KiCad project).
One difference to circuit of the article exists: instead of driving the columns LOW to read the rows (and use PullUps), I’m using the 74HC595 shift register to drive the columns HIGH to read the rows (and use PullDowns). As I learned, it’s easier to close circuits on the breadboard than to have them normally closed as the buttons tend to slip out of the breadboard holes...
My question is: what is the best way to debounce the big amount of switches in order to reach polyphony and low latency? In a nutshell: I want to build a polyphonic MIDI keyboard.
In another project, I have used an RC filter and a Schmitt trigger to debounce a few switches in hardware. But in the button matrix, I do not see how this would work as the rows are not permanently connected to the RC filter/Schmitt trigger.
I looked into the Teensy USB MIDI buttons example (Examples > Teensy > USB_MIDI > Buttons), but I am not sure if the code can be adapted to the input matrix as the single buttons are not permanently connected to the Teensy input pins.
I have read the Ganssle article regarding software debouncing ( http://www.ganssle.com/debouncing-pt2.htm ) and I like the referenced approach by “tcleg” ( https://github.com/tcleg/Button_Debouncer ) as the state based algorithm is quite short and effective. But same here: can it be applied to a button matrix?
Any help would be greatly appreciated!
Best wishes,
afterwards
Attachments
Last edited: