• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

It pays to check

DrG

Active Member
So, I sometimes like to by low-cost electronics...some would say junk...Usually these are a buck or two, sometimes less. They take a long time to arrive and I sometimes forget what and why I bought it in the frst place, but around now, they are like little holiday gifts...and better than fruitcake for the most part.

So, I bought a couple of these at US$1 each (free shipping):
BZ.jpg

Typical little piezo buzzer with some switching circuitry. When I get stuff like this, I like to check it out...test it...write a couple notes...bag it, label it, and stick it in a drawer...where I hope I will find it when I want.

There are four components:
The Buzzer
SMT resistor marked 510 (R2) - that's 51 Ohms
SMT resistor marked 101 (R1) - that's 100 Ohms
SMT transistor marked J3Y - that's an NPN with an Hfe=120+

I traced out the circuit (had to remove the buzzer), and this is what I saw...

BZschematic.jpg

Unless I am missing something fundamental, the value of R2 is WAY too low to be safely driven by an MCU GPIO. I believe it is simply a mistake. I don't have any 3.3 MCU IO that can source ~65 ma or any 5V MCU IO that can source ~98 mA.

I can still use them and if I connect a 470 ohm resistor (or higher) to the GPIO and then to the I/O pin on the board, it works fine. I think someone simply made a mistake.
 

gophert

Well-Known Member
Most Helpful Member
You are assuming the buzzer is zero ohms resistance. Power is I*I*R. If R=0, power = 0 and the buzzer produces no sound. Since the buzzer buzzes, the buzzer must consume some power and, therefore, buzzer's R must be > 0.
 

DrG

Active Member
You are assuming the buzzer is zero ohms resistance. Power is I*I*R. If R=0, power = 0 and the buzzer produces no sound. Since the buzzer buzzes, the buzzer must consume some power and, therefore, buzzer's R must be > 0.
What is the current to the base of the transistor?
 

gophert

Well-Known Member
Most Helpful Member
What is the current to the base of the transistor?
In the off state, (I/o pin low), no current will flow into the pin.

In the on state (I/o pin = high), let's say the worst case would be when the buzzer resistance is zero and saturation voltage of then npn is 0.
Then, assuming a 5v micro, the R1 (100 ohms) allows 50mA to flow. If Hf is 150 (worst case), the collector current is 50mA *149/150 = 49.666 mA.

Therefore, the load on R2 does not exceed 340 micro amps.

Or, if we correct for the 0.6V b-e of the Transistor, the emitter is 4.4v above ground.
4.4v * (R1 * (1+Hf)) = 304 microAmps.
 
Last edited:

DrG

Active Member
In the off state, (I/o pin low), no current will flow into the pin.

In the on state (I/o pin = high), let's say the worst case would be when the buzzer resistance is zero and saturation voltage of then npn is 0.
Then, assuming a 5v micro, the R1 (100 ohms) allows 50mA to flow. If Hf is 150 (worst case), the collector current is 50mA *149/150 = 49.666 mA.

Therefore, the load on R2 does not exceed 340 micro amps.

Or, if we correct for the 0.6V b-e of the Transistor, the emitter is 4.4v above ground.
4.4v * (R1 * (1+Hf)) = 304 microAmps.
OK, let's assume I am following all of this fictitious EE gobbeldygook (relax, I am kidding, thanks for responding).

So, if I want to switch a piezo buzzer with a GPIO, I ask myself....how much current is that buzzer going to take?
I hook up the buzzer to a hefty power supply and it buzzes as it should and I put my meter in there and I read - 14.1 mA at 3.3V and 21.2 mA at 5V [ I just did this - removed the piezo and hooked up the meter].

So, lets say I am using a 5V GPIO and 21.2 mA is above the comfortable drive capability (some can provide 25mA and some can only provide 4-5 or less), so this is not a contrived question.

Now I am thinking... well have the GPIO drive the base of NPN transistor which will switch the buzzer on and off.

So, armed with the specs on the transistor (I linked those earlier), I look up, how to calculate the base resistor to saturate the transistor .....and I find many such threads...
such as https://electronics.stackexchange.com/questions/91307/which-resistor-for-npn-transistor-base and https://www.electronics-tutorials.ws/transistor/tran_2.html and https://forum.allaboutcircuits.com/threads/calculating-base-resistor-for-transistor.78483/

But I don't see where any of that information leads me to a 51 ohm resistor. I am completely serious and have no embarrassment about it at all - I simply am not seeing that.

crutschow , in one of those threads said "A proper design that will work over a wide temperature range and with any BJT should have a base current of 1/10 (or perhaps 1/20 with high gain transistors) of the maximum collector current." Yes, it is out of context, but I don't see that guideline being used here - or the general formula in that thread - or the calculations in the stackexchange thread. I just don't get what would lead someone to calculating a base resistor of 51 ohms in that situation.

Can you shed some light on that? if I understand "Therefore, the load on R2 does not exceed 340 micro amps.", the transistor is not saturated ?- it is not operating as a switch? Or why not use a 500 Ohm resistor for R2. How much current is the GPIO providing - 340 microamps? Is that the truth?

I hate this stuff - it makes no sense and it gives me a headache.
 

gophert

Well-Known Member
Most Helpful Member
The advice from crutschow is for a "normal" use of an NPN as a switch (emitter connected to ground and load connected to collector.

Some of these cheap designs commonly have an NPN collector connected to the 5volt rail and put the load on the emitter.

Remember that a base-emitter of a transistor is a lot like a diode. Therefore, when the emitter is connected to the NPN base, some current limiting is needed at the base or "infinite" current will flow through the "diode".

In the case of the circuit you show, there is a load in series with that base-emitter "diode" (I.e. the buzzer and the 100 ohm load).

Since the Hf of the Transistor is 150, that means one part comes from the base and 149 parts come from the emitter for current flow out of the emitter.

The 304 uAmps is correct and R1 and load limit the current so R2 isn't actually needed. So, I don't know how/why it was selected.

Some people who don't understand the circuit may have criticized the design that didn't have R2 so the manufacturer maybe sells more to the DIY community if a resistor is present. Who knows.
 

alec_t

Well-Known Member
Most Helpful Member
Did you actually measure R2? Although its marking most likely should be interpreted as 51 * 10^0 = 51 Ohms, a standard value in the E24 series is 510 Ohms.
 

Nigel Goodwin

Super Moderator
Most Helpful Member
The advice from crutschow is for a "normal" use of an NPN as a switch (emitter connected to ground and load connected to collector.

Some of these cheap designs commonly have an NPN collector connected to the 5volt rail and put the load on the emitter.
Assuming it's not an actual 'buzzer', but just a 'speaker', then having it in the emitter allows you to operate it in an analogue fashion rather than a digital one.

If it's just a buzzer, then it's a crap design :D
 

DrG

Active Member
Did you actually measure R2? Although its marking most likely should be interpreted as 51 * 10^0 = 51 Ohms, a standard value in the E24 series is 510 Ohms.
I did and they are 100 and 51 ohms, respectively.
 

DrG

Active Member
If I remove the Vcc lead. That is, I attach GND to GND and IO to, say GPIO pin 3 on an UNO - it buzzes when the port is set high and stops with the port is set low. And it works as it had, when re-attaching Vcc to 5V (IOW nothing is trashed).

This is an active buzzer, which to me means that there is circuitry inside the buzzer to twiddle the piezo at the resonant frequency. - Remember, I removed it from the board and hooked it up directly to 5V and GND and it buzzes.

What if the board is meant to use a passive piezo? Could that be possible and be responsible for the design vis a vis the trans and two resistors?

Here is an $bay advert for them. Here is an Ama$on advert for the identical *looking* device. The description in the latter clearly indicates that it is a passive device requiring the GPIO to produce a frequency in order to hear anything.
 

DrG

Active Member
Assuming it's not an actual 'buzzer', but just a 'speaker', then having it in the emitter allows you to operate it in an analogue fashion rather than a digital one.

If it's just a buzzer, then it's a crap design :D
See my post 11 - could it be designed for a passive piezo element but produced with an active one?
 

gophert

Well-Known Member
Most Helpful Member
See my post 11 - could it be designed for a passive piezo element but produced with an active one?
I believe it is designed (or modified) to be useful to the mass-market diy community (I.e. Arduino), so I doubt it is intended for an analog input. This is just a poorly designed buzzer.
 

Latest threads

EE World Online Articles

Loading

 
Top