Since the zero has no audio output, we must either use HDMI or I2S audio outputs.
I prefer to use I2S for this project because of size and simplicity, because the HDMI output must be transformed with an adapter.
Use the MAX98357 amplifier, all documentation is in adafruit, click here
You just have to follow the steps in that guide. For the speaker I use one of 0.5W / 8ohm, typically in old computer.
The wires are:
- Amp Wine to Raspbery Pi 5V
- Amp GND to Raspbery Pi GND
- Amp DIN to Raspbery Pi # 21
- Amp BCLK to Raspbery Pi # 18
- Amp LRCLK to Raspbery Pi # 19
To configure the I2S output at zero:
curl -sS https://raw.githubusercontent.com/ adafrukt / Raspberry-Pi Installer-Scripts / master / i2samp.sh | bash
And then restart raspberries. The audio output is already configured to use the amplifier.
Fit the speaker's two wires into the horn. Glue the speaker to the horn.
Take out the wires. Cut the hose to the appropriate length. Slide the hose on the two speaker wires to cover it. Use a lighter to shrink the tube.
Drill a hole on the back wall and pass the two wires in the box.