Skip to content
esp-labsESP32-S3 bench guide
ESP32-S3 DevKitC pinoutThis lesson uses: VCC on 3V3, RC 3.3V on 3V3, BLK on 7, RES on 8, DC on 9, CS on 10, SDA on 11, SCL on 12, GND on GND, RC SDA on 15, RC SCK on 16, MOSI on 17, MISO on 18, RC RST on 14, IRQ on 13, RC GND on GND, BTN on 5, BOOT on 0.ESP32-S3WROOM-1 N16R8BOOTRSTRGBUSBCOM3V3VCC3V3RC 3.3VRST45BTN67BLK15RC SDA16RC SCK17MOSI18MISO8RES3469DC10CS11SDA12SCL13IRQ14RC RST5VGNDGNDGNDRC GNDTX 43RX 441242414039383736350BOOT454847212019GNDGND
  • used in this lesson
  • safe GPIO
  • avoid
  • power
  • ground
  • button input
  • RC522
Between lessons
  1. Ctrl+C closes the monitor on the Mac only. The board keeps running.
  2. Unplug USB: this is what stops the program and the screen
  3. Rewire while off
  4. Check VCC is on 3V3, no loose ends
  5. Plug in, flash the next lesson

Never unplug during Writing at 0x…. Pin changing from output to input? Flash first, then wire.

Lesson R2

RFID & NFC · lesson 2 of 8

The field, and the first hello

built, not flashed

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.

Goal

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).

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 upload
Open this lab's code on GitHubesp-labs / labs / rfid-lab-r2 (opens in a new tab)

Parts 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.

  1. 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. help lists 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.
  2. (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.
  3. 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 08 and the frames.
    If not
    Nothing? Run R1's chip again; then try the card flat in the middle of the antenna.
  4. 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.
  5. (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.
  6. 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 on at the bottom right.
  7. 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.
  8. 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 pinout

Explore 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 chip again; 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.