Piezo Buzzer (Active & Passive)

A Piezoelectric Buzzer uses a piezoelectric ceramic disc bonded to a metallic diaphragm.

Actuators10 blocksMicroPythonC++
Buzzer

At a glance

Pins and properties exactly as the circuit editor and simulator define this part. The text below explains how to use them.

Pinout

Pinout of the Buzzer, drawn as in the circuit editor. Select a label to see that pin in the table below.

Pins

Pins of this part
PinLabelType
VCC+Power in
GND-Ground

Properties

What you can change in the Property Inspector.

Properties of this part
PropertyRange or choicesDefault
Frequency100 to 8000 Hz2500 Hz

A Piezoelectric Buzzer uses a piezoelectric ceramic disc bonded to a metallic diaphragm. When an alternating voltage signal is applied across the disc, it bends rapidly, flexing the diaphragm to create sound waves in the air.


1. Schematic Symbol

Standard schematic symbol for a buzzer — a circle with sound-wave arcs, two polarized leads (this component's SPICE model flags reverse wiring as a real fault, so treat it as polarized like an LED):

+ −

2. Hardware Specifications & Pinout

  • Operating Voltage: 3.3V to 5.0V.
  • Buzzer Types:
    • Active Buzzer: Contains an internal oscillator circuit. Applying static DC voltage (HIGH) produces a fixed tone (~2 kHz).
    • Passive Buzzer: Has no internal oscillator. Requires an external square wave (PWM signal) to produce tone frequencies (typically 20 Hz to 20,000 Hz).
  • Pin Configuration:
    • Positive (+ / SIG): Connected to a PWM-capable GPIO pin.
    • Negative (- / GND): Connected to Ground.

3. How it Works (Frequency Synthesis & Note Conversion)

  • Tone Generation: Sound pitch is controlled by square wave frequency:
    f=1Tperiodf = \dfrac{1}{T_{period}}
  • Musical Note Mapping: Musical notes correspond to standard equal-temperament frequencies (A4=440 HzA_4 = 440\,\text{Hz}):
NoteFrequencyNoteFrequencyNoteFrequency
C4 (Do)262 HzE4 (Mi)330 HzG4 (Sol)392 Hz
D4 (Re)294 HzF4 (Fa)349 HzA4 (La)440 Hz
B4 (Ti)494 Hz
C5 (Do↑)523 Hz

4. Component Properties (Property Inspector)

  • Frequency (frequency): The pitch the simulator's Web Audio oscillator plays while the buzzer is powered.
    • Default: 2500 Hz
    • Range: 100 Hz to 8000 Hz (step size 100 Hz)

[!NOTE] There's no "Sound Volume" or "Mute" property — those don't exist on this component. In MicroPython projects, every block below now drives this Frequency property live as your code runs — playing a 262Hz note actually sounds like 262Hz. In C++ (Arduino-core) projects, this still isn't wired up yet — the oscillator keeps playing at whatever this property is manually set to (2500Hz by default), regardless of what pitch your compiled code requests. See Section 6 for the practical workaround on C++ projects.


5. Supported Blockly Blocks

Drawing the blocks…

6. Simulator Behavior

  • Web Audio API Synthesizer: The simulator uses the browser's Web Audio API to play a square wave whenever real current is flowing through the buzzer (a genuine simulated branch current, not a scripted on/off).
  • MicroPython projects drive the pitch live: every block above generates real PWM.freq()/.duty() calls, and the simulator now listens for those and updates the buzzer's Frequency property in real time as your code runs — playing a note or running the Frequency Sweep block sounds correct.
  • C++ (Arduino-core) projects don't yet — this is a real, disclosed simulator limitation, not a simplification: tone()/noTone() compile to real emulated hardware-timer PWM, and there's currently no way for the simulator to read back what frequency that timer is running at. The oscillator keeps playing at whatever the Frequency property is manually set to. Workaround: manually set the Frequency property to match what your C++ code requests, if you want an accurate pitch preview.
  • Sound Wave Animation: Concentric sound wave rings animate around the buzzer component on the canvas while current is flowing.
  • Fault Detection: Wiring the buzzer backwards trips a POLARITY fault; drawing more than ~35mA trips an OVERCURRENT fault (modeled on real ~25-30mA active-buzzer current draw at 5V, with margin).