# question regarding buzzer circuit

Discussion in 'General Electronics Chat' started by bluexdynasty, Nov 13, 2014.

1. ### bluexdynasty Thread Starter New Member

Oct 3, 2014
17
0
I've been reading up on PWM and how to use it with a speaker. I found this typical circuit online, but I'm not quite understanding the significance of the transistor, since I only understand transistors as a general switching mechanism.

Thus, depending on the PWM signal from the MCU is it just turning off and on the buzzer at different speeds for the buzzer to produce sound?

Thanks for the help!

2. ### wayneh Expert

Sep 9, 2010
12,362
3,220
What buzzer? In this diagram, the PWM signal itself is the "buzz" signal. The transistor's role is to amplify the current from the PWM signal to a level that can drive the speaker.

This will only work if the PWM signal frequency is in the audible range.

There's not much role for PWM here, though, since changing the duty cycle won't make much difference compared to changing the frequency.

3. ### bluexdynasty Thread Starter New Member

Oct 3, 2014
17
0
Thanks for the quick response. Sorry, I meant speaker in this case*.
However, from my limited knowledge of transistors doesn't an NPN current flow from the collector to the emitter? Thus, how does it amplify the current to drive the speaker if, when the transistor is on, the current will flow to ground.

4. ### wayneh Expert

Sep 9, 2010
12,362
3,220
Current has to flow to ground if it is to also flow through the speaker. Where else would it go? Think of the transistor as a simple switch under control of the base voltage. No voltage, the switch is off and no current flows. The speaker coil rests in its neutral position. Put voltage on the base, the switch turns on, current flows, the coil moves in proportion to the current and sound is produced. Repeat.

5. ### GopherT AAC Fanatic!

Nov 23, 2012
6,297
4,019
Pwm is always the same frequency. The pulse width change is the duty cycle change. The carrier frequency (40k to 60k Hz for example) could be filtered out to leave an audio signal behind. If a PWM signal carrying an audio signal is used in your circuit, then it certainly can be used. It might heat up the voice coil in your speaker if the duty cycle or current is too high for the speaker but, that is not specified in the design. A capacitor-coupled or H bridge might be better.

In your design, you rely on the Pwm frequency being filtered by the inductance of the voice coil. Not a great idea.

6. ### AnalogKid Distinguished Member

Aug 1, 2013
4,676
1,294
Actually, that is the basis of the vast majority of audio amplifiers today. Class D amps are in every cell phone, tablet, laptop TV. etc. As ideas go, it's pretty popular. Much of the filtering comes from the mass of the cone, not the voice coil inductance. For this to work, the PWM frequency should be much higher than the highest frequency of audio you are trying to reproduce.

In a true class D amp there are at least two switches, one for each direction of electron flow, but the basic idea is the same for your 1-transistor version. Vout in your drawing actually is a DC voltage source; let's assume 10 volts. At a 90% duty cycle out of the MCU, the transistor is on 90% of the time so the average voltage across the speaker is 9 volts (assume perfect transistor switch with no voltage drop). At 10% duty cycle the voltage across the speaker is 1 volt. As the duty cycle varies as a function of the audio signal, the average voltage across the speaker varies. In this example, the speaker "sees an audio signal of +/-4.5 volts sitting on a DC pedestal of 4.5 volts. This means there is a static current through the speaker at all times, and this can severely reduce the audio volume the speaker can deliver without distortion.

ak