Arduino RFID Attendance System with SMS Alerts and RTC Synchronization
View and Edit Project In Cirkit Designer
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
- Description: An RFID reader/writer module for contactless communication at 13.56MHz.
- Pins: VCC (3.3V), RST, GND, IRQ, MISO, MOSI, SCK, SDA
Piezo Buzzer
- Description: An electronic buzzer for producing sound.
- Pins: pin 1, pin 2
LCD I2C Display
- Description: A liquid crystal display with an I2C interface for showing text and numbers.
- Pins: GND, VCC, SDA, SCL
Resistor (200 Ohms)
- Description: A resistor with a resistance of 200 Ohms, used for current limiting.
- Pins: pin1, pin2
LED: Two Pin (red)
- Description: A red light-emitting diode for indicating status.
- Pins: cathode, anode
LED: Two Pin (green)
- Description: A green light-emitting diode for indicating status.
- Pins: cathode, anode
DS3231 RTC
- Description: A highly accurate I2C real-time clock with a built-in temperature-compensated crystal oscillator.
- Pins: 32K, SQW, SCL, SDA, VCC, GND
SIM800L
- Description: A GSM/GPRS module for cellular communication.
- Pins: NFT, RING, VCC, DTR, RST, MIC +, RXD, MIC-, TXD, SPK+, GND, SPK-
1-Channel Relay (5V 10A)
- Description: A relay module for controlling high power devices.
- Pins: NC, signal, C, power, NO, ground
Arduino Uno R3
- Description: A microcontroller board based on the ATmega328P.
- Pins: USB Port, Power Jack, Not Connected, IOREF, RESET, 3.3V, 5V, GND, VIN, A0-A5, SCL, SDA, AREF, Digital I/O pins 0-13
Wiring Details
RFID-RC522
- VCC (3.3V) to Arduino Uno 3.3V
- RST to Arduino Uno pin 9
- GND to common ground
- IRQ not connected
- MISO to Arduino Uno pin 12
- MOSI to Arduino Uno pin 11
- SCK to Arduino Uno pin 13
- SDA to Arduino Uno pin 10
Piezo Buzzer
- pin 1 to common ground
- pin 2 to Arduino Uno pin 7
LCD I2C Display
- GND to common ground
- VCC to Arduino Uno 5V
- SDA to Arduino Uno A4/SDA
- SCL to Arduino Uno A5/SCL
Resistor (200 Ohms)
- One resistor between RFID-RC522 GND and common ground
- Another resistor between LED cathodes and common ground
LED: Two Pin (red)
- cathode to 200 Ohm resistor
- anode to Arduino Uno pin 5
LED: Two Pin (green)
- cathode to 200 Ohm resistor
- anode to Arduino Uno pin 4
DS3231 RTC
- VCC to Arduino Uno 5V
- GND to common ground
- SCL to Arduino Uno A5/SCL
- SDA to Arduino Uno A4/SDA
SIM800L
- VCC to Arduino Uno 5V
- GND to common ground
- RST to Arduino Uno pin 8
- RXD to Arduino Uno pin 2
- TXD to Arduino Uno pin 3
1-Channel Relay (5V 10A)
- power to Arduino Uno 5V
- ground to common ground
- signal to Arduino Uno pin 6
Arduino Uno R3
- Powered via USB Port or Power Jack
- Ground pins connected to common ground
- Digital and analog pins connected as specified above
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.