KY-012 Active Piezo-Buzzer
When this sensor is powered, this active buzzer generates a sound with the frequency of 2.5kHz.
- Arduino
- Raspberry Pi
- Raspberry Pi Pico
- Micro:Bit
![](/files/files/sensors/KY-006/KY-006.png)
This module contains an active buzzer that immediately generates a sound when it is supplied with voltage. Unlike a passive buzzer, this module does not require an external square-wave voltage to generate a sound. As soon as a voltage of at least 3.3 V is applied to the signal pin, the buzzer automatically generates the necessary square-wave voltage and emits a tone with a frequency of 2.5 kHz.
The buzzer operates in a voltage range of 3.3 V to 5 V and requires a maximum current of 30 mA. It produces a loud sound with a minimum volume of 85 dB, which makes it ideal for applications where a clearly audible acoustic signal is required. This can be useful, for example, in alarm systems, warning systems or as acoustic feedback in various electronic devices.
Technical Data | |
---|---|
Operating voltage | 3,3 V - 5 V |
Maximum current | 30 mA |
Tone frequency | 2,5kHz ± 300 Hz |
Minimum sound output | 85 dB |
Operating temperature | -20 °C - 70 °C |
Storage temperature | -30 °C - 105 °C |
Dimensions | 19 x 15,5 x 11 mm |
Pin assignment
Arduino | Sensor |
---|---|
Pin 13 | Signal |
- | +V |
GND | GND |
Code-Example
This code example shows how the buzzer can be switched on alternately for four seconds and then switched off for two seconds using a definable output pin.
int Buzzer = 13;
void setup ()
{
pinMode (Buzzer, OUTPUT); // Initialize output pin for the buzzer
}
void loop () //main program loop
{
digitalWrite (Buzzer, HIGH); // Buzzer is switched on
delay (4000); // wait mode for 4 seconds
digitalWrite (Buzzer, LOW); // Buzzer is switched off
delay (2000); // Wait mode for another two seconds in which the LED is then turned off
}
Example program download
![](/files/files/sensors/KY-006/KY-006.png)
This module contains an active buzzer that immediately generates a sound when it is supplied with voltage. Unlike a passive buzzer, this module does not require an external square-wave voltage to generate a sound. As soon as a voltage of at least 3.3 V is applied to the signal pin, the buzzer automatically generates the necessary square-wave voltage and emits a tone with a frequency of 2.5 kHz.
The buzzer operates in a voltage range of 3.3 V to 5 V and requires a maximum current of 30 mA. It produces a loud sound with a minimum volume of 85 dB, which makes it ideal for applications where a clearly audible acoustic signal is required. This can be useful, for example, in alarm systems, warning systems or as acoustic feedback in various electronic devices.
Technical Data | |
---|---|
Operating voltage | 3,3 V - 5 V |
Maximum current | 30 mA |
Tone frequency | 2,5kHz ± 300 Hz |
Minimum sound output | 85 dB |
Operating temperature | -20 °C - 70 °C |
Storage temperature | -30 °C - 105 °C |
Dimensions | 19 x 15,5 x 11 mm |
Pin assignment
Raspberry Pi | Sensor |
---|---|
GPIO 24 [Pin 18] | Signal |
- | +V |
GND [Pin 6] | GND |
Code-Example
This code example shows how the buzzer can be switched on alternately for four seconds and then switched off for two seconds using a definable output pin.
from gpiozero import Buzzer
import time
# Initialize the Buzzer using the BCM pin number
buzzer = Buzzer(24)
print("Buzzer-Test [press CTRL+C to end the test]")
# Main program loop
try:
while True:
print("Buzzer 4 seconds on")
buzzer.on() # Turn buzzer on
time.sleep(4) # Wait for 4 seconds
print("Buzzer 2 seconds off")
buzzer.off() # Turn buzzer off
time.sleep(2) # Wait for another 2 seconds
# Cleanup after the program has been terminated
except KeyboardInterrupt:
print("Test ended by user")
# gpiozero handles cleanup when the script ends
Example program download
To start with the command:
sudo python3 KY012-RPi.py
![](/files/files/sensors/KY-006/KY-006.png)
This module contains an active buzzer that immediately generates a sound when it is supplied with voltage. Unlike a passive buzzer, this module does not require an external square-wave voltage to generate a sound. As soon as a voltage of at least 3.3 V is applied to the signal pin, the buzzer automatically generates the necessary square-wave voltage and emits a tone with a frequency of 2.5 kHz.
The buzzer operates in a voltage range of 3.3 V to 5 V and requires a maximum current of 30 mA. It produces a loud sound with a minimum volume of 85 dB, which makes it ideal for applications where a clearly audible acoustic signal is required. This can be useful, for example, in alarm systems, warning systems or as acoustic feedback in various electronic devices.
Technical Data | |
---|---|
Operating voltage | 3,3 V - 5 V |
Maximum current | 30 mA |
Tone frequency | 2,5kHz ± 300 Hz |
Minimum sound output | 85 dB |
Operating temperature | -20 °C - 70 °C |
Storage temperature | -30 °C - 105 °C |
Dimensions | 19 x 15,5 x 11 mm |
Pin assignment
Micro:Bit | Sensor |
---|---|
Pin 1 | Signal |
- | +V |
GND | GND |
Code-Example
This is an example program which switches the buzzer ON or OFF.
input.onButtonPressed(Button.A, function () {
pins.digitalWritePin(DigitalPin.P1, 1)
basic.pause(500)
pins.digitalWritePin(DigitalPin.P1, 0)
})
Example program download
![](/files/files/sensors/KY-006/KY-006.png)
This module contains an active buzzer that immediately generates a sound when it is supplied with voltage. Unlike a passive buzzer, this module does not require an external square-wave voltage to generate a sound. As soon as a voltage of at least 3.3 V is applied to the signal pin, the buzzer automatically generates the necessary square-wave voltage and emits a tone with a frequency of 2.5 kHz.
The buzzer operates in a voltage range of 3.3 V to 5 V and requires a maximum current of 30 mA. It produces a loud sound with a minimum volume of 85 dB, which makes it ideal for applications where a clearly audible acoustic signal is required. This can be useful, for example, in alarm systems, warning systems or as acoustic feedback in various electronic devices.
Technical Data | |
---|---|
Operating voltage | 3,3 V - 5 V |
Maximum current | 30 mA |
Tone frequency | 2,5kHz ± 300 Hz |
Minimum sound output | 85 dB |
Operating temperature | -20 °C - 70 °C |
Storage temperature | -30 °C - 105 °C |
Dimensions | 19 x 15,5 x 11 mm |
Pin assignment
Raspberry Pi Pico | Sensor |
---|---|
GPIO18 | Signal |
- | +V |
GND | GND |
This code example shows how the buzzer can be alternately switched on for three seconds and then switched off using a definable output pin.
# Load libraries
from machine import Pin
from utime import sleep
# Initialization of GPIO18 as output
device = Pin(18, Pin.OUT, value=0)
# Switch on buzzer
print("ON")
device.on()
# Wait 3 seconds
print(".")
sleep(1)
print(".")
sleep(1)
print(".")
sleep(1)
# Switch off buzzer
print("OFF")
device.off()