RFID DOOR LOCK SYSTEM USING ARDUINO UNO

Job ID: 40461790

Budget: ₹1,500 – ₹12,500 INR

1. ABSTRACT

This project presents an RFID-based door locking system using Arduino Uno to provide secure and contactless access control. The system uses RFID tags/cards to authenticate users and controls a servo motor to lock or unlock the door. An LCD display provides real-time status updates, and a buzzer gives audio feedback for access granted or denied. This system demonstrates the integration of embedded systems, IoT concepts, and automation for security applications.

2. OBJECTIVE

To design a secure, keyless door locking system using RFID technology
To integrate multiple electronic components such as RFID reader, servo motor, LCD, and buzzer with Arduino
To validate authorized users using stored RFID UID data
To provide real-time feedback using LCD and buzzer
To develop hands-on skills in embedded systems and automation

3. COMPONENTS REQUIRED

Arduino Uno
RFID Reader Module (RC522)
RFID Tags/Cards
Servo Motor
16x2 I2C LCD Display
Buzzer
Jumper Wires
Breadboard
External 5V Power Supply (recommended for servo)

4. CIRCUIT CONNECTIONS

RFID RC522 (SPI Interface)

SDA (SS) → D10
SCK → D13
MOSI → D11
MISO → D12
RST → D9
VCC → 3.3V
GND → GND

16x2 I2C LCD

SDA → A4
SCL → A5
VCC → 5V
GND → GND

Servo Motor

Signal → D8
VCC → 5V (external recommended)
GND → GND

Buzzer

Positive → D6
Negative → GND

5. WORKING PRINCIPLE

When powered ON, the system initializes LCD, RFID reader, servo motor, and buzzer.
The LCD displays “System Ready – Present Card”.
The user scans an RFID card near the reader.
The Arduino reads the unique UID from the card.
The UID is compared with pre-stored authorized IDs in memory.

✔ If UID is valid:

LCD shows “Access Granted”
Buzzer gives a short beep
Servo motor rotates to unlock position
Door remains open for a few seconds
Then automatically locks again

❌ If UID is invalid:

LCD shows “Access Denied”
Buzzer gives a long alert beep
Door remains locked


6.SOFTWARE USED

Arduino IDE
Embedded C Programming

7. PROGRAMMING: -

#include <SPI.h>
#include <MFRC522.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <Servo.h>

// Pins
#define SS_PIN 10 // RC522 SDA / SS
#define RST_PIN 9 // RC522 Reset
#define SERVO_PIN 8 // Servo SIGNAL
#define BUZZER_PIN 6 // Active buzzer (+)

// LCD address: use 0x27 (default) or change if your I2C scanner shows another
LiquidCrystal_I2C lcd(0x27, 16, 2);
MFRC522 mfrc522(SS_PIN, RST_PIN);
Servo doorServo;

// Adjust angles to match your lock positions!
// LOCKED_POS = angle for locked (default: 10)
// UNLOCKED_POS = angle for unlocked/open (default: 90)
const int LOCKED_POS = 10;
const int UNLOCKED_POS = 90;

// List of allowed UIDs (in "XX-YY-ZZ-AA" format, uppercase, dash-separated)
String allowedUIDs[] = {
"0F-34-C9-C4",
"1B-61-F6-04",
"EE-2F-D1-89",
"0E-9A-CC-89"
};
const int allowedCount = sizeof(allowedUIDs) / sizeof(allowedUIDs[0]);

void setup() {
Serial.begin(115200);

// Initialize LCD
lcd.init();
lcd.backlight();
lcd.clear();
lcd.setCursor(0,0);
lcd.print("System ready.");
lcd.setCursor(0,1);
lcd.print("Present card...");

// Initialize RC522
SPI.begin();
mfrc522.PCD_Init();

// Initialize Servo & buzzer
doorServo.attach(SERVO_PIN);
pinMode(BUZZER_PIN, OUTPUT);

// Lock the door initially
doorServo.write(LOCKED_POS);

Serial.println("System ready. Present a card...");
}

void loop() {
// Check for a new RFID card
if (!mfrc522.PICC_IsNewCardPresent() || !mfrc522.PICC_ReadCardSerial())
return;

// Convert UID to string in XX-YY-ZZ-AA format (UPPERCASE)
String uidString = "";
for (byte i = 0; i < mfrc522.uid.size; i++) {
if (mfrc522.uid.uidByte[i] < 0x10)
uidString += "0";
uidString += String(mfrc522.uid.uidByte[i], HEX);
if (i < mfrc522.uid.size - 1)
uidString += "-";
}
uidString.toUpperCase();

Serial.print("Card UID read: ");
Serial.println(uidString);

// Show UID on LCD
lcd.clear();
lcd.setCursor(0,0); lcd.print("UID:");
lcd.setCursor(0,1); lcd.print(uidString);

delay(400); // Optional: show UID before status

// Check if card is in allowed UIDs
if (isAuthorized(uidString)) {
grantAccess();
} else {
denyAccess();
}

// End RFID communication
mfrc522.PICC_HaltA();
mfrc522.PCD_StopCrypto1();
}

/* Check if UID matches any allowed */
bool isAuthorized(String uid) {
for (int i = 0; i < allowedCount; i++) {
if (uid.equalsIgnoreCase(allowedUIDs[i]))
return true;
}
return false;
}

/* Door unlock routine */
void grantAccess() {
Serial.println("Access Granted → Servo OPEN");
lcd.clear(); lcd.setCursor(0,0); lcd.print("Access Granted");
lcd.setCursor(0,1); lcd.print("Welcome");

tone(BUZZER_PIN, 2000, 120); // short high tone

doorServo.write(UNLOCKED_POS);
delay(4000); // Door stays unlocked for 4 seconds

doorServo.write(LOCKED_POS);
Serial.println("Servo CLOSED again");
lcd.clear();
lcd.setCursor(0,0); lcd.print("Door Closed");
delay(800);
lcd.clear();
lcd.setCursor(0,0); lcd.print("Present card...");
}

/* Door deny routine */
void denyAccess() {
Serial.println("Access Denied");
lcd.clear(); lcd.setCursor(0,0); lcd.print("Access Denied");
lcd.setCursor(0,1); lcd.print("Try again...");
tone(BUZZER_PIN, 1000, 400); // long low tone
delay(800);
lcd.clear();
lcd.setCursor(0,0); lcd.print("Present card...");
}

PROGRAM FLOW

Initialize all components
Wait for RFID card
Read UID
Compare UID with authorized list
If match → Unlock door
Else → Deny access
Repeat process

8. ADVANTAGES

Keyless and secure access system
Easy to add/remove users
Fast authentication
Low cost implementation
Useful for smart home automation learning

9. LIMITATIONS

RFID cards can be cloned in low-security systems
Limited reading range
Requires continuous power supply
Servo motor is not suitable for heavy locks
No internet/cloud security integration

10. APPLICATIONS

Home security systems
College lab access control
Office entry systems
Hostel room security
Smart automation systems

11. CONCLUSION

The RFID-based Door Lock System using Arduino Uno is an efficient and low-cost security solution that replaces traditional keys with RFID authentication. It enhances convenience and security while providing practical knowledge of embedded systems, automation, and microcontroller interfacing. The project is scalable and can be improved with IoT integration and encrypted authentication for higher security applications.