View Full Version : BS2 Ouput Driving Piezo Speaker

Greg Norton
04-18-2007, 10:47 AM
I'm driving a piezo speaker (radio shack 273-073) using a BS2 output pin and the FREQOUT command. Everything works fine, but I was hoping to increase the volume of the speaker since this will be an alarm sound. I wired up an NPN transistor (NTE 184) as shown in the attached diagram to a 12v source. The stamp pin drives the base of the transistor. My thought was this would increase the volume significantly over the 5v output of the stamp, but the reverse is true and the sound is now much softer. What is wrong with this setup?

I suppose this is not strictly a BS2 problem, but if someone can straighten me out that would be much appreciated.


Mike Green
04-18-2007, 10:54 AM
1) Don't ever hook up the base of a junction transistor (as opposed to an MOSFET) to a Stamp pin without a current limiting resistor. The Stamp is very forgiving of high current drain, but you could burn out the Stamp pin and the transistor. 220 ohm or 470 ohm is enough to protect the Stamp and transistor.
2) Many piezo speakers designed for alert use have a resonant frequency where they are at peak loudness and they're quite soft at other frequencies.
The particular one you're using requires a signal from 1500Hz to 3000Hz. If you're using some other frequency range, it will be soft.
3) You might want to consider using a piezo speaker with its own built-in oscillator. The Stamp just has to supply +5V from a high pin.

Greg Norton
04-19-2007, 01:15 AM
Hi Mike,

Thanks for the warning, I guess I got lucky without the resistor since it's still working. I'll remember this. I'm also using the speaker for other sounds as well, so I need to be able to create multiple sounds as opposed to using one with a built in oscillator and a fixed tone.

However, I'm still puzzled about the volume reduction that happens. I'm using a frequency of 2500 Hz and having the stamp directly drive the speaker is still louder than the transistor circuit. Now that I just wrote that, I'm thinking the resistor might be a good idea in either case. Assuming I have the resistor in place, is this circuit the correct way to get to where I want to go (more volume)?



Beau Schwabe
04-19-2007, 09:48 AM
If you want to increase piezo volume, you might want to take a look at this thread...


...With your current circuit, you can get a little more volume out of it by placing a resistor of say 1k in parallel across the piezo element. What that will do is help to discharge the piezo, when the transistor is off."Why is your volume soft?" - Think of the piezo as a capacitor. Your circuit drives the piezo in an open-collector configuration which does not provide a path for it to discharge or relax (see link above). Instead, the piezo remains stressed and does not deflect to produce any volume. Placing a small value resistor in parallel with the piezo as suggested above, or using an inverter, allows the piezo to either discharge, or deflect in the opposite direction.

Beau Schwabe (mailto:bschwabe@parallax.com)

IC Layout Engineer
Parallax, Inc.

Post Edited (Beau Schwabe (Parallax)) : 4/19/2007 3:02:05 AM GMT

Phil Pilgrim (PhiPi)
04-19-2007, 10:20 AM

DigiKey sells the Micrel MIC4428, which should make an excellent piezo driver. It has one inverting and one non-inverting totempole output, each designed for driving capacitive loads (i.e. MOSFET gates). Vdd can range to 18V, so you could theoretically get as much as a 36V P-P drive. To use it, connect both inputs to the same Stamp pin, and the outputs to either side of the transducer.