This is taking the solderless breadboard “keyboard” from my Pi Pico MIDI Matrix Decode project and committing it to stripboard.
- In part 3 I expand it to four octaves.
Warning! I strongly recommend using old or second hand equipment for your experiments. I am not responsible for any damage to expensive instruments!
These are the key tutorials for the main concepts used in this project:
- Getting Started with the Raspberry Pi Pico: Inputs and Outputs
- How to make a keyboard matrix
- Keyboard MIDI Matrix Decode
- MIDI, MicroPython and the Raspberry Pi Pico
If you are new to microcontrollers, see the Getting Started pages.
Parts list
- Raspberry Pi Pico
- One of the 3.3V compatible Ready-Made MIDI Modules; or
- 5-pin 180 DIN socket, 10Ω and 33Ω resistors
- 12x breadboard friendly switches
- 12 holes x 21 strips stripboard and jumper wires
- MIDI module or sound generator (I used my Arduino MIDI VS1003 or VS1053 Synth)
The Circuit
This is the same circuit as the Pi Pico MIDI Matrix Decode but with all connectors broken out at the top for connection to the microcontroller.
The far left pin is the common pin. All other pins relate to one of the switches. Due to how the common connections have been made, the “black” notes appear before the lower “white” note in the sequence, so the pins across the top are ordered: C#, C, D#, D, E, F#, F, G#, G, A#, A, B.
There are no resistors on the board, so internal PULL_UPs are required in software.
The size of the board is such at several can be put side by side to add more octaves. The circuit above shows an additional row of pin headers which can be used to connect to the next octave if required, but more on that another time.
The Code
This is using the same Micropython code for the Raspberry Pi Pico as used previously. The only difference is in the pin mappings, which are defined as follows now:
# Switch OFF will be HIGH (operating in PULL_UP mode) row_pins = [3,2,5,4,6,8,7,10,9,12,11,13]
Note the “cross-over” mentioned for the black/white notes above. Of course you could choose to do the “cross-over” in hardware and simply wire the board up slightly differently. That is up to you! I’ve chosen to keep a one-to-one “in order” mapping for the wires between the keyboard and the Pi, so will probably stick with that.
Whatever pin-mapping you use, this change will have to be made after downloading the code, which still has the mapping from the last project.
Closing Thoughts
This is a neat little module with many uses and I plan to make a few of these for more experiments.
Kevin
Just a thought… could the pin read velocity you could theoretically use just one pin to decode your keyboard; it’s cool to see this multiplex approach on the Pio Pico anyway. Great job! Very neat presentation and all that useful information!
LikeLiked by 1 person
Hmm. I’m not sure… I guess the more typical approach to cut down on pins is to use analog inputs (which I talk about in “part 3”). I’m not sure how you’d do it with velocity… I suspect if you are talking time for signals to travel then I believe that is how capacitive inputs are scanned, but I’m not quite sure how it would apply here. It might be possible, but I guess it will be a lot more complicated! I’ll have a think 🙂
Thanks for dropping by and commenting.
Kevin
LikeLike