Connecting a Piezo Transducer

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

Hello ... I wanna make several sounds via a buzzer. But, which is the best way to connect it ? Directly between Output and Gnd or Vcc ? The same with a transistor ? Or in pushpull mode, adding some gates (which ? LS, HCT, or OP amplifiers used as comparators, in "opposite phase"). Thanks for any answer ...

This topic has a solution.
Last Edited: Sat. Jun 18, 2022 - 05:29 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Is it a buzzer or a sounder? Some have on-board electronics and are designed to make just one sound (a buzz), whilst some are effectively a piezo loudspeaker. It's important to choose the right type.

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

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


A picture of your buzzer may help. Assuming it is a passive type, the best connection is 9-12V push-pull. This buzzer is a capacitor, after all, energy goes to charge/discharge of plates which are not polarized.

 

Edit: It is a buzzer I am talking about:

 

Last Edited: Mon. Jun 13, 2022 - 10:40 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

lemiceterrieux wrote:
I wanna make several sounds
Maybe take a step back and ask yourself is piezo is the best way to do this. A more general "sound out" might be something like an LM386 into a 4..8Ω  speaker. One option then is ot drive such a thing with PWM through RC to do a kind of "poor man's" DAC.

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


eBay, 5 euros...

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

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

Sorry, I used the wrong word (I am from France), I meant a piezo PASSIVE TRANSDUCER, without electronics, the various sounds should be generated by software (in GC Basic)

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


£2...

 

 

laugh

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

For simple beeps or bleeps, a piezo element type bleeper is cheap (€1) and works OK. For the bare disk in #3  you MUST have a housing or some other resonant structure, otherwise it will be almost silent.

 

I've used these PCB mounted jobs  https://www.digikey.co.uk/en/products/detail/murata-electronics/PKM22EPPH2001-B0/1219322 .

Do you have two spare pins ? Drive the piezo with 2 signals in anti-phase fashion for a bit more volume.

 

NB: Don't leave a DC voltage across the terminals for long time duration, they don't like it.

 

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

I don't wanna make a burglar alarm, the volume of a musical greetings card is enough for me, so no loudspeaker ; the system should produce a single click if I flip the output pin, a sound of 220 Hz about one / two seconds as an error signal and a quick "C E G C" sequence as an OK.

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

lemiceterrieux wrote:
"C E G C"
Assuming you mean C4 E4 G4 C4 then it is:

 

261.63 Hz

329.63 Hz

392.00 Hz

261.63 Hz

 

so the next question is whether the piezo is "resonant" as it may be best at only playing certain frequencies.

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

This small piezo, as an example, can work from 3V to 15 V driver signal voltage.

It beeps at ~ 3,500 Hz.

It draws 15 mA of current.

 

I suspect at 200 - 400 Hz sounds you would do better with a small amplifier and speaker, as suggested above.

 

JC

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

What is the main processor of your setup? Arduino? ATmega? Or anything else?

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

lemiceterrieux wrote:
a sound of 220 Hz

For a frequency that low you'll need some mechanical expertise in mounting a bare disk. Or simply copy the way those tacky greetings cards do it. They somehow get the card itself to act as a resonator. They thereby play delightful tunes as a result.

 

NB: Those Murata things I linked to in #8 don't really come to life until about 1KHz and have a very peaky response.

 

Last Edited: Mon. Jun 13, 2022 - 03:13 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

N.Winterbottom wrote:
Or simply copy the way those tacky greetings cards do it.
One noticeable thing they do is play tunes several octaves higher than most people's ears can stand !

 

C7 .. C8 is 2093 Hz .. 4186 Hz so if a piezo is resonant around 3,500Hz then it probably pays to play stuff up in that range.

 

It may also help to use a "sound chamber". First try playing to just the bare piezo element. Then put an upside down plastic cup on top and do the same - you may find a remarkable improvement.

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

DocJC wrote:

It draws 15 mA of current.

 

Thanks, this was the main information I needed ...

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

lemiceterrieux wrote:

Thanks, this was the main information I needed ...

What ?

You told us you wanted to play tunes. Now the continuous tone buzzer is the solution. Are you trolling us ?

 

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

lemiceterrieux wrote:
a quick "C E G C" sequence as an OK

 

A passive piezzo buzzer/transducer is not suitable for a playing an octave or two. It is best working on a resonant frequency (2kHz or more) where the sound output is formidable, all other frequencies are inferior. The driver circuit is not-at-all simple, for the best performance 12V is recommended.

 

To resume, this sound source is the worst choice for your player.

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

I use a transistor and piezo and can vary the pwm to make various chirps and clicks.

 

You can also use a tone pizeo module (one that produces a tone when hooked to 5v or powered by an AVR pin).....you can very well just give it a 1-5 ms or so on time & it will make a very nice button "click" sound (it's on too short to make a "tone"). Or turn on longer for an actual "beep". It's plenty loud for a handheld device, like a remote control, or whenever you are right at the control panel. 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

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

N.Winterbottom wrote:

What ?

You told us you wanted to play tunes. Now the continuous tone buzzer is the solution. Are you trolling us ?

 

Sorry, I didn't see it was a continuous tone version ... I thought it was a passive version.

 

Finally, I wonder if an earphone or a very small loudspeaker, controlled by a simple transistor, would not be the best solution ? I don't need a "big" volume, sounds will be produced in an (almost) silent environment ... so a big loudspeaker would be like a caterpillar to crack peanuts.

Last Edited: Tue. Jun 14, 2022 - 06:22 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What about the gadget Brian showed in #5? That speaker can't be much over about 2cm in diameter judging by the size of the other components on the board.

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

This guy gets reasonable results from a large diameter moving coil loudspeaker.. I've used the 10mm diameter types and they're not nearly as good as this large one.

"Play Sounds With Arduino || Passive vs. Active Speakers" https://www.youtube.com/watch?v=AQIayZgeqq4

 

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

Small piezo for Attiny.

www.tokopedia.com/madagang .Buy and Donated cheap electronics and manuscripts.

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

They are Active, come also in 3.3V version (beware of not damaging it with 5V AVR).

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

grohote wrote:

They are Active, come also in 3.3V version (beware of not damaging it with 5V AVR).

It’s China made and Cheap,Didn’t knew that there’s different version even for screw standard.

www.tokopedia.com/madagang .Buy and Donated cheap electronics and manuscripts.

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Finally I wonder if it would not be easier (and offer more possibilities) to use an AdaFruit SoundFx (sample player) together with a REAL loudspeaker, it would allow more waveforms, and even to play sounds generated by a musical keyboard (polyphonic ! ), or spoken messages ...

Last Edited: Sat. Jun 18, 2022 - 05:28 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Jeckson wrote:
Didn’t knew that there’s different version

Yes, they are. Also, some products are the same size, shape, package, but inside the 'buzzer' is passive, which means- just a loudspeaker of few ohms value.

 

Such choice for any user will require additional driver, but the benefit is perhaps a tone range (around the resonant frequency).

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

lemiceterrieux wrote:
Finally I wonder if it would not be easier (and offer more possibilities) to use an AdaFruit SoundFx

WOW -- Talk about spec. creep ! You've gone from a simple piezo disk costing about €0.50 to a 2W/channel WAV/OGG player module with 2MB Flash costing €28. (without loudspeaker)

 

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

1) I have already such a board, from a former project.

2) It should be only an accessory for ... look at the attachments ! So the supplementary costs would have been negligible in comparison.

Attachment(s): 

Last Edited: Sat. Jun 18, 2022 - 10:37 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I imagined you were making a digital door-lock or something similar. It can sometimes be a real surprise when we see the actual project instead of the project we imagined.

 

Model railway isn't my thing but it did look a nice layout and for railway sound effects the Adafruit module or similar is exactly the right choice.

 

I do wish you'd mentioned Model Railway Sound Effects in post #1 though.

 

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

Is this something that needs to be really small so it's carried on the actual trains making whistle noises etc or is this something fixed doing something like making station/platform announcements and size is not so important?

 

If the former I'd get a 6/8 pin Tiny, run PWM output into a small RC network to filter and straight to a small speaker. 

 

In fact I know it's a bit naughty (do the Ohm's law sums) but you can literally just hang a speaker off a PWM pin and get something usable - I've done this while testing PWM audio.

 

Also see some of Chan's projects like

 

http://elm-chan.org/works/sd20p/report.html

http://elm-chan.org/works/sd8p/report.html

http://elm-chan.org/works/mxb/report.html

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

No, there will be no railroad related "sound effects" or train announcements (it would be possible) otherwise I would have, to be consistent, to add music to my fun fair ("carnival") and to the band inside of the gazebo in the park (alternating, using the random and stereo function of a second SoundFX). I am afraid that when visitors hear "Start and Stripes" for the third time they would begin to be seriously bored ! No, the system will be used to say only "system messages" from the console, for example when a train starts (the four notes) or if my selection could cause an accident because another freight train already stops on a deviant track, or if I switch from manual to automatic mode : this gimmick is already implemented using randon numbers generated by reading timer1 when a train has finished its run (there is only one train at once, otherwise my system would have needed two 8PDT relays ... sad ), so I can walk around and show details while trains go on running. And I confess that I didn't yet totally give up the idea of a speech recognition. Wait and see ... When the layout will be finished I will publish a video on YouTube (If I succeed to do this thing ... )

Last Edited: Sat. Jun 18, 2022 - 02:28 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I didn't yet totally give up the idea of a speech recognition. 

Ok, now there is speech recognition, an android to control everything, and possibly time travel... 

Don't forget the buzzer!

 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

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

avrcandies wrote:

and possibly time travel...

Already done, the layout shows Massachusetts in 1965 !

smiley

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

lemiceterrieux wrote:

avrcandies wrote:

 

and possibly time travel...

 

Already done, the layout shows Massachusetts in 1965 !

 

Did someone mention time travel? 

 

I rode my bicycle through Massachusetts in 1965 on my way to the World's Fair in New York from Minnesota.  I must have missed it.  I try to keep current with the time business.

 

Why do I feel like I am flowing into the present from the future lately, instead of the usual causal way from the past?