Active Buzzer

A 12 mm magnetic buzzer with its own oscillator: give it DC and it beeps one fixed 2.4 kHz tone, no code tricks needed.

  • TypeElectromagnetic active buzzer (built-in oscillator)
  • Rated voltage5 V DC
  • Operating voltage3 V to 7 V DC
  • Operating current30 mA max
Active Buzzer, A 12 mm magnetic buzzer with its own oscillator: give it DC and it beeps one fixed 2.4 kHz tone, no code tricks needed.
In short

The active buzzer is a 12 mm electromagnetic buzzer with a built-in driver: apply DC and it sounds one fixed tone of 2400 ± 300 Hz, rated 5 V (3 V to 7 V) at 30 mA or less, with at least 95 dB at 10 cm (Jiangsu Huawha TMB12A05 specification, p. 2). Wire + to a digital pin and - to GND, then digitalWrite(pin, HIGH) beeps and LOW stops it. On a 3.3 V board, or for full volume, put + on 5 V and switch - to ground through an NPN transistor driven by the pin.

An active buzzer is a sealed 12 mm can that contains a magnetic sounder and the oscillator that drives it. The word active means the tone generator is built in: the moment DC appears across its two leads it buzzes, and the moment the voltage goes away it stops. The common part behind the hobby buzzer is the TMB12A05 class, rated 5 V with a 3 V to 7 V operating range, 30 mA or less, a resonant frequency of 2400 ± 300 Hz and at least 95 dB measured at 10 cm (Jiangsu Huawha TMB12A05 specification, p. 2).

Because the oscillator is inside, you drive it exactly like an LED: one digital pin set HIGH turns the sound on, LOW turns it off. That also means the pitch never changes. tone() and PWM cannot play a melody on it, because the internal oscillator ignores the frequency you apply. For notes and tunes, use a passive piezo buzzer with tone(); for alarms, timers, door chimes and keypad clicks, the active buzzer needs one line of code.

The buzzer is polarised. The + lead is marked on the case (and is usually the longer lead), and it must go to the positive side; reversed, the internal driver does not run. The body is 12.0 mm across and 9.5 mm tall with leads 7.6 mm apart, so it drops into a breadboard straddling three rows (specification, p. 2). Many sellers ship it with a paper seal over the sound hole for board washing; peel it off for full volume.

How to wire the Active Buzzer

Pin by pin, for the board you have.

Active BuzzerArduino UnoNote
plusD8
minusGND
  • Typical 5 V active buzzers are rated up to about 30 mA. That is within the Uno pin's 40 mA absolute maximum but above the 20 mA it is meant to run at: for a louder buzzer, switch it with an NPN transistor such as a 2N2222 (1 kΩ to the base).
Open this circuit on an Arduino UnoThe full Arduino Uno guide

Active Buzzer code

Every example here compiles for its board.

No library needed
// Active Buzzer on Arduino Uno: wiring and a free simulation at https://www.tinkered.ai/components/buzzer-active
// Active buzzer on a digital pin (or the transistor's base pin): HIGH beeps.
const int BUZZER = 8;

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 arduino:avr:uno on 2026-10-29

Before you wire it

Do
  • Polarised: plus to the signal, minus to GND. Reversed it stays silent.
  • Drive it with digitalWrite(HIGH/LOW) on any digital pin. No PWM pin, no tone(), no series resistor (that is the passive piezo's rule; on this buzzer a resistor only makes it quieter).
Don’t
  • No tone() for melodies on it (fixed pitch): use piezo-buzzer for notes.
  • No series resistor on its +.
  • No PNP on its + from a 3.3 V board: a 3.3 V pin cannot turn a 5 V PNP off, and the buzzer never stops. Use the NPN on its - instead.
  • Polarity matters: + to the signal (or to 5 V when a transistor switches it), - to GND (or to the transistor's collector). Reversed, it stays silent.
  • Drive it with digitalWrite() on any digital pin; it needs no PWM pin and no tone(). Its sound level and current both rise with voltage (specification, p. 3), so a series resistor only makes it quieter.
  • The buzzer can draw up to 30 mA (specification, p. 2). That is within the 40 mA absolute maximum of an Uno or Nano pin (Microchip ATmega328P datasheet, Absolute Maximum Ratings), but leaves little margin, and 3.3 V boards such as the ESP32 or Raspberry Pi Pico are better served by a transistor.
  • For full volume on any board, power + from 5 V and switch - to GND with an NPN transistor (2N2222 or 2N3904) through a 1 kΩ base resistor from the GPIO. HIGH on the pin then beeps.
  • Do not switch + with a PNP from a 3.3 V pin while + sits on 5 V: the pin cannot rise high enough to turn the PNP off, so the buzzer never stops. Use the low-side NPN instead.
  • Its operating range starts at 3 V (specification, p. 2), so it does sound directly from a 3.3 V pin, just more quietly than at its rated 5 V.

Specifications

Type
Electromagnetic active buzzer (built-in oscillator)Jiangsu Huawha TMB12A05 specification, p. 1
Rated voltage
5 V DCJiangsu Huawha TMB12A05 specification, p. 2
Operating voltage
3 V to 7 V DCJiangsu Huawha TMB12A05 specification, p. 2
Operating current
30 mA maxJiangsu Huawha TMB12A05 specification, p. 2
Resonant frequency
2400 ± 300 Hz (fixed)Jiangsu Huawha TMB12A05 specification, p. 2
Sound output
95 dB min at 10 cmJiangsu Huawha TMB12A05 specification, p. 2
Operating temperature
-40 °C to +85 °CJiangsu Huawha TMB12A05 specification, p. 2
Dimensions
12.0 mm diameter, 9.5 mm tall, leads 7.6 mm apartJiangsu Huawha TMB12A05 specification, p. 2
Weight
1.7 gJiangsu Huawha TMB12A05 specification, p. 2
Tone
about 2.4 kHzmaker's datasheet, checked 29 Oct 2026

From the Generic (Jiangsu Huaneng TMB12A05 class)'s datasheet, published by Generic (Jiangsu Huaneng TMB12A05 class).

Common mistakes

  1. Using tone() to play a melody

    The active buzzer has its own oscillator at a fixed 2400 ± 300 Hz (TMB12A05 specification, p. 2). tone() only chops that tone on and off, so every note sounds the same or garbled. Use a passive piezo buzzer for tunes.

  2. Wiring it backwards

    It is polarised. With + on GND and - on the pin, the internal driver never runs and the buzzer is silent. Check the + mark on the case or the longer lead.

  3. Mistaking a passive buzzer for an active one

    They look alike. An active buzzer beeps when you touch it straight across 5 V; a passive one only clicks. The active one usually has a sealed black bottom and a seal sticker over the top hole.

  4. Leaving the wash seal on

    The paper seal over the sound hole protects it during board cleaning. Left on, it muffles the buzzer. Peel it off once the buzzer is fitted.

  5. Overloading a weak GPIO

    Up to 30 mA (TMB12A05 specification, p. 2) is a heavy load for a 3.3 V microcontroller pin. Switch the buzzer through an NPN transistor so the pin only supplies a few milliamps of base current.

Active Buzzer questions

What is the difference between an active and a passive buzzer?

An active buzzer contains its own oscillator, so plain DC makes it sound its one tone of 2400 ± 300 Hz (TMB12A05 specification, p. 2). A passive buzzer has no oscillator and needs a square wave, which tone() supplies, so it can play different notes. Use the active one for beeps and alarms, the passive one for melodies.

Does an active buzzer work at 3.3 V with an ESP32 or Raspberry Pi Pico?

Yes. Its operating range is 3 V to 7 V (TMB12A05 specification, p. 2), so it sounds from a 3.3 V pin, but more quietly than at its rated 5 V. For full volume, and to keep the pin lightly loaded, put + on 5 V and switch - to ground through an NPN transistor driven by the GPIO.

How do I connect an active buzzer to an Arduino?

Connect + to any digital pin and - to GND, set the pin as an OUTPUT, then digitalWrite(pin, HIGH) to beep and LOW to stop. It draws up to 30 mA (TMB12A05 specification, p. 2), within an Uno pin's 40 mA absolute maximum (Microchip ATmega328P datasheet), though a transistor is the safer habit.

Why does my active buzzer make no sound?

Check polarity first: + must go to the pin or 5 V and - to GND. Then check that the pin is set as an OUTPUT and driven HIGH, that the seal sticker is off, and that you did not buy a passive buzzer, which only clicks on DC. With a transistor, make sure its emitter is on GND and the buzzer's - is on the collector.

Can I change the pitch or volume of an active buzzer?

Not the pitch: the internal oscillator fixes it near 2400 Hz (TMB12A05 specification, p. 2). Volume follows supply voltage, rising from 3 V to 8 V on the maker's curve (p. 3), so 5 V through a transistor is louder than a 3.3 V pin. A series resistor only makes it quieter.

Do I need a resistor with an active buzzer?

No series resistor is needed: the buzzer limits its own current to 30 mA or less at its rated 5 V (TMB12A05 specification, p. 2). The only resistor in the usual circuit is the 1 kΩ base resistor when an NPN transistor switches it.

Build something with the Active Buzzer

  • Kitchen or study timer

    Count down on a display and sound a pattern of beeps when time is up.

    Build this
  • Intruder or door alarm

    Sound the buzzer when a PIR sensor, reed switch or ultrasonic sensor trips.

    Build this
  • Keypad feedback

    Give each key press on a 4x4 keypad a short confirming click.

    Build this
  • Temperature or gas warning

    Beep when a DHT22, DS18B20 or MQ-2 reading crosses a threshold.

    Build this
  • Morse code trainer

    Key the buzzer from a push button or turn typed text into dots and dashes.

    Build this
For AI assistants

This page as plain Markdown, for ChatGPT, Claude or your own agent. /components/buzzer-active.md

What will you build with it?