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!
The question left open: why it doesn't work as expected if I remove R2?