The RFID Door Lock project involves designing and implementing a secure access control system using an Arduino UNO microcontroller, RFID (Radio Frequency Identification) technology, a relay, a solenoid valve (acting as a locking mechanism), and a power supply. The system is intended to control the locking and unlocking of a door based on RFID tags, which serve as unique keys. This type of project is widely used in modern smart home systems and commercial applications where security and ease of access are prioritized.
Components used in Project:
- Arduino UNO:
- Acts as the brain of the system, processing inputs and controlling outputs.
- Reads data from the RFID reader and controls the relay and solenoid valve.
- RFID Reader (MFRC522):
- Used to scan RFID tags (unique IDs) to grant access to authorized individuals.
- Communicates with the Arduino UNO via SPI (Serial Peripheral Interface).
- RFID Tags:
- These are the key cards or tags used to unlock the door.
- Each tag has a unique ID that is stored in the system and used for validation.
- Relay Module:
- Serves as a switch to control the solenoid valve based on input from the Arduino.
- When the correct RFID tag is detected, the relay activates the solenoid valve to unlock the door.
- Solenoid Valve:
- Used as the actual door-locking mechanism.
- When energized, it unlocks the door, and when de-energized, it locks the door again.
- Power Supply (5V or 12V):
- Powers the Arduino, RFID reader, and solenoid valve.
- A separate regulated power supply may be required for the solenoid valve, depending on its voltage requirement.
Working Principle:
- System Initialization:
- When powered on, the Arduino initializes the RFID reader and prepares the system to scan RFID tags.
- The system also initializes the relay in the “locked” state, ensuring the door is secured at startup.
- Tag Scanning:
- The user presents an RFID tag to the RFID reader. The RFID reader scans the unique ID from the tag and sends the data to the Arduino for processing.
- Tag Validation:
- The Arduino compares the scanned tag’s ID with a list of pre-approved IDs stored in its memory (either hardcoded in the program or stored in external memory like EEPROM).
- If the tag is recognized as valid, the Arduino triggers the relay to switch on, activating the solenoid valve and unlocking the door.
- Unlocking the Door:
- Once the relay is activated, the solenoid valve allows the door to unlock. The door remains unlocked for a pre-defined period (e.g., 5 seconds), after which the Arduino deactivates the relay, and the solenoid valve returns to the locked position.
- Invalid Tag Handling:
- If an unrecognized or invalid tag is presented, the system rejects the tag and the door remains locked. Optionally, the system can provide an alert (such as an LED indicator or buzzer) to notify the user that access is denied.
Circuit Diagram:
Code:
#include <SPI.h>
#include <MFRC522.h>
#define RST_PIN 9 // Reset pin for RFID reader
#define SS_PIN 10 // Slave select pin for RFID reader
#define RELAY_PIN 8 // Pin to control the relay
MFRC522 rfid(SS_PIN, RST_PIN); // Create MFRC522 instance
// Predefined valid RFID tag (example)
byte validTag[] = {0xDE, 0xAD, 0xBE, 0xEF};
void setup() {
Serial.begin(9600);
SPI.begin(); // Initiate SPI bus
rfid.PCD_Init(); // Initialize RFID reader
pinMode(RELAY_PIN, OUTPUT);
digitalWrite(RELAY_PIN, LOW); // Ensure relay is off (locked)
Serial.println("RFID Door Lock System Initialized");
}
Applications:
Home Automation: This project can be used in a smart home setup to automate door locking mechanisms.
Office Buildings: Businesses can implement the system for employee access control.
Secure Facilities: High-security areas, such as data centers or research labs, can benefit from RFID-based access control.
Conclusion:
By leveraging Arduino and RFID technology, this project demonstrates a practical and relatively simple approach to creating a secure and automated door lock system.