ESP32 C3 Super Mini - Buzzer

Learn how to program your ESP32 C3 Super Mini to control a 12V active buzzer and generate loud, attention-grabbing sounds perfect for alarms and notifications. This beginner-friendly tutorial walks you through everything you need to create a working buzzer project.

In this tutorial, you'll learn:

ESP32 C3 Super Mini - Buzzer

Note: If you want to control 5V active/passive buzzer, check out this ESP32 C3 Super Mini Piezo Buzzer tutorial

Hardware Preparation

1×ESP32 C3 Super Mini
1×USB Cable Type-A to Type-C (for USB-A PC)
1×USB Cable Type-C to Type-C (for USB-C PC)
1×Relay
1×12V Active Buzzer
1×12V Power Adapter
1×Optionally, DC Power Jack
1×Breadboard
1×Jumper Wires

Or you can buy the following kits:

1×DIYables Sensor Kit (18 sensors/displays)
Disclosure: Some of the links provided in this section are Amazon affiliate links. We may receive a commission for any purchases made through these links at no additional cost to you.
Additionally, some of these links are for products from our own brand, DIYables .

Overview of 12V Active Buzzer

The 12V Active Buzzer is an electronic buzzer that produces a loud, high-decibel sound suitable for alarm systems and attention alerts.

Key features:

  • Operates at 12V DC power supply
  • Produces loud sound (much louder than standard 5V buzzers)
  • "Active" means it has built-in oscillator - just apply power to make sound
  • Perfect for security alarms, notification systems, and warning signals
  • Requires external power supply (cannot be powered directly by ESP32)
  • Must be controlled through a relay module for safe operation

Why use a 12V buzzer?

  • Significantly louder than 5V buzzers
  • Better for outdoor or noisy environments
  • Ideal for alarm and alert systems where sound needs to carry

Pinout

The 12V Active Buzzer pinout is simple with only two connection points.

ESP32 C3 Super Mini 12V Active Buzzer Pinout
  • Negative (-) pin (black): Connect to GND of 12V DC power supply
  • Positive (+) pin (red): Connect to 12V positive of DC power supply

How to Control 12V Active Buzzer

The ESP32 C3 Super Mini outputs only 3.3V, which is not enough to power a 12V buzzer directly.

Control method:

  • Use a relay module as a switch between ESP32 and the buzzer
  • ESP32 C3 Super Mini controls the relay with a digital pin
  • Relay switches the 12V power supply to the buzzer ON or OFF
  • This keeps your ESP32 safe while controlling high-voltage devices

Important: If you're new to relays, check out the ESP32 C3 Super Mini - Relay tutorial to understand pinout, operation, and programming basics.

Wiring Diagram

Follow this wiring diagram to connect your ESP32 C3 Super Mini to the 12V active buzzer through a relay module.

The wiring diagram between ESP32 C3 Super Mini 12V Active Buzzer

This image is created using Fritzing. Click to enlarge image

Safety notes:

  • Note: Double-check 12V power supply polarity before connecting - reversed polarity can damage the buzzer
  • Note: Keep 12V wiring separate from ESP32 signal wires to avoid electrical interference
Component Pin Connection Point
ESP32 Pin 2 Relay Signal Pin (IN)
ESP32 GND Relay GND
ESP32 5V Relay VCC
Relay COM 12V Power Supply (+)
Relay NO Buzzer (+) Red Wire
Buzzer (-) Black Wire 12V Power Supply GND (-)

ESP32 C3 Super Mini Code

Here's the code to control your 12V active buzzer - it turns the buzzer ON for 1 second, then OFF for 2 seconds in a repeating pattern.

What this code does:

  • Sets up GPIO pin 2 to control the relay
  • Turns the buzzer ON for 1 second (relay activated)
  • Turns the buzzer OFF for 2 seconds (relay deactivated)
  • Repeats the pattern continuously for alarm-like beeping
  • Uses simple digitalWrite commands for easy customization
/* * This ESP32 C3 Super Mini code was developed by newbiely.com * * This ESP32 C3 Super Mini code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/esp32-c3/esp32-c3-super-mini-buzzer */ #define RELAY_PIN D2 // The Arduino Nano ESP32 that connects to relay to control the 12V buzzer // The setup function runs once on reset or power-up void setup() { // initialize digital pin as an output. pinMode(RELAY_PIN, OUTPUT); } void loop() { digitalWrite(RELAY_PIN, HIGH); delay(1000); digitalWrite(RELAY_PIN, LOW); delay(2000); }

Detailed Instructions

  • New to Arduino? Start with our ESP32 C3 Super Mini Getting Started guide first.
  • Setup environment: If this is your first time using ESP32 C3 Super Mini, follow the Arduino IDE setup guide
  • Connect hardware: Wire the ESP32 C3 Super Mini, relay, buzzer, and 12V power supply according to the wiring diagram above
  • Connect to PC: Plug your ESP32 C3 Super Mini into your computer using the USB Type-C cable
  • Open Arduino IDE: Launch the Arduino IDE and select the correct board and port
  • Upload code: Copy the code above, paste it into Arduino IDE, and click the Upload button
  • Test buzzer: Listen for the buzzer to beep ON for 1 second, OFF for 2 seconds repeatedly
  • Verify operation: The relay LED should also blink in sync with the buzzer sound
  • Pro Tip: Adjust the delay() values in the code to create different beep patterns - shorter delays make rapid alarm sounds, longer delays create slow warning beeps

Code Explanation

The code comments explain each line in detail - read through them to understand how the buzzer control works!

Key functions used:

  • pinMode() - Configures GPIO pin 2 as an output to control the relay
  • digitalWrite(HIGH) - Activates relay, connecting 12V to buzzer (sound ON)
  • digitalWrite(LOW) - Deactivates relay, disconnecting power (sound OFF)
  • delay() - Pauses program execution to control timing

Applications and Project Ideas

Use your ESP32 C3 Super Mini 12V active buzzer setup in these practical projects:

  • Security alarm system: Trigger loud alerts when motion sensors detect intrusion
  • Timer notifications: Create kitchen timers or workout interval buzzers
  • Door/window alerts: Sound alarm when doors or windows open unexpectedly
  • Water leak detector: Connect with moisture sensor to alert for leaks
  • Temperature warnings: Pair with temperature sensor for overheat alarms
  • Reminder system: Build medication or appointment reminder device
  • IoT alarm system: Combine with WiFi to create remote-controlled security alerts

Video Tutorial

Watch the video below for a visual walkthrough of this project.

Challenge Yourself

Take your buzzer project to the next level with these challenges:

  • Easy: Modify the code to create an SOS pattern (3 short beeps, 3 long beeps, 3 short beeps)
  • Easy: Add a button to manually trigger the buzzer ON/OFF
  • Medium: Create a melody by programming different beep durations and pauses
  • Medium: Use a motion sensor to trigger the alarm only when movement is detected
  • Advanced: Build a smartphone-controlled alarm using ESP32 WiFi and Blynk app
  • Advanced: Create a multi-zone alarm system with multiple buzzers controlled independently

Learn More

※ OUR MESSAGES

  • As freelancers, We are AVAILABLE for HIRE. See how to outsource your project to us
  • Please feel free to share the link of this tutorial. However, Please do not use our content on any other websites. We invested a lot of effort and time to create the content, please respect our work!