Sound PWM

Buzzer

A buzzer is an audio signaling component that turns electrical control into sound.

Part images

Active and passive buzzers. SunFounder distinguishes active and passive buzzers by construction. Image source: SunFounder Pico 2 W Starter Kit documentation, Components section, © 2026 SunFounder.
Buzzer symbol. The buzzer symbol shows positive and negative polarity. Image source: SunFounder Pico 2 W Starter Kit documentation, Components section, © 2026 SunFounder.
KY-006 Module Photo. Module Photo for the KY-006 Passive Buzzer Module. Image source: Joy-IT SensorKit KY-006 module documentation
KY-006 Pinout / Module Diagram. Pinout / Module Diagram for the KY-006 Passive Buzzer Module. Image source: Joy-IT SensorKit KY-006 module documentation
KY-006 Arduino Wiring Diagram. Arduino Wiring Diagram for the KY-006 Passive Buzzer Module. Image source: Joy-IT SensorKit KY-006 module documentation
KY-006 Raspberry Pi Wiring Diagram. Raspberry Pi Wiring Diagram for the KY-006 Passive Buzzer Module. Image source: Joy-IT SensorKit KY-006 module documentation
KY-012 Module Photo. Module Photo for the KY-012 Active Buzzer Module. Image source: Joy-IT SensorKit KY-012 module documentation
KY-012 Pinout / Module Diagram. Pinout / Module Diagram for the KY-012 Active Buzzer Module. Image source: Joy-IT SensorKit KY-012 module documentation
KY-012 Arduino Wiring Diagram. Arduino Wiring Diagram for the KY-012 Active Buzzer Module. Image source: Joy-IT SensorKit KY-012 module documentation
KY-012 Raspberry Pi Wiring Diagram. Raspberry Pi Wiring Diagram for the KY-012 Active Buzzer Module. Image source: Joy-IT SensorKit KY-012 module documentation

What it is

A buzzer is an audio signaling component that turns electrical control into sound.

How students use it

Students use buzzers for alarms, timers, button feedback, simple music, and sensor warnings. Active buzzers make a tone when powered; passive buzzers need a changing square wave.

Pins and power

Positive and negative pins. SunFounder notes the pin marked '+' is the anode, and the longer pin is also the anode.

DC-powered buzzer. Passive buzzers need a square wave, and SunFounder notes a typical passive-buzzer drive frequency range of 2 kHz to 5 kHz.

Active buzzer: connect with correct polarity and switch it on/off. Passive buzzer: use PWM or a square wave to create a tone.

Voltage and safety

Do not assume a buzzer can be driven directly from a GPIO at any current. Use the lesson circuit and current planning.

Buzzers can be loud up close. Start with short tests and keep it away from ears.

Datasheet notes

SunFounder explains active/passive buzzer behavior but does not identify one exact model number. Match the part marking before using a specific datasheet.

Common libraries

Use machine.Pin for active buzzer on/off. Use machine.PWM for passive buzzer tones.

Common mistakes

Mixing up active and passive buzzers, reversing polarity, using DC on a passive buzzer and expecting sound, and using a PWM frequency outside the useful range.