Buzzer / Piezo
Controlling Active Buzzer Buzzer / Piezo with ESP32
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 ESP32
Wiring
| Component pin | ESP32 pin | Note |
|---|---|---|
| VCC | 3.3V or 5V | Check your module's rated voltage — most active buzzer boards work fine at 3.3V, but volume drops |
| GND | GND | |
| I/O | GPIO25 | Avoid GPIO strapping pins (0, 2, 12, 15) for this to prevent boot issues |
Swipe sideways to see every column →
Running the buzzer from 3.3V instead of 5V is fine electrically but noticeably quieter — if volume matters, power VCC from the ESP32's 5V pin (on dev boards that expose one) instead of 3V3, while I/O still connects to a 3.3V-logic GPIO.
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
MicroPython vs Arduino on ESP32: Which Should You Learn First?
An honest comparison for beginners: where MicroPython is easier, where Arduino C++ is faster, how libraries and memory differ, and how to choose based on your project instead of hype.
MicroPython ESP32 Web Server: Control an LED or Relay from Your Browser
Create a working web server with the socket module, parse requests, serve a responsive control page for an LED or a relay, keep the displayed state truthful, choose a safe relay startup state and make the server survive bad or repeated requests.
MicroPython on ESP32 and Raspberry Pi Pico W: The Complete Guide
A structured MicroPython learning path for ESP32 and Pico W. Set up your tools, control GPIO, read sensors, connect to WiFi, build web servers, publish MQTT data and make projects reliable. Start here, then follow the links by level.
boot.py vs main.py in MicroPython: What Runs, When and Why
Understand the difference between boot.py and main.py in MicroPython, startup order, Wi-Fi setup, project structure, and recovery from boot errors.