Overview
The KY-006 is a small, breadboard-friendly passive piezo buzzer module that lets your microcontroller generate beeps, tones, and simple melodies. Unlike an active buzzer (which plays one fixed tone whenever it's powered), a passive buzzer needs an oscillating signal — so you control the frequency from code with tone() on Arduino or PWM on any other platform. That's what makes it useful for alarms, timer chimes, button feedback, success/error sound effects, and basic music.
The module exposes three pins on a 0.1" header — Signal (S), Power (+Vin), and Ground (-) — and works with both 3.3V and 5V microcontrollers. It draws very little current and can be driven directly from a single GPIO; no transistor needed for typical sound levels.
Pair it with an Arduino, ESP32, Raspberry Pi, or Pico to add audible status feedback to any project: a soil moisture alarm, a button-press click, an oven timer, or a simple keyboard.
At a Glance
Specifications
| Parameter | Value |
| Module Type | KY-006 passive piezo buzzer |
| Operating Voltage | 3.3V - 5V DC |
| Operating Current | ~10-30 mA (depends on signal level) |
| Resonant Frequency | ~2 kHz (loudest) |
| Usable Frequency Range | ~1.5 kHz - 5 kHz |
| Sound Pressure | ~85 dB at 10 cm |
| Drive | Direct from GPIO (no transistor needed) |
| Signal Type | Square wave / PWM |
| Pin Count | 3 (S, +Vin, GND) |
| Mounting | 2 x M2 holes |
| Operating Temperature | -20 degC to +70 degC |
| Dimensions | ~18 x 15 mm |
Pinout Diagram
Wiring Guide
Arduino Wiring
Wire S to a digital pin that supports the tone() function (any digital pin works on AVR Arduinos). +Vin to 5V, - to GND. The middle pin (between S and -) is the same as +Vin internally.
| KY-006 Pin | Arduino Pin |
|---|---|
| S (Signal) | Digital Pin 8 |
| +Vin | 5V |
| - (GND) | GND |
ESP32 Wiring
The KY-006 is happy at 3.3V. Use the ESP32's ledcWriteTone() (or tone() in newer cores) to generate frequencies on any GPIO.
| KY-006 Pin | ESP32 Pin |
|---|---|
| S (Signal) | GPIO 5 |
| +Vin | 3V3 |
| - (GND) | GND |
Raspberry Pi Wiring
The Pi can drive the buzzer directly with software PWM, or use hardware PWM on GPIO 18 / 19 for cleaner tones. Use 3.3V supply.
| KY-006 Pin | Raspberry Pi Pin |
|---|---|
| S (Signal) | Pin 12 (GPIO 18, hardware PWM) |
| +Vin | Pin 1 (3.3V) |
| - (GND) | Pin 6 (GND) |
gpiozero library's TonalBuzzer class is the easiest way to play melodies on the Pi without managing PWM frequencies manually.
Raspberry Pi Pico Wiring
The Pico's hardware PWM works on every GPIO. Pick any free GP pin for the signal.
| KY-006 Pin | Pico Pin |
|---|---|
| S (Signal) | GP15 |
| +Vin | 3V3 (OUT) |
| - (GND) | GND |
Code Examples
Arduino - Play a Two-Tone Beep
// KY-006 Passive Buzzer - alternating two-tone beep on Arduino
// Wire S to D8, +Vin to 5V, - to GND
const int buzzerPin = 8;
void setup() {
pinMode(buzzerPin, OUTPUT);
}
void loop() {
tone(buzzerPin, 1000); // 1 kHz tone
delay(250);
tone(buzzerPin, 2000); // 2 kHz tone
delay(250);
noTone(buzzerPin); // silence
delay(500);
}
Arduino - Play "Mary Had a Little Lamb"
// KY-006 - Play a simple melody using note frequencies
const int buzzerPin = 8;
// Note frequencies in Hz
#define NOTE_C5 523
#define NOTE_D5 587
#define NOTE_E5 659
#define NOTE_G5 784
int melody[] = {NOTE_E5, NOTE_D5, NOTE_C5, NOTE_D5, NOTE_E5, NOTE_E5, NOTE_E5};
int durations[] = {300, 300, 300, 300, 300, 300, 600};
void setup() {
pinMode(buzzerPin, OUTPUT);
for (int i = 0; i < 7; i++) {
tone(buzzerPin, melody[i], durations[i]);
delay(durations[i] + 50);
}
noTone(buzzerPin);
}
void loop() {}
Raspberry Pi Pico - MicroPython
# KY-006 on Raspberry Pi Pico - PWM tone (MicroPython)
# Wire S to GP15, +Vin to 3V3 (OUT), - to GND
from machine import Pin, PWM
import time
buzzer = PWM(Pin(15))
buzzer.duty_u16(32768) # 50% duty cycle
for freq in [1000, 1500, 2000, 2500]:
buzzer.freq(freq)
time.sleep(0.3)
buzzer.duty_u16(0) # silence
buzzer.deinit()
Raspberry Pi (Python)
#!/usr/bin/env python3
# KY-006 on Raspberry Pi - play a tone with gpiozero
# pip install gpiozero
from gpiozero import TonalBuzzer
from gpiozero.tones import Tone
import time
buzzer = TonalBuzzer(18) # GPIO 18 (hardware PWM)
for note in ["C4", "E4", "G4", "C5"]:
buzzer.play(Tone(note))
time.sleep(0.4)
buzzer.stop()
Frequently Asked Questions
tone() and you control the pitch. An active buzzer has its own oscillator and just plays one fixed tone whenever you apply power. Use passive when you want musical notes or variable beep pitches; use active for a simple "is it on or off?" alert.tone(pin, 2000) sketch to confirm it's working.