> Source: https://www.tinkered.ai/components/buzzer-active/raspberry-pi-pico (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/raspberry-pi-pico. 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 a Raspberry Pi Pico

On the Raspberry Pi Pico the page drives the active buzzer straight from GP0, plus to the pin and minus to GND, switching it with digitalWrite(). It sounds, but a 3.3 V RP2040 pin is a weak source for a buzzer rated 5 V and up to 30 mA, so expect it quieter than on a 5 V board; the page's warning moves it behind an NPN transistor such as a 2N2222.

## Wiring

| Active Buzzer | Raspberry Pi Pico | Note |
| --- | --- | --- |
| plus | GP0 |  |
| minus | GND |  |

Warning: Typical 5 V active buzzers are rated up to about 30 mA. An RP2040 pin drives 4 mA by default and 12 mA at most, so drive the buzzer through an NPN transistor such as a 2N2222: GP0 to the base through 1 kΩ, the buzzer from VBUS to the collector, the emitter to GND.

## What to know on the Raspberry Pi Pico

- The buzzer operates from 3 V to 7 V and draws up to 30 mA. An RP2040 pin's drive strength is 2, 4, 8 or 12 mA, 4 mA by default, so GP0 cannot hold 3.3 V at that current and the tone is quieter. (Jiangsu Huawha TMB12A05 specification, p. 2; RP2040 datasheet, section 2.19.4)
- For full volume, put plus on VBUS (5 V on USB) and switch minus to ground through an NPN transistor such as a 2N2222, its base driven from GP0 through 1 kΩ. Never switch plus with a PNP from a 3.3 V pin: the pin cannot turn it off. (Raspberry Pi Pico datasheet, release 21, p. 8)
- The pitch is fixed by the buzzer's own oscillator at 2400 ± 300 Hz, so tone() and PWM add nothing; HIGH beeps, LOW stops. (Jiangsu Huawha TMB12A05 specification, p. 2)

## Code

```cpp
// Active Buzzer on Raspberry Pi Pico: wiring and a free simulation at https://www.tinkered.ai/components/buzzer-active/raspberry-pi-pico
// Active buzzer on a digital pin (or the transistor's base pin): HIGH beeps.
const int BUZZER = 0;

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 rp2040:rp2040:rpipico on 2026-10-29.

## Questions

### Can a Raspberry Pi Pico drive an active buzzer directly?

It sounds, since the buzzer works from 3 V (TMB12A05 specification, p. 2), but it can draw 30 mA while an RP2040 pin is set for 4 mA by default and 12 mA at most (RP2040 datasheet, section 2.19.4). For full volume use an NPN transistor and 5 V.

### Why is my buzzer so quiet on the Pico?

The pin sags under the buzzer's current and 3.3 V is below its rated 5 V. Switch it through an NPN from VBUS on USB.

### Can I play melodies on this buzzer with the Pico?

No. An active buzzer has a fixed tone near 2400 Hz (TMB12A05 specification, p. 2). Use a passive piezo for tone().

## 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 Raspberry Pi Pico in the browser, with this wiring and code, free: https://www.tinkered.ai/components/buzzer-active/raspberry-pi-pico
