# Audio from Arduino Due's analog outputs using LM386

Due's DACs provide 0-3.3v (actually less) and are rated at 3mA max. As far as I know, common speaker/headphone impedances range from 8Ω to a few hundreds, so driving these from the DACs will destroy it at best. I guess I could stick a series resistor, but it would need to have a huge resistance and would greatly reduce the output volume.

According to Arduino's SimpleAudioExample I can drive a speaker from Arduino's DAC using an LM386 amplifier. Is it because $\rm{R_{in}}$ (datasheet, page 2) is the LM386 input resistance, so $I = \frac{V}{R_{\rm{in}}} = \frac{3.3\rm{v}}{50\rm{k\Omega}} = 66\rm{\mu A}$, which is a lot less than the max 3mA the DACs can handle?

Arduino's SimpleAudioExample circuit looks like LM386's "Minimum Parts" example (datasheet, page 5) with a 10μF capacitor between $V_{in}$ and the pot:

Is this extra cap AC coupling the DAC with the LM386 input to remove the implied $\frac{+3.3\rm{v}}{2}$ DC bias at the input?

I hope I got all that right.

Even at a low 20x gain setting (pins 1-8 open) $20*\frac{\pm3.3}{2}\ \rm{volts}$ seems like a lot! Also, max input voltage is listed at $\pm0.4\rm{v}$ (datasheet, page 2). Is something (I guess the pot) reducing the input voltage and preventing huge Vout? Could it accidentally be set to deliver the whole 3.3v input and break the speakers?

What am I missing?

Well, it's shown as a gain of 200 amplifier, and the signal can be 1.18V RMS, so if it was amplified by 200 and fed into an 8$\Omega$ speaker, you'd have almost 7kW going into that speaker. That's not what's going to happen, fortunately.

The LM386 can't output more than Vs/2.8 RMS (+/- Vs/2 peak) volts so you don't need to worry too much. Once the output gets close to Vs or GND it stops.

It will start distorting horribly if you overdrive it (turn the volume up too high) and make it hit the limits. That's called "clipping". A ~100K resistor in series with the input would keep that from happening, and keep the input within the +/-400mV range.

You're correct about the purpose of the capacitor and about the input impedance.

• That makes a lot of sense! What about the $\pm0.4\rm{v}$ input limit in the datasheet? Also, is 5/2.8=1.79 an acceptable RMS for speakers/headphones? Commented Feb 28, 2014 at 4:20
• Depends on the speaker/headphone. It's not a bad guess for a maximum, you can start off at less than the maximum. Commented Feb 28, 2014 at 18:55

Even at a low 20x gain setting (pins 1-8 open) 20∗±3.32 volts seems like a lot!

It is! 1.15v * 20 is 23v. But pesky laws of thermodynamics get in the way. You can't get energy from nowhere. Without going into voltage doublers or boost circuits, most amplifiers can only amplify to a given range, most often it's operating voltage. A LM386 powered by 5v will only be able to produce up to 5v at it's output.

But the 20 gain is for everything, not just the peak. An signal at peak input (3.3v/2 so 1.15v) will still get a gain of 20, until it clips at (5v/2) 2.5v. It will sound bad. But an input signal of 0.1v will get that same gain of 20 and output 2v. But remember that most audio is not at peak most of the time. So it will be fine.