fbpx

IoT Based RFID Authentication System

Introduction

Radio-frequency identification (RFID) uses electromagnetic fields to transfer data through wireless.

  • A rfid system uses tag, attached to the objects for identification.
  • Readers send a signal to the tag and read its response.
  • Tag is read-only the tag uses the radio energy transmitted by the reader.
  • Each tag have unique serial number,by using this tag number it is easy to identify product details.

Rfid has multiple usage,  it use to track the object attached to it using the unique serial no.Application: attendance system.An Rfid reader attached to esp8266, when ever reader detect the rfid card it read the tag serial no and push the serial no to cloud with timestamp.

Block Diagram

Flow Chart

Component Required:

  1. Node MCU.
  2. MRC522 RFID
  3. Jumper wire
  4. BreadBoard

Software Required:

  1. MIT App inventor – Android
  2. Firebase
  3. Arduino 

Circuit diagram

Firebase

Login To firebase

  • create new project
  • Create database for RFID device
  • Set firebase security rules to test mode to allow esp8266 to set and read database
  • Set Rules of firebase to read and write in real timedatabase
  • Select Real-time Database 
  • Copy the URL- Required in code as firebase host-id to communicate with firebase
  • Click to add child to Create a field to hold data in firebase
  • Create RFID field to hold RFID Access data in firebase.
  • RFID, Access field in realtime database hold RFID access data.
  • Get authentication id from firebase.

Android Application

  • Create New project from mit app inventor for RFID access monitoring
  • Select layout to place the user interface component
  • Create a header from the Android application: 

                 Drag and drop label in the screen for app header

  • Add firebase component to app
  • use the firebase database url, you can ignore the FirebaseToken 

Logics To Get the Data From Firebase

Android APP

  • Code
 #include <ESP8266WiFi.h>
#include <FirebaseArduino.h>
#include <SPI.h>
#include <MFRC522.h>

#define FIREBASE_HOST " "
const char* ssid = "IMAKE"; // Your ssid
const char* password = "12345678"; // Your Password 

#define RST_PIN D1
#define SDA_PIN D2
MFRC522 mfrc522(SDA_PIN, RST_PIN);
bool firebase_lock = true;
void setup() 
{
Serial.begin(9600); 
SPI.begin(); 
mfrc522.PCD_Init(); 
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED)
{
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi is connected");
Serial.println(WiFi.localIP());
delay(1000);
Firebase.begin(FIREBASE_HOST); 
}
void loop() 
{
if ( ! mfrc522.PICC_IsNewCardPresent()) 
{
return;
}
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));
}
content.toUpperCase();
if (content.substring(1) == "AD 15 31 DA") 
{
Serial.println("Authorized access");
Firebase.setString("Access", "Authorized");
Firebase.setString("RFID", "Match_Found");
Serial.println();
firebase_lock = true;
delay(3000);
}else 
{
if(firebase_lock == true)
{
Serial.println(" Access denied");
Firebase.setString("Access", "UnAuthorized");
Firebase.setString("RFID", "Match_Not_Found");
firebase_lock = false;
delay(3000);
}
}
} 

1 comment on “IoT Based RFID Authentication System

Leave a Reply

Your email address will not be published. Required fields are marked *