Raspberry Pi Pico Capacitive Foot Pedal Interface

By Jeremy S. Cook

Freelance Tech Journalist / Technical Writer, Engineering Consultant

Jeremy Cook Consulting

April 21, 2023


The RP20-Footie

If you’ve followed my work for any length of time, you may have noticed that I’m constantly pursuing the “perfect” computer interface. This has resulted in my cycling through a number of input devices, and even developing my fully custom JC Pro Macro 2 keypad. However, I really only have two out of four appendages well-optimized, and in this interface quest I also tried using a foot pedal, as discussed here.

As it turns out, a cheap foot pedal, a la musical keyboard and/or tattoo machine, just doesn’t match the high speed performance of a typical finger keyboard, and is actually a bit annoying to use as a computer interface. Now nearly a year later–thanks in part to what I learned in my class: capacitive input using the RP2040–I’ve made something much faster: a capacitive foot pedal using the Raspberry Pi Pico.

General Computer Interface

This pedal, which I’ve dubbed the “RP20-Footie,” features three capacitive zones. The idea is that while the RP2040 is capable of working with many more inputs, accurately hitting a large number of small pads with your foot is a bit of a long shot. I also broke out some of the Pico’s other GPIO pins, and added a small prototyping area in order to accommodate future ideas.

With the hardware settled, programming was quite easy, in no small part thanks to TodBot’s MIDI ruler code that was adapted to my 3-input device. It can be set up as a general HID, allowing it to plunk in commands to my computer. Modifiers, like shift/control/command, may cause OS issues outlined in the original foot pedal discussion linked above, and may be more of a challenge.

MIDI Interface

As outlined here, the RP2040/Pico, plus an RPi host, makes a fantastic general MIDI interface. When my new capacitive interface is connected directly to a MacOS computer, it works quite well as a foot pedal or as a finger pad. Using Garage Band, you simply plug it in, and like magic, it plays MIDI notes.

I didn’t have the same success when directly plugging it into a keyboard using a possibly questionable arrangement of USB adapter cables, though using a MIDI host as before would likely work. Perhaps even the correct arrangement of adapter cables would make direct connection possible, but my limited experimentation wasn’t as plug-and-play as I would have liked.

Simple “Tattoo Gun” Style Switch

(Caption: On/Off contact pins for sustain pedal / Image Credit: Jeremy Cook)

While one might argue that MIDI is the end all be all solution for electronic music, its massive capabilities aren’t always needed. Fortunately, our keyboard, and many others, also has a jack for a simple on/off switch, i.e. pedal, that activates the keyboard’s sustain function.

Getting this to work was a matter of setting up the capacitive sections to turn GPIO27 high, which activates an opto-isolator. This in turn activates isolated contacts, which are connected to a ¼ inch plug. It’s a no-fuss solution for this type of interface, with the exception of needing to use a battery pack or wall wart for power. There’s always a tradeoff is seems.

Potential Future Improvements

(Caption: Combo pads: THT or SMD / Image Credit: Jeremy Cook)

The design has gone through two iterations so far, the later of which forgoes using a background plane under the pads in an attempt to improve performance. There is likely a difference, though I haven’t noticed. I also added the combo SMD/THT resistor footprints discussed here.

The RP20-Footie also has breakouts on the sides, with the idea that you could chain two pedals together. While I’ve not tested it yet, it seems I forgot to add a ground. Rev and learn you might say.

Final Thoughts – The Capacitive Future of MIDI?

So, is the capacitive foot pedal the future of computer and musical interfaces? On the plus side, the response time is very fast.

On the other hand, you can’t rest your foot on a certain amount of spring pressure before activation, which would eventually leave your foot tired. Perhaps an interface where it triggers only when you pick up your foot would work, but this begs the question of how to code things for an AFK (away from keyboard) condition. You also can’t use it with shoes on, meaning it’s largely a work/perform-from-home option.

If you’d like to examine things further, code for this device is up on GitHub, as well as the PCB design from roughly when I ordered the current revision. I also put the RP20-Footie up for sale on my JC Devices Tindie store if you’d like to purchase one to try out!

Jeremy Cook is a freelance tech journalist and engineering consultant with over 10 years of factory automation experience. An avid maker and experimenter, you can follow him on Twitter, or see his electromechanical exploits on the Jeremy S. Cook YouTube Channel!

More from Jeremy

Open Source