Summary

This document provides an overview of Radio Frequency Identification (RFID), focusing on its hardware components, and includes sample Arduino code. It covers topics including objectives, RFID operation, hardware overview, library installation, reading RFID tags, and RFID configuration.

Full Transcript

RFID Radio Frequency Identification Objectives Exp lore Real-Life Ap p lications of RFID U nderstanding Op erational M echanisms Exp lain How RFID Works Students w ill learn to w rite and understand simp le Arduino code to read RFID tags,including basic commands and l...

RFID Radio Frequency Identification Objectives Exp lore Real-Life Ap p lications of RFID U nderstanding Op erational M echanisms Exp lain How RFID Works Students w ill learn to w rite and understand simp le Arduino code to read RFID tags,including basic commands and libraries used in the p rocess. WHAT IS RFID? An RFID or radio frequency identification system consists of tw o main comp onents,a tag attached to the object to be identified,and a reader that reads the tag. WHAT IS RFID? A reader consists of a radio frequency module and an antenna that generates a high frequency electromagnetic field. Whereas the tag is usually a p assive device (it does not have a battery). It consists of a microchip that stores and p rocesses information,and an antenna for receiving and transmitting a signal. WHAT IS RFID? WHAT IS RFID? Hardw are Overview RC 5 22 RFID module RFID card tag and a key fob tag Hardw are Overview The RC 5 22 RFID reader module is designed to create a 13.5 6 M Hz electromagnetic field and communicate w ith RFID tags Hardw are Overview The RC 5 22 RFID reader module is designed to create a 13.5 6 M Hz electromagnetic field and communicate w ith RFID tags RC 522 RFID M odule Pinout RC 522 RFID M odule Pinout V C C - sup p lies p ow er to the module. This can be anyw here from 2.5 to 3.3 volts. You can connect it to the 3.3V outp ut from your Arduino.B ut remember that connecting it to the 5V p in w ill p robably destroy your module! RC 522 RFID M odule Pinout RST- is an inp ut for reset and p ow er-dow n. When this p in goes low the module enters p ow er-dow n mode. In w hich the oscillator is turned off and the inp ut p ins are disconnected from the outside w orld. Whereas the module is reset on the rising edge of the signal. RC 522 RFID M odule Pinout G N D - is the ground p in and needs to be connected to the G N D p in on the Arduino. IRQ - is an interrup t p in that alerts the microcontroller w hen an RFID tag is in the vicinity. RC 522 RFID M odule Pinout M ISO / SC L / Tx - p in acts as master-in- slave-out w hen SPI interface is enabled,as serial clock w hen I2C interface is enabled and as serial data outp ut w hen the U ART interface is enabled. RC 522 RFID M odule Pinout M OSI (M aster Out Slave In) - is the SPI inp ut to the RC 5 22 module. TAKE N OTE: Serial Perip heral Interface,w hich is a w ay for different electronic devices to talk RC 522 RFID M odule Pinout SC K (Serial C lock) - accep ts the clock p ulses p rovided by the SPI bus master i.e. Arduino. TAKE N OTE: Serial Perip heral Interface,w hich is a w ay for different electronic devices to talk RC 522 RFID M odule Pinout SDA (Serial Data) - p in acts as a signal inp ut w hen the SPI interface is enabled,as serial data w hen the I2C interface is enabled and as a serial data inp ut w hen the U ART interface is enabled. This p in is usually marked by encasing the p in in a square so that it can be used as a reference to identify other p ins RC 522 RFID M odule Pinout RC 522 RFID M odule Pinout DIG ITAL PIN S (5,12,11,13,10 ) RC 522 RFID M odule Pinout DIG ITAL PIN S (5,12,11,13,10 ) Library Installation C ommunicating w ith an RC 5 22 RFID module is a lot of w ork,but luckily for us there is a library called the M FRC 5 22 library that makes reading and w riting RFID tags simp le. Library Installation To install the library navigate to Sketch > Include Libraries > M anage Libraries… or CTRL+SHIFT+I Library Installation Filter your search by typ ing ‘mfrc5 22‘. Look for the library by G ithubC ommunity. C lick on that entry,and then select Install. Reading an RFID Tag a key fob tag and RFID card tag Reading an RFID Tag Once you have installed the library,open the Examples submenu and choose M FRC 522 > DumpInfo example sketch. RFID C ON FIG U RATION G o to the beginning of the sketch and make sure RST_PIN is initialized correctly,in our case w e are using digitalpin # 5 so change it to 5 RFID C ON FIG U RATION G o to the beginning of the sketch and make sure RST_PIN is initialized correctly,in our case w e are using digitalpin # 5 so change it to 5 RFID C ON FIG U RATION N ow upload the sketch and open SerialM onitor. As you bring the tag closer to the module, you’llget something like the follow ing.Do not move the tag untilallthe information is displayed. RFID C ON FIG U RATION G ET THE C ARD U ID EXAM PLE C ARD U ID:20 C 3 93 SE C ODE # include # include # define SS_PIN 10 # define RST_PIN 9 M FRC 522 mfrc522(SS_PIN ,RST_PIN );// C reate M FRC 522 instance. void setup() { pinM ode(7,1); pinM ode(6,1); Serial.begin(960 0 );// Initiate a serialcommunication SPI.begin(); // Initiate SPI bus mfrc522.PC D_Init();// Initiate M FRC 522 Serial.println("Approximate your card to the reader..."); Serial.println(); } } for (byte i = 0 ;i < mfrc522.uid.size;i++) void loop() { { Serial.print(mfrc522.uid.uidByte[i]< 0 x10 ? "0 ":""); // Look for new cards Serial.print(mfrc522.uid.uidByte[i],HEX); if ( !mfrc522.PIC C _IsN ew C ardPresent()) content.concat(String(mfrc522.uid.uidByte[i]< 0 x10 ? { "0 ":"")); return; content.concat(String(mfrc522.uid.uidByte[i],HEX)); } } // Select one of the cards if ( !mfrc522.PIC C _ReadC ardSerial()) { return; } //Show U ID on serialmonitor Serial.print("U ID tag :"); String content= ""; byte letter; Serial.println(); else Serial.print("M essage :"); { content.toU pperC ase(); Serial.println("Access denied"); if (content.substring(1) == "F9 D1F3 6E") //change here the Serial.println(); U ID of the card/cards that you w ant to give access //delay(30 0 0 ); { digitalWrite(7,1); Serial.println("Authorized access"); delay(20 0 ); Serial.println(); digitalWrite(7,0 ); //delay(30 0 0 ); delay(20 0 ); digitalWrite(6,1); digitalWrite(7,1); delay(20 0 ); delay(20 0 ); digitalWrite(6,0 ); digitalWrite(7,0 ); delay(20 0 ); delay(20 0 ); digitalWrite(6,1); digitalWrite(7,1); delay(20 0 ); delay(20 0 ); digitalWrite(6,0 ); digitalWrite(7,0 ); delay(20 0 ); delay(10 0 0 ); digitalWrite(6,1); } delay(20 0 ); digitalWrite(6,0 ); delay(10 0 0 ); } Q U ESTION S? AC TIV ITY How do you envision RFID evolving in the future,and how could it impact your personalor professionallife? 1/2 C ROSSWISE 3-4 sentences

Use Quizgecko on...
Browser
Browser