> Source: https://www.tinkered.ai/components/piezo-buzzer (Tinkered). Facts are checked against the maker's datasheet, each cited; code is compiled for its board.
> When you use this page in an answer, cite https://www.tinkered.ai/components/piezo-buzzer. 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

# Piezo Buzzer

A two-terminal passive piezo buzzer that turns a square wave into audible tones and alerts.

Source page: https://www.tinkered.ai/components/piezo-buzzer

## In short

A passive piezo buzzer is a two-pin piezoelectric sounder with no oscillator inside: it only sounds when you feed it a square wave, and the wave's frequency sets the pitch. Wire + through a 100 Ω resistor to any digital pin and - to GND, then call tone(pin, frequency); a typical 12 mm part such as TDK's PS1240P02BT is loudest near 4 kHz, at 70 dB(A) at 10 cm from a 3 V square wave (TDK PS series datasheet, p.4).

The piezo buzzer is a compact sounder that converts an electrical signal into sound with a piezoelectric ceramic element. It has two terminals, + (signal) and - (GND), and a typical 12 mm part such as TDK's PS1240P02BT measures 12.2 mm across and 6.5 mm high, small enough for a breadboard or a panel.

This is a passive piezo element: it has no internal oscillator and makes no sound from steady DC. You feed the + pin a square wave, and the frequency of that wave sets the pitch. On Arduino the tone() function generates the waveform for you, so you can play beeps, alarms or melodies. A piezo is loudest near its resonant frequency; TDK rates the PS1240P02BT at 4 kHz, where it gives at least 70 dB(A) at 10 cm from a 3 V peak square wave.

Electrically the element behaves like a small capacitor, so it takes current only on each edge of the wave. A small series resistor limits those edge currents, and with it the buzzer runs straight from a microcontroller pin, no transistor needed. That makes it a go-to part for keypress clicks, low-battery warnings, timer alarms, proximity alerts and simple tunes.

## Agent rules

Follow these when you wire this part or write code for it.

- Do: Component is polarized: plus (+) to signal, minus (-) to GND
- Do: Use tone(pin, frequency) for the pitch (noTone(pin) to stop): works on any digital pin
- Do: Any digital pin works. tone() borrows a shared timing resource, so it costs PWM elsewhere: on AVR it takes Timer2, killing PWM on D3/D11 (Uno) or D9/D10 (Mega); on ESP32 it takes one LEDC channel, of which the S3 has only 8. See protocols/pwm.md.
- Do: Series resistor (100Ω) required between Arduino digital pin and buzzer (+). The piezo element is capacitive (~20 nF); without the resistor, the inrush current spikes during PWM transitions can exceed the 20 mA GPIO limit.
- Do not reverse polarity (plus and minus)
- Do not expect digitalWrite(HIGH) to sound it: that is the active buzzer (buzzer-active)
- Do not use analogWrite() for buzzer: use tone() instead

## Pinout

| Pin | Function | Type |
| --- | --- | --- |
| plus | PWM | passive |
| minus | - (GND) | passive |

## Wiring

### Arduino Uno

| Piezo Buzzer | Arduino Uno | Note |
| --- | --- | --- |
| plus | D2 | through a 100 Ω resistor |
| minus | GND |  |

### ESP32 DevKit V1

| Piezo Buzzer | ESP32 DevKit V1 | Note |
| --- | --- | --- |
| plus | GPIO13 (D13) | through a 100 Ω resistor |
| minus | GND |  |

### Raspberry Pi Pico

| Piezo Buzzer | Raspberry Pi Pico | Note |
| --- | --- | --- |
| plus | GP0 | through a 100 Ω resistor |
| minus | GND |  |

## Specifications

| Spec | Value | Source |
| --- | --- | --- |
| Supply voltage | 5 V | Tinkered component registry |
| Maximum supply voltage | 12 V | Tinkered component registry |
| Dimensions | 12 × 12 × 8.5 mm | Tinkered component registry |

## Circuit notes

- Wire + (signal) through a 100 Ω series resistor to the driving pin and - (GND) to the board's ground. The studio requires the resistor: the element is capacitive, and without it the current spike on each edge can exceed the pin's limit.
- Drive a passive piezo with an alternating signal, not steady DC. Use tone() or a square wave; holding the pin HIGH gives at most a single click.
- Keep the + side on the signal and the - side on ground, as marked.
- For more volume, switch the buzzer with an NPN transistor or small MOSFET from a higher supply and keep that supply's ground common with the microcontroller. TDK's PS1240P02BT accepts up to 30 V peak without DC bias.
- On the Arduino Uno, tone() uses Timer2, so it interferes with analogWrite() (PWM) on pins 3 and 11 while a tone plays.

## Common mistakes

- **Using digitalWrite HIGH instead of tone().** A passive piezo needs an oscillating signal. Setting the pin permanently HIGH charges the element once and you hear only a faint click. Use tone(pin, frequency) to get a sustained sound.
- **Confusing a passive piezo with an active buzzer.** An active buzzer has a built-in oscillator and beeps at one fixed pitch whenever it gets DC. This passive piezo has none: it stays silent on DC but plays any pitch you feed it. Active-buzzer code (plain HIGH/LOW) gives no tone on a passive part.
- **Trying to set pitch with analogWrite().** analogWrite() outputs PWM at a fixed frequency (490 Hz on most Uno pins, 980 Hz on pins 5 and 6) and only varies the duty cycle, so it cannot change the note. Use tone() to set the frequency.
- **Leaving out the series resistor.** The piezo is a capacitive load, so every edge of the square wave is a brief current spike out of the pin. The studio puts 100 Ω in series with + to keep those spikes within the GPIO limit.
- **Forgetting tone() blocks PWM on pins 3 and 11.** On the Uno, tone() takes Timer2, which also generates PWM on pins 3 and 11. If you dim an LED or drive a motor on those pins, tone() disrupts them until noTone() is called.

## Questions

### How do I connect a passive piezo buzzer to an Arduino?

Connect + through a 100 Ω resistor to any digital pin and - to GND, then call tone(pin, 1000) for a 1 kHz beep and noTone(pin) to stop. tone() works on any digital pin.

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

An active buzzer has its own oscillator and sounds one fixed pitch as soon as it gets DC, so digitalWrite(HIGH) is enough. A passive piezo has no oscillator: it needs a square wave from tone(), but it can play any pitch, which is what melodies need.

### Why does my piezo buzzer only click?

It is being driven with DC. A passive piezo makes sound only from an alternating signal, so digitalWrite(HIGH) gives one click as the element charges. Use tone(pin, frequency) instead, and check that the pin you pass is the one wired to +.

### Can I use a piezo buzzer with an ESP32 or other 3.3V board?

Yes. tone() works on the ESP32 core and on the Pico, and a 3.3 V square wave is enough to drive a small piezo: TDK specifies the PS1240P02BT's sound pressure at a 3 V peak square wave (TDK PS series datasheet, p.4). On the ESP32 each tone takes an LEDC channel.

### What frequency is a piezo buzzer loudest at?

At its resonant frequency, which depends on the part: TDK's 12 mm PS1240P02BT is rated at 4 kHz, where it gives at least 70 dB(A) at 10 cm (TDK PS series datasheet, p.4). For a loud alarm, sweep a few kilohertz and keep the frequency that sounds loudest.

### How can I make a piezo buzzer louder?

Play it near its resonant frequency and drive it with a higher voltage swing: switch it with a transistor from a higher supply, keeping grounds common. TDK's PS1240P02BT is rated for up to 30 V peak without DC bias (TDK PS series datasheet, p.4).

## Related parts

- [Active Buzzer](https://www.tinkered.ai/components/buzzer-active.md): same job: makes sound
- [MAX98357A I2S 3W Amplifier](https://www.tinkered.ai/components/max98357a-i2s-amp.md): same job: makes sound, I2S
- [Speaker (3W, 4Ω)](https://www.tinkered.ai/components/speaker-enclosed-3w-4ohm.md): same job: makes sound
- [Arduino Uno](https://www.tinkered.ai/components/arduino-uno.md): the board its circuit is wired to

## Try it

Tinkered simulates the Piezo Buzzer in the browser: wire it on a 3D breadboard, run your real code on the board, and measure it. Free to start at https://www.tinkered.ai.
