RFID & NFC · lesson 2 of 8
The field, and the first hello
The reader's antenna makes a 13.56 MHz magnetic field. The card has no battery: its coil harvests that field, its chip wakes up, and it answers by loading the field in a rhythm the reader can hear. First in 3D, then frame by frame, then for real in the sniffer.
See a card wake up and answer, read its identity, and find your reader's range.
You're done when
- The card view shows your card's UID, “MIFARE Classic 1K”, ATQA 00 04 and SAK 08.
- The trace view lists the wake-up frames: WUPA, ATQA, ANTICOLL, UID + BCC, SELECT, SAK, HLTA.
- You know roughly at what height the read rate starts dropping (your range).
On the board
You will learn
- 13.56 MHz near field
- inductive coupling
- 100 % ASK pauses
- load modulation
- REQA · WUPA · ATQA
- a polling task
- sniffing frames
uv run pio run -d labs/rfid-lab-r2 -e rfid-lab-r2 -t uploadParts required
Parts library- ESP32-S3-DevKitC-1 + USB-C data cable
- 1.9″ ST7789 screen
- RC522 card reader
- MIFARE card and key fob
The field, in 3D
A model of your reader and card: drag to turn it, move the card up and down, change the gain, and press Send WUPA to watch one wake-up. The chart under it shows why the range ends where it does.
3D electromagnetic field visualization explaining how the RC522 13.56 MHz coil powers passive ISO14443-A cards via inductive coupling. A model of your reader and card: drag to turn it, move the card up and down, change the gain, and press Send WUPA to watch one wake-up. The chart under it shows why the range ends where it does.
- Key concepts: 13.56 MHz near field, inductive coupling, 100 % ASK pauses, load modulation, REQA · WUPA · ATQA, a polling task, sniffing frames.
- Signals & pins: 3V3 (VCC), 3V3 (RC 3.3V), GPIO7 (BLK), GPIO8 (RES), GPIO9 (DC).
Interactive diagram loads after page initialization.
Follow one wake-up, step by step
What happens in the first millisecond after a card arrives, from the ESP32's SPI writes to the card's answer. The same frames appear in your sniffer.
ISO14443-A handshake sequence showing REQA/WUPA, ATQA, anticollision cascade, and SAK responses. What happens in the first millisecond after a card arrives, from the ESP32's SPI writes to the card's answer. The same frames appear in your sniffer.
- Key concepts: 13.56 MHz near field, inductive coupling, 100 % ASK pauses, load modulation, REQA · WUPA · ATQA, a polling task, sniffing frames.
- Signals & pins: 3V3 (VCC), 3V3 (RC 3.3V), GPIO7 (BLK), GPIO8 (RES), GPIO9 (DC).
- Walkthrough flows: wake, select.
Interactive diagram loads after page initialization.
What the screen shows
The board's screen has six views. A click on the push button (or BOOT) goes to the next one, a double-click runs the action written at the bottom left, a long press pauses card polling. Pick a view to see what each part means; the numbers match the list below it.
Gallery of ST7789 display screens rendered during the RC522 RFID labs. The board's screen has six views. A click on the push button (or BOOT) goes to the next one, a double-click runs the action written at the bottom left, a long press pauses card polling. Pick a view to see what each part means; the numbers match the list below it.
- Key concepts: 13.56 MHz near field, inductive coupling, 100 % ASK pauses, load modulation, REQA · WUPA · ATQA, a polling task, sniffing frames.
- Signals & pins: 3V3 (VCC), 3V3 (RC 3.3V), GPIO7 (BLK), GPIO8 (RES), GPIO9 (DC).
Interactive diagram loads after page initialization.
Commands, in order
Type these in the serial monitor (uv run pio device monitor) unless the grey tag says otherwise. The coloured tag says what should be near the board while it runs.
uv run pio run -d labs/rfid-lab-r2 -e rfid-lab-r2 -t uploadMac terminalcard: doesn't matter- Does
- Flashes lab R2's own firmware: everything from R1, plus the trace view and the poll and trace commands.
helplists exactly this lab's commands. - You should see
rfid-lab-r2: reader task started, then this lab's command list and views.- If not
- “Failed to connect”: hold BOOT, tap RST, release BOOT, run it again.
(click to the card view)push button / BOOTcard away- Does
- One click on the push button or BOOT goes to the next view; the dots at the top show which one.
- You should see
- Rings around the antenna and “Hold a card or tag flat on the reader”, plus how many taps so far.
lay the card flat on the readerwith your handscard on the reader- Does
- The reader task polls ~12 times a second; the first poll that finds the card wakes it, reads its UID, then halts it.
- You should see
- The on-board LED flashes bright green, then stays green while the card lies there. The card view shows the UID, type, ATQA/SAK and a read rate that fills to 100 %. The monitor prints
card 9C:4F:… · MIFARE Classic 1K · ATQA 0004 SAK 08and the frames. - If not
- Nothing? Run R1's
chipagain; then try the card flat in the middle of the antenna.
lift the card slowlywith your handscard on, then move it- Does
- The field gets weaker with height; polls start to miss.
- You should see
- The read rate turns amber, then coral. After 3 misses in a row (~0.3 s) the monitor says
card removed.
(click to the trace view)push button / BOOTcard: doesn't matter- Does
- The sniffer: the frames of the last wake-up, with times in ms.
- You should see
> 52 WUPA,< 04 00 ATQA,> 93 20 ANTICOLL CL1,< UID + BCC,> SELECT CL1,< SAK,> HLTA.- If not
- “Sniffer off”: type
trace on.
trace off / trace onserial monitorcard: doesn't matter- Does
- The sniffer is on by default and prints each new card's frames in the monitor. Off silences the monitor and the trace view.
- You should see
sniffer off/sniffer onat the bottom right.
gain 0, gain 7, then gain 4serial monitorcard on, then move it- Does
- Receiver gain 18 dB (0), 48 dB (7), default 33 dB (4). Hold the card at the edge of your range for each.
- You should see
- The read rate at the same height changes with gain, but only up to a point: far away the card has no power, whatever the gain.
- If not
- Finish with
gain 4.
poll off / poll on (or a long press)serial monitorcard: doesn't matter- Does
- Pauses and resumes card polling.
- You should see
- The card view says “polling paused”; new cards are ignored until
poll on.
Steps
0 of 6 ticked. Ticks are saved in this browser.
The reader polls about 12 times a second in its own task on core 0, so the screen never waits. A card counts as removed only after 3 missed polls in a row (~0.3 s), so one weak poll at the edge of range doesn't make it flicker. The 3D model is simplified on purpose: measure your real range in R6.
Preview: what you should see
Interactive RC522 13.56 MHz RFID reader simulator showing tag detection, VersionReg 0x92, UIDs, and serial monitor logs.
- Key concepts: 13.56 MHz near field, inductive coupling, 100 % ASK pauses, load modulation, REQA · WUPA · ATQA, a polling task, sniffing frames.
- Signals & pins: 3V3 (VCC), 3V3 (RC 3.3V), GPIO7 (BLK), GPIO8 (RES), GPIO9 (DC).
Interactive diagram loads after page initialization.
ESP32-S3 peripherals used in this lab
Open interactive GPIO pinoutExplore the hardware blocks, pin rules, and registers behind this experiment.
- GPIO and IO MUX
45 pins, and a matrix that routes almost any signal to almost any pin
- SPI
Fast four-wire bus for screens, card readers and flash
- UART
Three serial ports, the one you see in the serial monitor
- CPU
Two Xtensa LX7 cores at up to 240 MHz
- SRAM
512 KB of fast on-chip RAM for your code and data
- ROM
384 KB of factory code: the bootloader and download mode
Troubleshooting & hardware gotchas
See all 17 ESP32-S3 hardware gotchas- What if it does not work or behaves unexpectedly?
- The reader polls about 12 times a second in its own task on core 0, so the screen never waits. A card counts as removed only after 3 missed polls in a row (~0.3 s), so one weak poll at the edge of range doesn't make it flicker. The 3D model is simplified on purpose: measure your real range in R6.
- If “uv run pio run -d labs/rfid-lab-r2 -e rfid-lab-r2 -t upload” does not work
- “Failed to connect”: hold BOOT, tap RST, release BOOT, run it again.
- If “lay the card flat on the reader” does not work
- Nothing? Run R1's
chipagain; then try the card flat in the middle of the antenna. - If “(click to the trace view)” does not work
- “Sniffer off”: type
trace on. - If “gain 0, gain 7, then gain 4” does not work
- Finish with
gain 4. - Four pins are read at reset
- GPIO0, GPIO3, GPIO45 and GPIO46 are sampled the moment the chip comes out of reset: they pick the boot mode, the flash voltage, the ROM log and the JTAG source. Anything wired to them must not pull them the wrong way at power-up. After reset they are normal pins again.
- GPIO3 has no pull resistor at reset
- GPIO0 has a weak pull-up and GPIO45/46 weak pull-downs, but GPIO3 floats. When the eFuses make it choose the JTAG source, an outside circuit has to hold it at a clear level.
- GPIO47 and 48 run at 1.8 V on R16V modules
- Modules with the ESP32-S3R16V chip set the flash voltage to 1.8 V, and GPIO47/48 share that supply. A 3.3 V part on those pins sees the wrong levels.
- The pins are not 5 V tolerant
- A high input may go up to the pin's supply plus 0.3 V, so about 3.6 V on a 3.3 V board, and the power pins are rated to 3.6 V at most. 5 V from a sensor or an Arduino can damage the chip: use a level shifter or a divider.