Experience with AVRs Driving Piezo Buzzers?

Go To Last Post
17 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I was curious about experiences people had driving piezo buzzers directly from an AVR port pin or if a transistor interface is really needed.

I've got a project where the piezo is pretty important and we're moving out of prototype stage into small volume. Before I send out the boards, I was wondering if people had much experience with this and if direct drive was likely to cause failure later on.

The prototypes are working fine and have been since last summer but there was recently another post here where a Freaks member was thinking the piezo damaged his port pins.

I'll build-up another prototype this weekend and scope it out and see if I see any excursions too big (provided my scope can see them) but I wanted to also ask here since there are so many varied experiences to have insight.

So, transistor interface to a tiny piezo buzzer necessary? (CUI CEP-1160, BUZZER PIEZO 4KHZ 14MM EXT DRIVE)

Thanks for any input...

Please note - this post may not present all information available on a subject.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I think the piezos look like a cap... the impedance gets lower as the freq goes up... but they are over 1k to start out, so should be ok....

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The Butterfly uses a transistor and that design seems to be very cost concious, so I suspect it is needed.

Good Luck,
Smiley

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for the feedback!

I'll a) scope it just to see, and b) also check out the Butterfly schematic and see if I can figure out anything from that.

Transistors are cheap but it's also less to deal with and a circuit mod I don't have to do if I leave it out. But if necessary, then it beats the heck out of rework on deployed units!

Please note - this post may not present all information available on a subject.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Drive it with a 5v square wave from a sig gen thru a 1k resistor, and look at the piezo side of the resistor... run the freq up and down... this will show whre its loadest and lowest impedance (I think)

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You should not have any problem driving a piezo directly from a port pin,
especially considering that most avrs have pretty stout drive capability.
Also, if maximum possible volume is desired, drive both pins of the transducer
such that when one pin is driven hi, the other is driven lo. You can do this
with two port pins, or a port pin plus an inverter, effectively doubling the
voltage drive to the transducer. I've been doing this using CMOS gates for
many years with nary a problem. You shouldn't need to use a transistor
unless you were using an electromagnetic transducer, or perhaps using
the port pin to also drive something else and you wanted to isolate the
piezo's capacitance from the port line.

Tom Pappano
Tulsa, Oklahoma

Tom Pappano
Tulsa, Oklahoma

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Wow - both excellent suggestions!

The design just changed slightly and I will no longer be able to port the piezo to the back side of the box so I now need it louder - and have an extra NAND gate to use as an inverter to drive the side that had been going to ground. Thanks, Tom!

And Bob, that's a great idea too - and it might be interesting to see the piezo kickback as a function of frequency.

Like I said, the prototypes have been working like champs but if there is too much kick out of the piezo, it could be they start dying tomorrow so I'm still going to scope it.

I'll post my findings including scope traces...

Thanks!

Please note - this post may not present all information available on a subject.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

hehehe, Colin, I deleted my post, after re-reading the original post, he was referring to oscillation mode form the AVR. I was thinking about self oscillating piezo buzzers, in which case that trick would not work. In the case of raw piezo elements, where you must provide an oscillating signal, than the reversing ports trick is indeed a good one.

I do want to add to rfields, unless that nand gate has driver outputs, it is highly unlikely it will have more drive capability than the AVR itself.

[edit] ok I'm leaving this one for posterity. Colins as quick as I am on post/delete :)

Just for some history, I originally said that I didn't see how you would get double the voltage by swapping the polarity of the port pins. Basically you would always be driving the piezo between VCC and GND. (Note I was thinking of a self oscillating piezo here, thus why I deleted it once I realized they were talking about a raw piezo, where you must provide the excitation signal)

Colin, correctly, replied that it wasn't truly double the voltage, but with respect to the piezo from rest it would appear to be. (which he deleted right after seeing that I had deleted mine)

Writing code is like having sex.... make one little mistake, and you're supporting it for life.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

tpappano wrote:
You should not have any problem driving a piezo directly from a port pin,
especially considering that most avrs have pretty stout drive capability.

Tom,

I'm wondering why the Butterfly uses a transistor. Not challenging your post, just wondering. The Butterfly RS-232 voltage level converter is built from transistors, diodes, caps, and etc. which I think was to save some pennies versus using a dedicated IC. This leads me to believe that the design is about as cheap as it possibly could be. So I thought that if they could've gotten rid of the piezo driver transistor they would've. What am I missing. I'll need to know this for future design work

Thanks,
Joe

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

How I remember, one of the most bad ideeas wich I had about piezo was to drive it with a transistor. Piezo's capacitance had no way to discharge and the sound was really weak. With a resistor in parallel, maybe it should work better, I don't remember if I did it, its a long time. Well, I was unnatentive I must admit, but since then I drive pieos only with CMOS gates. And in AVRs with 2 PWM I drive them in bridge (normal/inverted) and I have no problem to do nice audio tricks with a high output and no nasty problems.
Now, Joe, are you sure that the Butterfly designer really knew what he is doing? In Romania we say: "1 mad man throw a rock into a lake and 10 wise men can't bring it out." However, I didn't saw the schematics of Butterfly, so who knows...

Paul/soare0

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
I'm wondering why the Butterfly uses a transistor...
Thanks,
Joe

I wonder too, I was surprised when you said a transistor was included!
Is there a link to look at the Butterfly schematic around here somewhere?

Tom Pappano
Tulsa, Oklahoma

Tom Pappano
Tulsa, Oklahoma

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There you go! Maybe they were allowing for an optional self-oscillating squeaker
or weren't quite sure what they were going to use when they did the layout.

Tom Pappano
Tulsa, Oklahoma

Tom Pappano
Tulsa, Oklahoma

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well I'll be d@mned. :oops: I looked at a lousy print of the schematic and the 'not mounted' was unreadable. But it's clear in the pdf file.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Do be careful if your circuit is constantly powered and need uA in sleep mode. Some piezo elements cannot withstand a constant DC across them, after a week or so with 3V permanently across them they can become leaky and take several mA.

This caught out my colleague whose instruments killed the battery in days when years were expected.

Nigel

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Murata has things to say about driving piezo's, covers all these issues.
Have a read, attached

Attachment(s): 

Regards,
Scott

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That's really interesting. Murata does say to avoid bias, but several of their
example drive circuits do always keep a voltage on the transducer!

FWIW, I have equipment in the field now with piezos driven with the logic
gate bridge configuration for over 15 years now, and they still make noise.
I have not had an occasion to measure the leakage across one, however.
I suppose to be most proper, one should include a blocking cap.

Tom Pappano
Tulsa, Oklahoma

Tom Pappano
Tulsa, Oklahoma

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Our units with leaking piezos did still bleep but rather quieter due to the micro pin having less output swing due to the extra current.

Nigel