I have a 4 KHz piezo buzzer and a microcontroller (arduino) that outputs that 4 KHz from one of it's pins. All is fine if I connect the buzzer to the output with one pin and to the ground with another. Also all works as expected if I try to control it with MOSFET: +5V to the drain, buzzer between source and ground, and the output pin to the gate.

However if I replace MOSFET with BJT, something goes wrong and the buzzer emits just a very-very-very quiet sound. Here's what I have:

  • Buzzer between +5 V and the collector
  • Output pin connected to the base through 2K2 resistor
  • Emitter connected to the ground

I have tried few other configurations with BJT, but result is the same. I use BC337 as a transistor (AFAIK it is analogue of 2N2222).

Could anybody clarify why this happens?


I've measured voltage levels. I have 2.51 V between the microcontroller output and the ground. I get 5 V / 2 because it generates square waves, isn't it? Then I have 2.1 V around the base resistor. And, surprisingly I've got 5 V around the buzzer! Shouldn't I get 2.5 V?

Also I noticed that once I measure voltage across the buzzer the sound become a bit louder. So I've tried to add a resistor in parallel to it. Aaaand… now it works!

alt text

The question left open: why it doesn't work as expected if I remove R2?

  • 1
    \$\begingroup\$ Can you look at it with a scope? \$\endgroup\$
    – endolith
    Nov 10, 2010 at 0:18
  • 1
    \$\begingroup\$ Do you have DS (datasheet) of buzzer part? \$\endgroup\$ Nov 10, 2010 at 6:01
  • \$\begingroup\$ I was curious -- what value for R2 did you end up using? \$\endgroup\$
    – yan
    Jul 1, 2015 at 22:50

4 Answers 4


The piezo buzzer use piezoelectric effect to emit sound (the material in the buzzer deform itself due to voltage, deformation will be "proportional" to the voltage applied). Since sound is pressure wave one have to provide oscillating voltage to the buzzer in order to produce oscillating deformations. And most important:

From the electrical perspective piezo buzzer act like capacitor!

So why circuit with BJT and without R2 did not work?

With BJT in the configuration that you use, BJT can only "sink" current. That is it can only lower voltage at its collector. So after first "turn on" the voltage at the collector dropped to ground (or close) level. Next turn on cycle will not change voltage across buzzer as the voltage at the collector was already at ground level. (That is why you have measured 5V across the buzzer). Since voltage across buzzer do not change buzzer will not vibrate and thus will not produce sound.

Adding R2 solved the issue. When BJT is conducting, it lowers voltage at collector (C). When BJT is NOT conducting, R2 pull voltage up. This crates oscillation and produce sound.

Now, more interesting question is why MOSFET seemed to work (and BJT did not)?

I am not sure but here is my thory: My guess is that you have used one of this big power mosfets. They tend to have big parasitic gate to source/drain capacitance, at the same order of magnitude as a capacitance of the piezo buzzer(hundreds of pF). This parasitic capacitance created AC coupling between your input signal and buzzer which was enough to produce sound.

Now BJT of the type you have used have much smaller capacitance (single pF) that was not enough to provide enough AC coupling (it did provide some that is why you did hear some barely audable sound)

Note: The whole issue is little more complicated then simple AC coupling, but I believe is good enough first order explanation of the phenomena.

  • \$\begingroup\$ You could validate this theory (which is what sprung to my mind also) by removing R2 and putting a diode across the collector and emitter of your NPN (cathode on the collector). This would make the bipolar behave a bit more like the MOSFET in this respect. You should find the sound "comes back". \$\endgroup\$ Nov 10, 2010 at 13:40

I think this is because a piezo device is essentially like a capacitor. The output of your microcontroller both charges and discharges the capacitor because it actively drives its output both high and low. The transistor circuit you show can charge the capacitor when it turns on, but it cannot discharge the capacitor. Your piezo will charge up to 5V but when the transistor turns off the charge stays at 5V. No change in voltage = no sound out of the peizo.

Adding the resistor in parallel provides a path for the piezo capacitance to discharge, so then you get the varying voltage you need to produce sound.

That doesn't explain why it works with a MOSFET though, unless there is an internal diode in the MOSFET that discharges the piezo capacitance through the gate?


Are you definitely sure you're using an output pin which can source current properly? (for example, it's not just got some weak internal pull-up turned on?) What voltage does each end of the 2k2 resistor rise to during the cycle?

I know it sounds as though you have this OK if you can source current into the buzzer directly, but it might be worth checking that nothing changed between tests.


I have experienced this with a bjt before as well .A piezo crystal is a very high impedance part. You'll want some other lower impedance load in parallel with the piezo. Maybe start with a 47K? Then work up and down from there for the required volume.

  • \$\begingroup\$ This is not a correct answer. The piezo is a capacitor which has to be discharged, hence the parallel resistor. Switching the transistor on will charge the piezo, but switching it off will leave it floating. \$\endgroup\$
    – stevenvh
    Apr 1, 2012 at 10:42

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.