Piezo buzzer
A piezo buzzer makes sound with a thin piezoelectric disc that bends when a voltage is applied. Switching the voltage on and off thousands of times a second makes the disc vibrate, and you hear a tone at that frequency: a 1 ms on-and-off cycle gives 1 ÷ 0.001 s = 1 kHz.
f = 1 ÷ T
where T is the time for one on-and-off cycle, so a 1 ms cycle gives 1 kHz.
An active buzzer has its own oscillator and beeps on steady DC; a passive one needs the signal supplied, which lets it play different notes.
What is a piezo buzzer?
A piezo buzzer is a small sounder built around a piezoelectric disc, which flexes when a voltage is applied and pushes the air to make a beep or a tone.
It is the beeper in alarms, timers, appliances and toys, and it draws only a few milliamps. In Figure 1, the lab’s Push-to-Sound Buzzer sounds an active buzzer from a 3 V battery while its pushbutton closes the loop.
Pressed: the button closes the loop, so 3 V reaches the active buzzer’s own oscillator, and it sounds at about 2.2 kHz, drawing about 5 mA.
How does a piezo buzzer work?
A piezo buzzer works through the piezoelectric effect: some ceramics change shape slightly when a voltage is put across them, so the disc bends one way, then back as the voltage is removed.
Switch the voltage on and off thousands of times a second and the disc vibrates, with a small cavity behind it making the sound louder. It is loudest at its resonant frequency, often 2 to 4 kHz, which is why buzzers sound shrill. The effect also works backwards: bend the disc and it makes a voltage.
What is the difference between an active and a passive buzzer?
An active buzzer has a built-in oscillator, so steady DC makes it beep at its own fixed tone; a passive buzzer has none, so it needs a changing signal to sound.
Active buzzers are simplest: one pin on and it beeps. Passive buzzers take a little code but play any note. Figure 2 feeds each one steady DC and a square wave.
Passive buzzer, 1 kHz square wave: the disc flexes with each cycle, so it plays a 1 kHz tone, and a different frequency gives a different note.
Does a piezo buzzer have polarity?
An active buzzer does: its oscillator needs + on the pin marked + or on the longer lead, and it stays silent the wrong way round.
A bare piezo disc or passive buzzer works either way round, since it simply bends with whichever voltage it gets, though many are still marked. Magnetic buzzers, which look similar but use a coil, are polarized too.
What is the difference between piezoelectric and magnetic buzzers?
A piezoelectric buzzer flexes a ceramic disc with voltage and draws only a few milliamps, while a magnetic buzzer pulls a thin steel disc with a coil and magnet, draws tens of milliamps and runs from lower voltages.
A magnetic buzzer’s coil, often 16 to 42 Ω, is a small inductor, so drive it through a transistor with a diode across it, as for a relay. A piezo can take a microcontroller pin directly.
How do you play a tone on a buzzer?
To play a tone on a buzzer, feed a passive one a square wave at the note’s frequency: the pin goes HIGH for half a cycle and LOW for the other half, over and over.
On an Arduino, tone(pin, frequency) does this for you, and a list of frequencies plays a tune. Figure 3 shows the wave for each note from C5 to C6; higher notes have shorter cycles.
A5, 880 Hz: each cycle lasts 1 ÷ 880 Hz = 1.14 ms, so the pin stays HIGH for 568 µs and LOW for 568 µs, over and over.
How do you connect a piezo buzzer to an Arduino?
To connect a piezo buzzer to an Arduino, wire its + pin to a digital pin and its other pin to ground, as long as it draws less than the pin’s 20 mA, as most piezo buzzers do.
A small series resistor of around 100 Ω protects the pin from a passive buzzer’s current spikes. Magnetic buzzers and loud 12 V sirens draw more, so switch them with a transistor, with a diode across a coil.
How do you work out a buzzer’s tone and loudness?
To work out a buzzer’s tone, add one HIGH and one LOW for the cycle and invert it; for its loudness farther away, take 20 log₁₀ of the distance ratio off its datasheet rating.
Example 1: a tone from a delay
A program drives a passive buzzer by toggling a pin every 250 µs. What note frequency does it play?
- Given
- a pin set HIGH, held 250 µs, set LOW, held 250 µs, and repeated
- Find
- the tone’s frequency
- Solution
- One cycle is HIGH and LOW: T = 2 × 250 µs = 500 µsf = 1 ÷ T = 1 ÷ 500 µs = 2 kHz
- Answer
- 2 kHz
Example 2: how loud at a distance
A buzzer’s datasheet gives 85 dB at 10 cm. How loud is it 1 m away?
- Given
- a buzzer rated 85 dB at 10 cm, heard from 1 m in open air
- Find
- how loud it is there
- Solution
- The level falls by 20 log₁₀(d ÷ 10 cm) = 20 log₁₀(10) = 20 dB85 dB − 20 dB = 65 dB
- Answer
- About 65 dB
Summary
Key equations
- f = 1 ÷ T a tone’s frequency
- T = 2 × thalf HIGH then LOW
- L2 = L1 − 20 log₁₀(d2 ÷ d1) loudness at a distance
Key terms
- Piezoelectric
- Bends with voltage, and back.
- Active
- Has its own oscillator.
- Passive
- Needs the signal supplied.
- Resonance
- The frequency it is loudest at.
Practice problems
-
What makes the sound in a piezo buzzer?
The piezoelectric disc flexes each time the voltage changes, pushing the air.
-
What does a passive buzzer do on steady DC?
It has no oscillator, so the disc bends once and stays bent.
-
A pin toggles every 500 µs. What frequency does the buzzer play?
One cycle is HIGH and LOW: 2 × 500 µs = 1 ms, and 1 ÷ 1 ms = 1 kHz.
-
A buzzer gives 85 dB at 10 cm. About how loud is it at 1 m in open air?
20 log₁₀(1 m ÷ 10 cm) = 20 dB less: 85 dB − 20 dB = 65 dB.
-
Which kind of buzzer can play different notes?
A passive buzzer follows the frequency it is fed; an active one plays its own fixed tone.
FAQ
How does a piezoelectric buzzer work?
A voltage across its ceramic disc makes it bend; switching the voltage thousands of times a second makes the disc vibrate and push air, loudest near its resonant frequency, often 2 to 4 kHz.
What is the difference between a buzzer and a speaker?
A buzzer is made for loud beeps near one frequency; a speaker’s cone moves with any signal, so it can play voice and music across the audio range.
Why is my piezo buzzer so quiet?
It may be off its resonant frequency, under-driven, or mounted without its cavity. Try a frequency nearer 2 to 4 kHz, a higher drive voltage, or an active buzzer.
How do I tell an active buzzer from a passive one?
An active one is usually sealed underneath and beeps on 3 to 5 V DC; a passive one often shows a green circuit board underneath and only clicks on DC.
Does a piezo buzzer need a resistor?
An active buzzer usually doesn’t. A passive one on a microcontroller pin is often given around 100 Ω in series to soften current spikes.
What is a piezoelectric sensor?
A piezo element used the other way round: tapping, pressing or shaking it makes a voltage, so it senses knocks and vibration. Put a 1 MΩ resistor across one so the voltage drains away between knocks.
What voltage does a piezo buzzer need?
Active buzzers are rated for a voltage, often 3 to 5 V or 12 V. Passive ones work from a few volts and get louder with a larger swing.
Can a buzzer play music?
A passive one can play simple tunes, one note at a time, from a list of frequencies and lengths. An active one only beeps at its own tone.