I would like to build an organ pedal board and use Raspberry Pi as signal processor.
The pedal board will have 32 inputs, one for each key.
I am planning to use magnetic sensors (like A3144), which, can send
true / 1 or
false / 0 signals to the Raspberry Pi (correct me if I am wrong, I never used this kind of sensor before).
What I don’t know is how can I have 32 inputs, since the Raspberry Pi board has less than 32 I/O pins.
I have the impression I need another component for that (like a converter… or something), but again, I don’t know what I need to build the electronic part of this project.
How can I connect more inputs to the Raspberry Pi? What would be the best way to build this?
The pedals should work simultaneously as well.
The best way depends on factors only you can determine.
I give a couple of ways.
- use two MCP23017, each of which supply 16 digital IO. They use the I2C bus (pins 3/5, GPIO 2/3) and up to 8 can be used on the bus.
- use 4 8-bit input shift registers. They provide 8 digital inputs each. They can use the SPI bus and you can daisy chain as many as you want. If needed you could instead bit bang reading the devices from any GPIO.
The shift registers are probably better for your application. They are likely to be more responsive as you can drive the SPI bus much faster than the I2C bus.
How to make a Rpi compatible keypad, with more than 32 keys?
- 12 Rpi GPIO pins scanning a 8 x 4 matrix keypad (8 x 4 = 32 keys)
- MCP23x08 x 2 – 16 GPIO pins scanning two 4 x 4 keypads (4 x 4 x 2 = 32 keys)
- MCP23x17 x 2 – scanning 8 x 4 keypad (8 x 4 = 32 keys)
Step 1 – Start with a cheapy (US$1) 4 x 4 push button keypad, program 8 Rpi GPIO pins to scan keypad, using edge and level interrupts.
I know very roughly the keypad scanning algorithm:
1. Connect GPIO 0, 1, 2, 3 to Row 0, 1, 2, 3 2 Connect GPIO 4, 5, 6, 7 to Col 4, 5, 6, 7 3. Set GPIO 0, 1, 2, 3 as Out 0, 1, 2, 3 4. Set GPIO 4, 5, 6, 7 as In 0, 1, 2, 3 5. Loop IN 0, 1, 2, 3 until any IN is low 6. ...
Have a nice weekend.
/ to continue, …
/ to add later, …
Appendix A – Research Notes
/ to add later, …
Appendix B – References
Description: This application note discusses interfacing a 4x4 matrix keypad with MCP23X08 8-Bit GPIO Expander. GPIO Expanders provide easy I/O expansion using standard serial interfaces such as I2C and SPI. They are especially useful in applications where pin count is limited on the microcontroller unit (MCU) or if remote inputs / outputs (I/O's) are needed.
How to ask a question