| Author |
Message |
ericmar
Joined: 14 Apr 2004 Posts: 279 Location: Singapore
|
26 Sep 2004 7:50 Controlling a +12V buzzer... |
|
|
|
Hi guys,
I plan to use a transistor as a switch to control the a +12V buzzer by my microcontroller (PIC16F877). I tried using a 2N3904 but the volume is too soft. So I tried another transistor, BC639, but it's not working correctly. It seems that when I used the BC639, the transistor is ON all the time so my microcontroller cant control the buzzer at all.
Basically, the way I connect the transistor to the buzzer and power is as the following. I connect +12V to the positive if the buzzer then connect the negative of the buzzer to the collector of transistor. I used a 220Kohm resistor in between of the microcontroller and the base of the transitor. Lastly, I connect the emitter of the transistor to ground!
I have a look on both datasheets, it seems that both can be used as an amplifier and switch. But the BC639's datasheet doesnt tell anything about the ON and OFF characteristics!?
Thanks for any help!
Regards,
Eric
|
|
| Back to top |
|
 |
glenjoy
Joined: 01 Jan 2004 Posts: 1021 Helped: 47 Location: Philippines
|
26 Sep 2004 8:50 Controlling a +12V buzzer... |
|
|
|
Hi, try to know the current on your Buzzer at ON in a direct 12 V Supply. Then this current will be the value of your Collector Current, your Collector Current is equal to your Base Current and Nominal transistor Beta.
Base Current is Equal to (Vbb - Vbe)/Rb.
Ib(Beta) = Ic.
At least there alone you can check if your current will be enough to drive your buzzer.
|
|
| Back to top |
|
 |
madjid
Joined: 29 Aug 2004 Posts: 36
|
26 Sep 2004 9:02 Re: Controlling a +12V buzzer... |
|
|
|
Hi,
You must provide this condition : Base_Current*Beta > Collector_curret.
|
|
| Back to top |
|
 |
Elavionic
Joined: 06 Apr 2002 Posts: 91 Helped: 1 Location: Portugal
|
26 Sep 2004 11:25 Re: Controlling a +12V buzzer... |
|
|
|
| The resistor you're using is to big. You want that the transistor works like a switch so it must saturate. don't botter finding the correct base current just put a resistor between 1k and 10k and it will work. At saturation the equation Ic=hfe*Ib isn't valide.
|
|
| Back to top |
|
 |
glenjoy
Joined: 01 Jan 2004 Posts: 1021 Helped: 47 Location: Philippines
|
26 Sep 2004 15:07 Re: Controlling a +12V buzzer... |
|
|
|
| Elavionic wrote: |
| The resistor you're using is to big. You want that the transistor works like a switch so it must saturate. don't botter finding the correct base current just put a resistor between 1k and 10k and it will work. At saturation the equation Ic=hfe*Ib isn't valide. |
A saturated transistor is not enough, if your Collector Saturation Current is not greater than ot equal to the speaker's nominal operating current, it will be useless.
We are not talking about an ideal transistor here, we are talking about a real application so the computation is needed.
May I ask you, can a 2N3904 give a 1A current at saturation? I guess not, so it is better to always check datasheet and compute before saying anything.
|
|
| Back to top |
|
 |
Big Boy
Joined: 20 Jan 2004 Posts: 253 Helped: 10
|
26 Sep 2004 15:48 Re: Controlling a +12V buzzer... |
|
|
|
For the buzzer to give optimal 'buzz', you need to switch the current on it from one direction to the other direction periodically. A buzzeer work a bit like a capacitor. If you just tie one side to 5V, and pulsate the other side, the buzzer won't give a loud sound because it will stay 'charged'.
So, for it to work properly, you need to put, for example, at pins 1 and 2, 5V and 0V, and then, 0V and 5V, and then, 5V and 0V, and so on.
This can be done with a microcontroler easily, however, some things to be carefull. If you switch the 5V/0V for 0V/5V directly, it will be like reversing a capacitor almost instentanously at the 2 pins of your micro. This will put a big load at the micro, and create potentially over-negative or over-positive voltage at the micro (like a brief -5V or +10V). The micro pins are usually protected agains't damage by this, but the problem is that it can create erratic behavior in the microcontroler (usually crash your program, sending the micro in lala-land).
So, on a micro, a correct approach is to send 5V/5V, then 5V/0V, then 0V/0V and finally, 0V/5V (each transition being at one quarter of the period, the period being 1 divided by the frequency).
This is a bit hard to use transistors, as the transistors will conduct current in only one direction. You could use a quad of 4 transistors, 2 per buzzer pin, arranged in totem-pole (push-pull). Don't tie the transistors base togetter though, as a transition from a 0 to 1 (or 1 to 0) will make both transistor conduct simultaneoulsy for a short period of time at each transistion, resulting in very high current flowing through the transistors. Then, this will require 4 micro pins, but beware of never putting both transistor of a pair in driving state at the same time unless you wish to also create a smoke generator. Transistors do run on smoke, and once the smoke get out of the transistor, it will stop working Unless it's marijuana, the smoke won't give any 'buzz' to the buzzer 
|
|
| Back to top |
|
 |
metal
Joined: 21 Dec 2004 Posts: 366 Helped: 13
|
03 Jan 2005 2:46 Re: Controlling a +12V buzzer... |
|
|
|
Hi
The buzzer might need that the 12 volt be oscillating at some frequency.
Regards
|
|
| Back to top |
|
 |
Borber
Joined: 01 Jan 1970 Posts: 1485 Helped: 111
|
03 Jan 2005 3:43 Re: Controlling a +12V buzzer... |
|
|
|
| First to know is are you having a buzzer or a piezo speaker. Buzzer needs only DC voltage to produce sound. Piezo speaker need AC voltage. For the buzzer you need to find what DC current it needs at 12V (connect it directly to 12V and measure current to the ground). Switch transistor should withstand this current in saturation. Saturation voltage is usually about .1V and this will not cause the problem with buzzing. Only difference is does transistor go to saturation. For this purpouse you should select transistor with proper collector current rating and beta. Then select base resistor which should be about 3k to 6k (for base current 1 to 2mA and max. collector current about 100mA). If you need more collector current use Darlington transistor.
|
|
| Back to top |
|
 |
djalli
Joined: 10 Nov 2001 Posts: 887 Helped: 15 Location: 1600 Pennsylvania Avenue, Washington DC 20500
|
03 Jan 2005 5:52 Controlling a +12V buzzer... |
|
|
|
No even a piezo buzzer works with DC only will not oscillate but give a constant sound.
A magnetic buzzer needs AC and triggering it is done by most of times by circuits which have transistor in it. Am I correct here? What buzzer are we talking here?
|
|
| Back to top |
|
 |
Borber
Joined: 01 Jan 1970 Posts: 1485 Helped: 111
|
03 Jan 2005 6:07 Re: Controlling a +12V buzzer... |
|
|
|
| Buzzer is buzzer. It has build in oscillator and driver for piezo speaker. Piezo speaker is only single element which gives only "click" when connected to DC.
|
|
| Back to top |
|
 |
pico
Joined: 30 Sep 2001 Posts: 261 Helped: 6
|
03 Jan 2005 7:45 Controlling a +12V buzzer... |
|
|
|
ericmar;
Check your source code and output of the uC that it work correctly or not?
|
|
| Back to top |
|
 |