The KY-006 Buzzer Module consists of a passive piezoelectric buzzer, it can generate tones between 1.5 to 2.5 kHz by switching it on and off at different frequencies either using delays or PWM.
Piezoelectric buzzer is composed of multivibrator, piezoelectric buzzer, impedance matching and resonance box, shell and other components. Some piezoelectric buzzer shell is also equipped with light-emitting diodes.
A multivibrator is composed of a transistor or an integrated circuit. When the power supply (1.5 ~ 15V DC operating voltage), multivibrator start, the output 1.5 ~ 2.5kHZ audio signal, impedance matching device to promote the piezoelectric buzzer sound.
The piezoelectric buzzer is made of lead zirconate titanate or lead niobate magnesia piezoelectric ceramic material. In both sides of the ceramic plate coated with silver electrodes, the polarization and aging, and then with the brass or stainless steel sheet together.
Connection
Connect the Power line (middle) and ground (-) to +5 and GND. Connect signal (s) to pin 8 on the Arduino for this example
KY-006 | Arduino |
S | Pin 8 |
middle | +5V |
– | GND |
Code
The following Arduino sketch will generate two different tones, you can see this is due to the change of frequency and the difference in the delay in the for loops. Experiment by changing the values and seeing what sound comes out.
[codesyntax lang=”cpp”]
int buzzer = 8;
void setup() {
pinMode(buzzer, OUTPUT);
}
void loop() {
for (int i = 0; i < 80; i++) {
digitalWrite(buzzer, HIGH); // send high signal to buzzer
delay(1); // delay 1ms
digitalWrite(buzzer, LOW); // send low signal to buzzer
delay(1);
}
delay(50);
for (int j = 0; j < 100; j++) { //make another sound
digitalWrite(buzzer, HIGH);
delay(2); // delay 2ms
digitalWrite(buzzer, LOW);
delay(2);
}
delay(100);
}
[/codesyntax]
Links
37 in 1 box Sensor Kit For Arduino Starters brand in stock