Interface Piezo Buzzer with Arduino | Active and Passive Buzzer
An active buzzer produces a loud single noise whereas a Passive buzzer produces a variety of noise between 1.5 kHz to 2.5 kHz by switching it on and off different frequencies either using PWM or delay.
Working - Piezo contains a very thin plate inside that vibrates or moves to produce a loud noise when a current (alternating current) is applied. It is very simple to use because buzzers is not polarized and can be connected in either direction.
Video link: https://youtu.be/iutrqwSBUHo
In this experiment, we will try out both the Piezo Active buzzer and the Piezo Passive buzzer.
Apparatus Required: 1 Piezo Active Buzzer, 1 Piezo Passive Buzzer, Connecting wires, 1 BreadboardPiezo Active Buzzer
Procedure:
- First of all, connect the Active buzzer to the breadboard.
- Now connect the positive end (see the sticker or the leg which is bigger in length) of the Active buzzer to Arduino's digital pin 8 (red wire).
- At last, connect the negative end of the Active buzzer to the ground (GND).
- The connection is completed for Active Buzzer.
Arduino Sketch:
int buzzerPin = 8;
void setup ()
{
pinMode (buzzerPin, OUTPUT);
}
void loop ()
{
digitalWrite (buzzerPin, HIGH);
delay (500);
digitalWrite (buzzerPin, LOW);
delay (500);
}
Piezo Passive Buzzer
Procedure:
Note: The connection for the Passive buzzer is the same as of Active buzzer, therefore only change the buzzer i.e., replace the Active buzzer with the Passive buzzer.
Now that you have done that upload the sketch that is given below.
Arduino Sketch:
int buzzer = 8; // set the buzzer control digital IO pin
void setup()
{ pinMode(buzzer, OUTPUT); // set pin 9 as output
}
void loop() {
for (int i = 0; i < 100; i++) { // make a sound
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);
}
0 Comments