Media Maker's Lab | RP0-GPIO Hack


[ MML homepage ]
[ Projects ]
[ Workshop Resources ] [ Workshop Photos ]
[ theoryofpaul.net homepage ]

We are always trying to do big projects with small things here in the Media Maker's Lab! This page is about adapting the Raspberry Pi Zero 2W to run PureData (Pd) headless, and to remap the GPIO pins to produce a "headphone out" signal, reducing costs and hardware significantly.

The main problem with this setup is that I was only able to get a mono signal out. The quality of the signal isn't so great either. But it worked fine -- if all you need is one channel, this is a great way to go.

The Raspberry Pi Zero 2W is an amazing system-on-a-chip that retails for about $15. You can ssh into it from another computer, so it doesn't need its own keyboard, mouse or screen. What's more, it runs Pd (Pure Data) and can execute patches remotely. You can get audio out by hooking it into a conventional audio interface (which costs money and space) or using the HDMI output jack (also requires space). However, by remapping two GPIO pins you can build a simple headphone jack output.

This page shows how to get the headphone jack to work!


The Pi Zero without the headers soldered in. It's sitting in a small 3D printed case that you can download for free.



We have to solder the headers in first.



Next we remap the GPIO pins by adding a few lines of code to the config.txt file in /boot/firmware.



Next we need to check that the GPIO pins have actually been remapped correctly by running pinctrl -p on the command line:



As a secondary check, run pd -listdev:



Make sure the alsa mixer is set correctly:



First patch: simple stereo siren:



Second ptch: simple OSC patch. I built a very straightforward interface using touchOSC on my iPhone. We have to use our own WiFi router in the Lab.



With the headers soldered in, and the pins mapped correctly, we can hook the zero up to a ribbon cable and build a simple headphone adaptor.





Now it's time to run a PD patch after sshing in.

Although you might think that this is broken from all the console messages, this is what it looks like when you play the siren Pd patch on the Raspberry Pi Zero from the command line, with no gui. The patch is running and sound is going out through the audio interface. Audio quality is excellent, no artifacts of glitches in processing!


Last updated on 13 October 2025.
Content on this page is licenced under GNU General Public License.