I'm building a simple amplifier around a LM386. The circuit I'm using is this:

The input is on pin 1 of the connector and is a square wave coming from a digital pin on a NodeMCU devboard.

When I turn the circuit on, I can hear a low frequency oscilation on the speakers (not a constant tone, but as if the speaker was turned on and off a few times a second).

I tried adding a capacitor between the signal and ground as it seemed to work in this related question but I needed a fairly big capacitor (220uF) to get any result at all, and it only decreased the volume of the noise (not to mention it is filtering my input, if I understand it correctly).

What did get rid of the noise completely was adding a 1K resistor between pin 7 and ground (in parallel with the existing capacitor):

I have no idea why this works, but it gets rid of the noise completely.

So my main question is: what is this resistor in parallel with the capacitor doing and why does this remove the noise?

I'm happy to keep this solution if it makes sense, but first I need to understand why it works.

  • 2
    \$\begingroup\$ What you describe sounds like motorboating. \$\endgroup\$
    – brhans
    Dec 26, 2018 at 16:58
  • \$\begingroup\$ What sort of 9V battery are you using and do you have anything other than that 100nF C4 for supply decoupling? \$\endgroup\$
    – brhans
    Dec 26, 2018 at 17:01
  • 2
    \$\begingroup\$ R2 is not a good solution - it fouls up the DC biasing internally, which limits the available undistorted audio output power. Look at DC voltage on pin 5: it should be about half the supply, near +4.5V. I'll bet its a lot lower. Try increasing C4 instead to a very large capacitor > 200uF. \$\endgroup\$
    – glen_geek
    Dec 26, 2018 at 17:04
  • \$\begingroup\$ Use one of the circuits in the data sheet. \$\endgroup\$ Dec 26, 2018 at 17:18
  • 1
    \$\begingroup\$ What is the power source? What length of wire between the power source and the amplifier? As a kid, I built many amplifiers, with 4 or 5 or 6 stages gain, that oscillated because of VDD resistance (and impedance). When I added 5,000uF capacitors, installed directly at the final stage (that drove 1Kohm earphones), the motorboating finally ended and I could hear the thermal noise. \$\endgroup\$ Dec 27, 2018 at 19:05

2 Answers 2


The main problem is that you have the gain of the LM386 set much too high.

By putting a capacitor (C1) between pin 1 and 8 you have set the gain to 200 times. If the input signal is coming straight from a digital pin on the processor with 3.3V output you only need a gain of 2 at most.

With a gain of 200 the LM386 is amplifying small signals coming from the digital pin to an audible level.

Even if you remove C1 the gain will still be 20 times - you will need to attenuate the signal from the processor by about 10-11 times to avoid overloading the amplifier. A 10k resistor in series with the input and a 1k resistor to ground will achieve that. Even better would be a potentiometer to adjust the volume.

Your current solution is drastically altering the biasing of the LM386 such that it is not a linear amplifier, the digital signal is still able to break through the LM386 to drive the speaker but small noise signals do not. Please see page 1 of the data sheet LM386 datasheet

If you only need to drive the speaker with a square wave then you may not even need an amplifier. For low volume just a capacitor and resistor in series driving the speaker will function (for example a 47 ohm resistor and a 10uF capacitor). The resistor is to avoid overloading the digital output with the low resistance of the speaker while the capacitor removes the DC offset since the digital output is always positive (either 0V or 3.3V).

  • \$\begingroup\$ Thank you for your answer! Attenuating the input and reducing the gain to 20 (by removing C1) did help a lot. I can still hear the motorboating, but it is very faint. I had tried other simpler solutions, but I didn't get the volume I need. Also, the signal is a square wave for now, for testing, but that will definitely change in the future. My main problem is that I need it to be very loud (as loud as possible), even if that comes at the expense of sound quality. Removing C1 also did noticeably reduce the volume, which I want to avoid. \$\endgroup\$ Dec 26, 2018 at 22:43

You have 3 grounds the circuit:

the speaker ground

pins 4.3.2 ground (3 is where the 10K ohm attached to GND)

the RETURN of the 9v power [which need to be tied together with heavy heavy wire]


(#4) the -pin of a 10,000 uF capacitor across the 9v power supply

You do have the 10,000uF bypass cap???


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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