ESP32 S3 - RFID

Learn how to connect an RC522 RFID/NFC reader module to an ESP32 S3 and read the unique identifier (UID) from any compatible RFID or NFC tag. This tutorial walks you through everything from wiring the hardware to uploading the finished sketch, so you can identify cards and tags with your ESP32 S3 in just a few minutes.

What you'll build:

  1. A circuit connecting the RFID-RC522 module to the ESP32 S3 over SPI
  2. Firmware that detects when an RFID or NFC tag is present and reads its UID
  3. A Serial Monitor output that prints the tag type and UID in hexadecimal format
  4. A foundation you can extend into access-control systems, inventory trackers, and smart-lock projects
ESP32 S3 RFID RC522

Hardware Preparation

1×ESP32 S3 WROOM N16R8
1×Alternatively, ESP32 S3 SuperMini Dev Module
1×Alternatively, ESP32 S3 Uno-form Board
1×Alternatively, ESP32 S3 Camera Board
1×USB Cable Type-A to Type-C (for USB-A PC)
1×USB Cable Type-C to Type-C (for USB-C PC)
1×RFID/NFC RC522 Kit (reader + tags)
1×Breadboard
1×Jumper Wires
1×Optionally, DC Power Jack
1×Recommended: Screw Terminal Expansion Board for ESP32 S3
1×Recommended: Breakout Expansion Board for ESP32 S3
1×Recommended: Power Splitter for ESP32 S3

Or you can buy the following kits:

1×DIYables ESP32 S3 Starter Kit (ESP32 S3 included)
1×DIYables Sensor Kit (18 sensors/displays)
Disclosure: Some of the links provided in this section are Amazon affiliate links. We may receive a commission for any purchases made through these links at no additional cost to you.
Additionally, some of these links are for products from our own brand, DIYables .

Overview of RFID-RC522 Module

The RFID-RC522 is a low-cost, 13.56 MHz RFID reader module based on the MFRC522 chip from NXP Semiconductors. It communicates with the ESP32 S3 over SPI and can detect and read ISO 14443A-compatible cards and tags — including the popular MIFARE card family — at distances of up to about 5 cm. The module operates at 3.3 V logic levels, making it directly compatible with the ESP32 S3 without any level-shifting circuitry.

Key Specifications

  • Operating frequency: 13.56 MHz
  • Communication interface: SPI (default), I2C, UART
  • Operating voltage: 3.3 V (do not connect VCC to 5 V)
  • Read range: up to ~5 cm (depending on tag and antenna orientation)
  • Supported tag types: MIFARE 1KB, MIFARE Ultralight, MIFARE Classic, and other ISO 14443A cards
  • Dimensions: approximately 40 mm × 60 mm

Pinout

RFID-RC522 module Pinout

The RFID-RC522 module has 8 pins, some of which are shared among three communication interfaces: SPI, I2C, and UART. Only one communication mode can be active at a time. The pins are:

  1. GND: Connect to GND (0 V)
  2. VCC: Connect to 3.3 V — never connect to 5 V
  3. RST: Reset and power-down control — when pulled low, hard power-down is enabled; the module resets on the rising edge
  4. IRQ: Interrupt output — alerts the ESP32 S3 when an RFID tag enters the detection range (not used in this tutorial)
  5. MISO / SCL / TX: Serves as MISO (SPI), SCL (I2C), or TX (UART) depending on the active interface
  6. MOSI: MOSI data line when SPI is enabled
  7. SCK: Serial clock when SPI is enabled
  8. SS / SDA / RX: Serves as SS (SPI), SDA (I2C), or RX (UART) depending on the active interface

※ NOTE THAT:

  • The pin order can vary between manufacturers. Always use the labels printed on the module itself. The image above shows the pinout of modules from the DIYables manufacturer.
  • The RFID-RC522 module operates at 3.3 V. Connecting the VCC pin to 5 V will permanently damage the module.
  • This tutorial uses the SPI interface for communication between the ESP32 S3 and the RFID-RC522 module.

Wiring Diagram

Connecting the RFID-RC522 module to the ESP32 S3 requires only a handful of jumper wires because the module uses the hardware SPI bus. Keep all wires short to reduce noise on the SPI lines and double-check each connection before powering the board.

The wiring diagram between ESP32 S3 RFID RC522

This image is created using Fritzing. Click to enlarge image

Safety Notes

The RFID-RC522 module runs on 3.3 V logic — connecting its VCC pin to the 5 V rail will immediately destroy the module, so always verify your power connection before applying power. The IRQ pin is left unconnected in this tutorial, which is fine; simply leave it floating if your wiring harness does not have a wire assigned to it. Because the ESP32 S3's SPI bus operates at 3.3 V, no level-shifting resistors are needed between the module and the board.

RFID/NFC RC522 Module ESP32 S3 Pin
SS pin GPIO10 (SS/CS)
SCK pin GPIO12 (SCK)
MOSI pin GPIO11 (MOSI)
MISO pin GPIO13 (MISO)
IRQ pin (not connected)
GND pin GND
RST pin GPIO39
VCC pin 3.3V

ESP32 S3 RFID/NFC Code

The following code initializes the SPI bus and the MFRC522 library, then continuously polls for a new tag. When a tag is detected, it reads the tag type and UID, prints both to the Serial Monitor in hexadecimal format, and then halts the card so the next tap will be treated as a fresh read.

/* * This ESP32 S3 code was developed by newbiely.com * * This ESP32 S3 code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/esp32-s3/esp32-s3-rfid */ /* * This ESP32-S3 code is created by esp32io.com * * This ESP32-S3 code is released in the public domain * * For more detail (instruction and wiring diagram), visit https://esp32io.com/tutorials/esp32-s3-rfid-nfc */ #include <SPI.h> #include <MFRC522.h> #define SS_PIN 10 // ESP32-S3 pin GPIO10 #define RST_PIN 39 // ESP32-S3 pin GPIO39 MFRC522 rfid(SS_PIN, RST_PIN); void setup() { Serial.begin(9600); SPI.begin(); // init SPI bus rfid.PCD_Init(); // init MFRC522 Serial.println("Tap an RFID/NFC tag on the RFID-RC522 reader"); } void loop() { if (rfid.PICC_IsNewCardPresent()) { // new tag is available if (rfid.PICC_ReadCardSerial()) { // NUID has been readed MFRC522::PICC_Type piccType = rfid.PICC_GetType(rfid.uid.sak); Serial.print("RFID/NFC Tag Type: "); Serial.println(rfid.PICC_GetTypeName(piccType)); // print UID in Serial Monitor in the hex format Serial.print("UID:"); for (int i = 0; i < rfid.uid.size; i++) { Serial.print(rfid.uid.uidByte[i] < 0x10 ? " 0" : " "); Serial.print(rfid.uid.uidByte[i], HEX); } Serial.println(); rfid.PICC_HaltA(); // halt PICC rfid.PCD_StopCrypto1(); // stop encryption on PCD } } }

Detailed Instructions

  1. New to ESP32 S3? Complete our Getting Started with ESP32 S3 guide first.
  2. Wire the circuit: Connect the RFID-RC522 module to the ESP32 S3 according to the wiring diagram above.
  3. Connect to computer: Plug the ESP32 S3 into your computer using a USB Type-C cable.
  4. Open Arduino IDE: Launch the Arduino IDE on your computer.
  5. Select your board: Choose ESP32 S3 from the board selector and select the correct COM port.
  6. Install the MFRC522 library: Click the Libraries icon on the left bar of the Arduino IDE.
  7. Search for the library: Type "MFRC522" in the search box, then look for the library by GithubCommunity.
  8. Install: Click the Install button to install the MFRC522 library.
  • Search for MFRC522 created by GithubCommunity and click the Install button.
Newbiely | Arduino IDE 2.3.8
──
File
Edit
Sketch
Tools
Help
ESP32S3 Dev Module
Library Manager
Type:
All
Topic:
All
MFRC522 by GithubCommunity
Read/Write a RFID Card or Tag using the ISO/IEC 14443A/MIFARE interface. More info
1.4.11
INSTALL
Newbiely.ino
···
1 void setup() {
Output
Serial Monitor
Ln 1, Col 1
ESP32S3 Dev Module on COM15
1
  1. Upload the code: Copy the code above, paste it into Arduino IDE, and click the Upload button.
  2. Open Serial Monitor: Open the Serial Monitor in Arduino IDE after uploading.
How to open serial monitor on Arduino IDE
  1. Test the reader: Tap several RFID or NFC tags against the RC522 module.
  2. View the output: Watch the tag type and UID appear in the Serial Monitor.
  3. Pro Tip: Hold each tag flat and parallel to the RC522 antenna coil at a distance of 1–3 cm for the most reliable reads.

Serial Monitor Output

Open the Serial Monitor at 9600 baud after uploading the code, then tap RFID or NFC tags onto the RC522 module to see their type and UID printed for each scan.

Newbiely | Arduino IDE 2.3.8
──
File
Edit
Sketch
Tools
Help
ESP32S3 Dev Module
Newbiely.ino
···
8 Serial.println("Hello World!");
Output
Serial Monitor
Message (Enter to send message to 'ESP32S3 Dev Module' on 'COM15')
New Line
9600 baud
[2026-06-16 09:14:22] Tap an RFID/NFC tag on the RFID-RC522 reader [2026-06-16 09:14:35] RFID/NFC Tag Type: MIFARE 1KB [2026-06-16 09:14:35] UID: 2B B8 59 B1 [2026-06-16 09:14:48] RFID/NFC Tag Type: MIFARE Ultralight or Ultralight C [2026-06-16 09:14:48] UID: 15 75 46 7A 2C 5B 7E
Ln 11, Col 1
ESP32S3 Dev Module on COM15
2

Applications and Project Ideas

The ESP32 S3 paired with an RC522 RFID module opens up a wide range of identification and access-control applications that can be deployed with minimal extra hardware. Here are practical ways to put this circuit to work:

  1. Access control system: Grant or deny entry by comparing a scanned UID against a stored list of authorized cards.
  2. Attendance tracker: Log each RFID scan with a timestamp over Wi-Fi to a cloud spreadsheet or database for automated attendance records.
  3. Smart locker: Pair with a solenoid lock or servo to create a keyless locker that opens only for registered tags.
  4. Inventory management: Tag items with RFID stickers and scan them with the ESP32 S3 to automate stock counting.
  5. Library book tracker: Attach RFID tags to books and track check-outs and returns without manual barcode scanning.
  6. Pet or asset identification: Read passive RFID chips embedded in pets or equipment for automatic identification at a checkpoint.
  7. Game or puzzle controller: Use RFID tokens as physical inputs in escape rooms, treasure hunts, or interactive installations.

Video Tutorial

Watch the step-by-step video walkthrough for this ESP32 S3 project below.

Challenge Yourself

Now that your ESP32 S3 is successfully reading RFID and NFC tag UIDs, push the project further with these progressively harder challenges:

  1. Beginner: Store a known UID in the sketch and print "Access Granted" or "Access Denied" depending on whether the scanned tag matches.
  2. Beginner: Add an LED indicator that turns green on an authorized tag and red on an unauthorized tag.
  3. Intermediate: Connect a buzzer and play a short tone on every successful scan, with a different tone for unauthorized tags.
  4. Intermediate: Log every scanned UID with a timestamp to a Micro SD Card for a persistent audit trail.
  5. Advanced: Build a web-based admin panel using the ESP32 S3's Wi-Fi to add and remove authorized UIDs at runtime without re-flashing the firmware.
  6. Advanced: Combine the RC522 reader with a solenoid lock and a keypad so the door opens only when both the correct RFID card and a PIN are presented.

Learn More

※ OUR MESSAGES

  • As freelancers, We are AVAILABLE for HIRE. See how to outsource your project to us
  • Please feel free to share the link of this tutorial. However, Please do not use our content on any other websites. We invested a lot of effort and time to create the content, please respect our work!