Raspberry Pi Zero Audio Circuit

To purchase a completed board or to get a BOM so you can make your own, visit the store page here.

A few methods are available to get audio from the Pi Zero. The easiest is just to use an HDMI display, but that’s not always an option. The next option is to use a USB audio adapter. That works fine, but takes up the only available USB port unless you have room in your project for a microUSB hub. There is a third option. This guide explains the the process of getting PWM audio working.

As for software, all that’s required is that you add one line of code to the bottom of your config.txt file on your SD card:

The schematic shows the audio filter circuit that was part of the original Pi. A better one is included in the newer Pi’s, but this will do the job. For this guide a few changes will be made because the Pi Zero’s PWM output is not powerful enough to be audible once the filter is installed.


The complete circuit is shown below. It begins with the PWM audio coming from GPIO pins 13 and 18.

Audio Filters

High_pass_filterFrom the GPIO we get to the first filter, the High Pass Filter. This one handles the filtering out of low frequencies and allows high frequencies to pass. It consists of a 10nF Tantalum Capacitor connected in line, followed by a 150 Ohm Resistor connected to ground. These low frequencies are now filtered out before reaching the amplifier. A standalone High Pass Filter is shown below for better understanding.

1st_Order_Lowpass_Filter_RCFrom the output of the amplifier we have the the second half of the circuit, the Low Pass Filter which filters out high frequencies and allows low frequencies to pass. It consists of a 270 Ohm Resistor connected in line, followed by a 33nF Capacitor connected to ground. The filter is placed on the output of the amplifier because it serves a dual purpose. When at full volume and when no audio is playing, the PWM has a constant hiss. Placing the filter on the output of the amplifier drops the volume down to a level where the hiss is barely audible. The volume is still sufficient as long as the OS volume is set at 100%. A standalone Low Pass Filter is shown below for better understanding.


PAM8403The amplifier is powered by the same 5v as the Pi.


The yellow L and R pads on the amplifier are the positive left and right PWM audio inputs coming from the GPIO and the High Pass Filter. Between them is a shared ground input, which can be any of the grounds on the Pi. For this reason, it makes sense just to connect it directly to the power input ground on the bottom left that’s used to power the audio amplifier. The red pad is the 5v power input, which should come directly from the Pi’s power supply and not the 5v GPIO pin. This little guy can pull a few watts and easily overwhelm the Pi if connected to the GPIO. The pink pads on the right are the audio output leading to the Low Pass Filter and finally to the speakers.

PAM8403 - colorsThe negative speaker outputs are not used. The speakers and the filter connect directly to the same ground that’s used for power input. This is done so the speakers share a ground, which makes volume control and muting easier. If you don’t need this ability, then the speaker output grounds on the amplifier do work just fine. Just don’t connect them together.

Questions? Comments? Leave a reply.

10 thoughts on “Raspberry Pi Zero Audio Circuit

  • September 4, 2016 at 10:33 am

    Awesome build you made!
    I also want to build my System in a PSP 1000 and was hoping you could help me out:
    I plan to use a USB Soundcard in my Build, a Model with Buttons to turn up/down the Volume and mute the Sound i should ad.
    The main Reason for my plans are this Buttons. I would like to use the Buttons “under” the Display to control it… Should be possible if i re-route the FCB Cable to it, they are simple Tactile Buttons…

    My Question ist: What do i need to use if i go this way?
    I Would gues the the High an Low Pass Filters are not needed anymore because the USB-Board takes Care of that?
    Should i even skip the Amplifier?
    Help would be Awesome!

    • September 4, 2016 at 10:54 am

      If the buttons for volume up/down operate by connecting to ground, then yes that should work fine.

      The filter and audio amplifier shouldn’t be needed if you’re using a USB sound card.

      Which USB sound card are you using?

  • September 4, 2016 at 11:33 am

    I have one lying around and a cheap one from China should arive soon.
    The expensive one is linked under my post.
    The comments say it should word fine with Linux and a Pi 2. I didnt have time yet to test it myself…

    Well, then i will try to finde some Time to test it Out… i have Speakers and a 5 Pin 3,5-jack Around…

  • October 12, 2016 at 4:48 pm

    Hi, firstly just want to say that your guides are great. After reading this one I have a question:

    I plan on building an PWM audio circuit soon, I was thinking that I would connect the circuit in the following order -> the pwm pin from the Pi to a wheel pot, then to high and low pass filter, then to headphone jack, then to a cheap chinese audio amp and finally to the speaker.

    In this guide you connect the high pass filter before the amp and a low pass filter after, why is that? This is the first time I have seen it done that way.

    • October 12, 2016 at 5:06 pm

      I think that will work. I’m still trying to get a full understanding of this amplifier’s capabilities. I’ve been doing some extensive research on the audio these last few weeks, and still have more to do.

      As far as the filter…I split it up because it got rid of a lot of the PWM static. There is a certain amount of noise that is on the line, regardless of volume level. So, what I did was set the volume at 100% and then put the low pass filter on the amplifier’s output to substantially drop the volume. It’s still not perfect, but it’s much better sounding. My ultimate goal is to get rid of the PWM noise.

  • December 4, 2016 at 1:56 am

    hi i am looking into doing this build and i have been looking through your guide and im a little confused to your pictures on the audio wiring. If you look at the third to last photo you show the ground for the speakers soldered to the amplifier but in the next two photos its not there anymore is. Was it soldered or is this just an illusion

    • December 4, 2016 at 9:45 am

      The third to last photo shows the overall wiring, and the last two show individual parts of the wiring. This tutorial was put together when I had to manually build a filter for the Version 2 build. Things have changed a little now that I have custom boards made, so I’m going to update the tutorial to make it more clear.

  • December 20, 2016 at 6:38 pm

    Small nitpick: the hiss is removed by the low pass filter because the hiss has a high frequency audio component, and a low pass filter removes high frequencies from the signal (hence the name). It naturally adds some attenuation/quieting of the signal (“insertion loss”).

    Somewhat at a loss as to why you added a highpass filter though, wouldn’t you lose the low end/bass?

    Neat little project either way 🙂

    • December 20, 2016 at 6:52 pm

      The hiss is not removed by the low-pass filter. It isn’t in the frequency range that’s being filtered. The placement of the filter on the output is meant to lower the volume intentionally so this hiss is less audible.

      The high-pass filter is needed because the bass frequencies generated by the PWM are too low and make the speakers sound blown.

Leave a Reply