ESP32 C3 Super Mini - Buzzer
by DIYables in Circuits > Microcontrollers
7 Views, 0 Favorites, 0 Comments
ESP32 C3 Super Mini - Buzzer
This is a compact build guide. The full tutorial, with the wiring diagram and a line-by-line walkthrough of the code, is here: https://newbiely.com/tutorials/esp32-c3/esp32-c3-super-mini-buzzer
This project uses an ESP32 C3 Super Mini to switch a 12V active buzzer on and off through a relay, producing a loud, repeating alarm-style sound. Because the ESP32 only outputs 3.3V, it cannot drive the buzzer directly, so a relay handles the 12V side while the ESP32 just toggles a digital pin. Good base for alarms, timers, and notification devices.
Supplies
Everything below is what the build uses. The links go to the parts we make and test.
Wiring
Connect GPIO pin 2 of the ESP32 C3 Super Mini to the control input of the relay module. The relay switches the 12V power supply to the buzzer: the buzzer's negative (black) pin connects to GND of the 12V power adapter, and its positive (red) pin is fed from the 12V positive line through the relay. Bring the 12V in through a DC power jack connected to the 12V adapter, and keep this high-voltage wiring separate from the ESP32 signal wires.
How It Works
The buzzer is active, meaning it has a built-in oscillator and just needs power to make noise, but it needs 12V and the ESP32 only outputs 3.3V. The relay acts as a switch in between: when GPIO pin 2 goes HIGH, the relay closes and connects the 12V supply to the buzzer, producing sound. When the pin goes LOW, the relay opens and cuts power, silencing it. This keeps the ESP32 isolated from the high-voltage circuit while still letting it control it.
Code
The sketch configures pin 2 as an output in setup(). In loop(), it writes the pin HIGH to activate the relay and sound the buzzer for 1 second, then LOW to deactivate the relay and silence it for 2 seconds, repeating this pattern continuously. Changing the delay values changes how long the buzzer stays on or off.
esp32-c3-super-mini-buzzer.ino - the sketch from the tutorial, unchanged.
Things That Go Wrong
Double-check the polarity of the 12V power supply before wiring it to the buzzer; reversed polarity can damage it. Keep the 12V wiring away from the ESP32 signal wires to avoid interference. If nothing happens, watch the relay's LED: if it doesn't blink in time with the 1-second-on, 2-second-off pattern, recheck the GPIO-to-relay wiring; if it blinks correctly but the buzzer stays silent, check the 12V supply and buzzer connections.
Full Tutorial
The complete tutorial, wiring diagram and code explanation: https://newbiely.com/tutorials/esp32-c3/esp32-c3-super-mini-buzzer