Active vs Passive Buzzer: What Is a Buzzer and How to Use It
Active vs passive buzzer: how to tell them apart, how a buzzer works, wiring to Arduino, the tone() function, note frequencies and a melody example.
A buzzer is a tiny speaker that turns an electrical signal into sound. The beep of an alarm system, a microwave's alert and the tunes in toys usually come from a buzzer. In Arduino projects it's the cheapest way to give audible feedback, but to get the right sound you need to know which type of buzzer you have.

Active vs passive buzzer
| Feature | Active buzzer | Passive buzzer |
|---|---|---|
| Built-in oscillator | Yes | No |
| To make a sound | Just give it HIGH | Needs a square wave (frequency) |
| Sound | A single fixed tone | Any frequency: notes, melodies |
| Arduino command | digitalWrite() | tone() / noTone() |
| Used for | Alarms, warning beeps | Music, different alert tones |
How do you tell whether a buzzer is active or passive?
- Look at the bottom: a passive buzzer usually shows a green circuit board underneath; an active buzzer's bottom is sealed with black filler.
- Apply 5 V: an active buzzer beeps continuously, a passive one only gives a faint click when you connect it.
- Measure with a multimeter: a passive buzzer's coil shows a low, steady resistance of around 16 Ω; an active one gives an unclear or very high reading.
- Check the sticker: active buzzers often have a protective sticker on top that says "remove".
Connecting a buzzer to Arduino
Small buzzers draw about 20–30 mA, so they can connect directly to an Arduino pin. Connect the long leg (+) to a digital pin, for example pin 8, and the short leg to GND. If it's too loud, you can add a resistor of around 100 Ω. Larger, stronger buzzers need to be driven through a transistor.
Playing notes and melodies with tone()
With a passive buzzer, tone(pin, frequency, duration) generates a square wave at the requested frequency. Every note has a frequency; for example A4 is 440 Hz:
| Note | C4 | D4 | E4 | F4 | G4 | A4 | B4 | C5 |
|---|---|---|---|---|---|---|---|---|
| Frequency (Hz) | 262 | 294 | 330 | 349 | 392 | 440 | 494 | 523 |
1const int BUZZER_PIN = 8; // pasif buzzer / passive buzzer
2
3// Do Re Mi Fa Sol La Si Do
4int notes[] = {262, 294, 330, 349, 392, 440, 494, 523};
5
6void setup() {
7 for (int i = 0; i < 8; i++) {
8 tone(BUZZER_PIN, notes[i], 300); // 300 ms çal / play for 300 ms
9 delay(350); // notalar arası boşluk / gap between notes
10 }
11 noTone(BUZZER_PIN); // sesi kapat / stop the sound
12}
13
14void loop() {
15}Common mistakes
- Expecting a melody from an active buzzer: its built-in oscillator produces a fixed tone; tone() doesn't change the pitch.
- Using PWM on pins 3 and 11 together with tone(): on the Uno, tone() uses Timer2, so analogWrite on these pins misbehaves while it plays.
- Playing two buzzers at once: tone() works on only one pin at a time.
- Reversing the polarity: the long leg is positive; connected backwards, an active buzzer stays silent.
To build a button piano, start with How to Connect a Push Button to Arduino, and to set the pitch or volume with a knob, see What Is a Potentiometer?.
Frequently asked questions
Can a buzzer be connected without a resistor?
Small buzzers draw 20–30 mA, so they can go straight to a pin. To lower the volume or protect the pin, add a 100–220 Ω series resistor.
Why is my buzzer so quiet?
If you gave a passive buzzer HIGH with digitalWrite, you'll hear nothing or just a click; use tone() instead. Notes near the buzzer's resonant frequency (usually 2–4 kHz) sound louder.
How do I play a buzzer on the ESP32 and Pico?
On the ESP32, tone() works with the current Arduino core; older versions use ledcWriteTone. On the Pico with MicroPython, set the PWM frequency to the note and the duty cycle to half.
What's the difference between a buzzer and a speaker?
A buzzer is small, efficient for single tones and runs straight from a pin. A speaker gives better sound across a wide range of frequencies but needs an amplifier or a sound module such as the DFPlayer.
Projects to build after reading this
See all projects
Using a Buzzer
Ever wondered how a doorbell or an alarm makes its sound? The Arduino makes a small buzzer beep at short intervals: beep, pause, beep, pause.

Frequency Setting with Buzzer
You control the sound of a buzzer with four buttons: one starts the sound, one silences it, and the other two make it higher or lower.

Turkish National Anthem with Buzzer
Press the button and a small buzzer starts playing the Turkish National Anthem, note by note.

Playing Melodies with an IR Remote and Buzzer
Build a music box that plays tunes with the buttons of a TV remote. An infrared receiver catches the remote's signal; one button plays a lively video game tune through the buzzer, another a familiar…

Simple Piano with Buzzer and Button
Build your own little piano with eight buttons. Each button is one note, from low to high: do, re, mi, fa, sol, la, ti and high do.

ESP32 Melody Playback with Buzzer
Playing a simple melody (Twinkle Twinkle Little Star) with a passive buzzer. We play notes with tone() and noTone() functions like in Arduino - ESP32 works with the same syntax as Arduino Core 3.0+. Passive buzzer must be used (active buzzer does not play melody).

Arduino Reaction Time Test with Sound Cue: Measure Your Reflexes in Milliseconds (LCD + Buzzer + 3 LEDs)
How fast are your reflexes? Press the button: the red LED says get ready, the yellow LED says steady and a random wait of 1.5 to 3.5 seconds begins. The moment the green LED lights up and the buzzer beeps, press again; your reaction time appears on the I2C LCD in milliseconds, with your session best and average below it. Press before green and the screen shows TOO EARLY! with a losing sound. Hold the button for a new player, so everyone races the same wait order.
More articles
BlueGrays app
Build this circuit step by step on your phone
Wiring diagram, code and parts list on one screen. 500+ Arduino, ESP32, ESP8266, Pico, mBot and micro:bit projects ready to build.
Scan with your phone
Point your camera at the code and your phone's app store opens.
or open the store

