Active vs Passive Buzzer: Differences and Arduino Wiring

Electronics Basics Intermediate 9 min read Published:
Active and passive buzzer difference: drawing of an active buzzer that sounds from DC and a passive buzzer driven by a square wave

An active buzzer has its own built-in oscillator: apply a DC voltage across its leads and it sounds at a fixed tone. A passive buzzer is only the sound element, and it needs an external square wave to make sound. On an Arduino, you play a passive buzzer at any frequency you want with the tone() function; an active buzzer is simply switched on and off by setting a pin HIGH (through a transistor if needed). This article covers the difference between the two types, a comparison table with datasheet values, Arduino wiring diagrams and how to tell which type of buzzer you have.

The topic came from Circuit Digest’s tutorial comparing active and passive buzzers with Arduino. Here we answer the same question using specific parts and their datasheet values: the 12 V active buzzer TMB12A12 and the passive piezo buzzers SFN-1207PA7.6 and SFN-1407PA7.6. The part values in this article are taken from the datasheets of these parts.

Block diagram of active and passive buzzers: in the active buzzer, the DC voltage feeds an internal oscillator that drives the sound element; in the passive buzzer, an external 4 kHz square wave is applied directly to the piezo element
An active buzzer sounds on its own from a DC voltage; the frequency of a passive buzzer is set by the external circuit.

What is a buzzer?

A buzzer is a small audio component that turns an electrical signal into a short, loud alert sound. Buzzers are used for alarms, doorbells, device power-on sounds and key-press confirmation. The part that makes the sound is either a piezo ceramic disc or a metal diaphragm vibrated by a coil (magnetic type). The “active” and “passive” distinction is about where the signal that vibrates this part comes from.

How does an active buzzer work?

An active buzzer contains a small oscillator circuit next to the sound element. When you apply a DC voltage with the correct polarity, this circuit oscillates at its own frequency and the buzzer sounds. The TMB12A12 datasheet gives the oscillation frequency as 2300 ±300 Hz. You cannot change this frequency from outside; all you can do is turn the buzzer on and off. The product page lists the TMB12A12 as a magnetic type.

How does a passive buzzer work?

A passive buzzer has no oscillator. The SFN-1207PA7.6 and SFN-1407PA7.6 are described in their datasheets as piezoelectric passive buzzers. Electrically, a piezo disc behaves like a capacitor: according to the datasheets, its capacitance is 11 nF ±30% for the SFN-1207 (at 1 kHz) and 12 nF ±30% for the SFN-1407 (at 120 Hz). If you apply a steady DC voltage, the disc bends once and stays there, so you only hear a “click” at the moment of connection. A continuous sound requires the voltage to change thousands of times per second, and the frequency of the square wave you apply sets the pitch.

Active vs. passive buzzer comparison table

The table below puts the datasheet values of the three parts side by side. Sound pressure level (SPL) values are measured 10 cm from the buzzer.

Parameter TMB12A12 (active) SFN-1207PA7.6 (passive) SFN-1407PA7.6 (passive)
Drive method DC voltage External square wave External square wave
Rated voltage 12 V DC 5 Vp-p square wave (test condition) 5 Vp-p square wave (test condition)
Operating / maximum voltage 8–16 V DC 30 Vp-p max 30 Vp-p max
Frequency 2300 ±300 Hz (internal) 4 kHz resonance 4.0 kHz resonance
Sound pressure (10 cm) 85 dB min (at 12 V) 80 dB min (4 kHz, 5 Vp-p) 85 dB min (4 kHz, 5 Vp-p)
Current 30 mA max (at 12 V) 5 mA max 5 mA max
Capacitance Not specified 11 nF ±30% (1 kHz) 12 nF ±30% (120 Hz)
Operating temperature -20 to +85 °C -20 to +70 °C -20 to +70 °C
Size (diameter × height) Ø12 × 9.5 mm Ø12.6 × 7.0 mm Ø14 × 7.0 mm
Lead spacing 7.6 mm 7.5 mm 7.6 mm

The TMB12A12 is a 12 V part, and its datasheet does not define operation below 8 V. An Arduino’s 5 V pin cannot run this buzzer on its own. The test condition of the passive SFN buzzers, on the other hand, is exactly the signal an Arduino pin can produce: a 4 kHz, 5 V peak-to-peak square wave.

Connecting a passive buzzer to an Arduino

You can connect a passive piezo buzzer to a digital pin through a series resistor, with the other lead going to GND. The SFN datasheets show no polarity marking; since the piezo element is non-polarized, the leads can be inserted either way.

Arduino buzzer wiring diagram: (a) pin D8 through a 220 ohm resistor to the SFN-1207 passive piezo buzzer, other lead to GND; (b) 12 V supply to the positive lead of the TMB12A12 active buzzer, negative lead to the collector of an NPN transistor, base through a 1 kilohm resistor from pin D7, emitter to common GND
(a) The passive piezo buzzer connects directly to an Arduino pin. (b) The 12 V active buzzer is switched on its negative side by an NPN transistor.

The example code sounds the buzzer at its 4 kHz resonant frequency for half a second, then keeps it silent for half a second:

const int BUZZER_PIN = 8;

void setup() {
}

void loop() {
  tone(BUZZER_PIN, 4000);   // 4 kHz square wave
  delay(500);
  noTone(BUZZER_PIN);
  delay(500);
}

tone() generates a square wave with a 50% duty cycle on the pin. According to the Arduino documentation, only one tone can be generated at a time, and on AVR-based boards such as the Uno and Nano (except the Mega) tone() interferes with PWM output on pins 3 and 11. You can also play melodies by passing different frequencies. A piezo buzzer is loudest near its resonant frequency; the 80 and 85 dB values in the datasheets are specified only at 4 kHz.

Why use a series resistor? A quick calculation

Because the piezo disc is a capacitor, it draws a short charging current at every edge of the square wave. The series resistor limits this peak current. For 220 Ω:

  • Peak current: 5 V / 220 Ω ≈ 23 mA (the pin’s own internal resistance lowers this value a little further).
  • Time constant: τ = R × C = 220 Ω × 11 nF ≈ 2.4 µs.
  • Half period at 4 kHz: 1 / (2 × 4000) = 125 µs.

The capacitor is almost fully charged within about 5τ ≈ 12 µs. That is very short compared with the 125 µs half period. So the resistor lowers the peak current, but the piezo still charges to 5 V in every half period and the sound level practically does not change. Values between 150 and 220 Ω suit this job. At 100 Ω the calculated peak current rises to 50 mA, which is higher than necessary for the pin.

Driving an active buzzer with an Arduino (12 V)

To use the TMB12A12 with an Arduino you need a separate 12 V supply and an NPN transistor. The positive lead of the buzzer goes to 12 V and the negative lead to the transistor’s collector. The emitter goes to GND, and the base connects to the Arduino pin through a resistor. The Arduino GND and the negative terminal of the 12 V supply must be tied together. We used the same low-side switching approach for an LED strip in the article on using a MOSFET with Arduino.

Base resistor calculation:

  1. The collector current equals the buzzer current: the datasheet gives IC ≤ 30 mA at 12 V.
  2. A common rule for driving the transistor firmly into saturation is to choose a base current of one tenth of the collector current: IB = 30 mA / 10 = 3 mA.
  3. Taking the base-emitter voltage as about 0.7 V: RB = (5 V − 0.7 V) / 3 mA ≈ 1.43 kΩ.
  4. For a little more base current, 1 kΩ can be chosen. In that case IB ≈ 4.3 mA and the transistor saturates comfortably.

Most small-signal NPN transistors such as the BC547 handle this current easily; check in your transistor’s datasheet that its collector current limit is well above 30 mA. No tone() is needed in the code; set the pin HIGH and the buzzer sounds, set it LOW and it stops:

const int BUZZER_PIN = 7;

void setup() {
  pinMode(BUZZER_PIN, OUTPUT);
}

void loop() {
  digitalWrite(BUZZER_PIN, HIGH);  // transistor on, buzzer sounds
  delay(200);
  digitalWrite(BUZZER_PIN, LOW);
  delay(800);
}

The maximum response time of 50 ms given in the datasheet is measured at the lowest operating voltage. If you are designing very short beeps, take this delay into account.

Driving a passive buzzer at a higher voltage with a transistor

The maximum input voltage of the piezo buzzers is 30 Vp-p. If you have a 12 V supply, you can also drive the passive buzzer with a 12 V square wave through a transistor. One detail matters here: when the transistor turns off, the charge on the piezo has no path to discharge. That is why a resistor is placed in parallel with the buzzer. The test circuit in the SFN-1207 datasheet uses this arrangement and shows 1 kΩ as the parallel resistor.

Circuit for driving a passive piezo buzzer from 12 V: the buzzer and a parallel 1 kilohm resistor between 12 V and the collector of an NPN transistor, base through a 1 kilohm resistor to Arduino pin D8, emitter to GND
The 1 kΩ resistor in parallel with the piezo buzzer lets the piezo discharge while the transistor is off.

Discharge calculation: τ = 1 kΩ × 11 nF = 11 µs (for the SFN-1407, 1 kΩ × 12 nF = 12 µs). Since the half period at 4 kHz is 125 µs, the piezo discharges almost completely within 5τ ≈ 55–60 µs in every off half period. Without the parallel resistor, the disc stays charged and the sound becomes noticeably weaker. Because the datasheet gives the sound pressure only at 5 Vp-p, there is no figure for how much louder it gets at 12 V; judge this by listening to your own circuit.

If you want to run a passive buzzer without a microcontroller, a 555 astable circuit set to 4 kHz does the same job. For the frequency calculation, see the article on the 555 astable circuit.

Is your buzzer active or passive?

  • DC test: Apply the rated voltage to the buzzer with the correct polarity (5 V for a 5 V buzzer, 12 V for the TMB12A12). If you hear a continuous sound, it is active. If you only hear a “click” when connecting and disconnecting, it is passive. Apply the voltage only briefly: the coil of a passive magnetic buzzer draws a steady current under DC and can heat up.
  • Capacitance measurement: On the resistance range of a multimeter, a piezo buzzer looks like an open circuit. On the capacitance range, the SFN series reads about 11–12 nF, with a ±30% tolerance.
  • Polarity marking: Active buzzers have polarity because of their oscillator circuit. The positive (+) lead is marked on the TMB12A12 datasheet drawing. The SFN passive buzzer datasheets show no polarity marking.
  • Part number: The most reliable way is to look up the datasheet from the part number. Judging by the look of the body does not work for every manufacturer.

Common mistakes

  • Connecting a 12 V active buzzer directly to an Arduino pin: The operating range of the TMB12A12 is 8–16 V. It is not expected to sound at 5 V, and since the buzzer can draw up to 30 mA, the pin is stressed as well.
  • Applying digitalWrite(HIGH) to a passive buzzer: The piezo clicks only once. Sound requires a square wave from tone().
  • Driving an active buzzer with tone(): The external frequency mixes with the signal of the internal oscillator and the sound is distorted. Only switch an active buzzer on and off.
  • Forgetting the parallel resistor in a transistor-driven piezo circuit: The piezo cannot discharge while the transistor is off and the sound becomes weak.
  • Not connecting a common GND: When working with a separate 12 V supply, the transistor will not switch unless the Arduino GND and the negative terminal of the supply are tied together.

Frequently asked questions

What is the difference between an active and a passive buzzer?

An active buzzer has an internal oscillator and sounds at a fixed tone from a DC voltage. A passive buzzer has no oscillator; it needs an external square wave to sound, and the frequency of this signal sets its pitch.

Which buzzer do I need to play a melody with an Arduino?

A passive buzzer. With tone() you can set a different frequency for each note. An active buzzer only sounds at its own frequency (2300 ±300 Hz for the TMB12A12).

Does a passive buzzer need a resistor?

It is not mandatory but it is recommended. A series resistor of 150–220 Ω limits the short charging current the piezo draws at every edge and practically does not change the sound level.

Does a 12 V buzzer work at 5 V?

Not the TMB12A12. Its datasheet gives an operating range of 8–16 V. In a 5 V system, either choose a 5 V active buzzer or drive the 12 V buzzer from a separate supply through a transistor.

Does a piezo buzzer have polarity?

The SFN-1207PA7.6 and SFN-1407PA7.6 datasheets show no polarity marking; the piezo element can be inserted either way. Active buzzers, however, have a marked positive lead and must not be connected in reverse.

Conclusion

If you need a simple alert sound, an active buzzer does the job: the TMB12A12 gives at least 85 dB at 12 V and is switched on and off with a transistor. If you need tones, melodies or different alert sounds, choose a passive piezo buzzer. The SFN-1207PA7.6 and SFN-1407PA7.6 give at least 80 and 85 dB from the Arduino’s 5 V, 4 kHz square wave and draw at most 5 mA. When choosing, look first at the supply voltage, then at what will set the sound frequency.

SFN-1407PA7.6S&S · EE00665$0.1850 In StockView

You can find other options in the Buzzers, Alarms and Sirens category. To check the transistor used in the driver circuit, you can follow the steps in the article on testing transistors.

References

Products in this article

More from Electronics Basics