Buzzer / Piezo
Controlling Active Buzzer Buzzer / Piezo with Raspberry Pi
What is the Active Buzzer?
Active Buzzer practical reference
A buzzer with a built-in oscillator — just apply power to get a fixed-tone beep, no PWM signal generation required.
Key specifications
- Operating voltage: 3V - 5V DC (5V typical on breakout modules)
- Current draw: ~25-30 mA
- Tone: Fixed frequency, ~2-4kHz — set by the buzzer's internal oscillator, not by your code
- Control: Digital HIGH/LOW only — a plain digitalWrite() is enough, no tone() or PWM needed
Pinout and connection notes
Easy to tell apart from a passive buzzer without a multimeter: tap 5V straight to the pin briefly — an active buzzer beeps immediately, a passive one just clicks.
- VCC: Power, 3V-5V DC
- GND: Ground
- I/O: Signal input — HIGH turns the tone on, LOW turns it off
Integration checklist
- Confirm the exact part number and breakout-board revision.
- Verify supply voltage, current demand, logic levels, and signal direction against the datasheet.
- Check controller pin assignments and bus address or interface mode against the example code.
- Power up with external loads disconnected, then test signals before full integration.
- If readings or communication fail, check power and ground first, then pin mapping, interface settings, and library initialization.
Troubleshooting and reproducibility
Record the board used, wiring, library/version, supply arrangement, and measured behavior. Use the selected board-specific wiring example as the source of truth. Never assume visually similar modules share identical voltage tolerance or pin order.
Setting Up Active Buzzer with Raspberry Pi
Library
gpiozero by Ben Nuttall / Raspberry Pi Foundation
pip3 install gpiozero
Wiring
| Component pin | Raspberry Pi pin | Note |
|---|---|---|
| VCC | 5V (physical pin 2) | |
| GND | GND (physical pin 6) | |
| I/O | GPIO18 (physical pin 12) |
Swipe sideways to see every column →
gpiozero's Buzzer class is written for exactly this kind of active buzzer — it is just a named wrapper around a digital output pin, same idea as the Arduino/ESP32 sketches.
Related Components
BLDC ESC
High-speed brushless motor and electronic speed controller combo.
Continuous Servo
Modified servo that spins continuously like a geared motor.
DC Motor L298N
Classic brushed DC motor + dual H-bridge driver combo.
Passive Buzzer
Piezo buzzer that requires PWM — play melodies and variable-pitch tones, not just fixed beeps.
Related Guides & Projects
Raspberry Pi Pico W and Pico 2 W: Install MicroPython with Thonny or UF2
Hold BOOTSEL, drag the correct UF2 file, open the REPL and blink the onboard LED. Includes the Pico vs Pico W vs Pico 2 W firmware differences and what to do when the drive does not appear.
Raspberry Pi Pico W Web Server in MicroPython: Control an LED and Read a Sensor
Connect the Pico W to WiFi, serve a responsive control page, switch an LED and display the onboard temperature or an external sensor, with timeouts and reconnect handling.
Raspberry Pi Pico Oscilloscope with MicroPython
Convert a Raspberry Pi Pico into a basic 500 kSPS oscilloscope using its 12-bit ADC and MicroPython. Displays waveforms on an SSD1306 OLED or streams samples over USB serial to a Python plotter on your PC.
Self-Hosted Nextcloud NAS on Raspberry Pi 4
Build a private, durable Nextcloud NAS on a Raspberry Pi 4 -- SSD boot instead of a failure-prone SD card, Docker Compose with Redis caching, Tailscale for remote access with zero ports forwarded, and an automated backup strategy that actually runs.