HOW TO INTERFACE AN ACTIVE BUZZER WITH ARDUINO

by Adesolasamuel in Circuits > Arduino

2351 Views, 1 Favorites, 0 Comments

HOW TO INTERFACE AN ACTIVE BUZZER WITH ARDUINO

active buzzer 2.jpg
Active buzzer 1.jpg

Making sound on the arduino is an interesting project, this con be accomplish using different modules and devices depending on your project and choices. In this project, we'll be looking at the way you can make sound with a buzzer. Buzzer used by hobbyist come in two types: The active buzzer and the passive buzzer. For this project, we are going to be using an active buzzer. Check out my tutorial on using a passive buzzer.

An active buzzer will generate a tone using an internal oscillator, so all that is needed is a DC voltage. To generate tone with an active buzzer, all you need is a DC voltage. Most active buzzer can be powered with 3-5V.

An active buzzer can be controlled from an Arduino pin, very similar to the way you turn on and off an LED using digitalWrite.

Materials

Active Buzzer

Arduino Board (Uno in this case)

Jumper wires

Circuit Diagram

Active buzzer schema.jpg

A simple schematic of how you can connect your active buzzer to the Arduino is show below. You can use any digital pin of the arduino for the positive pin and connect the negative pin to ground. There is need to use a resistor since the buzzer operates on 5V. You can recognize the positive pin by looking at the top side of the buzzer, you will a point marked "+", the pin on this side is the positive pin.

NOTE: Its not advisable to control the buzzer using analogWrite i.e. PWM.

Working Code

The code below gives an example of how you can use the active buzzer.

// Code to make an active buzzer sound for 1 second and go off

//Author: Adesola Samuel

//Date: November, 2020.

//put the positive pin of the buzzer to pin 7

#define buzzerPin 7

void setup() {

pinMode(buzzerPin,OUTPUT);

}

//The buzzer on for 1 second and off for 1 second

void loop() {

delay(1000);

digitalWrite(buzzerPin,HIGH);

delay(1000);

digitalWrite(buzzerPin,LOW);

}

Application

The active buzzer can be use in alarm system. The system can be based on a motion sensing whereby the buzzer sound whenever motion is detected. You can also apply the buzzer in many other ways depending on your project and imagination.