0% found this document useful (0 votes)
18 views3 pages

Exp 8

Uploaded by

Krishna RS
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views3 pages

Exp 8

Uploaded by

Krishna RS
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

DEPARTMENT OF

COMPUTER SCIENCE & ENGINEERING


Experiment 8

Student Name: Sagar Rawat UID: 22BCS10832


Branch: CSE Section/Group: 22BCS_639_A
Semester: 5th Date of Performance: 14 -10 -24
Subject Name: IOT LAB Subject Code: 22CSP-329

Aim:

To create a smart door lock system using RFID for secure access control.

Objective:

 Design a secure smart lock system using RFID technology.


 Control a door lock via servo motor based on authorized RFID tags.
 Display system status on an LCD screen.

Hardware Required:

 Arduino Uno  Servo Motor


 RFID Module (RC522)  Door Lock
 LCD Display  Jumper Wires
 I2C Module

CODE

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

#define SS_PIN 10
#define RST_PIN 9
MFRC522 rfid(SS_PIN, RST_PIN);

LiquidCrystal_I2C lcd(0x27, 16, 2);


Servo doorLock;

const String authorizedUID = "12345678"; // Example authorized tag UID


DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

void setup() {
SPI.begin();
rfid.PCD_Init();
lcd.init();
lcd.backlight();
doorLock.attach(8);
doorLock.write(0); // Lock the door initially
lcd.setCursor(0, 0);
lcd.print("RFID Smart Lock");
delay(2000);
lcd.clear();
}

void loop() {
lcd.setCursor(0, 0);
lcd.print("Scan your card");

if (!rfid.PICC_IsNewCardPresent() || !rfid.PICC_ReadCardSerial()) {
return; // Wait for a valid card
}

String uid = "";


for (byte i = 0; i < rfid.uid.size; i++) {
uid += String(rfid.uid.uidByte[i], HEX);
}

lcd.clear();
if (uid == authorizedUID) {
lcd.print("Access Granted");
doorLock.write(90); // Unlock door
delay(3000);
doorLock.write(0); // Lock door after 3 sec
} else {
lcd.print("Access Denied");
delay(2000);
}

rfid.PICC_HaltA();
lcd.clear();
}
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING
Result:

Learning Outcomes:

 Understand RFID technology and its integration with Arduino.


 Develop skills in interfacing servo motors and LCDs via I2C.
 Learn how to implement access control mechanisms.
 Gain practical experience with Arduino programming for real-world applications.

You might also like