KY-006 Passive Buzzer Module

View on Amazon
Overview
About KY-006 Passive Buzzer Module
The KY-006 is a piezoelectric passive buzzer module capable of generating tones between 1.5 kHz and 2.5 kHz when driven by a PWM signal. Unlike active buzzers, it requires an external signal, allowing for custom tones and melodies.
⚡ Key Features
- Customizable Sound Output – Produces tones and melodies via PWM control.
- Frequency Range – Operates between 1.5 kHz and 2.5 kHz.
- Operating Voltage – Compatible with 3.3V to 5V, making it ideal for ESP32, Arduino, and other microcontrollers.
- Compact Design – Measures 18.5mm × 15mm, perfect for audio alerts in embedded projects.
With its flexibility and easy integration, the KY-006 is an excellent choice for sound-based notifications, alarms, and interactive projects. 🚀
Get Your KY-006
Prices are subject to change. We earn from qualifying purchases as an Amazon Associate.
KY-006 Specifications
Complete technical specification details for KY-006 Passive Buzzer Module
📊 Technical Parameters
KY-006 Pinout
The **KY-006** is a 3-pin passive piezoelectric buzzer module:
Visual Pinout Diagram

Pin Types
Quick Tips
**Interface**: PWM (Pulse Width Modulation) input,🔊 **Type**: Passive piezoelectric buzzer (requires external signal)
**Frequency**: 1.5 kHz to 2.5 kHz range,⚡ **Power**: 3.3V or 5V operation
**Size**: 18.5mm × 15mm compact design,🎯 **Applications**: Custom tones, melodies, alarms, audio notifications
Pin Descriptions
| Pin Name | Type | Description | Notes |
|---|---|---|---|
1 Pin (S) | Communication | PWM signal input | Requires PWM for tone generation |
2 Pin (+) | Power | Power supply | 3.3V or 5V |
3 Pin (-) | Power | Ground connection |
Wiring KY-006 to ESP32
To interface the **KY-006** with an **ESP32** for PWM-driven tones:
Visual Wiring Diagram

Connection Status
Protocol
Pin Connections
| KY-006 Pin | Connection | ESP32 Pin | Description |
|---|---|---|---|
1 Pin (S) Required | GPIO18 | PWM signal (any PWM-capable GPIO) | |
2 Pin (+) Required | 3.3V or 5V | Power supply | |
3 Pin (-) Required | GND | Ground |
**PWM Pins**: Use any PWM-capable GPIO, GPIO18 is just an example
**Voltage**: Use 3.3V or 5V depending on desired volume
**Frequency Control**: Adjust PWM frequency to create different tones
**Melodies**: Can play custom melodies by changing frequencies
KY-006 Troubleshooting
Common issues and solutions to help you get your sensor working
Common Issues
Issue: The buzzer does not produce any sound when expected.
Solutions:
- Ensure that the signal pin is connected to a PWM-capable GPIO pin on the microcontroller.
- Verify that the PWM signal is being generated correctly in the code.
- Check all wiring connections for continuity and correctness.
- Confirm that the supply voltage is within the specified range (3.3V to 5V).
Issue: The buzzer produces distorted sounds or tones that are not as intended.
Solutions:
- Ensure that the PWM frequency is set within the buzzer's optimal range (1.5 kHz to 2.5 kHz).
- Check for any software conflicts that might affect PWM signal generation.
- Verify that there are no loose connections or interference affecting the signal integrity.
Debugging Tips
Use the Serial Monitor to check for error messages and verify the sensor's output. Add debug prints in your code to track the sensor's state.
Use a multimeter to verify voltage levels and check for continuity in your connections. Ensure the power supply is stable and within the sensor's requirements.
Additional Resources
KY-006 Programming Examples
Ready-to-use code examples for different platforms and frameworks
#define BUZZER_PIN 8
void setup() {
pinMode(BUZZER_PIN, OUTPUT);
}
void loop() {
tone(BUZZER_PIN, 1000); // Play tone at 1000 Hz
delay(500);
noTone(BUZZER_PIN); // Stop tone
delay(500);
}This Arduino code uses the tone() function to generate a 1000 Hz sound from the KY-006 passive buzzer connected to pin 8. The buzzer plays the tone for 500 milliseconds, then stops for 500 milliseconds, creating a beeping effect.
This ESP-IDF code sets up the KY-006 passive buzzer on GPIO18 using the LEDC PWM module. It generates a 2 kHz tone by setting the duty cycle to 50% (512 out of 1024) and uses a hardware timer to control the frequency. The buzzer will continue to emit the tone until the duty cycle is set to 0 or the program stops.
output:
- platform: ledc
pin: GPIO18
id: buzzer_pwm
switch:
- platform: template
name: "KY-006 Buzzer"
turn_on_action:
- output.set_frequency:
id: buzzer_pwm
frequency: 2000Hz
- output.set_level:
id: buzzer_pwm
level: 50%
turn_off_action:
- output.set_level:
id: buzzer_pwm
level: 0%This ESPHome configuration sets up the KY-006 passive buzzer on GPIO18 using the LEDC module for PWM control. The buzzer emits a 2 kHz tone when turned on and stops when turned off.
platformio.ini
[env:esp32]
platform = espressif32
board = esp32dev
framework = arduinomain.cpp
#include <Arduino.h>
#define BUZZER_PIN 18
void setup() {
pinMode(BUZZER_PIN, OUTPUT);
}
void loop() {
tone(BUZZER_PIN, 2000); // Generate 2 kHz tone
delay(500);
noTone(BUZZER_PIN);
delay(500);
}This PlatformIO code initializes the KY-006 passive buzzer on GPIO18. It generates a 2 kHz tone for 500ms, then stops for 500ms, creating a beeping effect.
import machine
import time
BUZZER_PIN = machine.Pin(18, machine.Pin.OUT)
PWM = machine.PWM(BUZZER_PIN)
PWM.freq(2000)
while True:
PWM.duty(512) # 50% duty cycle
time.sleep(0.5)
PWM.duty(0)
time.sleep(0.5)This MicroPython script configures the KY-006 passive buzzer on GPIO18 using PWM. It sets the frequency to 2 kHz and alternates between 50% duty cycle (sound on) and 0% duty cycle (sound off) every 500ms.
Wrapping Up KY-006
The ESP32 KY-006 Passive Buzzer Module is a powerful KY-0xx module sensor that offers excellent performance and reliability. With support for multiple development platforms including Arduino, ESP-IDF, ESPHome, PlatformIO, and MicroPython, it's a versatile choice for your IoT projects.
Best Practices
For optimal performance, ensure proper wiring and follow the recommended configuration for your chosen development platform.
Safety First
Always verify power supply requirements and pin connections before powering up your project to avoid potential damage.
Ready to Start Building?
Now that you have all the information you need, it's time to integrate the KY-006 into your ESP32 project and bring your ideas to life!








