A while ago I thought it would be a good idea to have a Pi Zero with audio out that I could hook up to some speakers… I can’t remember why I thought that or what project I was going to use it for but the idea to design the board has remained.
This is the result… The Crunchy Pi v0.2!
Why Crunchy? Because if you turn the volume up too much, it distorts!
It runs straight off the Pis 5v rail… yeah yeah, more decoupling etc, but it seems to work well enough with the official Raspberry Pi PSU and some 4ohm speakers. Just don’t power up or down the amp (that’s what the jumper does) when the Pi is running or it will reboot and potentially corrupt your SD card!
The PAM8403 is designed to be permanently connected in a low power device so is prone to damage when powered up with no load. So yeah… don’t power the Amp without speakers connected! That said, the modules are cheap enough on ebay that if it does die, it can be de-soldered and replaced.
The headphone socket can be used at the same time as the amp, but is directly connected so will probably attenuate the volume (it wasn’t noticeable when I tried it with some ear buds).
To get this thing to work we have to enable the PWM audio output. Enabling PWM audio on the Pi Zero requires a config.txt change. Add the following to /boot/config.txt on your Pi:
# Pi Zero PWM Audio settings dtoverlay=pwm-2chan,pin=18,func=2,pin2=13,func2=4 audio_pwm_mode=2 disable_audio_dither=1
- The dtoverlay line routes the PWM signals to pins 13 & 18 .
- The pwm mode enables sigma-delta pwm which is much cleaner than the orignal mode 1.
- The disable audio dither can remove the hiss when no audio is playing.
See this page for more details.
you might also have to enable analog audio in the raspi-config utility.
I’ve hand soldered all the components and the eagle eyed may have spotted that not all of the 40 pin female header are soldered. I’ve only soldered the pins that are actually connected and the ground pins. I’ve also tested all the boards I’m offering for sale.
Price is £12 each plus £2 postage in the UK. Please get in touch via the contact form if you’d like to order one. If you are outside the UK get in touch and i’ll get a price for shipping.
V0.1 PCBs were made by iTead (I made another stupid mistake with the headphone socket pinout and decided to add screw terminals for the speaker output instead of pin headers) The v0.2 PCB is by PCBway. They do a surprisingly fast turn-around and the boards are as good as iTead.
As usual i’ll put the schematic and board layout files on github at some point.