This circuit is an RFID-based access control system. It uses an Arduino UNO to interface with an RFID reader, a servo motor, a buzzer, an RTC module, an I2C LCD, and an ESP8266 NodeMCU for Wi-Fi connectivity. The system reads RFID tags, checks for authorized access, and logs access attempts to a Firebase database via the ESP8266.
Arduino UNO
RFID-RC522
Buzzer
RTC
Servo
16x2 I2C LCD
ESP8266 NodeMCU
LED: Two Pin (red)
Resistor (200 Ohms)
LED: Two Pin (green)
#include <Wire.h>
#include <LiquidCrystal_PCF8574.h>
#include <SPI.h>
#include <MFRC522.h>
#include <Servo.h>
// Define the I2C address for the LCD
#define LCD_ADDRESS 0x27
// RFID Module Pins
#define RFID_PIN_RST 9
#define RFID_PIN_SDA 10
// Buzzer Pin
#define BUZZER_PIN 2
// Servo Pin
#define SERVO_PIN 4
// Authorized UID
const String authorizedUID = "608ACD21";
// Create objects for peripherals
LiquidCrystal_PCF8574 lcd(LCD_ADDRESS);
MFRC522 rfid(RFID_PIN_SDA, RFID_PIN_RST);
Servo servo;
void setup() {
Serial.begin(9600);
lcd.begin(16, 2);
lcd.setBacklight(255);
lcd.clear();
lcd.print("Scan your tag...");
SPI.begin();
rfid.PCD_Init();
pinMode(BUZZER_PIN, OUTPUT);
servo.attach(SERVO_PIN);
servo.write(0);
}
void loop() {
handleRFID();
}
void handleRFID() {
if (!rfid.PICC_IsNewCardPresent() || !rfid.PICC_ReadCardSerial()) {
return; // No card found
}
// Read the UID
String scannedUID = "";
for (byte i = 0; i < rfid.uid.size; i++) {
scannedUID += String(rfid.uid.uidByte[i], HEX);
}
scannedUID.toUpperCase();
lcd.clear();
String accessStatus;
if (scannedUID == authorizedUID) {
lcd.print("Access Granted");
servo.write(180);
tone(BUZZER_PIN, 1000);
delay(500);
noTone(BUZZER_PIN);
delay(3000);
servo.write(0);
accessStatus = "Granted";
} else {
lcd.print("Access Denied");
for (int i = 0; i < 2; i++) {
tone(BUZZER_PIN, 1000);
delay(300);
noTone(BUZZER_PIN);
delay(300);
}
accessStatus = "Denied";
}
// Send UID, access status, and timestamp to ESP8266
unsigned long timestamp = millis();
Serial.println(scannedUID + ":" + accessStatus + ":" + String(timestamp));
delay(500); // Small delay for stability
lcd.clear();
lcd.print("Scan your tag...");
rfid.PICC_HaltA(); // Halt PICC communication
rfid.PCD_StopCrypto1(); // Stop encryption
}
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <Firebase_ESP_Client.h>
#include "addons/TokenHelper.h"
#include "addons/RTDBHelper.h"
#include <SoftwareSerial.h>
// Wi-Fi credentials
#define WIFI_SSID "IT Club"
#define WIFI_PASSWORD "#9]BF4crc1"
// Firebase credentials
#define API_KEY "AIza