Virtual Expo 2024

Design and Implementation of a Smart School Bell System

Envision
Diode

Design and Implementation of a Smart School Bell System

Abstract

This project presents the development of a Smart School Bell System using Arduino microcontroller technology. The system automates the process of bell ringing in educational institutions by allowing users to input class schedules via a keypad interface. It utilizes an Arduino Uno microcontroller, a liquid crystal display (LCD), a keypad, and a buzzer to manage class timings and generate audible alerts. The system enhances operational efficiency and eliminates the need for manual bell ringing, offering a convenient solution for educational institutions.

I. Introduction

The traditional method of manual bell ringing in schools can be inefficient and prone to errors. The Smart School Bell System aims to address these challenges by automating the process using Arduino technology. This report details the design and implementation of the system, highlighting its components, functionality, and benefits.

II. System Overview

The Smart School Bell System consists of an Arduino Uno microcontroller, a liquid crystal display (LCD) for visual output, a keypad for user input, and a buzzer for generating sound alerts. The system allows users to input class schedules, which are then used to automate bell ringing according to predefined timings.

III. Hardware Components

  1. Arduino Uno Microcontroller: The central processing unit responsible for executing program logic and interfacing with other hardware components.

  2. Liquid Crystal Display (LCD): Provides visual output for displaying current time and class information.

  3. Keypad: Enables user input for setting class schedules and system parameters.

  4. Buzzer: Generates audible alerts to notify students and staff of class start and end times.

IV. Software Components

  1. LiquidCrystal.h Library: Facilitates communication with the LCD display for displaying information.

  2. Keypad.h Library: Enables interfacing with the keypad for user input.

  3. Arduino Sketch: The main program logic written in C/C++ language, responsible for managing class schedules, updating time, and triggering bell alerts.

V. System Functionality

  • Users input class schedules via the keypad interface, including start and end times for each class.

  • The system continuously updates the current time and compares it with the predefined class timings.

  • When a class is about to start or end, the system triggers the buzzer to notify students and staff.

  • The LCD display shows the current time and the name of the ongoing class if applicable.

VI. Code Snippets

Initialization and Library Inclusion

#include <LiquidCrystal.h> // Include the LiquidCrystal library for interfacing with the LCD display
#include <Keypad.h> // Include the Keypad library for interfacing with the keypad

LiquidCrystal lcd(A2, 9, 10, 11, 12, 13); // Initialize the LiquidCrystal library with the pins connected to the LCD

Variable Definitions

//Defining variables
int hours = 0;
int minutes = 0;
int seconds = 0;
int previousMillis = 0;
int numPeriods = 0;
int periodNumber[15];
String periodTimings[15];

bool classEnded = false;
int currentPeriod = -1;
int classcount = 0;
//Defining the subjects which is mapped to a corresponding number
String sub[13] = {"Math","Phy","Chem","Bio","Hist","Geo","Eco","Civ","Eng","2lan","Art","P.T","Lib"};

Keypad Setup

// Define keypad pins and keys
const byte ROWS = 4; // Four rows
const byte COLS = 4; // Four columns
char keys[ROWS][COLS] = {
  {'1','2','3','A'},
  {'4','5','6','B'},
  {'7','8','9','C'},
  {'*','0','#','D'}
};
byte rowPins[ROWS] = {A4, A5, 7, 6}; // Connect keypad ROW0, ROW1, ROW2, and ROW3 to these Arduino pins.
byte colPins[COLS] = {5, 4, 3, 2}; // Connect keypad COL0, COL1, COL2, and COL3 to these Arduino pins.

// Create the Keypad object
Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS);

Period Definitions

// Define periods and their timings
String periodNames[50];
String periodTimings[50];
int numPeriods = 0;

Buzzer Pin Definition

// Define buzzer pin
const int buzzerPin = A2;

Setup Function

void setup()
{
  pinMode(A3 , OUTPUT); // sets the buzzer to be connected to the output pin 
  noTone(A3); //Silences the buzzer in case it is on 
  lcd.begin(16, 2); // Set up the LCD's number of columns and rows
  lcd.setCursor(2, 0);
  lcd.print("Smart School"); // Display a message on the LCD
  lcd.setCursor(5, 1);
  lcd.print("Bell");
  delay(2000); // Wait for 2sec
  
  // Get starting time from keypad input
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Enter start time:");
  lcd.setCursor(0,1);
  lcd.print("HHMM");
  getTimeFromKeypad();
  lcd.setCursor(0, 0);
  // Get the class info from the keypad input 
  lcd.setCursor(0,0);
  getNumClasses();
  getClasses();
}  

Loop Function

void loop() {
    updateTime();
    displayTime();
  
    if (classEnded) {
        tone(buzzerPin, 1000,5000);
        classEnded = false; // Reset classEnded flag
        lcd.clear();
    }
}

Time Update Function

void updateTime() {
    unsigned long currentMillis = millis();
    if (currentMillis - previousMillis >= 1000) {
        // Increment seconds
        seconds++;

        // Update minutes and reset seconds if necessary
        if (seconds >= 60) {
            seconds = 0;
            minutes++;

            // Update hours and reset minutes if necessary
            if (minutes >= 60) {
                minutes = 0;
                hours++;

                // Reset hours if it reaches 24
                if (hours >= 24) {
                    hours = 0;
                }
            }
        }

        // Check if the current time matches any class start time
        if(classcount < numPeriods) 
        {
            int startHour = atoi(periodTimings[classcount].substring(0, 2).c_str());
            int startMinute = atoi(periodTimings[classcount].substring(2, 4).c_str());
            if (hours == startHour && minutes == startMinute && seconds == 0) 
            {
                currentPeriod = classcount; 
              	classEnded = true;
            }
        }

        // Check if the current time matches any class end time
        if(classcount < numPeriods) 
        {
            int endHour = atoi(periodTimings[classcount].substring(4, 6).c_str());
            int endMinute = atoi(periodTimings[classcount].substring(6, 8).c_str());
            if (hours == endHour && minutes == endMinute && seconds == 0) 
            {
                currentPeriod = -1;
              	classcount++ ;// No class currently
                classEnded = true;
            }
        }
      delay(1000);
        // Save the current time for the next iteration
        previousMillis = currentMillis;
    }
}

Time Input Function

void getTimeFromKeypad() {
    String timeStr = "";
    char key = '\0';

    while (key != '#') { // Wait until '#' is pressed to indicate end of input
        key = keypad.getKey();
        if (key) {
            lcd.setCursor(timeStr.length(), 1);
            lcd.print(key);
            timeStr += key;
            delay(200); // Debouncing delay
        }
    }
    lcd.clear();

    // Parse the time string (format: HHMM)
    hours = (timeStr.substring(0, 2)).toInt();
    minutes = (timeStr.substring(2, 4)).toInt();
}

Display Time Function

void displayTime() {
    lcd.setCursor(0, 0);
    lcd.print("Time: ");
    if (hours < 10) {
        lcd.print("0");
    }
    lcd.print(hours);
    lcd.print(":");
    if (minutes < 10) {
        lcd.print("0");
    }
    lcd.print(minutes);
    lcd.print(":");
    if (seconds < 10) {
        lcd.print("0");
    }
    lcd.print(seconds);

   if(currentPeriod != -1)
  {
  	lcd.setCursor(0,1);
    lcd.print("Cur:");
    lcd.print(sub[periodNumber[currentPeriod]]);
  	lcd.setCursor(9,1);
  	lcd.print("Nxt:");
    if(currentPeriod != (numPeriods-1))
    {
      	int nextPeriod = currentPeriod + 1;
    	lcd.print(sub[periodNumber[nextPeriod]]);
    }
    else
    {
      lcd.print("---");
    }
  }
  else
  {
    lcd.setCursor(0,1);
    lcd.print("--Break--");
  }
}

Number of Classes Input Function

//Funtion to get the number of classes in a day
void getNumClasses()
{
  lcd.setCursor(0,0);
  lcd.print("Enter no_class");
  String dum = "";
  char key = '\0';
  while (key != '#') 
  { // Wait until '#' is pressed to indicate end of input
        key = keypad.getKey();
        if (key) 
        {
            lcd.setCursor(dum.length(), 1);
            lcd.print(key);
            dum += key;
            delay(200); // Debouncing delay
        }
  		numPeriods = dum.toInt();
  }
  lcd.clear();
}

Class Information Input Function

//Function to get the info about the classes in the day
void getClasses()
{
  char key='\0';
  String Strname = "";
  String StrTime = "";
  
  for(int i =0;i < numPeriods;i++)
  {
    Strname = "";
    lcd.setCursor(0,0);
    lcd.print("Enter Subject");
  	key='\0';
    lcd.setCursor(0,1);
  	while (key != '#') 
    { // Wait until '#' is pressed to indicate end of input
        key = keypad.getKey();
        if (key) 
        {
            lcd.print(key);
            Strname += key;
            delay(200); // Debouncing delay
		}
    }
    periodNumber[i] = Strname.toInt();
    
    lcd.clear();
    StrTime = "";
    lcd.setCursor(0,0);
    lcd.print("Enter Time");
    lcd.setCursor(0,1);
    lcd.print("HHMMHHMM");
  	key='\0';
  	while (key != '#') 
    { // Wait until '#' is pressed to indicate end of input
        key = keypad.getKey();
        if (key) 
        {
            lcd.setCursor(StrTime.length(), 1);
            lcd.print(key);
            StrTime += key;
            delay(200); // Debouncing delay
		}
    }
    periodTimings[i] = StrTime.c_str();
    lcd.clear();
  }
}  

VII. Conclusion

The Smart School Bell System offers an efficient and automated solution for managing class schedules and bell ringing in educational institutions. By eliminating manual intervention and enhancing operational efficiency, the system improves the overall learning environment for students and facilitates smooth functioning for school staff. Future enhancements may include additional features such as remote monitoring and scheduling capabilities to further enhance the system’s functionality.

VIII. References

[1] Praveen Kumar, “Arduino based Automatic School Bell System”, Available URL: https://www.engineersgarage.com/arduino-based-automatic-school-bell-system/

The link for the meet -- https://meet.google.com/xjg-kmej-qcc
METADATA

Report prepared on May 7, 2024, 7:57 a.m. by:

  • Pavankumar S [Diode]
  • Radhika [Diode]

Report reviewed and approved by Aditya Pandia [CompSoc] on May 9, 2024, 10:49 p.m..

Check out more projects!