Introduction: How to Make an Arduino Driven Piezo LOUD
- astable multivibrator as suggested by some piezo MFG..
- Arduino charge pump to boost the voltage (cool idea though)
- Arduino voltage booster (might be totally useful to another project though!)
I spent more hours than I will admit. Go to the dollar store and purchase their Intruder Alert noise maker and your'll find... an Auto Transformer and a 'black blob' of circuitry. The black blob is a pulsing square wave that the Arduino can produce.
The tranformer works well. If anyone can explain the phyisics behind its operation, pleas chime in! thanks.
The auto-transformer has three leads and you can measure the resistance across the leads to determine which is which. Here is the transformer that I measured: Pin1-2 154ohm and Pin 2-3 8ohm Pins 1-3 is ~161ohm. Also ozitronics posted some data (see picture) on his 'autotransformer' with similar resistance and 91mH/2.1mH inductance. If anyone can find similar transformers on Mouser I'd be interested in seeing it. thanks!
Credits: I stole the pictures/knowledge/ and content from the following places:
- How to harvest a piezo.(just a picture)
- this fellow has a couple circuits using 555 timers to produce a square wave using an auto transformer. PDF version
- Jack Lopez provided this nice schematic of the dollar store with 'black blob' circuit
xxx
Step 1: How to Drive a Piezo With an Arduino
Look up the piezo buzzer's resonant frequency. This one has a peak frequency of 2600 HZ shown on the cut sheet. It actually has two peak frequencies but I just chose one. The cut sheet selects the point in the middle of the two frequencies.
Next calculate the square wave you need to make on the Arduino. 1 second / 2600 = 385us (micro seconds).
The square wave is positive for half the time and neutral for half the time or 385/2 = 192us
You may use other frequencies but this is one of the loudest frequencies based on the mfg literature.
Arduino Code:
int piezoPin = 5;
void setup() {
pinMode(piezoPin, OUTPUT);
}
void loop() {
analogWrite(piezoPin, 255); //positive square wave
delayMicroseconds(192); //192uS
analogWrite(piezoPin, 0); //neutral square wave
delayMicroseconds(192); //192uS
}
18 Comments
1 year ago
https://www.allaboutcircuits.com/industry-articles...
https://www.murata.com/~/media/webrenewal/support/library/catalog/products/sound/p15e.ashx
6 years ago
Great information here with all parts listed. After hours of searching. I find no one references the mysterious autotransformer part number. Why is this?
Reply 1 year ago
It is common for Electrical Engineers to design a custom transformer for an application, since they are in general so unique. So there may not be a part number, and even if there is, unless you know the manufacturer, it will mean nothing.
3 years ago
Hi, thanks!
I noticed that the autotransformer has 3 different sizes pins. In my case, what worked best: the longest one is shared between the pwm pin and the piezo, the shortest one goes to GND and the middle one goes to the other pin of the piezo.
Sharing a sketch with a couple helper functions:
// Buzzer settings
#define PIEZO_PIN 12 // Piezo speaker/buzzer pin
#define FREQUENCY 2000 // Sound frequency (hertz)
#define SHORT_CHIRP 50 // Length of the short chirp (millisecon ds)
#define LONG_CHIRP 250 // Length of the long chirp (milliseconds)
void setup() {
}
void loop() {
longChirp();
delay(500);
}
void shortChirp(void) {
chirp(SHORT_CHIRP);
}
void longChirp(void) {
chirp(LONG_CHIRP);
}
void chirp(int duration) {
pwmWave(PIEZO_PIN, FREQUENCY, duration);
}
void pwmWave(int pin, int frequency, int duration) {
unsigned long t = millis();
bool flag = true;
int us = round(1000000 / (2 * frequency));
while (millis() - t < duration) {
analogWrite(pin, flag ? 255 : 0);
flag = !flag;
delayMicroseconds(us);
}
analogWrite(pin, 0);
}
6 years ago
Can also use an inductor in parallel with piezo with ground & a transistor to drive it. You can find coils that will work in old phones, power supplies, AV baluns, etc. You just need inductance to optimize current across capacitor over time.
6 years ago
The reason you need the transformer is a matter of impedance. A
piezoelectric element is rather high impedance, and very capacitive. In
fact one generally treats them as a capacitor. So, a capacitor passes
AC, but rejects DC. This fact, means that only the transitions in your
square wave actually carry any power, so you're losing much of the power
due to DC blocking. Further, piezos tend to dampen themselves
mechanically due to a sharp resonance / antiresonance.
So, here,
the trick is that you're decoupling the capacitor (piezo) up off of
ground and letting it couple at resonance with the inductive transformer
winding. Think of a the way that a spring allows something to move more
freely, even if it is tied to something quite heavy.
If you use
an audio transformer say 8ohm to 10kohm or more, you can actually get
some pretty impressive frequency ranges, play music through it, even
vibrate an object (thin wood, metal plate)...
7 years ago
You did a great job of giving lots of links to relevant and helpful places. Thanks! A great instructable
7 years ago
I think what you did is called a "balun" - it gets ground-biased 0-5 volts on input (when pins are switching between equal voltage and 5 volts difference) and produces differential 5 volts peak to peak AC voltage on output (when pins always differ by 5 volts, but are constantly swapping polarity). But your device is also a transformer, so the output voltage is higher (or lower), depending on the turns ratio.
I'm trying to drive a buzzer myself right now with a similar generator (0-5 volts), but don't have any auto transformer at hand, so I would try to use a capacitor to remove DC offset and hope it works.
8 years ago on Introduction
Good work. I was looking for a solution to amplify sound of buzzer that I extracted from burglar alarm and found a way thanks to you !
8 years ago on Step 1
How do I make it turn off?
9 years ago on Introduction
Hello Thomas!
interesting project! I am still trying to understand how the autotransformer works.
Is that similar to transistor? can I replace it using transistor ?
Thanks!
- Dipta
Reply 9 years ago on Introduction
I think it is simply a super small inexpensive transformer. So it amplifies the piezo based on the turns on the coils. The dollar store 3-pin transformer that worked best had one small coil (8ohms worth of windings) and a larger coil with 154ohms of windings. The oscilating signal is fed into the small windings and the larger windings are attached across the Piezo.
Reply 9 years ago on Introduction
Oh ok thanks! I would like to make a similar circuit but smaller.
Do you have any ideas to replace that autotransformer with anything?
Op-Amp or NPN transistor maybe?
Reply 9 years ago on Introduction
Here's an answer.
http://www.ti.com/product/tpa2100p1
Reply 9 years ago on Introduction
Hello Murray,
Thanks for your reference! I have made one circuit using this : http://www.linear.com/product/LT3469
this is also awesome, I have tried it
9 years ago on Introduction
I know I am cheating a little, but I just can't figure out how to build an autotransformer and I need something simple for my wearable project.
So I bought buzzers instead:
http://www.mallory-sonalert.com/Articles/TechAppGu...
You just need to feed it a high output directly from the arduino and it gives a loud beep until you turn it off. And I got two kinds to test:
This one is smaller/cheaper (loud beep, but not scary loud)
http://www.digikey.com/product-detail/en/PB-12N23P...
And this one: (More expensive, even louder than the one above, but bigger)
http://www.digikey.com/product-detail/en/MSR205NR/...
9 years ago on Introduction
Hey, Thomas
I found the physics behind this autotransformer if you'd like
http://www.skm-eleksys.com/2011/07/autotransformer.html
Reply 9 years ago on Introduction
Cool. I only skimmed it but I'll update the instructable when I get a minute. Thanks for taking the time to send it to me. - Thomas