ELECTRONIC BELL USING ARDUINO We are living in the automation world, where everything in industrial and home automation is getting automated with the help of an advanced programmable controller. An automatic bell system for schools or institutions reduces the effort necessary to control an electric bell manually that gives alarm for certain intervals of time based on school or college timings. The proposed system uses a simple basic Arduino to make the product affordable. Generally conservative methods need a peon or bell operator to control the bell system for every class and intermission in schools and also institutions. Such systems require plenty human efforts to do so, and need progress in order to become automatic – the ones that reduce human efforts.
A bell is a percussion instrument used in schools that tells the students when it is time to go to class in the morning and when it is time to change classes during the day. The bell is an important instrument in both primary and secondary schools and even in the industries and other businesses where the bell timer plays a critical role in running the day .Bells are also associated with clocks indicating the hour by ringing. In any school, the classes are organized in periods and beginning of a period or break is alerted to the students and teachers by ringing the school bell. Conventionally, the school bell is rang by a peon or multi-tasking assistant but the margin of error where more. To reduce the margin and efforts of human we created automatic bell using Arduino. Basically it includes Arduino UNO as a controller, RTC module which tells real time, Relay module to operate AC machines on DC signal which connects electric bell to AC mains and the electric bell as a output. We designed one program which includes all the time table of the school .As we connect the bell to the AC mains according to the program it will start ringing and after certain time of interval it will stop automatically .The time of start and stop are included in the program it will not require any human efforts to start or stop the bell it is fully automatic.
The working of this Automatic bell system starts with Real time clock module DS3231. This module feeds Arduino with real time and keeps track of it. Through the process of polling Arduino will frequently get the time and date values from this chip. Also user can change the time, date, month and year simply by editing the code. The automatic bell timer is activated by means of a Relay. Adding a flywheel diode will act as a protection to the rest of circuit when the relay is turned OFF. The required libraries are imported like DS3231.h for handling RTC module. The baud rate for data transmission is set to 9600 bits per second using Serial.begin() function . The Arduino Board is programmed using the Arduino IDE software.
Code:-
#include <DS3231.h>
int Relay = 13;
DS3231 rtc(SDA, SCL);
Time t;
int OnHour ;
int OnMin ;
int OnSec ;
int OnDay;
int OffHour ;
int OffMin ;
int OffSec ;
void setup()
{
Serial.begin(9600);
rtc.begin();
pinMode(Relay, OUTPUT);
digitalWrite(Relay, LOW);
}
void loop()
{
t = rtc.getTime();
Serial.print(t.hour);
Serial.print(" hour(s), ");
Serial.print(t.min);
Serial.print(" minute(s)");
Serial.print(t.sec);
Serial.print(" sec(s), ");
Serial.print(t.dow);
Serial.print(" day(s), ");
Serial.println(" ");
delay (1000);
if
(OnDay==MONDAY||TUESDAY||WEDNESDAY||THURSDAY||FRIDAY)
{
OnHour=11;
OnMin=35;
OnSec=5;
OffHour=11;
OffMin=35;
OffSec=15;
if
(t.hour == OnHour && t.min == OnMin && t.sec==OnSec){
digitalWrite(Relay,HIGH);
Serial.println("LIGHT ON");
}
else if(t.hour == OffHour && t.min == OffMin && t.sec==OffSec){
digitalWrite(Relay,LOW);
Serial.println("LIGHT OFF");
}
OnHour=8;
OnMin=0;
OnSec=5;
OffHour=8;
OffMin=0;
OffSec=15;
if
(t.hour == OnHour && t.min == OnMin && t.sec==OnSec){
digitalWrite(Relay,HIGH);
Serial.println("LIGHT ON");
}
else if(t.hour == OffHour && t.min == OffMin && t.sec==OffSec){
digitalWrite(Relay,LOW);
Serial.println("LIGHT OFF");
}
OnHour=9;
OnMin=0;
OnSec=0;
OffHour=9;
OffMin=0;
OffSec=10;
if
(t.hour == OnHour && t.min == OnMin && t.sec==OnSec){
digitalWrite(Relay,HIGH);
Serial.println("LIGHT ON");
}
else if(t.hour == OffHour && t.min == OffMin && t.sec==OffSec){
digitalWrite(Relay,LOW);
Serial.println("LIGHT OFF");
}
OnHour=10;
OnMin=0;
OnSec=0;
OffHour=10;
OffMin=0;
OffSec=10;
if
(t.hour == OnHour && t.min == OnMin && t.sec==OnSec){
digitalWrite(Relay,HIGH);
Serial.println("LIGHT ON");
}
else if(t.hour == OffHour && t.min == OffMin && t.sec==OffSec){
digitalWrite(Relay,LOW);
Serial.println("LIGHT OFF");
}
OnHour=11;
OnMin=0;
OnSec=0;
OffHour=11;
OffMin=0;
OffSec=20;
if
(t.hour == OnHour && t.min == OnMin && t.sec==OnSec){
digitalWrite(Relay,HIGH);
Serial.println("LIGHT ON");
}
else if(t.hour == OffHour && t.min == OffMin && t.sec==OffSec){
digitalWrite(Relay,LOW);
Serial.println("LIGHT OFF");
}
OnHour=11;
OnMin=30;
OnSec=0;
OffHour=11;
OffMin=30;
OffSec=10;
if
(t.hour == OnHour && t.min == OnMin && t.sec==OnSec){
digitalWrite(Relay,HIGH);
Serial.println("LIGHT ON");
}
else if(t.hour == OffHour && t.min == OffMin && t.sec==OffSec){
digitalWrite(Relay,LOW);
Serial.println("LIGHT OFF");
}
OnHour=12;
OnMin=30;
OnSec=0;
OffHour=12;
OffMin=30;
OffSec=10;
if
(t.hour == OnHour && t.min == OnMin && t.sec==OnSec){
digitalWrite(Relay,HIGH);
Serial.println("LIGHT ON");
}
else if(t.hour == OffHour && t.min == OffMin && t.sec==OffSec){
digitalWrite(Relay,LOW);
Serial.println("LIGHT OFF");
}
OnHour=13;
OnMin=30;
OnSec=0;
OffHour=13;
OffMin=30;
OffSec=20;
if
(t.hour == OnHour && t.min == OnMin && t.sec==OnSec){
digitalWrite(Relay,HIGH);
Serial.println("LIGHT ON");
}
else if(t.hour == OffHour && t.min == OffMin && t.sec==OffSec){
digitalWrite(Relay,LOW);
Serial.println("LIGHT OFF");
}
OnHour=14;
OnMin=00;
OnSec=0;
OffHour=14;
OffMin=00;
OffSec=10;
if
(t.hour == OnHour && t.min == OnMin && t.sec==OnSec){
digitalWrite(Relay,HIGH);
Serial.println("LIGHT ON");
}
else if(t.hour == OffHour && t.min == OffMin && t.sec==OffSec){
digitalWrite(Relay,LOW);
Serial.println("LIGHT OFF");
}
OnHour=15;
OnMin=00;
OnSec=0;
OffHour=15;
OffMin=00;
OffSec=10;
if
(t.hour == OnHour && t.min == OnMin && t.sec==OnSec){
digitalWrite(Relay,HIGH);
Serial.println("LIGHT ON");
}
else if(t.hour == OffHour && t.min == OffMin && t.sec==OffSec){
digitalWrite(Relay,LOW);
Serial.println("LIGHT OFF");
}
OnHour=16;
OnMin=00;
OnSec=0;
OffHour=16;
OffMin=00;
OffSec=15;
if
(t.hour == OnHour && t.min == OnMin && t.sec==OnSec){
digitalWrite(Relay,HIGH);
Serial.println("LIGHT ON");
}
else if(t.hour == OffHour && t.min == OffMin && t.sec==OffSec){
digitalWrite(Relay,LOW);
Serial.println("LIGHT OFF");
}
OnHour=16;
OnMin=15;
OnSec=0;
OffHour=16;
OffMin=15;
OffSec=10;
if
(t.hour == OnHour && t.min == OnMin && t.sec==OnSec){
digitalWrite(Relay,HIGH);
Serial.println("LIGHT ON");
}
else if(t.hour == OffHour && t.min == OffMin && t.sec==OffSec){
digitalWrite(Relay,LOW);
Serial.println("LIGHT OFF");
}
OnHour=17;
OnMin=15;
OnSec=0;
OffHour=17;
OffMin=15;
OffSec=10;
if
(t.hour == OnHour && t.min == OnMin && t.sec==OnSec){
digitalWrite(Relay,HIGH);
Serial.println("LIGHT ON");
}
else if(t.hour == OffHour && t.min == OffMin && t.sec==OffSec){
digitalWrite(Relay,LOW);
Serial.println("LIGHT OFF");
}
OnHour=18;
OnMin=15;
OnSec=0;
OffHour=18;
OffMin=15;
OffSec=20;
if
(t.hour == OnHour && t.min == OnMin && t.sec==OnSec){
digitalWrite(Relay,HIGH);
Serial.println("LIGHT ON");
}
else if(t.hour == OffHour && t.min == OffMin && t.sec==OffSec){
digitalWrite(Relay,LOW);
Serial.println("LIGHT OFF");
}
}
else
(OnDay==(SATURDAY));
{
OnHour=23;
OnMin=59;
OnSec=0;
OffHour=0;
OffMin=0;
OffSec=20;
if
(t.hour == OnHour && t.min == OnMin && t.sec==OnSec){
digitalWrite(Relay,HIGH);
Serial.println("LIGHT ON");
}
else if(t.hour == OffHour && t.min == OffMin && t.sec==OffSec){
digitalWrite(Relay,LOW);
Serial.println("LIGHT OFF");
}
}
if
(OnDay==SUNDAY)
{
digitalWrite(Relay,LOW);
Serial.println("LIGHT OFF");
}
}