Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 16 of 16

Thread: Help neede: Debouncing a button matrix

Threaded View

  1. #1
    Junior Member
    Join Date
    Nov 2016

    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

    , 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 ( ) and I like the referenced approach by “tcleg” ( ) 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,

    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	keyboard_scanner_breadboard.jpg 
Views:	182 
Size:	98.7 KB 
ID:	11460   Click image for larger version. 

Name:	keyboard_scanner_schematics.jpg 
Views:	267 
Size:	96.2 KB 
ID:	11461  

    Last edited by afterwards; 09-04-2017 at 05:04 PM. Reason: corrected typos, added attachment

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts