Buzzer Features
A buzzer is a device used to produce sound. There are two types of buzzer: active and passive. In the active model, buzzer starts playing sound only if connected to a power supply, but in the passive model, we need to send a pulse from the microcontroller to play sounds.
The supply voltage of the buzzer is 3 volts, 5 volts and 12 volts.
You can download the passive buzzer datasheet here.
SEN-17-005_Datasheet.pdf
1 file(s) 108.19 KB
Passive Buzzer Module Pinout
Buzzer has 2 pins: DATA and GND but the buzzer module has an extra VCC pin.
You can see the pinout in the image below.
Required Materials
Hardware Components
Interfacing Buzzer with Arduino
Step 1: Circuit
Connect the wires according to the following circuit.
Step 2: Code
Upload the following code to Arduino.
/*
modified on June 5, 2018
by SURYATEJA from create.arduino.cc
Home
*/
const int buzzer = 9; //buzzer to arduino pin 9
void setup(){
pinMode(buzzer, OUTPUT); // Set buzzer - pin 9 as an output
}
void loop(){
tone(buzzer, 1000); // Send 1KHz sound signal...
delay(1000); // ...for 1 sec
noTone(buzzer); // Stop sound...
delay(1000); // ...for 1sec
}