This circuit is an RFID-based door lock system using an Arduino UNO. The system includes an RFID reader, an LCD display, a servo motor for locking and unlocking, LEDs for status indication, and a buzzer for alerting invalid access. The Arduino UNO controls all components and processes the RFID tags to determine access.
Arduino UNO
LED: Two Pin (red)
LED: Two Pin (blue)
LED: Two Pin (green)
Resistor (220 Ohms)
Servo
16x2 I2C LCD
RFID-RC522
Buzzer
#include <SPI.h>
#include <MFRC522.h>
#define RST_PIN 9
#define SS_PIN 10
MFRC522 mfrc522(SS_PIN, RST_PIN);
String UIDCard = "";
void setup() {
Serial.begin(9600);
SPI.begin();
mfrc522.PCD_Init();
Serial.println("Scan your RFID Card:");
for (int i = 0; i < 20; i++) {
Serial.print(".");
delay(50);
}
Serial.println("");
}
void loop() {
while (getUID()) {
Serial.print("UID: ");
Serial.println(UIDCard);
for (int i = 0; i < 20; i++) {
Serial.print(".");
delay(50);
}
delay(3000);
}
}
boolean getUID() {
if (!mfrc522.PICC_IsNewCardPresent()) {
return false;
}
if (!mfrc522.PICC_ReadCardSerial()) {
return false;
}
UIDCard = "";
for (byte i = 0; i < mfrc522.uid.size; i++) {
UIDCard.concat(String(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " "));
UIDCard.concat(String(mfrc522.uid.uidByte[i], HEX));
}
UIDCard.toUpperCase();
UIDCard = UIDCard.substring(1);
mfrc522.PICC_HaltA();
return true;
}
#include <SPI.h>
#include <MFRC522.h>
#define RST_PIN 9
#define SS_PIN 10
MFRC522 mfrc522(SS_PIN, RST_PIN);
String UIDCard = "";
void setup() {
Serial.begin(9600);
SPI.begin();
mfrc522.PCD_Init();
Serial.println("Scan your RFID Card:");
for (int i = 0; i < 20; i++) {
Serial.print(".");
delay(50);
}
Serial.println("");
}
void loop() {
while (getUID()) {
Serial.print("UID: ");
Serial.println(UIDCard);
for (int i = 0; i < 20; i++) {
Serial.print(".");
delay(50);
}
delay(3000);
}
}
boolean getUID() {
if (!mfrc522.PICC_IsNewCardPresent()) {
return false;
}
if (!mfrc522.PICC_ReadCardSerial()) {
return false;
}
UIDCard = "";
for (byte i = 0; i < mfrc522.uid.size; i++) {
UIDCard.concat(String(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " "));
UIDCard.concat(String(mfrc522.uid.uidByte[i], HEX));
}
UIDCard.toUpperCase();
UIDCard = UIDCard.substring(1);
mfrc522.PICC_HaltA();
return true;
}
/*
* Arduino RFID Door Lock
* Components: RFID-RC522, LCD, Buzzer, Red LED, Blue LED, Green LED,
* 3x 220 Ohm Resistors, Arduino UNO, Servo Motor
*
* This code controls an RFID-based door lock system. When a valid RFID tag
* is detected, the servo motor unlocks the door, the green LED lights up,
* and a message is displayed on the LCD. If an invalid tag is detected,
* the red LED lights up and the buzzer sounds. The blue LED indicates
* system readiness.
*/
#include <SPI.h>
#include <MFRC522.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <Servo.h>
#define SS_PIN 10
#define RST_PIN 9