Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino RFID Attendance System with SMS Alerts and RTC Synchronization

View and Edit Project In Cirkit DesignerImage of Arduino RFID Attendance System with SMS Alerts and RTC Synchronization

Circuit Documentation

Summary

This circuit is designed to create an RFID Attendance System using an Arduino Uno R3 as the central microcontroller. The system features an RFID reader for logging attendance, a Real-Time Clock (RTC) for timekeeping, a SIM800L module for sending SMS messages, a piezo buzzer for audible alerts, an LCD display for user feedback, and two LEDs (red and green) to indicate access status. The system is powered by the Arduino's 3.3V and 5V outputs and includes resistors for current limiting to the LEDs.

Component List

RFID-RC522

Piezo Buzzer

LCD I2C Display

Resistor (200 Ohms)

LED: Two Pin (red)

LED: Two Pin (green)

DS3231 RTC

SIM800L

1-Channel Relay (5V 10A)

Arduino Uno R3

Wiring Details

RFID-RC522

Piezo Buzzer

LCD I2C Display

Resistor (200 Ohms)

LED: Two Pin (red)

LED: Two Pin (green)

DS3231 RTC

SIM800L

1-Channel Relay (5V 10A)

Arduino Uno R3

Documented Code

/*
 * RFID Attendance System using Arduino Uno R3
 * This system uses an RFID reader to log attendance, an RTC to check the time,
 * a SIM800L module to send messages to parents, a buzzer for alerts, an LCD
 * display for messages, and two LEDs to indicate access status.
 */

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <SPI.h>
#include <MFRC522.h>
#include <DS3231.h>
#include <SoftwareSerial.h>

// Pin definitions
#define RST_PIN 9
#define SS_PIN 10
#define GREEN_LED_PIN 4
#define RED_LED_PIN 5
#define BUZZER_PIN 7
#define RELAY_PIN 6
#define SIM800_TX 3
#define SIM800_RX 2

// Initialize components
LiquidCrystal_I2C lcd(0x27, 16, 2);
MFRC522 rfid(SS_PIN, RST_PIN);
DS3231 rtc(SDA, SCL);
SoftwareSerial sim800(SIM800_TX, SIM800_RX);

void setup() {
  // Initialize serial communication
  Serial.begin(9600);
  sim800.begin(9600);

  // Initialize LCD
  lcd.begin();
  lcd.backlight();

  // Initialize RFID
  SPI.begin();
  rfid.PCD_Init();

  // Initialize RTC
  rtc.begin();

  // Initialize pins
  pinMode(GREEN_LED_PIN, OUTPUT);
  pinMode(RED_LED_PIN, OUTPUT);
  pinMode(BUZZER_PIN, OUTPUT);
  pinMode(RELAY_PIN, OUTPUT);

  // Welcome message
  lcd.setCursor(0, 0);
  lcd.print("RFID Attendance");
  lcd.setCursor(0, 1);
  lcd.print("System");
  delay(2000);
  lcd.clear();
}

void loop() {
  // Check for RFID card
  if (!rfid.PICC_IsNewCardPresent() || !rfid.PICC_ReadCardSerial()) {
    return;
  }

  // Get current time
  DateTime now = rtc.now();

  // Check if student is on time
  if (isOnTime(now)) {
    grantAccess();
  } else {
    denyAccess();
  }

  // Halt PICC
  rfid.PICC_HaltA();
}

bool isOnTime(DateTime now) {
  // Define the allowed time range (e.g., 8:00 AM to 9:00 AM)
  DateTime start(2023, 1, 1, 8, 0, 0);
  DateTime end(2023, 1, 1, 9, 0, 0);
  return now >= start && now <= end;
}

void grantAccess() {
  // Turn on green LED
  digitalWrite(GREEN_LED_PIN, HIGH);
  digitalWrite(RED_LED_PIN, LOW);

  // Activate relay
  digitalWrite(RELAY_PIN, HIGH);

  // Display message
  lcd.setCursor(0, 0);
  lcd.print("Access Granted");

  // Send SMS
  sendSMS("Access Granted");

  // Deactivate relay after delay
  delay(5000);
  digitalWrite(RELAY_PIN, LOW);
  lcd.clear();
}

void denyAccess() {
  // Turn on red LED
  digitalWrite(RED_LED_PIN, HIGH);
  digitalWrite(GREEN_LED_PIN, LOW);

  // Activate buzzer
  digitalWrite(BUZZER_PIN, HIGH);
  delay(1000);
  digitalWrite(BUZZER_PIN, LOW);

  // Display message
  lcd.setCursor(0, 0);
  lcd.print("Access Denied");

  // Send SMS
  sendSMS("Access Denied");

  delay(5000);
  lcd.clear();
}

void sendSMS(String message) {
  sim800.print("AT+CMGF=1\r");
  delay(100);
  sim800.print("AT+CMGS=\"+1234567890\"\r");
  delay(100);
  sim800.print(message);
  delay(100);
  sim800.write(26);
  delay(1000);
}

This code is responsible for controlling the RFID Attendance System. It initializes the components, checks for RFID card presence, verifies the time with the RTC, grants or denies access accordingly, and sends SMS messages using the SIM800L module. The LCD displays messages, and the LEDs and buzzer provide visual and audible feedback.