2
\$\begingroup\$

I am adding an LM386 to a music project and follow the guidelines in the datasheet:

Enter image description here

  • My Vs is 4.7 V.
  • My Vin comes straight from a 12 bit DAC of a Cortex M3 MCU and goes from 0 to 3.3 V.
  • Pin 7 is not connected at all (I don't have a 10 µF ceramic capacitor (106) at hand right now and I am not sure how close I'd need to be to the spec, I have 104 and 108, but those are magnitudes away).
  • On pin 5 I used a 0.1 µF ceramic capacitor (104) since I don't have a 0.05 µF (503) one - should this be okay?

The main problem is that I don't get a clean output. I both check it with a speaker and an oscilloscope. I have a ready made breakout board (https://www.ebay.de/i/352510367394?chn=ps) and there I get decent output. On my own circuit, I can head the 'rhythm', but the output is very spiky and noisy (blue is from the ready made breakout, yellow is mine). There is some visual correlation. Any idea? How can I debug this other than comparing the schematics over and over?

Enter image description here

\$\endgroup\$
  • 1
    \$\begingroup\$ Nice scope. Let's be honest here: the LM386 is a terrible, terrible audio amplifier, and you'd be way better of just getting a good one. Your problem might be caused by a lack of compensation, insufficient supply current capability/high supply impedance, bad decoupling or bad output capacitor coupling, but without a lot of investigation on your own board it's hard to say. \$\endgroup\$ – Marcus Müller Jan 4 '19 at 13:11
  • \$\begingroup\$ Oh and your replacement of the output filtering caps of course changes characteristics, so hm. You got plans for a car, you replaced the tires with cheese, you get a different behaviour? \$\endgroup\$ – Marcus Müller Jan 4 '19 at 13:12
  • 1
    \$\begingroup\$ I am open for recommendation for a better amplifier. Please note though, that I am a hobbyist in terms of electronics. Anything that is easy to buy and not too difficult to wire goes. \$\endgroup\$ – ensonic Jan 4 '19 at 14:31
  • 1
    \$\begingroup\$ Vs=+4.7 is near/at the bottom limit especially for LM386N-4. No capacitor on pin 6 - could cause problems? We usually test with sinusoidal waves. Running BOTH amps from the same DC supply/ground is not fair - they could inter-act. Your 'scope shows no large oscillations - that's good. \$\endgroup\$ – glen_geek Jan 4 '19 at 14:35
  • 1
    \$\begingroup\$ So, @ensonic, the TPA6203A looks like a feasible choice; additional requirements are one power supply decoupling capacitor, two input caps, no output capacitor (which is great!), and in 2×(two different resistors) to set the gain. The formulas for the gain-setting resistors and how to choose input caps (and whether these you've got lying around suffice) are in the datasheet :) \$\endgroup\$ – Marcus Müller Jan 4 '19 at 14:51
3
\$\begingroup\$

You have 10uF between pins 1 and 8. That sets the gain of the 386 to 200.

200 x 3.3 V = 660V.

You are getting distortion because you are overdriving the 386.

Work it backwards:

You have a 4.7 V power supply. You have a gain of 200. Your input signal can be (at most) 4.7/200= 23.5 mV.

You need to lower the level of your input signal, and reduce the gain of the amplifier.

Reduce the gain:

Remove the 10uF capacitor from pin 1 to pin 8. You now have a gain of 20. That makes a maximum of 235mV before distortion gets bad.

Reduce the input signal:

Use a voltage divider to bring the signal down to 230mV. From 3.3V to 230mV is a factor of about 14. So, use a series resistor of 150k between your DAC and the 386.

You also need to put a capacitor in series with the DAC output and the 386.

The DAC has a DC offset different from that of the 386. This will cause the 386 to push its output off to one side or the other. Put like a 1uF capacitor in series with the DAC output, before the series resistor.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Thanks. Regarding the series resistor, should that be a simple 150k resistor in Vin before getting into the 10k pot? \$\endgroup\$ – ensonic Jan 9 '19 at 20:47
  • \$\begingroup\$ Yes. 150k in series with the DAC output before it goes to the 10k volume control. \$\endgroup\$ – JRE Jan 10 '19 at 20:40
  • \$\begingroup\$ How, did you calculate the 150k resistor. Wouldn't I need 2 resistors in a voltage divider? Also for the 1µF can use an electrolytic capacitor (with the audio going to the + side and the - side going into the 150k resistor)? \$\endgroup\$ – ensonic Jan 11 '19 at 19:32
  • \$\begingroup\$ You have two resistors: The 10k pot and the 150k. 150k because it is about 14 times the 10k. Close enough for a volume control that'll be twiddled with anyway. The coupling capacitor can be an electrlytic, but measure the DC on both sides. The positive terminal goes towards the highest DC. \$\endgroup\$ – JRE Jan 11 '19 at 20:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.