I'm relatively new to the rasperry pi but not so to Python programming. So i'm mostly new to the electronics side of the story. I'm looking to build a bass midi controller. My idea was to have one button for each fret and i would need more or less 84 inputs to the raspberry pi. More or less because not every fret has to have a button. I would then use Python to recieve input and pd to produce a note based on the button being pressed. My first obstacle is getting 84 inputs on the pi. The only thing i came across was this port extender. But i'm not sure i would know how to connect three of these to the pi. Secondly would this be a 'clean' solution? Any advice?


An approach that potentially requires less wiring is a keypad matrix. It essentially looks like this:


You then would "scan" the rows by only enabling one row at a time, and reading the column to see which keys in that row are pressed. You'll only need enough GPIOs to make ROWS * COLS > 84. In this case, 9 and 10 would work, which means 19 GPIOs (the Pi has 26 available on the header).

  • Thanks alot! This is definitely the best solution and what i was looking for. – Scottyers Oct 8 '15 at 20:41

It would work and would probably be a cleaner solution than just buying the six MCP23017 you need and sticking them on a breadboard.

The only thing to be concerened about is the latency of detecting the key press. You'll need to research how long that will take in Python over the I2C bus.

  • Thanks for your answer. I just have a few concerns. Do you know how i could figure out the latency issue? I am not planning to use any sound card or anything. As a matter of fact the pi would only serve as a pure midi controller and it would send the values over an ethernet cable to a more powerful computer running an effects processor. Since there was no sound output from the pi i wasn't expecting to have to deal with latency. Am i wrong? – Scottyers Oct 9 '15 at 11:16
  • @Scottyers Everything is relative. The latency between a button press and the software finding out may be a few milliseconds (a few thousandths of a second). I have no idea if that is a problem for your application or not. – joan Oct 9 '15 at 11:24

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.