I am working on a project where I need 50 Digital Input/Outputs. Each one of the 25 of the Digital Inputs will be connected to a small piece of metal, triggered by Capacitive Touch with a finger and thus a different audio sound (note) to play, the other 25 digital inputs will be triggered by Resistive (two pieces of metal touching that when a key is pressed the metal connection is broken).

This project is for an electronic Irish bagpipe I am designing, so I need quick reaction time on the fingers that capacitive touch provides. I was looking at the Raspberry Pi, which has 26 GPIOs available, falling short of my digital input needs. Is there any expansion GPIOs boards for the Raspberry Pi that will give me the ability to control each of the 50 Digital inputs in need individually?

I also need a customizable small LCD GUI screen which the Raspberry seems to offer (to control different "patch settings" that I need i.e. play all notes in the "Key of D", then setting for playing in "Key of C", etc. I would estimate I would need at least 20 patches or more).

I initially looked into the Arduino, but that does not have an onboard processor, so I would be limited to a single "patch" setting which is not acceptable. While I am at it, I might as well ask if I need to connect to a MIDI software, as I need to record actual sound samples of the notes I need played, or can I get around this somehow?

Reason I want to get around using MIDI software is I want the entire unit easily portable as to not have to drag a computer around to operate it. I know this a lot of questions, but any advice or help would be greatly appreciated as I am just getting starting this "labor of love" project.

  • 1
    Hi, and welcome @Thomas Kelly. These are indeed many questions, and in general, this forum is to provide specific answers to technical questions. My suggestion here is that you take it step-by-step: first try to solve the issue regarding the number of input/output pins. Then, try building a simple application. If you run into specific problems that are likely to blame on the RPi, ask about them here. Here is usually not the best place to ask about overall direction. There are many online guides on how to build musical projects with the RPi; perhaps you can find inspiration in one of them?
    – David
    Apr 2, 2019 at 22:58
  • 1
    You ought to ask a series of discrete questions. As an aside for your digital inputs the simplest choice may be a number of 8-bit input shift registers.
    – joan
    Apr 3, 2019 at 8:44

2 Answers 2


Your questions

  1. How can Rpi read 50 digital inputs with quick response?

  2. Any Rpi GPIO port expansion boards available?

  3. Any customizable Rpi compatible LCD GUI screen?

  4. How to connect Rpi to a Midi device, to make it as portable as possible?

My short answers

  1. The usual recommendation is IO port expansion chips such as MCP23017 or MCP23S17. MCP23x07 devices have built in "interrupt" features which can record very fast interrupting events and let you processes them at your leisure. In other words, Rpi with MCP23017 is perhaps 10 times faster than you can key. However, be warned that MCP23027 and I2C have a very steep learning curve, not that suitable for faint of heart newbies.

  2. Yes, MCP23017 has very cheap modules available. There are the old and new versions. I tried the old versions and found it not that good. I am now playing with new version. See the references below. BTW, I have not found any cheap MCP23S17 modules available.

  3. For Rpi touch screens, there are many newbie friendly tutorials. You can also consider smart phone instead of touch screen. The official 7" touch screen is a bit expensive. But usually expensive things have very user friendly tutorials and libraries, ...

  4. Midi devices use a very old style 5 pin UART like connector for serial communication, so Rpi UART should be able to talk to a Midi device (but with some modification, because Midi UART is not pure UART). I have a MidiPlus X2 Mini and found it quite "portable". There are python Midi libraries available. I tried the beginners ones and found them OK. You may find the referenced video showing the USB and serial connector sockets at the back of the keyboard.

Newbie suggestions on how to start with MCP23017

  1. Treat MCP23017 with respect. Do not jump start with assembling 4 MCP23017s just because you will need 4. Be humble, start with just one piece of 8 bit through hole version MCP23008 and play it with a bread board. MagPi Issue 16 has an introduction to MCP23008. I actually followed that expert in learning this device.

    Expanding your senses with I2C (Using MCP23008 through hole chip) - MagPi Issue 16, 2013Sep

    Simulating Traffic Light (Using MCP23017 modules for LEDs and buttons) - MagPi Issue 29, 2014Dec

  2. I know you need MCP23017 to input signals. But do start with output signals, such as blinking LEDs. Input is more difficult than output, and interrupt is a very scary thing and has a learning curve even steeper than I2C and MCP23017. This is a severe warning to newbies.

  3. Below is a basic schematic showing the wiring of interrupt pins.

    MCP23017 with interrupt

Good luck to your labour of love project!


  1. MCP23x17 datasheet

  2. MCP23017 modules MCP23017 I2C Interface 16bit I/O Extension Module ... - US $1.99

  3. Rpi Compatible Touch Screens Raspberry Pi 3 Model B+ Plus Official 7 Inch TFT LCD Touch Screen Shield Monitor Display + Acrylic Base Holder Stander Kit - US$97

  4. MidiPlus X2 mini Keyboard Controller

    MidiPlus Mini X2 Keyboard Controller

  5. Capactitive and MicroSwitch Keys References

    AliExpress TTP223 Touch Key Switch Module Touch Button Capacitive Switches Self-Locking/No-Locking Capacitive Touch Switches – US$1.48/lot (10Pcs)

    AliEXpress XD21 6x6MM keypad keyboard Touch the switch module board 6*6mm – US$0.22

    Tutorial for TTP223 Touch Sensor Module (Capacitive) By mybotic in Electronics 15,684

  6. Update 2019apr05hkt0949

    Data Communication/MIDI - Juan P Bello

    Rpi Midi UART interface

Update 2019apr20hkt1506

AliExpress USB To MIDI Interface Adapter Cable Converter For PC Windows Mac iOS

midi usb adapter


There's an old Stack Exchange question on how to expand your GPIO port.

If you look into the RPi Compute Module and Development Kit you'll see there are models that already come with 120 GPIO pins.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.