Piezo Differential Drive: Via Software or Hardware?

Status
Not open for further replies.

joshsstuff

New Member
My Arduino project is a level indicator that uses a Piezo transducer.
I've used the "tone" function to manipulate the sound to raise the pitch when the desired level is reached.
With the 'tone' function I can very precisely control the pitch and speed of the speaker.
However, the project runs from a Lipo battery, and even with 5 volts, the transducers i've tried don't get very loud.

I wish to limit my projects size and complexity as much as possible.
This is why I'd rather not use a boost converter simply for the piezo part of the circuit.

Differential drive:

I found a solution online where you could use 2 MCU pins (instead of 1 pin & ground) to effectively double the output!
This works!
As long as you turn on one pin and the other off simultaneously the effect is a doubling of the piezo voltage.
(I think that the 2nd pin in the (LOW) state is also able to source some current, however it does not work if I try to replace the ground with an MCU GPIO pin)
This is very simple to do, I used boolean logic in my demo sketch:
digitalWrite(Pin_1, ringState);
digitalWrite(Pin_2, !ringState);

The problem with software differential drive: the tone() function compatibility.

The Tone function makes the frequency voicings I require possible (and simplifies the sketch considerably from direct control)
The Tone function takes control of a MCU timer, and I'm pretty certain you cannot have 2 'tone' functions running at once
(i.e. a "tone()" and one "!Tone()" to drive the other pin)
I would have to litter my sketch with" digitalWrite(Pin_2, !ringState); calls to try to switch the differential pin in time, but I don't think that even this would work.
I'm open to code suggestions if you have an idea that might work.

Hardware:

What type of inverting logic would I need that would provide Vcc to the other side of the Piezo when the MCU driver pin was LOW?
I know that you can create simple NOT logic from a single NPN transistor:


I can't just replace the MCU pin for the push button and the Piezo for the LED, but is there a way to change this around to make it work?
Or, should I use a different inverting component?
 
See my replies in the thread below from about 13 years ago ... https://forums.parallax.com/discussion/62310/amplifying-piezo-speaker
Thank You, I fetched your post and explanation.



So we are using an NPN and PNP transistor to handle the inversion of the Piezo.
Is the 3mA while in operation only? (because my project will be on battery power)
Do you know what the quiescent current of this circuit would be?

I'm off to get some parts together to try it out
 
I found a solution online where you could use 2 MCU pins (instead of 1 pin & ground) to effectively double the output!
This works!

We know, it's a common technique called 'bridging' - I had a letter published years back in Practical Electronics for a modification to one of their published designs, where I used a second I/O pin to 'bridge' the output, greatly increasing the volume of the piezo.

However, it doesn't 'double' the output, it quadruples it - even better!!.

Your problem, obviously, is wanting to use the Tone instruction on the Arduino - I would suggest you copy and modify the Arduino Tone code (the source is freely available) to add bridging to it (perhaps calling it BTone?). It would then be just as easy to use from within the Arduino IDE
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…