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.
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.
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?
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?