Components · 3 min read

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.

Buzzer
A 12 mm buzzer that plugs into a breadboard. The long leg is positive (+).

Active vs passive buzzer

FeatureActive buzzerPassive buzzer
Built-in oscillatorYesNo
To make a soundJust give it HIGHNeeds a square wave (frequency)
SoundA single fixed toneAny frequency: notes, melodies
Arduino commanddigitalWrite()tone() / noTone()
Used forAlarms, warning beepsMusic, 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:

NoteC4D4E4F4G4A4B4C5
Frequency (Hz)262294330349392440494523
C++ (Arduino IDE)
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}
This code doesn't work with an active buzzer; an active buzzer gives the same sound for every note. For melodies, always use a passive buzzer.

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.

See all projects
Using a Buzzer
AR-13Beginner

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.

4.7(93)
180
Frequency Setting with Buzzer
AR-14Intermediate

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.

4.6(69)
124
Turkish National Anthem with Buzzer
AR-15Intermediate

Turkish National Anthem with Buzzer

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

4.8(117)
275
Playing Melodies with an IR Remote and Buzzer
AR-18Beginner
Premium

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…

4.8(59)
75
Simple Piano with Buzzer and Button
AR-26Advanced
Premium

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.

4.9(68)
90
ESP32 Melody Playback with Buzzer
ES-12Beginner
Premium

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).

4.8(31)
55
Arduino Reaction Time Test with Sound Cue: Measure Your Reflexes in Milliseconds (LCD + Buzzer + 3 LEDs)
AR-95Intermediate
Premium

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.

4.6(34)
51