I found an audio circuit and I built it just fine, but I find it a bit too quiet. How do I amplify the output so that it is a bit louder?Input sound to arduino via microphone jackConnect IPOD audio output to old rotary telephoneGood engineering for Audio AmpsChaining output of amplifier (to speaker) to another amplifierviability of idea for low voltage signal clipping (distortion) for guitar effectSpeaker protection using only zener diodes?Running the PAM8403 amplifier with only one audio channel?Very little amplification when amplifying audio signal with LM318Trying a PWM audio application. I can't figure out why I'm getting a loud beep overlapping my soundMerging audio lines - one channel is quieter

A variation to the phrase "hanging over my shoulders"

How to draw a matrix with arrows in limited space

What does Apple's new App Store requirement mean

What is the English pronunciation of "pain au chocolat"?

Does grappling negate Mirror Image?

I found an audio circuit and I built it just fine, but I find it a bit too quiet. How do I amplify the output so that it is a bit louder?

JIS and ISO square taper

Review your own paper in Mathematics

sp_blitzCache against one stored procedure

Will the Sticky MAC access policy prevent unauthorized hubs from connecting to a network?

Non-trope happy ending?

PTIJ: Why is Haman obsessed with Bose?

Why the "ls" command is showing the permissions of files in a FAT32 partition?

How to explain what's wrong with this application of the chain rule?

Multiplicative persistence

Does Doodling or Improvising on the Piano Have Any Benefits?

Quoting Keynes in a lecture

Stack Interview Code methods made from class Node and Smart Pointers

Circuit Analysis: Obtaining Close Loop OP - AMP Transfer function

Is there any evidence that Cleopatra and Caesarion considered fleeing to India to escape the Romans?

What to do when eye contact makes your coworker uncomfortable?

What (the heck) is a Super Worm Equinox Moon?

Can I cause damage to electrical appliances by unplugging them when they are turned on?

How to get directions in deep space?



I found an audio circuit and I built it just fine, but I find it a bit too quiet. How do I amplify the output so that it is a bit louder?


Input sound to arduino via microphone jackConnect IPOD audio output to old rotary telephoneGood engineering for Audio AmpsChaining output of amplifier (to speaker) to another amplifierviability of idea for low voltage signal clipping (distortion) for guitar effectSpeaker protection using only zener diodes?Running the PAM8403 amplifier with only one audio channel?Very little amplification when amplifying audio signal with LM318Trying a PWM audio application. I can't figure out why I'm getting a loud beep overlapping my soundMerging audio lines - one channel is quieter













2












$begingroup$


I want to try something audio related and found the following circuit from technoblogy



enter image description here



I built it and loaded a sound clip. Everything works fine, but I found it a bit too quiet and I want to amplify it, but not entirely sure how.



The biggest problem is that I do not have access to an oscilloscope so while this does play sound clips just fine, I have zero idea what the waveform output looks like at the speaker, or even its voltage level (I'm assuming the peak to peak voltage is less than 3.7V) and because of that, I'm not sure how to amplify the output to make it more audible. Or is this even possible to amplify it due to the 3.7V constrain?










share|improve this question









$endgroup$











  • $begingroup$
    One-word: "H-Bridge".
    $endgroup$
    – brhans
    2 hours ago






  • 2




    $begingroup$
    @brhans: Have another look at the circuit. It's already a H-bridge (two hyphenated words) so I think you'll need more words than one.
    $endgroup$
    – Transistor
    2 hours ago










  • $begingroup$
    @Transistor - I meant a 'real' H-bridge which can deliver more than a few mA into a low-ohm load.
    $endgroup$
    – brhans
    2 hours ago






  • 1




    $begingroup$
    @brhans: And that requires some understanding of how to connect a H-bridge output to an unbalanced input. My point is that your comment was useless to the OP given that s/he's a novice. You're usually quite helpful though.
    $endgroup$
    – Transistor
    2 hours ago







  • 1




    $begingroup$
    What impedance speaker are you you using? The output characteristics of the Attiny's IO mean you need about a 100 ohm speaker, or the outputs may not be able to develop the full voltage.
    $endgroup$
    – Phil G
    1 hour ago
















2












$begingroup$


I want to try something audio related and found the following circuit from technoblogy



enter image description here



I built it and loaded a sound clip. Everything works fine, but I found it a bit too quiet and I want to amplify it, but not entirely sure how.



The biggest problem is that I do not have access to an oscilloscope so while this does play sound clips just fine, I have zero idea what the waveform output looks like at the speaker, or even its voltage level (I'm assuming the peak to peak voltage is less than 3.7V) and because of that, I'm not sure how to amplify the output to make it more audible. Or is this even possible to amplify it due to the 3.7V constrain?










share|improve this question









$endgroup$











  • $begingroup$
    One-word: "H-Bridge".
    $endgroup$
    – brhans
    2 hours ago






  • 2




    $begingroup$
    @brhans: Have another look at the circuit. It's already a H-bridge (two hyphenated words) so I think you'll need more words than one.
    $endgroup$
    – Transistor
    2 hours ago










  • $begingroup$
    @Transistor - I meant a 'real' H-bridge which can deliver more than a few mA into a low-ohm load.
    $endgroup$
    – brhans
    2 hours ago






  • 1




    $begingroup$
    @brhans: And that requires some understanding of how to connect a H-bridge output to an unbalanced input. My point is that your comment was useless to the OP given that s/he's a novice. You're usually quite helpful though.
    $endgroup$
    – Transistor
    2 hours ago







  • 1




    $begingroup$
    What impedance speaker are you you using? The output characteristics of the Attiny's IO mean you need about a 100 ohm speaker, or the outputs may not be able to develop the full voltage.
    $endgroup$
    – Phil G
    1 hour ago














2












2








2





$begingroup$


I want to try something audio related and found the following circuit from technoblogy



enter image description here



I built it and loaded a sound clip. Everything works fine, but I found it a bit too quiet and I want to amplify it, but not entirely sure how.



The biggest problem is that I do not have access to an oscilloscope so while this does play sound clips just fine, I have zero idea what the waveform output looks like at the speaker, or even its voltage level (I'm assuming the peak to peak voltage is less than 3.7V) and because of that, I'm not sure how to amplify the output to make it more audible. Or is this even possible to amplify it due to the 3.7V constrain?










share|improve this question









$endgroup$




I want to try something audio related and found the following circuit from technoblogy



enter image description here



I built it and loaded a sound clip. Everything works fine, but I found it a bit too quiet and I want to amplify it, but not entirely sure how.



The biggest problem is that I do not have access to an oscilloscope so while this does play sound clips just fine, I have zero idea what the waveform output looks like at the speaker, or even its voltage level (I'm assuming the peak to peak voltage is less than 3.7V) and because of that, I'm not sure how to amplify the output to make it more audible. Or is this even possible to amplify it due to the 3.7V constrain?







microcontroller amplifier audio pwm attiny85






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 2 hours ago









cheunstecheunste

884




884











  • $begingroup$
    One-word: "H-Bridge".
    $endgroup$
    – brhans
    2 hours ago






  • 2




    $begingroup$
    @brhans: Have another look at the circuit. It's already a H-bridge (two hyphenated words) so I think you'll need more words than one.
    $endgroup$
    – Transistor
    2 hours ago










  • $begingroup$
    @Transistor - I meant a 'real' H-bridge which can deliver more than a few mA into a low-ohm load.
    $endgroup$
    – brhans
    2 hours ago






  • 1




    $begingroup$
    @brhans: And that requires some understanding of how to connect a H-bridge output to an unbalanced input. My point is that your comment was useless to the OP given that s/he's a novice. You're usually quite helpful though.
    $endgroup$
    – Transistor
    2 hours ago







  • 1




    $begingroup$
    What impedance speaker are you you using? The output characteristics of the Attiny's IO mean you need about a 100 ohm speaker, or the outputs may not be able to develop the full voltage.
    $endgroup$
    – Phil G
    1 hour ago

















  • $begingroup$
    One-word: "H-Bridge".
    $endgroup$
    – brhans
    2 hours ago






  • 2




    $begingroup$
    @brhans: Have another look at the circuit. It's already a H-bridge (two hyphenated words) so I think you'll need more words than one.
    $endgroup$
    – Transistor
    2 hours ago










  • $begingroup$
    @Transistor - I meant a 'real' H-bridge which can deliver more than a few mA into a low-ohm load.
    $endgroup$
    – brhans
    2 hours ago






  • 1




    $begingroup$
    @brhans: And that requires some understanding of how to connect a H-bridge output to an unbalanced input. My point is that your comment was useless to the OP given that s/he's a novice. You're usually quite helpful though.
    $endgroup$
    – Transistor
    2 hours ago







  • 1




    $begingroup$
    What impedance speaker are you you using? The output characteristics of the Attiny's IO mean you need about a 100 ohm speaker, or the outputs may not be able to develop the full voltage.
    $endgroup$
    – Phil G
    1 hour ago
















$begingroup$
One-word: "H-Bridge".
$endgroup$
– brhans
2 hours ago




$begingroup$
One-word: "H-Bridge".
$endgroup$
– brhans
2 hours ago




2




2




$begingroup$
@brhans: Have another look at the circuit. It's already a H-bridge (two hyphenated words) so I think you'll need more words than one.
$endgroup$
– Transistor
2 hours ago




$begingroup$
@brhans: Have another look at the circuit. It's already a H-bridge (two hyphenated words) so I think you'll need more words than one.
$endgroup$
– Transistor
2 hours ago












$begingroup$
@Transistor - I meant a 'real' H-bridge which can deliver more than a few mA into a low-ohm load.
$endgroup$
– brhans
2 hours ago




$begingroup$
@Transistor - I meant a 'real' H-bridge which can deliver more than a few mA into a low-ohm load.
$endgroup$
– brhans
2 hours ago




1




1




$begingroup$
@brhans: And that requires some understanding of how to connect a H-bridge output to an unbalanced input. My point is that your comment was useless to the OP given that s/he's a novice. You're usually quite helpful though.
$endgroup$
– Transistor
2 hours ago





$begingroup$
@brhans: And that requires some understanding of how to connect a H-bridge output to an unbalanced input. My point is that your comment was useless to the OP given that s/he's a novice. You're usually quite helpful though.
$endgroup$
– Transistor
2 hours ago





1




1




$begingroup$
What impedance speaker are you you using? The output characteristics of the Attiny's IO mean you need about a 100 ohm speaker, or the outputs may not be able to develop the full voltage.
$endgroup$
– Phil G
1 hour ago





$begingroup$
What impedance speaker are you you using? The output characteristics of the Attiny's IO mean you need about a 100 ohm speaker, or the outputs may not be able to develop the full voltage.
$endgroup$
– Phil G
1 hour ago











2 Answers
2






active

oldest

votes


















6












$begingroup$

Actually, the peak-to-peak voltage is going to be close to 7.4 V. This is because the speaker is being used in a differential mode, connected to two separate MCU outputs, with neither terminal grounded.



Since the firmware is simply driving the two pins with complementary waveforms, you can use just one of them (with a suitable filter, as JRE shows) to drive an external amplifier.



Of course, the speaker will also get somewhat louder if you simply raise the supply voltage to the full 5.5V that the ATtiny85 allows.



However, the primary limitation is not voltage, but rather the current capability of the MCU pins. If you were to simply add external buffers to those pins, you'd get a lot more sound out of the speaker:





schematic





simulate this circuit – Schematic created using CircuitLab



Note that the buffers are configured as emitter-followers. There's no voltage gain here (in fact, it loses about 1.3V in peak voltage), but a lot more current is available to the speaker. Since it's a digital signal, we don't need to worry about the horrible crossover distortion of this configuration. But it should be able to deliver about 4.8 Vpp @ several hundred mA, or almost 500 mW of audio power!






share|improve this answer











$endgroup$












  • $begingroup$
    The OP's link answers his question in the comments, at least to the extent we have here.
    $endgroup$
    – TimWescott
    1 hour ago


















1












$begingroup$

The site you got the circuit and code from tells you what it is doing.



From the description, you can find out what the output looks like. It says it is using pulse width modulation (PWM) to generate the audio.



Wikipedia has a good explanation of PWM, and how it is used to make audio.



This image from the wikipedia page show pretty much what you can expect as output from your noise maker.



The red line is what your speaker "sees." The blue line is what your circuit generates.



enter image description here



Simply put, your program makes pulses of various widths on the two output pins. Wider pulses cause the speaker to move more than narrower pulses. The pulses have to occur faster than the speaker can respond to them. The inertia of the speaker smooths the pulses into something that resembles normal audio.



What is limiting the volume of the output is the current from the output pins. That is normally measured in milliamperes. Assume you can get 20mA out of your pins. At 7 volts and 20mA, you will get maybe 0.14 watts. Assuming you don't kill your processor doing this.



That's not much power. Compare it to what you expect from your stereo, and how many watts of power it can output.



To get more power, the simplest thing to to is to clean up the PWM signal and send it to a regular amplifier.



You only need one of the outputs pins. Your gadget uses two in attempt to get more power, but it really can't do much.



So, do this:





schematic





simulate this circuit – Schematic created using CircuitLab



Then connect the output to any standard audio amplifier. Buy and build a kit if you like, or connect it to the line in of a stereo.



That is a low pass filter. It filters out everything above 4kHz. I chose 4KHz because the project says to use a file with an 8kHz sampling rate. A file sampled at 8kHz can't contain any audio above 4kHz. Look up Shannon and Nyquist (in relation to sampling rates.)



The pulse rate of the PWM will have to be much higher than 8kHz, so using a 4 kHz filter doesn't lose any of your audio, but should smooth the square edges into a nice smooth wave.




There are small amplifiers that you could power from 3.3V. There are also many other amplifiers that run on higher voltages. There are cheap and common circuits (and kits) to build an amplifier from an LM386. The LM386 needs 5V or more, though. It is commonly operated on a 9V battery.



You could also look up H-bridges. If you drive an H-bridge with you speaker in the middle (the cross bar of the H) using your two processor outputs on the H-bridge inputs, then it should be quite loud. This could be tricky, though. It will be operating at the pulse rate, and amplifying the pulses rather than the smooth wave. That will cause a lot of electrical "noise" and probably make your speaker and the bridge get hot.






share|improve this answer











$endgroup$












  • $begingroup$
    And it's a pretty poor output filter -- the sound will be discernibly muddied with that filter. But to make it sound good you'd need an active filter, and that may be beyond the OP's abilities.
    $endgroup$
    – TimWescott
    1 hour ago










  • $begingroup$
    Guys, there's no point in trying to make it sound "good." It's 8 bit, 8kHz audio generated by PWM. More effort is just trying to make a silk purse out of a sow's ear.
    $endgroup$
    – JRE
    1 hour ago










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
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2felectronics.stackexchange.com%2fquestions%2f428398%2fi-found-an-audio-circuit-and-i-built-it-just-fine-but-i-find-it-a-bit-too-quiet%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









6












$begingroup$

Actually, the peak-to-peak voltage is going to be close to 7.4 V. This is because the speaker is being used in a differential mode, connected to two separate MCU outputs, with neither terminal grounded.



Since the firmware is simply driving the two pins with complementary waveforms, you can use just one of them (with a suitable filter, as JRE shows) to drive an external amplifier.



Of course, the speaker will also get somewhat louder if you simply raise the supply voltage to the full 5.5V that the ATtiny85 allows.



However, the primary limitation is not voltage, but rather the current capability of the MCU pins. If you were to simply add external buffers to those pins, you'd get a lot more sound out of the speaker:





schematic





simulate this circuit – Schematic created using CircuitLab



Note that the buffers are configured as emitter-followers. There's no voltage gain here (in fact, it loses about 1.3V in peak voltage), but a lot more current is available to the speaker. Since it's a digital signal, we don't need to worry about the horrible crossover distortion of this configuration. But it should be able to deliver about 4.8 Vpp @ several hundred mA, or almost 500 mW of audio power!






share|improve this answer











$endgroup$












  • $begingroup$
    The OP's link answers his question in the comments, at least to the extent we have here.
    $endgroup$
    – TimWescott
    1 hour ago















6












$begingroup$

Actually, the peak-to-peak voltage is going to be close to 7.4 V. This is because the speaker is being used in a differential mode, connected to two separate MCU outputs, with neither terminal grounded.



Since the firmware is simply driving the two pins with complementary waveforms, you can use just one of them (with a suitable filter, as JRE shows) to drive an external amplifier.



Of course, the speaker will also get somewhat louder if you simply raise the supply voltage to the full 5.5V that the ATtiny85 allows.



However, the primary limitation is not voltage, but rather the current capability of the MCU pins. If you were to simply add external buffers to those pins, you'd get a lot more sound out of the speaker:





schematic





simulate this circuit – Schematic created using CircuitLab



Note that the buffers are configured as emitter-followers. There's no voltage gain here (in fact, it loses about 1.3V in peak voltage), but a lot more current is available to the speaker. Since it's a digital signal, we don't need to worry about the horrible crossover distortion of this configuration. But it should be able to deliver about 4.8 Vpp @ several hundred mA, or almost 500 mW of audio power!






share|improve this answer











$endgroup$












  • $begingroup$
    The OP's link answers his question in the comments, at least to the extent we have here.
    $endgroup$
    – TimWescott
    1 hour ago













6












6








6





$begingroup$

Actually, the peak-to-peak voltage is going to be close to 7.4 V. This is because the speaker is being used in a differential mode, connected to two separate MCU outputs, with neither terminal grounded.



Since the firmware is simply driving the two pins with complementary waveforms, you can use just one of them (with a suitable filter, as JRE shows) to drive an external amplifier.



Of course, the speaker will also get somewhat louder if you simply raise the supply voltage to the full 5.5V that the ATtiny85 allows.



However, the primary limitation is not voltage, but rather the current capability of the MCU pins. If you were to simply add external buffers to those pins, you'd get a lot more sound out of the speaker:





schematic





simulate this circuit – Schematic created using CircuitLab



Note that the buffers are configured as emitter-followers. There's no voltage gain here (in fact, it loses about 1.3V in peak voltage), but a lot more current is available to the speaker. Since it's a digital signal, we don't need to worry about the horrible crossover distortion of this configuration. But it should be able to deliver about 4.8 Vpp @ several hundred mA, or almost 500 mW of audio power!






share|improve this answer











$endgroup$



Actually, the peak-to-peak voltage is going to be close to 7.4 V. This is because the speaker is being used in a differential mode, connected to two separate MCU outputs, with neither terminal grounded.



Since the firmware is simply driving the two pins with complementary waveforms, you can use just one of them (with a suitable filter, as JRE shows) to drive an external amplifier.



Of course, the speaker will also get somewhat louder if you simply raise the supply voltage to the full 5.5V that the ATtiny85 allows.



However, the primary limitation is not voltage, but rather the current capability of the MCU pins. If you were to simply add external buffers to those pins, you'd get a lot more sound out of the speaker:





schematic





simulate this circuit – Schematic created using CircuitLab



Note that the buffers are configured as emitter-followers. There's no voltage gain here (in fact, it loses about 1.3V in peak voltage), but a lot more current is available to the speaker. Since it's a digital signal, we don't need to worry about the horrible crossover distortion of this configuration. But it should be able to deliver about 4.8 Vpp @ several hundred mA, or almost 500 mW of audio power!







share|improve this answer














share|improve this answer



share|improve this answer








edited 14 mins ago

























answered 2 hours ago









Dave TweedDave Tweed

121k9152261




121k9152261











  • $begingroup$
    The OP's link answers his question in the comments, at least to the extent we have here.
    $endgroup$
    – TimWescott
    1 hour ago
















  • $begingroup$
    The OP's link answers his question in the comments, at least to the extent we have here.
    $endgroup$
    – TimWescott
    1 hour ago















$begingroup$
The OP's link answers his question in the comments, at least to the extent we have here.
$endgroup$
– TimWescott
1 hour ago




$begingroup$
The OP's link answers his question in the comments, at least to the extent we have here.
$endgroup$
– TimWescott
1 hour ago













1












$begingroup$

The site you got the circuit and code from tells you what it is doing.



From the description, you can find out what the output looks like. It says it is using pulse width modulation (PWM) to generate the audio.



Wikipedia has a good explanation of PWM, and how it is used to make audio.



This image from the wikipedia page show pretty much what you can expect as output from your noise maker.



The red line is what your speaker "sees." The blue line is what your circuit generates.



enter image description here



Simply put, your program makes pulses of various widths on the two output pins. Wider pulses cause the speaker to move more than narrower pulses. The pulses have to occur faster than the speaker can respond to them. The inertia of the speaker smooths the pulses into something that resembles normal audio.



What is limiting the volume of the output is the current from the output pins. That is normally measured in milliamperes. Assume you can get 20mA out of your pins. At 7 volts and 20mA, you will get maybe 0.14 watts. Assuming you don't kill your processor doing this.



That's not much power. Compare it to what you expect from your stereo, and how many watts of power it can output.



To get more power, the simplest thing to to is to clean up the PWM signal and send it to a regular amplifier.



You only need one of the outputs pins. Your gadget uses two in attempt to get more power, but it really can't do much.



So, do this:





schematic





simulate this circuit – Schematic created using CircuitLab



Then connect the output to any standard audio amplifier. Buy and build a kit if you like, or connect it to the line in of a stereo.



That is a low pass filter. It filters out everything above 4kHz. I chose 4KHz because the project says to use a file with an 8kHz sampling rate. A file sampled at 8kHz can't contain any audio above 4kHz. Look up Shannon and Nyquist (in relation to sampling rates.)



The pulse rate of the PWM will have to be much higher than 8kHz, so using a 4 kHz filter doesn't lose any of your audio, but should smooth the square edges into a nice smooth wave.




There are small amplifiers that you could power from 3.3V. There are also many other amplifiers that run on higher voltages. There are cheap and common circuits (and kits) to build an amplifier from an LM386. The LM386 needs 5V or more, though. It is commonly operated on a 9V battery.



You could also look up H-bridges. If you drive an H-bridge with you speaker in the middle (the cross bar of the H) using your two processor outputs on the H-bridge inputs, then it should be quite loud. This could be tricky, though. It will be operating at the pulse rate, and amplifying the pulses rather than the smooth wave. That will cause a lot of electrical "noise" and probably make your speaker and the bridge get hot.






share|improve this answer











$endgroup$












  • $begingroup$
    And it's a pretty poor output filter -- the sound will be discernibly muddied with that filter. But to make it sound good you'd need an active filter, and that may be beyond the OP's abilities.
    $endgroup$
    – TimWescott
    1 hour ago










  • $begingroup$
    Guys, there's no point in trying to make it sound "good." It's 8 bit, 8kHz audio generated by PWM. More effort is just trying to make a silk purse out of a sow's ear.
    $endgroup$
    – JRE
    1 hour ago















1












$begingroup$

The site you got the circuit and code from tells you what it is doing.



From the description, you can find out what the output looks like. It says it is using pulse width modulation (PWM) to generate the audio.



Wikipedia has a good explanation of PWM, and how it is used to make audio.



This image from the wikipedia page show pretty much what you can expect as output from your noise maker.



The red line is what your speaker "sees." The blue line is what your circuit generates.



enter image description here



Simply put, your program makes pulses of various widths on the two output pins. Wider pulses cause the speaker to move more than narrower pulses. The pulses have to occur faster than the speaker can respond to them. The inertia of the speaker smooths the pulses into something that resembles normal audio.



What is limiting the volume of the output is the current from the output pins. That is normally measured in milliamperes. Assume you can get 20mA out of your pins. At 7 volts and 20mA, you will get maybe 0.14 watts. Assuming you don't kill your processor doing this.



That's not much power. Compare it to what you expect from your stereo, and how many watts of power it can output.



To get more power, the simplest thing to to is to clean up the PWM signal and send it to a regular amplifier.



You only need one of the outputs pins. Your gadget uses two in attempt to get more power, but it really can't do much.



So, do this:





schematic





simulate this circuit – Schematic created using CircuitLab



Then connect the output to any standard audio amplifier. Buy and build a kit if you like, or connect it to the line in of a stereo.



That is a low pass filter. It filters out everything above 4kHz. I chose 4KHz because the project says to use a file with an 8kHz sampling rate. A file sampled at 8kHz can't contain any audio above 4kHz. Look up Shannon and Nyquist (in relation to sampling rates.)



The pulse rate of the PWM will have to be much higher than 8kHz, so using a 4 kHz filter doesn't lose any of your audio, but should smooth the square edges into a nice smooth wave.




There are small amplifiers that you could power from 3.3V. There are also many other amplifiers that run on higher voltages. There are cheap and common circuits (and kits) to build an amplifier from an LM386. The LM386 needs 5V or more, though. It is commonly operated on a 9V battery.



You could also look up H-bridges. If you drive an H-bridge with you speaker in the middle (the cross bar of the H) using your two processor outputs on the H-bridge inputs, then it should be quite loud. This could be tricky, though. It will be operating at the pulse rate, and amplifying the pulses rather than the smooth wave. That will cause a lot of electrical "noise" and probably make your speaker and the bridge get hot.






share|improve this answer











$endgroup$












  • $begingroup$
    And it's a pretty poor output filter -- the sound will be discernibly muddied with that filter. But to make it sound good you'd need an active filter, and that may be beyond the OP's abilities.
    $endgroup$
    – TimWescott
    1 hour ago










  • $begingroup$
    Guys, there's no point in trying to make it sound "good." It's 8 bit, 8kHz audio generated by PWM. More effort is just trying to make a silk purse out of a sow's ear.
    $endgroup$
    – JRE
    1 hour ago













1












1








1





$begingroup$

The site you got the circuit and code from tells you what it is doing.



From the description, you can find out what the output looks like. It says it is using pulse width modulation (PWM) to generate the audio.



Wikipedia has a good explanation of PWM, and how it is used to make audio.



This image from the wikipedia page show pretty much what you can expect as output from your noise maker.



The red line is what your speaker "sees." The blue line is what your circuit generates.



enter image description here



Simply put, your program makes pulses of various widths on the two output pins. Wider pulses cause the speaker to move more than narrower pulses. The pulses have to occur faster than the speaker can respond to them. The inertia of the speaker smooths the pulses into something that resembles normal audio.



What is limiting the volume of the output is the current from the output pins. That is normally measured in milliamperes. Assume you can get 20mA out of your pins. At 7 volts and 20mA, you will get maybe 0.14 watts. Assuming you don't kill your processor doing this.



That's not much power. Compare it to what you expect from your stereo, and how many watts of power it can output.



To get more power, the simplest thing to to is to clean up the PWM signal and send it to a regular amplifier.



You only need one of the outputs pins. Your gadget uses two in attempt to get more power, but it really can't do much.



So, do this:





schematic





simulate this circuit – Schematic created using CircuitLab



Then connect the output to any standard audio amplifier. Buy and build a kit if you like, or connect it to the line in of a stereo.



That is a low pass filter. It filters out everything above 4kHz. I chose 4KHz because the project says to use a file with an 8kHz sampling rate. A file sampled at 8kHz can't contain any audio above 4kHz. Look up Shannon and Nyquist (in relation to sampling rates.)



The pulse rate of the PWM will have to be much higher than 8kHz, so using a 4 kHz filter doesn't lose any of your audio, but should smooth the square edges into a nice smooth wave.




There are small amplifiers that you could power from 3.3V. There are also many other amplifiers that run on higher voltages. There are cheap and common circuits (and kits) to build an amplifier from an LM386. The LM386 needs 5V or more, though. It is commonly operated on a 9V battery.



You could also look up H-bridges. If you drive an H-bridge with you speaker in the middle (the cross bar of the H) using your two processor outputs on the H-bridge inputs, then it should be quite loud. This could be tricky, though. It will be operating at the pulse rate, and amplifying the pulses rather than the smooth wave. That will cause a lot of electrical "noise" and probably make your speaker and the bridge get hot.






share|improve this answer











$endgroup$



The site you got the circuit and code from tells you what it is doing.



From the description, you can find out what the output looks like. It says it is using pulse width modulation (PWM) to generate the audio.



Wikipedia has a good explanation of PWM, and how it is used to make audio.



This image from the wikipedia page show pretty much what you can expect as output from your noise maker.



The red line is what your speaker "sees." The blue line is what your circuit generates.



enter image description here



Simply put, your program makes pulses of various widths on the two output pins. Wider pulses cause the speaker to move more than narrower pulses. The pulses have to occur faster than the speaker can respond to them. The inertia of the speaker smooths the pulses into something that resembles normal audio.



What is limiting the volume of the output is the current from the output pins. That is normally measured in milliamperes. Assume you can get 20mA out of your pins. At 7 volts and 20mA, you will get maybe 0.14 watts. Assuming you don't kill your processor doing this.



That's not much power. Compare it to what you expect from your stereo, and how many watts of power it can output.



To get more power, the simplest thing to to is to clean up the PWM signal and send it to a regular amplifier.



You only need one of the outputs pins. Your gadget uses two in attempt to get more power, but it really can't do much.



So, do this:





schematic





simulate this circuit – Schematic created using CircuitLab



Then connect the output to any standard audio amplifier. Buy and build a kit if you like, or connect it to the line in of a stereo.



That is a low pass filter. It filters out everything above 4kHz. I chose 4KHz because the project says to use a file with an 8kHz sampling rate. A file sampled at 8kHz can't contain any audio above 4kHz. Look up Shannon and Nyquist (in relation to sampling rates.)



The pulse rate of the PWM will have to be much higher than 8kHz, so using a 4 kHz filter doesn't lose any of your audio, but should smooth the square edges into a nice smooth wave.




There are small amplifiers that you could power from 3.3V. There are also many other amplifiers that run on higher voltages. There are cheap and common circuits (and kits) to build an amplifier from an LM386. The LM386 needs 5V or more, though. It is commonly operated on a 9V battery.



You could also look up H-bridges. If you drive an H-bridge with you speaker in the middle (the cross bar of the H) using your two processor outputs on the H-bridge inputs, then it should be quite loud. This could be tricky, though. It will be operating at the pulse rate, and amplifying the pulses rather than the smooth wave. That will cause a lot of electrical "noise" and probably make your speaker and the bridge get hot.







share|improve this answer














share|improve this answer



share|improve this answer








edited 1 hour ago

























answered 1 hour ago









JREJRE

22.3k53773




22.3k53773











  • $begingroup$
    And it's a pretty poor output filter -- the sound will be discernibly muddied with that filter. But to make it sound good you'd need an active filter, and that may be beyond the OP's abilities.
    $endgroup$
    – TimWescott
    1 hour ago










  • $begingroup$
    Guys, there's no point in trying to make it sound "good." It's 8 bit, 8kHz audio generated by PWM. More effort is just trying to make a silk purse out of a sow's ear.
    $endgroup$
    – JRE
    1 hour ago
















  • $begingroup$
    And it's a pretty poor output filter -- the sound will be discernibly muddied with that filter. But to make it sound good you'd need an active filter, and that may be beyond the OP's abilities.
    $endgroup$
    – TimWescott
    1 hour ago










  • $begingroup$
    Guys, there's no point in trying to make it sound "good." It's 8 bit, 8kHz audio generated by PWM. More effort is just trying to make a silk purse out of a sow's ear.
    $endgroup$
    – JRE
    1 hour ago















$begingroup$
And it's a pretty poor output filter -- the sound will be discernibly muddied with that filter. But to make it sound good you'd need an active filter, and that may be beyond the OP's abilities.
$endgroup$
– TimWescott
1 hour ago




$begingroup$
And it's a pretty poor output filter -- the sound will be discernibly muddied with that filter. But to make it sound good you'd need an active filter, and that may be beyond the OP's abilities.
$endgroup$
– TimWescott
1 hour ago












$begingroup$
Guys, there's no point in trying to make it sound "good." It's 8 bit, 8kHz audio generated by PWM. More effort is just trying to make a silk purse out of a sow's ear.
$endgroup$
– JRE
1 hour ago




$begingroup$
Guys, there's no point in trying to make it sound "good." It's 8 bit, 8kHz audio generated by PWM. More effort is just trying to make a silk purse out of a sow's ear.
$endgroup$
– JRE
1 hour ago

















draft saved

draft discarded
















































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.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2felectronics.stackexchange.com%2fquestions%2f428398%2fi-found-an-audio-circuit-and-i-built-it-just-fine-but-i-find-it-a-bit-too-quiet%23new-answer', 'question_page');

);

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







Popular posts from this blog

Era Viking Índice Início da Era Viquingue | Cotidiano | Sociedade | Língua | Religião | A arte | As primeiras cidades | As viagens dos viquingues | Viquingues do Oeste e Leste | Fim da Era Viquingue | Fontes históricas | Referências Bibliografia | Ligações externas | Menu de navegação«Sverige då!»«Handel I vikingetid»«O que é Nórdico Antigo»Mito, magia e religião na volsunga saga Um olhar sobre a trajetória mítica do herói sigurd«Bonden var den verklige vikingen»«Vikingatiden»«Vikingatiden»«Vinland»«Guerreiras de Óðinn: As Valkyrjor na Mitologia Viking»1519-9053«Esculpindo símbolos e seres: A arte viking em pedras rúnicas»1679-9313Historia - Tema: VikingarnaAventura e Magia no Mundo das Sagas IslandesasEra Vikinge

What's the metal clinking sound at the end of credits in Avengers: Endgame?What makes Thanos so strong in Avengers: Endgame?Who is the character that appears at the end of Endgame?What happens to Mjolnir (Thor's hammer) at the end of Endgame?The People's Ages in Avengers: EndgameWhat did Nebula do in Avengers: Endgame?Messing with time in the Avengers: Endgame climaxAvengers: Endgame timelineWhat are the time-travel rules in Avengers Endgame?Why use this song in Avengers: Endgame Opening Logo Sequence?Peggy's age in Avengers Endgame

Are there legal definitions of ethnicities/races? The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)Legal definitions in the United StatesAre there truly legal limits on US interest rates?Are gender identity and sexual orientation federally protected?Why is there an apparent legal bias against digital services?What limits are there to the powers of individual judges in the United States legal system?Are women only scholarships legal under Irish / EU law?Is the term “race” defined by Public Law enacted by Congress of the United StatesIs there a legal definition of race in the US?Neighbors are spying for landlord on Renters is it legal?Are Protected Classes Bi-directional?