I've designed a battery powered, 24 hours ATMEGA328P MCU based LCD start/stop timer that during counting, ticks every second with a short but STRONG "beep" sound that is being generated by the Tone library (1KHz 50mS 5V squarewave).
It have a software trigger that stops the count when a pin (say pin 14) goes LOW (TTL, 0V).
This device must be produced in a small series, so I've keeped in mind the KISS concept, making it easy to assemble, cheap and using the lowest number of component possible.
The main feature that I've keep in mind in this device is that it must have low current consumption, because is battery operated and must work for 24 hours, so both for the KISS and for the current consumption, I can't use an 1W audio amplifier circuit driven by the square wave only to make sound a traditional loudspeaker!
So I've used a traditional piezo buzzer.
Now, all the firmware is done and functional, and also the hardware works good. Only the sound is a little problematic: it is too quiet.
I need to add some "power" to the "ticking" sound. I guess that any 5V squarewave drived piezo is too quiet. I need something that could reach at least 92dB at 0,5M.
So I tried to use a small mosfet to drive a high volume 12V piezo (Kingstate KPEG-276 A) with two 10V zener in push-pull, and apparently it seemed to work fine.
Unfortunately, few hours later this mod, I discovered that this method cannot manage at all the voltage glitches coming out the piezo, and this have an impact on the entire circuit and affect the execution of the firmware AND MOST OF ALL, THESE GLITCHES SOMEHOW TRIGGERS SPORADICALLY AND RANDOMLY THE PIN 14 (the "stop" pin)!
I fear that this is caused by the glitches that randomly affect the linear regulator that generates the 5V used also to read the state of the "stop" pin, and this is confirmed by a DSO trace that I've captured during a long running in "one shot" mode.
Of course this is strange to me, because if it's a bad engineered circuitry issue, it should happen always, and not randomly. But I must accept that with a cheap 5V buzzer I've got no problems at all.
I must find a solution.
What do you suggest to do in hardware to drive the piezo and produce a loud sound without affecting the circuitry and the MCU behaviour? Do you agree using a transistor instead a mosfet? Or what else?
Can you suggest a schematic of your solution?