IOT - 8 (Mrigaank Jaswal)

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

DEPARTMENT OF

COMPUTER SCIENCE & ENGINEERING

Experiment 8
Student Name: Mrigaank Jaswal UID: 22BCS14681
Branch: BE-CSE Section/Group: KRG-IOT-2/B
Semester: 5th Date of Performance: 15-10-24
Subject Name: IOT Lab Subject Code: 22CSP-329

1. Aim:
To Create a Smart door lock system-using RFID.

2. Objective:
• Prevent unauthorized access by only allowing registered RFID tags.
• Logs access history for auditing who enters and exits.
• Deactivate lost or stolen RFID tags to prevent misuse.
• Keyless entry using RFID cards, tags, or smartphones with NFC.
• Automatic unlocking when an authorized RFID tag is detected.
• Simplified access management—easy to add or remove users.

3. Equipment Used:
• Arduino Uno R3 board
• RFID RC522
• SG-90 Servo Motor
• 16×2 LCD

4. Procedure:
• D0 – D7: Pin number 7-14 are data bus lines that are used to send data
from Arduino which you want to display on LCD. With these 8 data
lines, data can be transferred either in an 8-bit format or in a 4-bit
format.
• Contrast Select (VEE): It will help to control the contrast of PIXELS
according to the 16X2
• LCD light.
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

• RS: This pin is known as a register select pin. It helps to toggle the
command/data register.
• R/W: The signal on this pin will decide whether it is going to read
from LCD or write on it.
• EN: Enable pin will help to transfer the instruction from the data pins
and another command pin
• to the LCD. It acts as permission to internal registers.
• VSS: It’s a ground pin for common grounds.
• VCC: The power pin will use for voltage input to the 16X2 LCD.

5. Code:
//Arduino Code - RC522 Read RFID Tag UID
#include <SPI.h>
#include <MFRC522.h>
#define SS_PIN 10
#define RST_PIN 7
MFRC522 rfid(SS_PIN, RST_PIN); // Instance of the class
MFRC522::MIFARE_Key key;
void setup() {
Serial.begin(9600);
SPI.begin(); // Init SPI bus
rfid.PCD_Init(); // Init RC522
}
void loop() {
// Reset the loop if no new card present on the sensor/reader. This saves the entire process
when idle.
if ( ! rfid.PICC_IsNewCardPresent())
return;
// Verify if the NUID has been readed
if ( ! rfid.PICC_ReadCardSerial())
return;
MFRC522::PICC_Type piccType = rfid.PICC_GetType(rfid.uid.sak);
Serial.print(F("RFID Tag UID:"));
printHex(rfid.uid.uidByte, rfid.uid.size);
Serial.println("");
rfid.PICC_HaltA(); // Halt PICC
}
//Routine to dump a byte array as hex values to Serial.
void printHex(byte *buffer, byte bufferSize) {
for (byte i = 0; i < bufferSize; i++) {
Serial.print(buffer[i] < 0x10 ? " 0" : " ");
Serial.print(buffer[i], HEX);
}
}
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

7. Output:

8. Learning Outcome:
• Learn the principles of RFID operation, including how RFID tags and
readers communicate.
• Understand the differences between active and passive RFID systems.
• Gain experience in working with microcontrollers (such as Arduino,
Raspberry Pi) to control the RFID system.
• Learn how to interface RFID readers with microcontrollers for real-
time access control.
• Learn how to design and build circuits that integrate RFID readers,
door locks (e.g., electronic solenoids), and other components like
buzzers or LEDs.

You might also like