As an Amazon Associate we earn from qualifying purchases.
A piezo buzzer is one of the cheapest and simplest ways to add sound to an electronics project. It is small, light, needs very little current and has no moving coil or magnet. This article looks inside a piezo buzzer, explains how it makes sound, and shows a driver circuit, a short Arduino program and some voltage waveforms measured across the piezo crystal.
What is inside a piezo buzzer?
Most piezo buzzers are built around a thin piezoelectric ceramic disc bonded to a metal plate. The whole assembly sits in a plastic housing that has a small sound hole. Two wires or pins connect to the ceramic layer and the metal plate.
A piezoelectric material changes shape slightly when a voltage is applied across it. If the voltage is switched on and off, or reversed, many times per second, the disc flexes back and forth. The metal plate moves the air around it, and you hear that movement as a tone.
Active and passive piezo buzzers
There are two common types, and mixing them up is a frequent source of confusion:
- Active buzzer: has a built-in oscillator. You apply a DC voltage and it produces a fixed tone. It usually has a marked polarity.
- Passive buzzer: is just the piezo element. It makes no sound from plain DC, apart from a faint click when you switch it. You must drive it with a changing signal, such as a square wave, and the signal frequency sets the pitch.
The circuit and code below use the second approach: the piezo crystal is driven by a signal we generate ourselves.
How a piezo buzzer is driven
Electrically, a piezo element behaves mostly like a small capacitor. It draws current only while the voltage across it is changing, which is why it uses so little power. It also means a simple square wave from a microcontroller pin is enough to make it sound.
Two things affect how loud it is:
- Drive voltage: a higher voltage across the element bends the disc further and gives a louder sound. This is why some circuits add an inductor or a step-up stage to get far more than the 5 V of a microcontroller pin.
- Frequency: a disc mounted in its housing has a resonant frequency, and it is loudest near that point. Many small buzzers are designed to resonate in the low kilohertz range, so check the datasheet for your part.
Circuit
The diagram above shows a piezo electric crystal based buzzer circuit. A microcontroller output switches the circuit on and off, and the voltage that appears across the crystal is what makes it vibrate. The waveforms later in this article were measured across the crystal in this kind of setup.
If you build it, keep the wiring short and use a small series resistor or a suitable driver stage as shown in the diagram, so the microcontroller pin is not stressed by the capacitive load.
Program (Arduino, for 20 kHz)
The sketch below toggles pin 13 with a short high time and a short low time to produce a square wave. The piezo circuit is connected to that pin.
void setup() {
pinMode(13,OUTPUT);
}
void loop() {
digitalWrite(13,HIGH);
delayMicroseconds(10);
digitalWrite(13,LOW);
delayMicroseconds(12);
}
The two delays add up to 22 microseconds. Each digitalWrite call and the loop itself also take a little time, so the real output frequency is not exactly what the delays alone suggest. If you need a precise frequency, measure the pin with an oscilloscope or frequency counter and adjust the delay values until it matches.
For ordinary audible tones, Arduino’s built-in tone() function is easier. It generates a square wave at the frequency you ask for, without you having to calculate delays. The manual delay method is useful when you want direct control over high and low times, as in this experiment.
Waveforms
(Note : attenuation probe *10 used)
The captures below show the voltage across the piezo crystal for different supply voltages, output capacitor values (Cout) and frequencies. Because a 10x probe was used, the scope scale needs to be read with that factor in mind.
40 V, Cout = 0.1 uF, 4.7 kHz
voltage wave form across piezo electric crystal (40v ,Cout =0.1uF , f=4.7KHz)
50 V, Cout = 0.01 uF, 4.7 kHz
voltage wave form across piezo electric crystal (50v ,Cout =0.01uF , f=4.7KHz)
52 V, Cout = 220 pF, 4.7 kHz
voltage wave form across piezo electric crystal (52v ,Cout=220pF, f=4.7KHz)
28 V, Cout = 0.01 uF, 20 kHz
voltage wave form across piezo electric crystal (28v ,Cout =0.01uF , f=20KHz)
What the waveforms show
- At 4.7 kHz, the three captures reached 40 V, 50 V and 52 V as Cout was reduced from 0.1 uF to 0.01 uF to 220 pF. In this setup, a smaller output capacitor went together with a higher voltage across the crystal.
- At 20 kHz, with Cout of 0.01 uF, the voltage was 28 V, lower than the 50 V seen at 4.7 kHz with the same capacitor.
- Since loudness depends on the voltage across the crystal, the 4.7 kHz tests would be expected to sound louder than the 20 kHz test.
These figures come from one specific circuit and component set, so treat them as an example of the trend rather than values you will get on every build.
Where piezo buzzers are used
- Alarm and alert beeps in appliances and clocks
- Key press feedback on keypads and control panels
- Status and error tones in Arduino and other microcontroller projects
- Simple melodies and warning signals in hobby electronics
- Ultrasonic experiments, when the frequency is raised beyond the range most people can hear
Tips for using a piezo buzzer in a project
- Check whether your part is active or passive before wiring it.
- For a passive buzzer, use a square wave and try frequencies around the datasheet’s rated value.
- Do not exceed the rated voltage on the datasheet, since the ceramic disc can crack or be damaged.
- Leave the sound hole unblocked and mount the buzzer so the housing is not damped, otherwise it will sound quieter.
- Use a scope, if you have one, to confirm the real frequency and amplitude.
FAQ
How does a piezo buzzer make sound?
A voltage across the piezoelectric ceramic disc makes it change shape. When the voltage alternates quickly, the disc and its metal plate vibrate and move air, which we hear as a tone.
What is the difference between an active and a passive piezo buzzer?
An active buzzer contains its own oscillator and sounds when given DC power. A passive buzzer has no oscillator, so you must supply a square wave, and its pitch follows the frequency you provide.
Can I drive a piezo buzzer directly from an Arduino pin?
Usually yes, for small buzzers, because a piezo element draws very little current. Check the datasheet of your buzzer, and use a driver stage if you want more volume or the part needs a higher voltage.
Why can’t I hear the buzzer at 20 kHz?
20 kHz is at or above the upper limit of hearing for most adults, so the buzzer may seem silent even though it is vibrating. Lower the frequency into the low kilohertz range to hear it clearly.