You wired a buzzer to an Arduino pin, uploaded a sketch calling tone(), and got either complete silence or a flat, unchanging beep that ignores your melody. Your code is not broken — you almost certainly have an active buzzer instead of a passive buzzer.
⚡ Quick 10-Second Test: Active vs Passive Buzzer
For standard 3V–5V hobby electronics buzzers, connect the buzzer directly across a 3V coin cell (CR2032) or a 3.3V DC bench supply, observing polarity (the longer lead or
+mark to positive):• Continuous audible tone: It is an active buzzer (contains an internal oscillating circuit). Drive it with
digitalWrite(pin, HIGH). Callingtone()will NOT alter its pitch.• Single faint click, then total silence: It is a passive buzzer (transducer only, no internal oscillator). Drive it with
tone(pin, frequency)to generate sound waves.Note: This test applies to 3V–5V components. Buzzers rated for 12V will not sound on a 3V coin cell, and magnetic buzzers connected in reverse polarity will remain quiet. Always check component markings.
⚡ Simulate and Hear Both Buzzers in Your Browser
CircuPilot simulates buzzers in real time — a steady DC voltage sounds an active buzzer at its resonant frequency, and an AVR square wave from
tone()plays the exact musical pitch you requested.
Active vs Passive Buzzer: What Is the Difference?
The confusion is widespread because active and passive buzzers frequently ship in the same assorted sensor kits, share identical cylindrical black plastic housings, and are often labeled generically as "piezo buzzer."
| Feature | Active Buzzer | Passive Buzzer |
|---|---|---|
| Internal Oscillator | Yes (built-in driver circuit) | No (raw transducer or speaker coil) |
| Input Signal | Pure DC Voltage (3.3V / 5V) | Alternating AC / PWM Square Wave |
| Arduino Function | digitalWrite(pin, HIGH) | tone(pin, frequency) |
| Pitch Control | Fixed frequency (typically ~2 kHz) | Fully variable melodies and musical notes |
| Typical Appearance | Sealed black epoxy base | Often exposed green PCB underside |
| Battery Click Test | Emits steady, continuous beep | Emits a single click, then silence |
Why active buzzers ignore Arduino `tone()`
An active buzzer has an internal multivibrator that oscillates at a fixed frequency whenever DC power is applied. It has only two operational states: ON and OFF.
When you call tone(pin, 440) on an active buzzer, the microcontroller rapidly flips the pin between 5V and 0V at 440 Hz. Instead of changing the acoustic pitch, this rapidly cuts power to the buzzer's internal oscillator. The result is a broken chirp, clicking, or an irritating buzz fixed at the buzzer's internal 2 kHz resonance.
A passive buzzer is an electromagnetic diaphragm or piezoelectric disk without an internal oscillator. When you feed it a 440 Hz square wave using tone(), the diaphragm flexes back and forth exactly 440 times per second, producing the note A4.
Does a Passive Buzzer Need a Current-Limiting Resistor?
A frequent source of failed circuits is improper resistor sizing:
Piezoelectric vs Electromagnetic buzzers
- Piezoelectric buzzers: Behave like small capacitors with high AC impedance. They draw minimal current (typically under 2 to 5 mA). They can be safely connected directly between an Arduino digital pin and GND without any series resistor.
- Electromagnetic (magnetic) buzzers: Feature an internal wire coil with low DC resistance (often 16 Ω to 80 Ω). At 5V, a 16 Ω coil tries to pull:
I = 5V / 16 Ω = 312 mA
This vastly exceeds the 40 mA absolute maximum rating of an ATmega328P I/O pin! A magnetic buzzer connected directly to an MCU pin can damage the internal output stage transistors or reset the board.
Resistor sizing guidelines
- For magnetic buzzers, add a 100 Ω to 220 Ω resistor in series to limit pin current to a safe 15–20 mA.
- For louder sound, use a general-purpose NPN transistor (e.g. 2N2222 or 2N3904) to switch the buzzer from the 5V rail.
Why a 10k resistor silences the buzzer completely
Engineers frequently try adding a 10kΩ potentiometer or resistor to "turn down the volume," only for the buzzer to go totally silent.
A buzzer is a low-impedance load (e.g. 150 Ω). In series with a 10kΩ resistor, the two form an aggressive voltage divider:
V_buzzer = 5 V × 150 / (10000 + 150) ≈ 0.07 V
Seventy millivolts is insufficient to move the diaphragm. For audible volume control, use a series resistance between 100 Ω and 470 Ω, never kilohms.
What Arduino `tone()` Is Actually Doing
The Arduino tone() function does not utilize hardware analog PWM like analogWrite(). Instead, it configures an internal hardware timer (Timer2 on Uno/Nano) to fire an interrupt at twice your requested frequency, toggling the output pin inside the ISR.
Because it runs on a dedicated timer:
- The frequency is mathematically precise.
- The tone continues playing in the background while your code executes other tasks.
- You must explicitly call
noTone(pin)to stop the sound.
In CircuPilot's cycle-accurate AVR emulator, running a compiled tone(8, 1000) sketch produces exactly 602 pin transitions in 300 ms (1003.3 Hz), perfectly verifying the underlying hardware timer behavior.
Working Arduino Code Examples
1. Passive Buzzer Melody (Pin 8 to GND)
void setup() {
// Pin mode is configured automatically by tone()
}
void loop() {
tone(8, 440); // Note A4 (440 Hz)
delay(400);
tone(8, 523); // Note C5 (523 Hz)
delay(400);
tone(8, 659); // Note E5 (659 Hz)
delay(400);
noTone(8); // Silence output
delay(800);
}
2. Active Buzzer Alarm (Pin 8 to GND)
void setup() {
pinMode(8, OUTPUT);
}
void loop() {
digitalWrite(8, HIGH); // Sound the built-in 2 kHz oscillator
delay(200);
digitalWrite(8, LOW); // Turn off
delay(800);
}
Verify Your Buzzer Circuit in Simulation
You can verify whether your code and buzzer type are matched in the browser before wiring physical hardware. CircuPilot simulates the compiled AVR machine code alongside analog circuit components, letting you inspect pin waveforms on an oscilloscope and hear the audio output in real time.
Launch the free buzzer simulator in CircuPilot →
Frequently asked questions
How do I tell an active buzzer from a passive one?
For standard 3V–5V hobby buzzers, apply 3V from a coin cell (CR2032) across the pins observing polarity. An active buzzer emits a continuous tone because it contains an internal oscillator. A passive buzzer makes only a single faint click and remains silent because it requires an alternating AC or PWM signal to vibrate. Note that 12V automotive buzzers will not sound on 3V, and magnetic buzzers connected with reverse polarity will remain silent.
Why does my buzzer make no sound with Arduino tone()?
Most likely it is an active buzzer. Active buzzers have their own internal oscillator tuned to a fixed frequency (usually ~2 kHz) and only understand DC ON/OFF. Feeding an active buzzer a square wave from tone() switches the internal oscillator on and off at an audio rate, producing an erratic beep or single fixed pitch that completely ignores your melody notes. tone() is designed specifically for passive buzzers.
Does a passive buzzer need a resistor on Arduino?
For a piezoelectric buzzer, no series resistor is needed because its high capacitive impedance draws less than 5 mA, well within the safe 20–40 mA limit of an ATmega328P digital pin. However, small magnetic or electromagnetic buzzers have low internal coil resistance (16 to 80 Ω) and can draw 30 to 50 mA or more. For magnetic buzzers, always use a 100 to 220 Ω current-limiting resistor or an NPN transistor driver to protect the microcontroller pin.
Why did my buzzer go completely silent when I added a 10k resistor?
Because a buzzer is a low-impedance load (typically 16 to 150 Ω). Putting a 10k potentiometer or resistor in series creates a severe voltage divider where the buzzer receives only about 0.07 V out of 5 V, which is far too low to produce sound. For volume control on buzzers, use a small resistance in the range of 100 to 470 Ω, never kilohms.
Can I drive an active buzzer directly from an Arduino digital pin?
A miniature active buzzer drawing under 20 to 30 mA can be driven directly by digitalWrite(pin, HIGH). However, if your buzzer is louder or draws more than 30 mA, you should drive it using an NPN transistor (like a 2N2222 or 2N3904) to avoid browning out the microcontroller or degrading the I/O pin over time.