In 2020, I made a Teensy-based USB MIDI footswitch for controlling my MPC One.

However, the Teensy 2.0 is no longer available, so when someone asked me about making a couple for them, I decided that it was time to port the code to something newer, and the obvious candidate was the capable and very cheap Raspberry Pi Pico.

Three painted metal enclosures with four footswitches each,
and a USB connector on one side.

Mark II footswitches

I also took the opportunity to improve the hardware design. One of the hardest and most tedious parts last time was filing out a rectangular hole for the USB connector. This time, I skipped that by designing a 3D-printed bezel that allows me to drill some round holes (a matter of seconds with a stepper bit) and end up with a tidier result.

The side of a metal enclosure with three holes in it. Two are small, and
the one in the middle is much larger.

Drilled for the USB bezel

The side of a metal enclosure with a USB type B connector in a 3D-printed
black surround.

The fitted bezel

To mount the microcontroller, I designed a bracket supported by the switch shafts to which the microcontroller can be screwed by its convenient mounting holes. It’s very skeletal because I optimised the design to print fast.

A view inside the footswitch. A USB cable snakes around the circumference
and plugs into a microcontroller board in the middle. Wires connect it to
four switches around it, and the board is screwed onto a 3D-printed bracket
that links the switch shafts.

Mounting the Pico board

Software was a bit more of a challenge. Initially, I ported the code using PlatformIO and the Arduino framework. I enjoy using PlatformIO’s command-line tools, and the porting went very quickly.

However, while the resulting implementation worked perfectly on my computer, the MPC wouldn’t recognise it at all. Like my development machine, the MPC runs Linux internally, so this surprised me.

I carried out some tests with the Raspberry Pi SDK to establish that it would work with the MPC, and ported my code using a platform-independent debouncing library in place of the Arduino-specific one.

Once again, it worked on a computer, but not on the MPC One, even though a simple demo project using the same libraries was recognised perfectly, as I knew because I had tested that before going to the trouble of porting.

After many hours of tweaking minimal examples, I found the problem: the name was too long. As far as I can tell, USB product name strings can be up to 31 characters long, but the MPC didn’t like anything longer than 10. I’m not sure that this is the bottom of the problem, but it was enough to get it working.

The updated code and 3D models can be found in the same repository as before.

Thanks to Tom Armitage for his convenient version of the TinyUSB MIDI example tweaked for the Pico, which saved me a lot of time, and to Emmanuel Maschas for the pull request that helped me get it working with the current SDK.