Electronic Buzzers - What they Are and How They Work

Contents

What is a Buzzer?

A buzzer is an electronic component that converts electrical energy into audible sound (beeps, tones, or alarms). It is widely used in devices like timers, alarms, doorbells, and microcontroller projects to provide audio feedback.

Two-Terminal Buzzers

Most buzzers in basic hobby kits have two terminals: Positive (+) and Negative (-). Often (but not always) the positive leg is longer. It's usually marked with a + sign on the casing. Generally, no permanent damage is done if a standard buzzer is wired backwards (reverse polarity).

Two terminal buzzer.
Fig 1 - Typical two terminal buzzer
Three-Terminal Buzzers

These are less common in basic hobby kits but frequent in industrial applications or specific piezo drivers. The third pin is a Feedback pin. These buzzers requires a specific driver circuit that utilizes the feedback loop.

Operational Voltages

Buzzers operate over a range of voltages depending upon type. Many hobbyist buzzers operate fine at 3.3V to 5V for use with microcontrollers. Automotive/Industrial use buzzers typically require 12V or 24V. Some specialised industrial piezo buzzers can operate up to 220V - 250V.

How Do They Work?

Buzzers operate using two distinct physical principles to convert electrical energy into sound: Electromagnetism  and the Piezoelectric Effect.

Electromagnetic Buzzers

These operate on the principle of electromagnetic induction, similar to a miniature speaker. An electric current flowing through a coil creates a magnetic field. This field attracts a flexible ferromagnetic diaphragm, pulling it inward, and when the current stops, the diaphragm snaps back due to elasticity.

By rapidly switching the current on and off, the diaphragm vibrates continuously to produce sound waves.

Piezo Buzzers

The core component is a piezoelectric ceramic disc sandwiched between two electrodes and attached to a metal plate (diaphragm). When an alternating voltage is applied across the electrodes, the electric field causes the ceramic material to physically deform (expand and contract).

This rapid mechanical deformation forces the attached metal plate to vibrate. The vibration of the plate displaces air, generating sound waves.

Piezo buzzers have largely become the standard in modern electronics. They consume significantly less current, making them ideal for battery-powered devices, and can operate across a much wider voltage range. Their solid-state construction lacks moving coils, resulting in greater durability.

Types of Buzzers

There are two distinct types of buzzers; active buzzers   and passive buzzers.

Active Buzzers

Active buzzers contain a built-in oscillation source (driver circuit). They produce a sound immediately upon connecting to a DC voltage (e.g., 3V, 5V, 12V). Simply apply a (usually) HIGH logic signal (e.g. from a microcontroller's GPIO pin) or direct DC power to generate a continuous tone.

They emit a fixed frequency (typically ~2-4 kHz); the pitch cannot be changed because the builtin oscillator is fixed hardware. They are ideal for simple alarms, timers, and status indicators where a consistent beep is required with minimal code or circuitry.

Passive Buzzers

Passive buzzers lack an internal oscillator and function similarly to a small electromagnetic speaker.They require an external AC signal (usually a square wave) to vibrate the diaphragm. They must be driven by a fluctuating signal (e.g., from a microcontroller pin toggling at a specific frequency). Applying DC voltage results only in a single "click".

They are capable of producing variable frequencies, allowing for different pitches, melodies, and complex sound effects. Thus passive buzzers are best for musical projects, toys, and applications requiring distinct tones or songs.

How to Control a Buzzer with a Microcontroller

Using a microcontroller or single board computer (e.g. a Raspberry Pi) is a convenient means to control an electronic buzzer. It requires only a single GPIO pin to control the buzzer.

However, connecting buzzers directly to microcontroller GPIO pins is generally discouraged due to at least two primary risks: current overload and voltage spikes.

  1. Current Overload
    • Electromagnetic buzzers: These often have low impedance (e.g., 16Ω) and can attempt to draw >100 mA if connected directly to 5V, far exceeding the pin's rating and potentially burning out the microcontroller.
    • Piezo buzzers: While some low-power piezo active buzzers draw <20 mA, many standard models require 30-50 mA, pushing the GPIO pin to its absolute limit or probably beyond.
  2. Voltage Spikes:
    • Electromagnetic Buzzers: Being inductive loads (coils), they generate back electromotive force (Back EMF)—high-voltage spikes—when switched off. Without a flyback diode, these spikes can exceed the microcontroller's voltage tolerance and destroy the pin.
    • Piezo Buzzers: These can act as sensors; physical shock or vibration can generate tens of volts across the element, feeding high voltage back into the GPIO pin and bypassing internal ESD protection.

The easiest solution is to use an NPN transistor (e.g. 2N2222, 2N3904, BC337, C1815, S8050) or MOSFET (e.g. 2N7000, BS170) as a switch.

The GPIO drives the transistor base/gate with minimal current, while the transistor handles the higher current required by the buzzer from an external power rail. The circuit below illustrates the approach.

Connecting a microcontroller to a buzzer.
Fig 2 - Connecting a microcontroller to a buzzer using an NPN transistor as a switch

If the buzzer is of the active type the GPIO can control the buzzer by simply changing the logic level on the pin.

If the buzzer is passive then the pin must supply a continuously PWM (square wave) signal to enable buzzer sound. The PWM frequency determines the buzzer output frequency. Maximum volume from the buzzer will occur at a 50% PWM duty cycle.

Here is an article that documents how to control an active buzzer with a Raspberry Pi; Controlling an Active Buzzer With the GPIO Zero Library

This article describes how to control a passive buzzer with a Raspberry Pi; Controlling a Passive Buzzer With the GPIO Zero Library