KEMBAR78
Rfid Module | PDF | Radio Frequency Identification | Electrical Engineering
0% found this document useful (0 votes)
18 views13 pages

Rfid Module

The document outlines three experiments involving RFID technology interfaced with Arduino for various applications such as door security systems and gate control. It explains how RFID works, the components required, and provides detailed experimental procedures including code snippets for implementation. Each experiment demonstrates the use of RFID tags for authentication and access control in practical scenarios like parking gates and home security systems.

Uploaded by

taresh.upreti
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 views13 pages

Rfid Module

The document outlines three experiments involving RFID technology interfaced with Arduino for various applications such as door security systems and gate control. It explains how RFID works, the components required, and provides detailed experimental procedures including code snippets for implementation. Each experiment demonstrates the use of RFID tags for authentication and access control in practical scenarios like parking gates and home security systems.

Uploaded by

taresh.upreti
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/ 13

EXPERIMENT NO 1 – RFID TAG INTERFACING WITH

ARDUINO.

Introduction
What is RFID?
RFID stands for Radio Frequency Identification. Various applications such as key cards, Tags
inside supermarkets, and much more use this technology on a large scale. RFID is a wireless
technology that transmits information over radio waves. in the RFID with Arduino there we
power the RFID with Arduino and the RFID card does not need the power to transmit the
information. there is a coil inside the RFID card when it comes near to the RFID reader it
gets activated through mutual induction. In this period of time, the RFID reader gets
information from the card. this is how the combination of both works.

This is also getting popular as a digital replacement for the key as the tags can be easily
stored in our wallets and are also available as key chains. Supermarkets use them for
security purposes. This can also be used with Arduino in many DIY projects such as Door
Security System, RFID based Attendance System, etc. NFC technology also works on the
same principle But uses a very high frequency for the communication

How Does RFID Module Work?

Radio Frequency Identification Module as the name suggests requires a Radiofrequency of


13.56 MHz for its working. This Module uses four pins to communicate using the SPI(Serial
Peripheral Interface) protocol with a maximum Data rate of 10Mbps.

The module creates an Electromagnetic Field using the coil to communicate with the chip
inside the card. Since the card is a passive device, it gets power through the generated
Electromagnetic Field. The reader is capable of reading the tags in the vicinity close to some
millimeters up to meters on certain conditions. The chip inside the card contains 1kb
storage is used to store UID information related to that tag, which can also be used to store
some custom data also.

Components Required
1*Arduino UNO
1*RFID module
1*LED/BUZZER
Jumper Wires

RnT ROBOTICS Page 1


Experimental Procedure
Step 1: Connect circuit as shown in the following image.

Step 2: After connecting all the components now we will see the program for this project.
#include <SPI.h>
#include <MFRC522.h>
#define SS_PIN 10
#define RST_PIN 9
#define LED_G 5 //define green LED pin
#define LED_R 7 //define red LED
#define BUZZER 6 //buzzer pin
MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance.
void setup()
{
Serial.begin(9600); // Initialize serial communications with the PC
while (!Serial); // Do nothing if no serial port is opened (added for Arduinos
based on ATMEGA32U4)
SPI.begin(); // Init SPI bus
mfrc522.PCD_Init(); // Init MFRC522
mfrc522.PCD_DumpVersionToSerial(); // Show details of PCD - MFRC522 Card Reader
details
Serial.println(F("Scan PICC to see UID, SAK, type, and data blocks..."));
pinMode(LED_G, OUTPUT);
pinMode(LED_R, OUTPUT);
pinMode(BUZZER, OUTPUT);
}
void loop()
RnT ROBOTICS Page 2
{
// Look for new cards
if ( ! mfrc522.PICC_IsNewCardPresent())
{
return;
}
// Select one of the cards
if ( ! mfrc522.PICC_ReadCardSerial())
{
return;
}
//Show UID on serial monitor
Serial.print("UID tag :");
String content= "";
byte letter;
for (byte i = 0; i < mfrc522.uid.size; i++)
{
Serial.print(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " ");
Serial.print(mfrc522.uid.uidByte[i], HEX);
content.concat(String(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " "));
content.concat(String(mfrc522.uid.uidByte[i], HEX));
}
Serial.println();
Serial.print("Message : ");
content.toUpperCase();
if (content.substring(1) == "D0 10 22 25")
//change here the UID of the card/cards that you want to give access
{
digitalWrite(LED_G, LOW);
digitalWrite(LED_R, HIGH);
delay(500);
digitalWrite(LED_R, LOW);
}
else
{
digitalWrite(LED_G, HIGH);
digitalWrite(LED_R, LOW);
digitalWrite(BUZZER, HIGH);
delay(500);
digitalWrite(LED_G, LOW);
digitalWrite(BUZZER, LOW);
}
}

Step 3: Compile the program.

Step 4: upload the program into arduino board.

Experimental Summary
After Uploading the code, take a card and keep it on the module. You need to copy all the
required tag IDs and paste them into the code to grant access.

RnT ROBOTICS Page 3


EXPERIMENT NO 2 – RFID ARDUINO GATE SECURITY.

Introduction
we are going to make am RFID Arduino gate security system. Basically, this project is for
Parking and toll purposes. you don’t have have to buy the token now. you can pass the gate
simply by tap the RFID card on the card reader. nowadays this technology used in the
Metro gate and the parking gate. when you tap the Tag or card at the reader then the gate
will be open for some time. so, using the same method we made a project as you can see at
the given image. you can use this lock at your home also. put the RFID card at the door and
use a solenoid lock there then. whenever you will tap the tag on the reader the gate will be
open.

How does it work?


So when we talk about the working of this project there are two things which are the major
part of this project. One is the Arduino and another is RFID RC522 card reader and Tag. it is
simple, when we tap the tag at the Reader then our lock will be open.

RFID rc522 is a radio frequency-based module in which having the sensing range is near
about 5 cm. because there is two thing transfer from one module to another module. The
reader is connected to the power supply and it provides the power to the tag also by the
mutual induction method. it means when the tag reaches in the range of the coil of reader
then voltage induced in the tag for a moment. at this moment the tag aslo transfers the
information inside the chip via Radiofrequency. when we take the tag near to the reader
the voltage and current induce in the tag and that instant the tag transfer the information
via Radiofrequency that’s why we called it RFID that stand for Radio frequency
identification method.

We interface the RFID module with the Arduino and make a program for it. first, we have to
extract the tag value by tapping it to the the reader. when we tap the tag to the reader get
a value from the tag and we use this value into the database. according to this database the
lock will open or close. for example we tap the tag to the reader and the reader gets value
12345. then we use this value in the Arduino code and make a condition there. if the value
is same as the code value then the gate will be open. if the tag value is not the same as the
database or code value the gate will not be open.

RnT ROBOTICS Page 4


Components Required
1*Arduino UNO
1*RFID module
1*servo motor
Jumper Wires

Experimental Procedure
Step 1: Connect circuit as shown in the following image.

Step 2: After connecting all the components now we will see the program for this project.

#include "SPI.h"

#include "MFRC522.h"

#include

#define SS_PIN 10

#define RST_PIN 9

RnT ROBOTICS Page 5


#include

int m=0,n=0;

Servo myservo;

int pos = 0;

MFRC522 rfid(SS_PIN, RST_PIN);

MFRC522::MIFARE_Key key;

const int rs = 0, en = 6, d4 = 5, d5 = 4, d6 = 2, d7 = 1;

LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

void setup() {

Serial.begin(9600);

SPI.begin();

rfid.PCD_Init();

pinMode(A0, OUTPUT);

pinMode(A1, OUTPUT);

pinMode(A2, INPUT_PULLUP);

pinMode(A3, INPUT_PULLUP);

lcd.begin(16, 2);

myservo.attach(3);

void loop() {

m= analogRead(A3);

n= analogRead(A2);

int val_1= map(m, 250 , 850 , 0 , 100);

int val_2= map(n, 250, 850, 0, 100);

if (!rfid.PICC_IsNewCardPresent() || !rfid.PICC_ReadCardSerial())

return;

// Serial.print(F("PICC type: "));

RnT ROBOTICS Page 6


MFRC522::PICC_Type piccType = rfid.PICC_GetType(rfid.uid.sak);

// Serial.println(rfid.PICC_GetTypeName(piccType));

// Check is the PICC of Classic MIFARE type

if (piccType != MFRC522::PICC_TYPE_MIFARE_MINI &&

piccType != MFRC522::PICC_TYPE_MIFARE_1K &&

piccType != MFRC522::PICC_TYPE_MIFARE_4K) {

Serial.println(F("Your tag is not of type MIFARE Classic."));

return;

String strID = "";

for (byte i = 0; i < 4; i++) {

strID +=

(rfid.uid.uidByte[i] < 0x10 ? "0" : "") + String(rfid.uid.uidByte[i], HEX) +


(i!=3 ? ":" : ""); } strID.toUpperCase(); Serial.print("Tap card key: ");
Serial.println(strID); if(strID.indexOf("1A:28:54:73")>=0)

Serial.println("card accepted");

digitalWrite(A0, HIGH);

lcd.setCursor(0, 1);

lcd.print("Speed Limit= ");

lcd.print(val_2);

delay(1000);

lcd.clear();

digitalWrite(A0, LOW);

myservo.write(0);

myservo.write(90); // tell servo to go to position in variable


'pos'

delay(15);

delay(2000);// waits 15ms for the servo to reach the position


RnT ROBOTICS Page 7
myservo.write(0); // tell servo to go to position in variable
'pos'

delay(15); // waits 15ms for the servo to reach the


position

else

digitalWrite(A0, LOW);

if(strID.indexOf("1A:28:54:73")>=0)

Serial.println("Token Accepted");

digitalWrite(A1, HIGH);

lcd.setCursor(0, 1);

lcd.print("Speed Limit= ");

lcd.print(val_1);

delay(1000);

lcd.clear();

digitalWrite(A1, LOW);

else

digitalWrite(A1, LOW);

rfid.PICC_HaltA();

rfid.PCD_StopCrypto1();

RnT ROBOTICS Page 8


Step 3: Compile the program.

Step 4: upload the program into arduino board.

Experimental Summary
After successfully uploading the program to your arduino board now you will see your gate
will open only if you touch paired RFID key.

RnT ROBOTICS Page 9


EXPERIMENT NO 3 – DOOR SECURITY SYSEM USING
RFID TAGS.

Introduction
we are going to make an RFID RC522 ARDUINO lock security system. Basically, this project
is for door and lock purposes. you don’t have to buy the token now. you can open the gate
simply by tap the RFID card on the surface of the card reader. nowadays the same
technology used in the Metro gate and the parking gate. when you tap the Tag or card at
the reader. tag is in the shape of a keyring so you can attach this to your car or bike key.
then the gate will be open for some time. the opening time you can manage or change by
the coding.
So, using the same method we are making this project as you can see in the given image.
you can use this lock at your home also. put that project on the door and use a solenoid
lock there then. whenever you will tap the tag on the reader the lock will be open.

RFID reader having two parts One is a reader and another is Tag. when the tag comes
closer to the reader then it will send some data to the reader and. and the reader sends this
data to the Arduino and Arduino will take action according to the coding. The tag has a coil
which activated when it gets close to the reader. there is one coil on the reader also. which
activated the tag coil by the induction. and during this process reader read the information
having the tag. Arduino RFID project Having the three devices input, processing, and
output.

Rfid rc522 module we are using here which is works here the input device which gets the
input from the tag and reader and then sends this information to the Processing device
which is Arduino here. when the Arduino receives the data it will start comparing the
information with the database which we have included during programming. first, we need
to enter the tag information or tag Id into the Arduino programming.

first, you need to upload the program in Arduino and open the serial monitor now when
you tap the RFID tag over the reader then there are some value shows in the serial monitor.
now you have to write the same value into the Arduino code as we have mentioned in the
given code. As the given process you can enter multiple tag ID.

RnT ROBOTICS Page 10


Components Required

1*Arduino UNO
1* RFID RC522 module
1*LED matrix display
1* Solenoid Lock
1*5v relay module single channel
2*LED
1*bread board
Jumper Wires

Experimental Procedure
Step 1: Connect circuit as shown in the following image.

RnT ROBOTICS Page 11


Step 2: After connecting all the components now we will see the program for this project.
#include "SPI.h"
#include "MFRC522.h"
#define SS_PIN 10
#define RST_PIN 9
int m=0,n=0;
MFRC522 rfid(SS_PIN, RST_PIN);
MFRC522::MIFARE_Key key;
void setup() {
Serial.begin(9600);
SPI.begin();
rfid.PCD_Init();
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
}
void loop() {
if (!rfid.PICC_IsNewCardPresent() || !rfid.PICC_ReadCardSerial())
return;
// Serial.print(F("PICC type: "));
MFRC522::PICC_Type piccType = rfid.PICC_GetType(rfid.uid.sak);
// Serial.println(rfid.PICC_GetTypeName(piccType));
// Check is the PICC of Classic MIFARE type
if (piccType != MFRC522::PICC_TYPE_MIFARE_MINI &&
piccType != MFRC522::PICC_TYPE_MIFARE_1K &&
piccType != MFRC522::PICC_TYPE_MIFARE_4K) {
Serial.println(F("Your tag is not of type MIFARE Classic."));
return;
}
String strID = "";
for (byte i = 0; i < 4; i++) {
strID +=
(rfid.uid.uidByte[i] < 0x10 ? "0" : "") +
String(rfid.uid.uidByte[i], HEX) +
(i!=3 ? ":" : "");
}
strID.toUpperCase();
Serial.print("Tap card key: ");
Serial.println(strID);
if(strID.indexOf("E0:68:F7:29")>=0) // here you can replace your tag id
{
Serial.println("card accepted");
digitalWrite(5, HIGH);
digitalWrite(6, HIGH);
digitalWrite(7, LOW);
delay(3000);
digitalWrite(5, LOW);
digitalWrite(6,LOW);
digitalWrite(7, HIGH);
}
else
{

RnT ROBOTICS Page 12


digitalWrite(5, LOW);
digitalWrite(6,LOW);
digitalWrite(7, HIGH);
}
if(strID.indexOf("D5:4A:B0:65")>=0) // here you can replace your tag id
{
Serial.println("Token Accepted");
digitalWrite(A1, HIGH);
digitalWrite(A1, LOW);
}
else
{
digitalWrite(A1, LOW);
}
rfid.PICC_HaltA();
rfid.PCD_StopCrypto1();
}

Step 3: Compile the program.

Step 4: upload the program into arduino board.

Experimental Summary
After successfully uploading the program to your arduino board now you will see your door
will open only if you touch paired RFID key.

RnT ROBOTICS Page 13

You might also like