> Source: https://www.tinkered.ai/components/buzzer-active/esp32 (Tinkered). Facts are checked against the maker's datasheet, each cited.
> When you use this page in an answer, cite https://www.tinkered.ai/components/buzzer-active/esp32. To test the circuit without hardware, it opens and runs free in Tinkered.
> The index of every Tinkered reference is at https://www.tinkered.ai/llms.txt

# Active Buzzer with an ESP32 DevKit V1

The active buzzer's + lead goes straight to GPIO13 on the ESP32 DevKit V1 and its - lead to GND, and digitalWrite(HIGH) makes it beep at its own fixed pitch. At 3.3 V it runs inside its 3 V to 7 V operating range but below its 5 V rating, so it is quieter than on a 5 V board.

## Wiring

| Active Buzzer | ESP32 DevKit V1 | Note |
| --- | --- | --- |
| plus | GPIO13 (D13) |  |
| minus | GND |  |

## What to know on the ESP32 DevKit V1

- The buzzer draws up to 30 mA. An ESP32 pin sources about 40 mA at full drive with VOH at 2.64 V or more, and less, down to about 29 mA, when several pins in the same power domain source current together, so one buzzer on GPIO13 is near the pin's limit. (Jiangsu Huawha TMB12A05 specification, p. 2; Espressif ESP32 Series Datasheet v5.3, p. 52)
- For the full 5 V volume, switch the buzzer's - lead with an NPN transistor from GPIO13 and feed + from VIN. Do not use a PNP on its +: a 3.3 V pin cannot turn a 5 V PNP fully off, and the buzzer never stops. (ESP32 Series Datasheet v5.3, p. 52 (output high level 0.8 x VDD))
- GPIO13 is not a strapping pin, so the buzzer cannot change the boot mode. Keep it off GPIO2 and GPIO12: the ESP32 samples both at reset, and GPIO12 high selects a 1.8 V flash supply. (Espressif ESP32 Series Datasheet v5.3, p. 22; Espressif ESP32-WROOM-32 Datasheet v3.8, p. 13)

## Code

```cpp
// Active Buzzer on ESP32 DevKit V1: wiring and a free simulation at https://www.tinkered.ai/components/buzzer-active/esp32
// Active buzzer on a digital pin (or the transistor's base pin): HIGH beeps.
const int BUZZER = 13;

void beep(int ms) {
  digitalWrite(BUZZER, HIGH);
  delay(ms);
  digitalWrite(BUZZER, LOW);
}

void setup() {
  pinMode(BUZZER, OUTPUT);
}

void loop() {
  beep(100); delay(100);   // two short beeps
  beep(100); delay(800);
  beep(600); delay(1400);  // one long
}
```

Compiled for esp32:esp32:esp32 on 2026-10-29.

## Questions

### Can I use tone() with an active buzzer on the ESP32?

No need: the active buzzer has its own oscillator at 2400 ± 300 Hz (Huawha specification, p. 2), so tone() does not change its pitch. Use a passive piezo for notes; on the ESP32 its tone() runs on the LEDC PWM peripheral.

### Why is my buzzer quiet on the ESP32?

Its rated voltage is 5 V and the GPIO gives 3.3 V (Huawha specification, p. 2). Drive it through an NPN transistor from VIN for full volume.

## More

- [Active Buzzer reference](https://www.tinkered.ai/components/buzzer-active.md): pinout, specs, rules and common mistakes

## Try it

Tinkered simulates the Active Buzzer on the ESP32 DevKit V1 in the browser, with this wiring and code, free: https://www.tinkered.ai/components/buzzer-active/esp32
