An RFID reader is used to reading RFID tags. Radio waves are used to transfer data from the card tag to an RFID reader. It is a wireless identification technology used for identifying the object presence.
Just like the bar code technology, RFID is used to identify objects, persons, by reading the card tag. This is better than the bar code because the bar code can sometimes be damaged or unreadable.
This RFID module is a 125KHz card reader mini-module which is design to read ing code from the 125KHz card tag.
It is mainly used in companies to access authorized employees, attendance systems, personal identification.
RC522 RFID Pinout
RC522 RFID Sensor has 8 pins.
- VCC (3.3v):- Connect the VCC pin to the 3.3V pin of the Arduino. Connecting it to the 5v Arduino pin can destroy the RFID module.
- RST:- This pin is for resetting the module.
- GND:- This pin connects to the GND pin of Arduino.
- IRQ:- This is blocking or interrupt pin that can alert the microcontroller when it comes around the RFID tag.
- MISO/SCL/TX:- This pin is Master-In-Slave-Out. It acts as serial data output and connects to the Arduino RX pin.
- MOSI:- Master-Out-Slave-In pin is SPI input to the RC522 module.
- SCK:– Serial Clock is accepting clock pulses provided by Arduino.
- SS / SDA / Rx:- When the SPI interface is enabled it acts like Signal input when the I2C interface is enabled it acts like Serial data and acts as Serial data input when the UART interface is enabled. This pin usually connects to the Arduino TX pin.
Circuit Diagram For Interfacing RFID with Arduino
Code for Interfacing RFID with Arduino
You need to install the IR library. Now go to Sketch > Include Library > Manage Libraries and search for MFRC522 by shirriff.
OR just download from https://github.com/miguelbalboa/rfid and Add .Zip Library.
This code also available in the library which you can get from File > Examples > MFRC522 > DumpInfo. Upload this code and open Serial Monitor and scan RFID Card or Keychain. By using this code you get more information about RFID Reader and cards.
Code For Access Card
From the first code, we get an RFID card tag value. Put those output card tag value in the below code in the function:
if (content.substring(1) == "F0 60 AB A3") //Change this UID
Now after changing the tag value, upload the code.