RFID Arduino – Read RFID Tag’s UID with RC522

In this post we will go over how to use the RC522 RFID Module with Arduino. We’ll focus on basics, module pins, how to connect to Arduino, programming in Arduino IDE, and testing. The main focus will be around reading an RFID tag’s UID (Unique ID).

What is RFID?

RFID stands for “Radio-frequency identification” and its use consists mainly of two components: the RFID tag or tags (which contains some information) and the RDIF reader (which reads the information). Normally, the tag is not powered, while the reader is powered (i.e. battery).

RC522 RFID Module

As mentioned earlier, an RFID system contains an RFID reader. The RC522 is a simple and low cost option for DIY projects. The RC522 supports I2C, SPI, and UART communication.

Module Specs:
Read Distance Range: Min: Direct contact, Max: ~2in (50mm)
Input Voltage: 2.5V – 3.3V (Make sure to NOT connect to the 5V pin of the Arduino)
Current: 13mA – 26mA
Working Frequency: 13.56 MHz

RC522 Module Pins

SDA – Used as SDA for I2C communication.
SCK
– Serial Clock.
MOSI
– SPI communication pin (Master Out Slave In).
MISO
– SPI communication pin (Master In Slave Out).
IRQ
– Interrupt Pin to wake up the Arduino when an RFID tag is read.
GND
– Ground pin that must be connected to Arduino ground.
RST
– Reset pin to reset or power down the RC522 module.
3.3V
– Power input pin (please don’t connect to 5V).

RFID Arduino RC522
RFID Arduino RC522 connections

Click to Enlarge

Downloading the RFID Arduino Library for RC522

This example requires use of the Arduino RC522 RFID Library from Miguel Balboa. You can download the library from GitHub on this link: github.com/miguelbalboa/rfid

Installing the library

Once the Zip library has been downloaded, you need to import it within the Arduino IDE. To do this, go to the top menu, then click Sketch, Include Library, Add .Zip Library… Then, find the Zip file in the folder in which you downloaded it to, then select the Zip file and click open to import into Arduino IDE.

Click to enlarge

Click to enlarge

Arduino Code

Run Arduino Code – Testing RFID Arduino Reader

RFID Arduino RC522 testing

Components used in this example

*As an Amazon & Ebay Associate I earn from qualifying purchases.

ComponentLink
Arduino UNOhttps://amzn.to/3uYVAMC
https://ebay.us/veZdKX
RC522 RFID Reader Kithttps://amzn.to/3mT5YD1
https://ebay.us/CmJGs8

Leave a Reply

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