LM386 motorboating that goes away with a resistor in parallel with the bypass capacitor on pin 7
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.
amplifier lm386
New contributor
|
show 1 more comment
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.
amplifier lm386
New contributor
2
What you describe sounds like motorboating.
– brhans
11 hours ago
What sort of 9V battery are you using and do you have anything other than that 100nF C4 for supply decoupling?
– brhans
11 hours ago
2
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.
– glen_geek
11 hours ago
Use one of the circuits in the data sheet.
– Leon Heller
11 hours ago
thank you @brhans it does sound like that. I'll edit the question to make it clearer.
– Flávio Amieiro
6 hours ago
|
show 1 more comment
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.
amplifier lm386
New contributor
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.
amplifier lm386
amplifier lm386
New contributor
New contributor
edited 6 hours ago
New contributor
asked 12 hours ago
Flávio Amieiro
1235
1235
New contributor
New contributor
2
What you describe sounds like motorboating.
– brhans
11 hours ago
What sort of 9V battery are you using and do you have anything other than that 100nF C4 for supply decoupling?
– brhans
11 hours ago
2
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.
– glen_geek
11 hours ago
Use one of the circuits in the data sheet.
– Leon Heller
11 hours ago
thank you @brhans it does sound like that. I'll edit the question to make it clearer.
– Flávio Amieiro
6 hours ago
|
show 1 more comment
2
What you describe sounds like motorboating.
– brhans
11 hours ago
What sort of 9V battery are you using and do you have anything other than that 100nF C4 for supply decoupling?
– brhans
11 hours ago
2
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.
– glen_geek
11 hours ago
Use one of the circuits in the data sheet.
– Leon Heller
11 hours ago
thank you @brhans it does sound like that. I'll edit the question to make it clearer.
– Flávio Amieiro
6 hours ago
2
2
What you describe sounds like motorboating.
– brhans
11 hours ago
What you describe sounds like motorboating.
– brhans
11 hours ago
What sort of 9V battery are you using and do you have anything other than that 100nF C4 for supply decoupling?
– brhans
11 hours ago
What sort of 9V battery are you using and do you have anything other than that 100nF C4 for supply decoupling?
– brhans
11 hours ago
2
2
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.
– glen_geek
11 hours ago
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.
– glen_geek
11 hours ago
Use one of the circuits in the data sheet.
– Leon Heller
11 hours ago
Use one of the circuits in the data sheet.
– Leon Heller
11 hours ago
thank you @brhans it does sound like that. I'll edit the question to make it clearer.
– Flávio Amieiro
6 hours ago
thank you @brhans it does sound like that. I'll edit the question to make it clearer.
– Flávio Amieiro
6 hours ago
|
show 1 more comment
2 Answers
2
active
oldest
votes
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. 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).
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.
– Flávio Amieiro
6 hours ago
add a comment |
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]
and
(#4) the -pin of a 10,000 uF capacitor across the 9v power supply
You do have the 10,000uF bypass cap???
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
});
});
}, "mathjax-editing");
StackExchange.ifUsing("editor", function () {
return StackExchange.using("schematics", function () {
StackExchange.schematics.init();
});
}, "cicuitlab");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "135"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Flávio Amieiro is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2felectronics.stackexchange.com%2fquestions%2f413891%2flm386-motorboating-that-goes-away-with-a-resistor-in-parallel-with-the-bypass-ca%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
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. 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).
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.
– Flávio Amieiro
6 hours ago
add a comment |
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. 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).
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.
– Flávio Amieiro
6 hours ago
add a comment |
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. 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).
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. 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).
edited 8 hours ago
answered 8 hours ago
Kevin White
12.7k11521
12.7k11521
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.
– Flávio Amieiro
6 hours ago
add a comment |
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.
– Flávio Amieiro
6 hours ago
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.
– Flávio Amieiro
6 hours ago
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.
– Flávio Amieiro
6 hours ago
add a comment |
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]
and
(#4) the -pin of a 10,000 uF capacitor across the 9v power supply
You do have the 10,000uF bypass cap???
add a comment |
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]
and
(#4) the -pin of a 10,000 uF capacitor across the 9v power supply
You do have the 10,000uF bypass cap???
add a comment |
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]
and
(#4) the -pin of a 10,000 uF capacitor across the 9v power supply
You do have the 10,000uF bypass cap???
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]
and
(#4) the -pin of a 10,000 uF capacitor across the 9v power supply
You do have the 10,000uF bypass cap???
answered 10 hours ago
analogsystemsrf
13.6k2716
13.6k2716
add a comment |
add a comment |
Flávio Amieiro is a new contributor. Be nice, and check out our Code of Conduct.
Flávio Amieiro is a new contributor. Be nice, and check out our Code of Conduct.
Flávio Amieiro is a new contributor. Be nice, and check out our Code of Conduct.
Flávio Amieiro is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Electrical Engineering Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2felectronics.stackexchange.com%2fquestions%2f413891%2flm386-motorboating-that-goes-away-with-a-resistor-in-parallel-with-the-bypass-ca%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
What you describe sounds like motorboating.
– brhans
11 hours ago
What sort of 9V battery are you using and do you have anything other than that 100nF C4 for supply decoupling?
– brhans
11 hours ago
2
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.
– glen_geek
11 hours ago
Use one of the circuits in the data sheet.
– Leon Heller
11 hours ago
thank you @brhans it does sound like that. I'll edit the question to make it clearer.
– Flávio Amieiro
6 hours ago