Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Thread

ATTINY13 driving a Piezo transducer directly? The port just locks high .

ATTINY13 driving a Piezo transducer directly? The port just locks high .

2009-05-07 by doug_marysnowden

The PIEZO element is just a standard one that is supposed to be resonant around 24khz.  I disconnected the piezo and the port started toggling, as it should.  Should I put a pair of HEX invertor drivers in parallel for each output port to drive the piezo element?
I am trying to build a small dog whistler, and am using a 9vdc battery, a 78L05 regulator for 5v to the Micro. 

Doug

Re: [AVR-Chat] ATTINY13 driving a Piezo transducer directly? The port just locks high .

2009-05-07 by Dennis Clark

> The PIEZO element is just a standard one that is supposed to be resonant
> around 24khz.  I disconnected the piezo and the port started toggling, as
> it should.  Should I put a pair of HEX invertor drivers in parallel for
> each output port to drive the piezo element?
> I am trying to build a small dog whistler, and am using a 9vdc battery, a
> 78L05 regulator for 5v to the Micro.

  You'll need to do a little engineering around this I think.  The AVR can
drive 20ma as I to remember, if at your micro Vdd voltage the current
draw of your piezo is more than that you'll need a driver.  Something as
simple as a logic level FET will do the job nicely.  Piezos don't pull a
lot of current, but yours appears to pull more than your ATTINY13 can
supply.  I've driven piezos directly before, so either there is
something interesting in your design or your piezo is much more power
hungry than those I've experienced in the past.

DLC

> Doug
>
>
>


-- 
Dennis Clark
TTT Enterprises

Re: [AVR-Chat] ATTINY13 driving a Piezo transducer directly? The port just locks high .

2009-05-07 by David VanHorn

>  You'll need to do a little engineering around this I think.  The AVR can
> drive 20ma as I to remember, if at your micro Vdd voltage the current
> draw of your piezo is more than that you'll need a driver.  Something as
> simple as a logic level FET will do the job nicely.  Piezos don't pull a
> lot of current, but yours appears to pull more than your ATTINY13 can
> supply.  I've driven piezos directly before, so either there is
> something interesting in your design or your piezo is much more power
> hungry than those I've experienced in the past.
>

The piezo is a capacitor, so any piezo will attempt to draw more
current than the pin can provide, during the switching.
However, the limiting factor here is the Rdson of the output fets, so
that in itself, is harmless.

If the piezo is driven by one pin, and the other side of the peizo is
grounded or tied to VCC, then I don't see how you can get into
trouble.
Re-check how you're setting the pin state in DDR, and avoid any
read-modify-write operations, since the capacitance of the piezo can
interfere with that.


A more interesting effect is what happens at the moment of switching,
if the piezo is driven by two I/O pins.
At the end of a cycle, the piezo is a charged capacitor.
If the switching sequence takes the high side to ground, and then
takes the low side high, all is well.
If the switching sequence takes the low side high first, then you've
just applied VCC*2 with very little current limiting, to an I/O pin.
This is how a max232 generates +12V and -12V for serial.
That's not a happy thing for an AVR I/O pin though.




-- 
There is no computer problem which cannot be solved by proper
application of a sufficiently large hammer.

Re: ATTINY13 driving a Piezo transducer directly? The port just locks high .

2009-05-10 by kernels_nz

Hi Doug,

I'm fairly sure a few of the other guys are correct. It's likely that you have the port pin setup as an input, which means you are actually toggling the pullup resistor on that pin. Because there is no fet connecting it to ground, you are basically just charging up the capacitor (piezo) through the pullup resistor. 

Hein B
Auckland, New Zealand.


--- In AVR-Chat@yahoogroups.com, "doug_marysnowden" <doug_marysnowden@...> wrote:
Show quoted textHide quoted text
>
> The PIEZO element is just a standard one that is supposed to be resonant around 24khz.  I disconnected the piezo and the port started toggling, as it should.  Should I put a pair of HEX invertor drivers in parallel for each output port to drive the piezo element?
> I am trying to build a small dog whistler, and am using a 9vdc battery, a 78L05 regulator for 5v to the Micro. 
> 
> Doug
>

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.