DacAudio Hardware

The hardware required to build an Audio circuit suitable for the DACAudio library is quite simple, here’s the parts list;

ESP32  (Library only supports this at present)
PAM8403 Audio Amplifier board (other amplifiers will probably be fine)
10K Resistor
1K Resistor
4 or 8Ohm speaker (rated 3Watts or larger)
10K Logarithmic potentiometer (Usually sold as 10K Log Pot)
Various wires

I’ll presume you have a breadboard or something to build the circuit on. The circuit diagram is below (click to enlarge);

And here is a picture of my build on a breadboard (again click to enlarge);

Explaining the circuit
Referring more to the circuit diagram (as that’ll be easier to follow) the output from the DAC (GPIO pin 25 on the ESP32) goes to a 10K and 1K resistor. By tapping the signal off in the middle of these they act as a voltage divider and reduce the output voltage down by a factor of 10 times. This is important as the ESP32 will output a voltage in the range of 0 to about 3.2 volts and the Audio amplifier only wants a maximum of 0.3 volts. So by using this potential divider we reduce the voltage range down to 0 to 0.32 volts (which will be fine). But we’re not sending straight to the Audio amp just yet, we pass it through another potential divider, namely the 10K Log variable resistor that is the volume control. You can see we tap off the middle of this divider again and it’s this signal that finally goes to the amplifier. Technically you don’t need this but if you didn’t then the sound would be at full volume all the time and for me this is an essential item!

The PAM8403 based audio amp board then does the rest with the output going to the speakers. Note this is a stereo amplifier but we only use one channel. IMPORTANT, never be tempted to connect the two outputs together in any way (i.e. common ground etc.) as this will destroy your amp. What you might think is a common ground is NOT, always leave the two outputs powering speakers separately. In this project we are only using one speaker and output so is not really a thought we should be considering.

What Next?
Let’s move on to testing this circuit, click here for the next article.