Play with Circuit Posted Thursday at 08:10 AM Report Posted Thursday at 08:10 AM RFID technology is all around us—often working silently in the background. A familiar example is the Electronic Toll Collection (ETC) system, which allows vehicles with RFID tags to drive through toll booths without stopping. The toll amount is automatically deducted from the user's account, enabling faster and smoother commutes. Beyond toll systems, RFID is also widely used in contactless payment cards, inventory tracking in warehouses, and anti-theft systems in retail stores. Its versatility and ease of integration make it an essential part of many modern systems. One of the most popular modules for experimenting with RFID in DIY electronics is the RC522 RFID reader/writer. In this tutorial, we’ll explore how RFID works, the key components involved, and how to interface the RC522 module with an Arduino Uno. Understanding RFID Technology: What It Is and How It Works RFID (Radio Frequency Identification) is a wireless communication technology that uses radio waves to identify and track objects without the need for direct contact. A typical RFID system comprises two main components: RFID Tag This tag is affixed to the object that needs to be identified. It contains: A microchip that stores data such as a unique ID or short description. An antenna that enables communication with the reader. RFID tags come in various forms like cards, key fobs, stickers, and embedded tags depending on the application. RFID Reader The reader emits and receives radio signals to communicate with RFID tags. It can be stationary or portable, and is connected to antennas that create a high-frequency electromagnetic field. This enables the tag to respond with its stored data. Both the reader and the tag use antennas to facilitate wireless data transmission, tuned to specific frequencies depending on the application requirements. What is the RC522 RFID Module? The RC522 RFID module is a popular, affordable RFID reader based on the MFRC522 chip from NXP. It operates at a frequency of 13.56 MHz and is capable of reading RFID tags within a range of up to 5 cm. This module supports various communication protocols including SPI, I2C, and UART, making it flexible for different microcontroller platforms. It usually comes bundled with an RFID card and a key fob, allowing immediate experimentation. The RC522 is designed to work with ISO/IEC 14443 Type A RFID cards, which are common in most RFID applications. RC522 RFID Module Specifications Frequency Range: 13.56 MHz Operating Voltage: 2.5V to 3.3V Maximum Operating Current: 13–26 mA Reading Distance: Up to 5 cm Supported Protocols: SPI, I2C, UART RC522 RFID Module – Hardware Overview The RC522 RFID module is built around the MFRC522 chip from NXP Semiconductors, a powerful RFID reader IC designed for contactless communication at 13.56 MHz. The chip is clocked by an onboard 27.12 MHz crystal oscillator, ensuring stable timing and communication. To ensure optimal performance, the module includes an EMI (Electromagnetic Interference) filter circuit and a matching circuit. These components help reduce signal noise and improve data integrity. The module also features an integrated PCB antenna, which enables it to wirelessly communicate with RFID cards and tags. RC522 RFID Module Pinout Description The RC522 module has several pins for power and communication. Depending on the interface you choose—SPI, I2C, or UART—some pins will serve different functions. Pinout Overview: VCC Supplies power to the module. The RC522 operates at 2.5V to 3.3V, so this pin should be connected to the 3.3V output of the Arduino. RST (Reset) Used to reset the module. It can be connected to a digital pin on the Arduino for software-based resetting. GND Ground connection. This pin should be connected to the Arduino’s GND. IRQ (Interrupt Request) Sends an interrupt signal to the microcontroller when a tag is detected. This pin is optional and only required for advanced applications that need interrupt-driven detection. MISO / SCL / TX This multifunctional pin operates differently based on the selected communication protocol: MISO (Master In Slave Out) – Used in SPI mode to send data from the RC522 to the Arduino. SCL (Serial Clock) – Used in I2C mode as the clock line. TX (Transmit) – Used in UART mode to transmit serial data. MOSI (Master Out Slave In) Used only in SPI mode, this pin sends data from the Arduino to the RC522. SCK (Serial Clock) In SPI communication, this pin receives the clock signal from the Arduino (SPI master). SS / SDA / RX Like the earlier multifunction pin, this one also changes its behavior depending on the protocol: SS (Slave Select) – Used in SPI mode to select the RC522 device. SDA (Serial Data) – Used in I2C communication as the data line. RX (Receive) – In UART mode, it receives incoming serial data. Interfacing an RC522 RFID Module to an Arduino In this project, we'll interface the RC522 RFID module with an Arduino UNO using the SPI protocol, and display the unique ID (UID) of scanned RFID tags on a 16×2 I2C LCD display. Hardware Requirements Arduino UNO R3 RC522 RFID Module Kit 16×2 LCD Display with I2C Module Jumper Wires (Male to Female) USB Type-A to B Cable 12V DC Power Adapter Wiring the RC522 RFID Module with Arduino UNO The RC522 supports SPI, UART, and I2C communication. For this project, we’ll use the SPI interface, which offers fast and reliable communication with the Arduino UNO. Connect the RC522 Module to Arduino UNO as follows: RC522 Pin Arduino UNO Pin Function VCC 3.3V Power supply (⚠️ Do not use 5V) GND GND Ground SCK 13 SPI Clock MOSI 11 SPI Master Out Slave In MISO 12 SPI Master In Slave Out SS (SDA) 10 SPI Slave Select RST 9 Reset line Important Note: RC522 operates at 3.3V logic. Supplying 5V may damage the module. Wiring the 16×2 I2C LCD with Arduino UNO The I2C LCD uses just two data lines (SDA and SCL), which simplifies wiring and leaves more GPIO pins free on the Arduino. Connect the I2C LCD as follows: I2C LCD Pin Arduino UNO Pin Function VCC 5V Power supply GND GND Ground SDA A4 I2C Data line SCL A5 I2C Clock line Tip: Ensure that the A0, A1, and A2 jumpers on the I2C backpack are not shorted. The I2C address 0x27 (used in code) is valid only when these address jumpers are left open. Arduino Code to read all the Data of RFID Card /* Code to Read all data from RFID card and send it to UART port @ baudrate 115200,n,8,1 by platwithcircuit.com */ #include <LiquidCrystal_I2C.h> // Library to run I2C LCD #include <SPI.h> #include <MFRC522.h> #define RST_PIN 9 // Configurable, see typical pin layout above #define SS_PIN 10 // Configurable, see typical pin layout above MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance // Set the LCD address to 0x27 for a 16 chars and 2 line display LiquidCrystal_I2C lcd(0x27, 16, 2); // this flag is used to check if previous card is removed or not bool boIsPreviousCardRemoved = true; void setup() { // initialize the LCD lcd.init(); // Turn ON the Backlight lcd.backlight(); // Clear the display buffer lcd.clear(); // Print a message to the LCD lcd.setCursor(0, 0); lcd.print("Initializing"); // Initialize serial communications with the PC Serial.begin(115200); while (!Serial); // Do nothing if no serial port is opened SPI.begin(); // Init SPI bus mfrc522.PCD_Init(); // Init MFRC522 delay(4); // Optional delay of 4 ms mfrc522.PCD_DumpVersionToSerial(); // Show details of PCD - MFRC522 i.e., RF Card Reader details Serial.println(F("Scan PICC to see UID, SAK, type, and data in the Card")); delay(1000); lcd.clear(); lcd.setCursor(0, 0); lcd.print("Place Card on"); lcd.setCursor(0, 1); lcd.print("Card Reader"); } void loop() { // Make sure that previous card is removed before going ahead if ((mfrc522.PICC_IsNewCardPresent() == true) && (boIsPreviousCardRemoved == true)) { // Read Serial Data if (mfrc522.PICC_ReadCardSerial() == true) { lcd.clear(); lcd.setCursor(0, 0); lcd.print("Card Detected"); lcd.setCursor(0, 1); lcd.print("Keep it there..."); // Dump debug info about the card; PICC_HaltA() is automatically called mfrc522.PICC_DumpToSerial(&(mfrc522.uid)); delay(1000); lcd.clear(); lcd.setCursor(0, 0); lcd.print("Remove Card From"); lcd.setCursor(0, 1); lcd.print("Card Reader "); boIsPreviousCardRemoved = false; delay(2000); } } else { if (boIsPreviousCardRemoved == false) { lcd.clear(); lcd.setCursor(0, 0); lcd.print("Place Card on"); lcd.setCursor(0, 1); lcd.print("Card Reader"); boIsPreviousCardRemoved = true; } } } Output To learn how to Read/Write Data on RFID Card checkout: Interfacing RC522 RFID Module with Arduino Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.