Skip to content

RFID Reader Hardware Setup

RFID Reader Hardware Setup

This section covers the hardware wiring between the RC522 RFID reader module and the ESP32 microcontroller. Learning this section will enable you to:

  • Understand the RC522 module pinout and specifications
  • Wire the RC522 to ESP32 using SPI interface
  • Identify correct voltage requirements (3.3V only)
  • Recognize wiring issues from incorrect connections

Before starting this section, ensure you have:

  • An ESP32 development board (DevKit, D1, or similar)
  • An RC522 RFID reader module
  • RFID tags/cards (13.56 MHz)
  • Breadboard and jumper wires
  • Two LEDs (green and red) with 100-200Ω resistors
  • Basic understanding of SPI communication

The RC522 is a low-cost RFID reader module based on the NXP MFRC522 integrated circuit. It operates at 13.56 MHz and supports ISO/IEC 14443 A/MIFARE protocol.

Key Specifications:

ParameterValue
Operating Frequency13.56 MHz
Supported ProtocolsMIFARE, ISO/IEC 14443 A
Read Range3-5 cm (typical)
InterfaceSPI (default), I2C, UART
Operating Voltage3.3V only
Current Consumption13-26 mA
Data Transfer RateUp to 10 Mbps (SPI)

⚠️ Critical Warning: The RC522 module does NOT have an onboard voltage regulator. Supplying 5V will permanently damage the module. Always use 3.3V.

RC522 Module Pin Layout:
┌──────────────────────────────┐
│ RC522 RFID Reader Module │
├──────────────────────────────┤
│ SDA(SS) SCK MOSI MISO ││
│ IRQ GND RST 3.3V ││
└──────────────────────────────┘
PinFunctionConnection
SDA (SS)SPI Chip SelectESP32 GPIO 5
SCKSPI ClockESP32 GPIO 18
MOSISPI Master Out Slave InESP32 GPIO 23
MISOSPI Master In Slave OutESP32 GPIO 19
IRQInterrupt RequestNot used (optional)
GNDGroundESP32 GND
RSTResetESP32 GPIO 4
3.3VPower Supply (3.3V)ESP32 3.3V

Before any wiring, confirm your RC522 module is the 3.3V variant:

Terminal window
# Check module markings
# Look for "RC522" or "MFRC522" on the PCB
# If there is no voltage regulator IC visible, it is 3.3V only

⚠️ Important: Some RC522 modules labeled “3.3V/5V” may still lack proper voltage regulation. When in doubt, always use 3.3V.

Connect the components according to the following wiring:

ESP32 DevKit RC522 Module
┌─────────┐ ┌──────────┐
│ GPIO 5 ├──────────────┤ SDA (SS) │
│ GPIO 18 ├──────────────┤ SCK │
│ GPIO 23 ├──────────────┤ MOSI │
│ GPIO 19 ├──────────────┤ MISO │
│ GPIO 4 ├──────────────┤ RST │
│ 3.3V ├──────────────┤ 3.3V │
│ GND ├──────────────┤ GND │
└─────────┘ └──────────┘
ESP32 DevKit LED Circuit
┌─────────┐
│ GPIO 22 ├───┐
│ GPIO 21 ├───┐
│ GND ├───┘
└─────────┘
┌─────┐
┌───────────────┤ GREEN│─── 200Ω ──┐
│ └─────┘ │
│ │
│ ┌─────┐ │
│───────────────┤ RED │─── 200Ω ──┤
└─────┘ GND

Pin Assignments Summary:

ESP32 PinConnected To
GPIO 5RC522 SDA (SS)
GPIO 18RC522 SCK
GPIO 23RC522 MOSI
GPIO 19RC522 MISO
GPIO 4RC522 RST
GPIO 22Green LED (anode)
GPIO 21Red LED (anode)
3.3VRC522 VCC
GNDRC522 GND, LED cathodes

The LEDs require current-limiting resistors:

// LED Resistor Calculation
// Vf (Red LED) ≈ 2.0V, Vf (Green LED) ≈ 2.2V
// Supply = 3.3V, Desired current = 10mA
// For Red LED:
// R = (3.3V - 2.0V) / 0.01A = 130Ω → Use 200Ω (standard value)
// For Green LED:
// R = (3.3V - 2.2V) / 0.01A = 110Ω → Use 200Ω (standard value)

Note: Using 200Ω resistors for both LEDs provides sufficient brightness while ensuring the GPIO pins are not overloaded (ESP32 max 12mA per pin).

Before powering on, verify:

  • RC522 connected to 3.3V, NOT 5V
  • All SPI pins connected correctly (SDA→GPIO5, SCK→GPIO18, MOSI→GPIO23, MISO→GPIO19)
  • RST pin connected to GPIO 4
  • GND connections are common (ESP32 + RC522 share ground)
  • LEDs have current-limiting resistors
  • LEDs are oriented correctly (anode to GPIO, cathode to GND via resistor)

For a more permanent setup (vs. breadboard), the connections can be soldered directly:

RC522 → ESP32 (Direct Solder Points):
┌─────────┬──────────┬──────────┐
│ RC522 │ ESP32 │ Wire │
├─────────┼──────────┼──────────┤
│ SDA │ GPIO 5 │ Red │
│ SCK │ GPIO 18 │ Yellow │
│ MOSI │ GPIO 23 │ Blue │
│ MISO │ GPIO 19 │ Green │
│ RST │ GPIO 4 │ White │
│ 3.3V │ 3.3V │ Orange │
│ GND │ GND │ Black │
└─────────┴──────────┴──────────┘

After completing the wiring:

// Upload a simple blink test to verify LED wiring
void setup() {
pinMode(22, OUTPUT); // Green LED
pinMode(21, OUTPUT); // Red LED
}
void loop() {
digitalWrite(22, HIGH); // Green ON
delay(500);
digitalWrite(22, LOW);
digitalWrite(21, HIGH); // Red ON
delay(500);
digitalWrite(21, LOW);
}

Expected Result: Green and red LEDs should alternately blink every 500ms.

Symptom: The RC522 module becomes hot to touch after power-on

Cause: Module is receiving 5V instead of 3.3V

Solution:

  1. Immediately disconnect power
  2. Verify VCC pin is connected to ESP32 3.3V pin, not 5V
  3. Replace module if damaged

Symptom: LEDs stay off during blink test

Possible Causes:

  • LED orientation reversed (anode/cathode swapped)
  • Resistor value too high (unlikely with 200Ω)
  • GPIO pin not set correctly

Solution:

// Test with a multimeter or use built-in LED first
// ESP32 has built-in LED on GPIO 2
pinMode(2, OUTPUT);
digitalWrite(2, HIGH);
delay(1000);
digitalWrite(2, LOW);

Symptom: RFID tags are only sometimes detected

Cause: Loose wiring or long jumper wires causing signal noise

Solution:

  1. Ensure all connections are firmly seated in breadboard
  2. Keep SPI signal wires as short as possible (<20cm)
  3. Avoid routing SPI wires near high-current lines
  • Recommended: Use a common ground for all components
  • Recommended: Add a 100nF capacitor between 3.3V and GND near RC522 for noise filtering
  • Recommended: Use female-to-female jumper wires for breadboard prototyping
  • Avoid: Powering RC522 from ESP32 3.3V if also driving many other peripherals (current limit ~150mA)
  • Avoid: Running SPI wires parallel to AC power lines
  1. RC522 requires 3.3V only — 5V will destroy the module
  2. SPI wiring: SDA→GPIO5, SCK→GPIO18, MOSI→GPIO23, MISO→GPIO19
  3. LED circuit: GPIO22 (green), GPIO21 (red), each with 200Ω resistor
  4. Common ground is essential for reliable operation

Writing Date: 2026-05-17
Based on Source File: 校正版/10 Time recording witht RFID und TimeTagger.md
Target Audience: Alibaba.com IoT Pre-sales Engineer
Status: ✅ Completed