Arduino Projects

MFRC522 RFID Sensor With Arduino Tutorial


In this RFID sensor with Arduino tutorial, we are going to be using the MFRC522 RFID Module With Arduino. The RFID RC522 is a very low-cost RFID sensor that is popular with hobbyists and makers. This sensor can be used to read and write RFID tags. This text provides a tutorial for using an RFID module with an Arduino. The tutorial includes a list of materials needed and step-by-step instructions for wiring the RFID module to the Arduino and programming it.

The RFID reader reads the identification number of the RFID tag. The identification number is then sent to the Arduino board. The Arduino board uses the identification number to do an action, such as turning on a light or opening a door.

Why NextPCB

  • Most Efficient, Economic, Inventive PCB Solutions
  • Higher Quality
  • Lower Price
  • Faster Delivery

Required Material – RFID Module With Arduino

What is RFID?

RFID  (radio frequency identification)  is a type of wireless technology that uses radio waves to communicate with a tag placed on an object. The tag contains information about the object, such as a serial number, and an RFID reader can read the tag. This allows for much faster scanning of large numbers of objects. RFID is used in many applications, including access control, asset tracking, and inventory management.



RFID or “radio-frequency identification,” tags have an internal antenna and an integrated circuit that is responsible for communicating with the reader device. The antenna is simply a coil of wires and it normally occupies an important portion of the tag’s internal space. The purpose of the antenna is to create communication with the reader, and also to obtain enough energy from the received waves to power the internal circuits.

How does RFID work?

MFRC522 RFID Sensor With Arduino Tutorial

RFID is a system that uses electromagnetic fields to automatically identify and track tags attached to objects. The tags contain electronically stored information.

Passive tags collect energy from a nearby RFID reader’s interrogating radio waves. Active tags have a local power source, such as a battery, and may operate hundreds of meters from the RFID reader. Unlike a barcode, the tag need not be within the line of sight of the reader, so it may be embedded in the tracked object.

MFRC522 RFID Module

A Brief Note on RC522 RFID Module

An MFRC522 RFID sensor is a device that can be used to read and write data to an RFID tag. RFID tags are used in a variety of applications, such as tracking inventory, identifying people or animals, and security. The MFRC522 sensor is a popular choice for RFID applications due to its low cost and ease of use. The MFRC522 is a highly integrated reader/writer IC for contactless communication at 13.56MHz.

MFRC522 RFID Module Pinout

The pinout of the MFRC522 RFID module is shown below.

mfrc522 e1662615982498

RFID module pins

The RFID module has 8 pins:

  • VCC: RC522 RFID reader power supply pin. It supports a supply voltage between 2.5V and 3.3V.
  • RST: Reset pin used to put the RC522 in low consumption mode (“power-down”). it will remain off with hardly any consumption. When the state changes to HIGH the RC522 restarts.
  • GND: ground pin or GND.
  • IRQ – Interrupt pin that alerts the microcontroller when an RFID tag approaches the RC522 RFID reader.
  • MISO/SCL/TX: This pin has three functions. When the SPI interface is enabled, it works as slave output and master input. When the I2C interface is activated, it works as a clock signal and as a serial output when the UART interface is enabled.
  • MOSI: SPI communication master output pin.
  • SCK: SPI communication clock pin.
  • SS/SDA/RX: The pin acts as a signal input when the SPI interface is enabled. If the I2C interface is active it acts as data input and as a serial data input when the UART interface is enabled.

Connecting the RFID Module With Arduino

The RFID RC522 module uses the SPI interface to make bi-communicative contact with the Arduino through digital pins 10 to 13, with pin 9 connected to the module’s RST. Inspect the arrangement of the pins in the interface shown below, showing the arrangement of the module connection pins to the Arduino, which are supported by the MFRC522 library.

RFIDwith Arduino Wiring Diagram e1662620566736

MFRC522 module Arduino Uno, Nano
SDA (SS) 10
SCK 13
IRQ Not connected
3.3V 3.3V

Note – the module power supply, is done through the 3.3V pin of the Arduino.

MFRC522 Programming & Code :

Here’s the library you need for this project:

  1. Download the RFID library here developed by Miguel Balboa.
  2. Unzip the RFID library
  3. Install the RFID library in your IDE
  4. Restart your Arduino IDE

Code For Reading Data from an RFID tag

Below is a sketch to read the identification code of our Tags. First, go to File > Examples > MFRC522 > DumpInfo and upload the code. This code will be available in Arduino IDE.

In the sketch, we send the tag code via the serial port, to view the code it is required to open the Serial Monitor of the Arduino IDE.

You should see something like the figure below:

Code For Reading Data from an RFID tag

Compare the RFID card or the keychain to the reader. Let the reader and the tag closer until all the information is displayed.

RFID card or the keychain to the reader

Copy Card UID

Demonstration – RFID Module With Arduino

Now, upload the code to your Arduino and open the serial monitor, and swipe the card that comes with the RC522 RFID reader. You will see something similar to the following image.

Code For Access Card


From the first code, we get an RFID card tag value. Set those result card tag values in the below code in the function:

Now after changing the tag value, upload the code.

Control LED With Valid Tags

RFID Control LED with Arduino Wiring Diagram e1662624936980

Code ( verification of the registered tag ):


Here are some more Posts for you:

Related Articles

Leave a Reply

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

Back to top button

Adblock Detected

Please consider supporting us by disabling your ad blocker