Piezo Buzzer vs Passive Buzzer: Arduino Sound Projects
When adding sound to your Arduino project, the first decision is choosing between a piezo buzzer (active) and a passive buzzer. While both look nearly identical, they work very differently and suit different applications. This guide explains the technical differences, wiring, Arduino code examples, and practical use cases to help you pick the right buzzer for your project in India.
How Active and Passive Buzzers Work
Both buzzers use the piezoelectric effect — a phenomenon where certain crystals (like lead zirconate titanate) vibrate when voltage is applied. However, the key difference lies in what’s built inside the component:
- Active Buzzer: Contains a built-in oscillator circuit. Apply DC voltage → it beeps at a fixed frequency (typically 2kHz-4kHz). It’s like a complete self-contained alarm — just power it on.
- Passive Buzzer: Contains only the piezoelectric element with no internal oscillator. You must supply a square wave signal at the desired frequency. This gives full control over pitch and tone.
In India, both are available for ₹5-30 each. The 5V active buzzer modules (with transistor driver) are extremely popular in Arduino starter kits and cost ₹20-50 as complete modules.
How to Identify: Active vs Passive
The easiest identification methods without a datasheet:
- Multimeter test: Connect a 3V battery. If it beeps continuously → active. If silent → passive.
- Visual inspection: Active buzzers typically have a green circuit board visible through the bottom hole. Passive buzzers show just the piezo disc.
- Label: Active buzzers are often labeled with a + sign or a red wire; passive have equal pin lengths.
- Module sticker: Pre-packaged Arduino modules clearly mark “Active” or “Passive” on the PCB silkscreen.
Active (Piezo) Buzzer: Simple Beeps
The active buzzer module for Arduino typically includes a transistor (S8050 or similar) that allows direct control from a 5V digital pin without exceeding current limits. The module has three pins: VCC (5V), GND, and I/O (signal).
Basic Active Buzzer Arduino Code
// Active Buzzer Module - Simple On/Off Control
// Module Wiring:
// VCC → Arduino 5V
// GND → Arduino GND
// I/O → Arduino Pin 8
#define BUZZER_PIN 8
void setup() {
pinMode(BUZZER_PIN, OUTPUT);
Serial.begin(9600);
}
void loop() {
// Simple alarm pattern
Serial.println("BEEP!");
digitalWrite(BUZZER_PIN, HIGH); // Buzzer ON
delay(500);
digitalWrite(BUZZER_PIN, LOW); // Buzzer OFF
delay(500);
}
// SOS pattern function
void sos() {
// S: 3 short beeps
for(int i=0; i<3; i++) {
digitalWrite(BUZZER_PIN, HIGH); delay(150);
digitalWrite(BUZZER_PIN, LOW); delay(150);
}
delay(300);
// O: 3 long beeps
for(int i=0; i<3; i++) {
digitalWrite(BUZZER_PIN, HIGH); delay(400);
digitalWrite(BUZZER_PIN, LOW); delay(150);
}
delay(300);
// S: 3 short beeps again
for(int i=0; i<3; i++) {
digitalWrite(BUZZER_PIN, HIGH); delay(150);
digitalWrite(BUZZER_PIN, LOW); delay(150);
}
delay(1000); // Gap before next SOS
}
Recommended Product
5V Active Alarm Buzzer Module for Arduino
Pre-built module with transistor driver — works directly with Arduino digital pins. Ideal for alarm systems, door bells, and notification projects.
Category: Audio & Sound Modules
Limitations of Active Buzzers
The fixed frequency is both a feature and a limitation. You cannot play music or vary pitch with an active buzzer. For simple alarms, door chimes, or status notifications in IoT projects, the active buzzer is perfect. For anything musical, you need a passive buzzer.
Passive Buzzer: Play Melodies
The passive buzzer requires a PWM square wave to produce sound. Arduino’s built-in tone() function makes this trivial — it handles the PWM generation automatically, letting you specify any frequency from 31Hz to 65,535Hz. This enables playing actual musical notes and melodies.
Passive Buzzer: Play Super Mario Theme
// Passive Buzzer - Play Melodies with tone()
// Direct connection: Buzzer pin 1 → Arduino Pin 9
// Buzzer pin 2 → GND
// (No transistor needed for passive buzzer at low power)
#define BUZZER_PIN 9
// Musical note frequencies (Hz)
#define NOTE_C4 262
#define NOTE_D4 294
#define NOTE_E4 330
#define NOTE_F4 349
#define NOTE_G4 392
#define NOTE_A4 440
#define NOTE_B4 494
#define NOTE_C5 523
#define NOTE_E5 659
#define NOTE_G5 784
// Super Mario Bros Theme (simplified)
int melody[] = {
NOTE_E5, NOTE_E5, 0, NOTE_E5, 0, NOTE_C5, NOTE_E5, NOTE_G5,
0, NOTE_G4, 0, 0
};
int durations[] = {
8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8
};
void setup() {
pinMode(BUZZER_PIN, OUTPUT);
}
void loop() {
playMelody();
delay(2000);
}
void playMelody() {
int noteCount = sizeof(melody) / sizeof(melody[0]);
for (int i = 0; i < noteCount; i++) {
int duration = 1000 / durations[i];
if (melody[i] == 0) {
delay(duration); // Rest
} else {
tone(BUZZER_PIN, melody[i], duration);
delay(duration * 1.3); // Small gap between notes
}
noTone(BUZZER_PIN);
}
}
// Scale test function
void playScale() {
int notes[] = {NOTE_C4, NOTE_D4, NOTE_E4, NOTE_F4,
NOTE_G4, NOTE_A4, NOTE_B4, NOTE_C5};
for (int i = 0; i < 8; i++) {
tone(BUZZER_PIN, notes[i], 300);
delay(400);
}
noTone(BUZZER_PIN);
}
Comparison Table
| Feature | Active Buzzer | Passive Buzzer |
|---|---|---|
| Internal oscillator | Yes | No |
| Control signal | DC ON/OFF | PWM square wave |
| Frequency control | Fixed (~2-4kHz) | Full range (31Hz-65kHz) |
| Can play melodies | No | Yes |
| Arduino function | digitalWrite() | tone() / noTone() |
| Sound volume | Louder (optimized freq) | Softer (depends on freq) |
| India Price | ₹20-50 (module) | ₹5-20 (bare buzzer) |
| Best for | Alarms, alerts, notifications | Music, tones, Morse code |
Practical Arduino Projects
Project 1: Door Alarm with PIR + Active Buzzer
// PIR Motion Detector + Active Buzzer Alarm
#define PIR_PIN 2
#define BUZZER_PIN 8
#define LED_PIN 13
void setup() {
pinMode(PIR_PIN, INPUT);
pinMode(BUZZER_PIN, OUTPUT);
pinMode(LED_PIN, OUTPUT);
Serial.begin(9600);
delay(2000); // PIR warm-up (60-90s for accuracy, 2s for demo)
Serial.println("Security system armed!");
}
void loop() {
int motion = digitalRead(PIR_PIN);
if (motion == HIGH) {
Serial.println("INTRUSION DETECTED!");
digitalWrite(LED_PIN, HIGH);
// Alarm sequence
for(int i = 0; i < 10; i++) {
digitalWrite(BUZZER_PIN, HIGH);
delay(100);
digitalWrite(BUZZER_PIN, LOW);
delay(100);
}
digitalWrite(LED_PIN, LOW);
}
delay(100);
}
Project 2: Passive Buzzer Metronome for Music Practice
// Metronome with Passive Buzzer - Adjustable BPM
#define BUZZER_PIN 9
#define POT_PIN A0
void setup() {
pinMode(BUZZER_PIN, OUTPUT);
Serial.begin(9600);
}
void loop() {
// Read potentiometer for BPM (40-200 BPM range)
int potValue = analogRead(POT_PIN);
int bpm = map(potValue, 0, 1023, 40, 200);
int beatInterval = 60000 / bpm; // ms per beat
Serial.print("BPM: "); Serial.println(bpm);
// TICK sound: 880Hz for 50ms
tone(BUZZER_PIN, 880, 50);
delay(beatInterval);
noTone(BUZZER_PIN);
}
Recommended Product
Analog Sound Sensor Microphone Module
Pair with a buzzer for clap-activated switches or echo-detect projects. Sound input + buzzer output = complete audio interaction system.
Category: Audio & Sound Modules
Troubleshooting Common Issues
Active Buzzer Not Sounding
- Check polarity — active buzzers are polarity-sensitive (+ to positive)
- Verify the module signal pin is wired to a digital output pin, not analog
- Some modules are active-LOW (buzzer ON when pin is LOW) — test both states
- Measure voltage across buzzer: should be 4-5V when ON
Passive Buzzer Produces No Sound
- Must use
tone()function, NOTdigitalWrite()— passive buzzers need AC/PWM signal - tone() only works on timer-capable pins: 3, 5, 6, 9, 10, 11 on Arduino Uno
- Minimum audible frequency: ~100Hz; human sweet spot: 1kHz-4kHz
- Check for short circuit — passive buzzers can be connected directly without transistor
Recommended Product
Mini Digital Amplifier Module — 3W
When buzzer volume isn’t enough, upgrade to this compact amplifier module for louder, cleaner audio output in your Arduino projects.
Category: Audio & Sound Modules
Frequently Asked Questions
Q: Can I use tone() with an active buzzer?
A: Technically yes, but it won’t change the pitch — the internal oscillator overrides the input frequency. You’ll only control the on/off state. For frequency control, always use a passive buzzer with tone().
Q: Why does my Arduino reset when the buzzer activates?
A: Buzzers can draw 20-30mA which strains Arduino’s 5V regulator. Solutions: (1) Power buzzer from external 5V source, (2) Use a transistor driver (BC547 or 2N2222) to isolate from Arduino, (3) Add a 100µF capacitor between 5V and GND near the buzzer.
Q: How loud is a piezo buzzer vs a small speaker?
A: Piezo buzzers are typically 75-85dB at 10cm — noticeably loud in a quiet room. Small 0.5W speakers driven by LM386 produce similar volume but with richer tone. For outdoor alarms (>90dB), use dedicated high-decibel piezo sirens rated 100-110dB.
Q: What’s the difference between piezo buzzer and electromagnetic buzzer?
A: Electromagnetic buzzers use a vibrating magnetic diaphragm (like a tiny speaker), producing richer, louder sound. Piezo buzzers use ceramic crystal vibration — they’re thinner, cheaper, and more power-efficient but have a thinner sound. Most Arduino modules use piezo type.
Q: Can I control buzzer volume in Arduino?
A: For passive buzzers, indirectly — higher frequencies around 2-4kHz sound louder due to resonance. For true volume control, use PWM with varying duty cycle (e.g., analogWrite() at different values creates perceived volume change). A hardware potentiometer in series provides direct attenuation.
Add comment