0% found this document useful (0 votes)
24 views5 pages

Iot 8

Uploaded by

Sushmit Singh
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)
24 views5 pages

Iot 8

Uploaded by

Sushmit Singh
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/ 5

DEPARTMENT OF

COMPUTER SCIENCE & ENGINEERING

Experiment 8

Student Name: Abhigyan Singh UID: 22BCS14340


Branch: BE CSE Section/Group: 22BCS_IOT_ FL_602 ‘A’
Semester: 5th Date of Performance: 19-09-24
Subject Name: IOT architecture & protocols lab Subject Code: 22CSP-329

1. Aim:
To create a smart door lock system using RFID

2. Objectives:
• Learn about IoT based simulations.
• Testing and model in IoT based simulation platform.

3. Software/Components Used:

▪ Arduino Uno
▪ RFID
▪ LCD
▪ I2C module
▪ Servomotor
▪ Door lock
▪ Jumper Wires

Arduino:
It is an open-source electronics platform. It consists ATmega328 8-bit Micro controller. It can be able to
read inputs from different sensors & we can send instructions to the micro controller in the Arduino. It
provides Arduino IDE to write code & connect the hardware devices like Arduino boards & sensors.

4. Procedure:

▪ Connect RFID reader (SDA to pin 10, RST to pin 9, SPI pins).
▪ Connect LCD with I2C module (SDA to A4, SCL to A5).
▪ Connect servomotor (signal wire to pin 8).
▪ Power components (5V and GND to Arduino).
▪ Upload the code to Arduino.
▪ Test the system with RFID cards Connect the MQ135 sensor to the Arduino Uno using male-to-
female jumper wires.
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING
5. CODE:
#include <SPI.h>
#include <Servo.h>
#include <LiquidCrystal.h>
#include <RFID.h>
LiquidCrystal lcd(7, 6, 5, 4, 3, 2);
Servo myservo; // Servo object for controlling the door
#define val0 117 // Token value for user 1 #define val1 134 // Token value for user 2 int pos = 0;
#define SDA_DIO 10
#define RESET_DIO 9
RFID RC522(SDA_DIO, RESET_DIO);
void setup()
{ myservo.attach(8);
Serial.begin(9600);
SPI.begin();
RC522.init(); // Initialize RFID reader
lcd.begin(16, 2);
}
void loop() {
byte i = 0; intID; if (RC522.isCard()) {
RC522.readC
ardSerial();
Serial.println(RC522.serNum[i], DEC);
Serial.println("Card detected:");
ID = RC522.serNum[0];
}
User 1
if (val0 == ID) {
lcd.clear();
lcd.print("Access
Granted");
lcd.setCursor(0, 1);

lcd.print("Welcome Haris");
delay(1800); lcd.clear();
lcd.print("Door
Opening"); delay(1500); for (pos = 0;
pos <= 180; pos++) { myservo.write(pos);
// Rotate servo toopen door delay(15);
} delay(5000); lcd.clear(); lcd.print("Door
Closing"); delay(1500); for (pos = 180;
pos >= 0; pos--) { myservo.write(pos); //
Rotate servo to close door delay(15);
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING
} } else if (val1
== ID) {
lcd.clear();
lcd.print("Access
Granted");
lcd.setCursor(0, 1);
lcd.print("Welcome
Bilal"); delay(1800);
lcd.clear();
lcd.print("Door
Opening");
delay(1500); for (pos =0;
pos <= 180; pos++)
{ myservo.write(pos);
delay(15);
} delay(5000);
lcd.clear();
lcd.print("Door
Closing");
delay(1500);
for (pos = 180; pos >= 0; pos--) {
myservo.write(pos);
delay(15);
}}else{
Lcd.clear();
lcd.print("DoorSecurity "); lcd.setCursor(0,1);
lcd.print("System");
}
}

// ABHIGYAN SINGH 22BCS14340

6. Connections:

Servo Motor Arduino

VCC pin 5V
GND pin GND

Control Signal Pin 8

Connections of Servomotor with Arduino


DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

RC522 RFID Reader Module Arduino


VCC 3.3V
RST Pin 9
GND GND
IRQ Not connected
MISO Pin 12
MOSI Pin 11
SCK Pin 13
SDA Pin 10

Connections of RC522 Module with Arduino

16×2 LCD Arduino


D4 – D7 Pin 5,4,3,2
Enable Pin 6
RS Pin 7
RW GND
VEE 10k POT (Middle Leg)
VSS GND
VCC +5V
LED+ +5V
LED- GND

Arduino connections with 16×2 LCD

7. Result:
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

8. Conclusion:
By following the setup procedure, the Arduino Uno is ready for programming and communication with
the motor for various projects and experiments. A smart door lock system using RFID offers a secure,
efficient, and modern solution for access control. By integrating an RFID reader with a microcontroller like
Arduino, users can unlock doors by simply tapping authorized RFID cards or tags. The system uses a relay
module to activate an electronic lock, ensuring that access is only granted to approved individuals. This
technology eliminates the need for traditional keys, reducing the risk of unauthorized entry or lost keys..

You might also like