Connecting a Magnetic Buzzer and LCD display to Arduino

In this blog, I will talk how to connect a magnetic buzzer on Arduino and make it sound. Just for making this project better, i have also connected LCD to it and displaying the message whether ring is happening or not. AC-1005G buzzer is being used for this demo. It will have operating voltage from 3.0 – 8.0 V.

This kind of buzzer can be useful in some projects where you want to sound a alarm when some particular incident happens for example temperature rises to a certain value or water level reaches to some threshold value.

Before going further, I am assuming that you have already gone through the Arduino Basics and familiar with programming Arduino boards using Arduino IDE.

If not, go through my previous blogs Arduino Basics and LED Blinking on Arduino.

For connecting an LCD to Arduino Board, please go through this blog LCD Display

Making Buzzer Connection on Arduino Pins

Pin 6 PWM output of Arduino board should be connected to +ve input of Buzzer.

GND of  Arduino Board should be connected with -ve input of Buzzer

Program on Arduino Software

You can copy and paste whole program from here.

Compile it and Upload it on Arduino Board and observe the output on LCD and Buzzer

//Program starts here

#include

LiquidCrystal lcd(7,8,9,10,11,12);

const int buzzer = 6;

void setup() {
// put your setup code here, to run once:
lcd.begin(16,2);
lcd.clear();
pinMode(buzzer, OUTPUT);
}

void loop() {
// put your main code here, to run repeatedly:
lcd.clear(); // clear the screen
tone(buzzer, 1000); // send 1 khz signal
lcd.print(“RING!!! RING!!!”); // print on LCD that ring is happening
delay(3000); // give delay of 2 sec
lcd.clear();
noTone(buzzer); // stop ringing
lcd.print(“RINGING Stopped”); // print on LCD that ringing has stopped
delay(3000); // delay of 2 sec

}

//Program ends here

Explanation of Program

Functions related to LCD library have already explained in previous blog.

I am explaining the things which are new to this blog.

tone(buzzer, 1000) — this function will send a 1 khz signal to pin named buzzer which is defined as Pin 6 and Magnetic buzzer is connected at Pin 6.

noTone(buzzer) — will stop sending 1 khz signal. Hence, the ringing will stop

this full loop is continuing after every 3 sec interval.

Demo of the Program

Below is the snapshot of the demo when Ringing is stopped on the buzzer

ring_buzzer

Please look at the whole demonstration on Youtube here Buzzer and LCD connection.

-Signing Off, Arduino Novice

Please do follow my Blog and subscribe to my Youtube Channel for more demos and videos related to Arduino.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s