This guide shows how to use the ELECHOUSE ST25R3916 NFC Reader Module with an ESP32 over I2C. The module works in SPI mode by default. To use I2C, you must first bridge the on-board pad marked I2C.
Before You Start
- SPI is the default quick-start interface.
- I2C requires a hardware pad bridge on the module.
- This guide is intended for users who specifically need a two-wire host connection.
Step 1, Switch the Module to I2C Mode
Bridge the on-board pad marked “I2C” on the module. Without this bridge, the board remains in default SPI mode and the I2C examples will not work correctly.
If you are preparing product images or internal docs, place the pad-bridge photo next to this instruction so users can see exactly what must be soldered.
Step 2, Install the Latest Library
Use the latest ELECHOUSE ST25R3916 library from GitHub:
https://github.com/wilson-elechouse/ST25R3916
Install both folders into your Arduino libraries directory:
- NFC-RFAL
- ST25R3916_ELECHOUSE
Recommended board in Arduino IDE: ESP32 Dev Module
Step 3, Default ESP32 I2C Wiring
| ESP32 Pin | ST25R3916 Pin |
| GPIO21 | SDA |
| GPIO22 | SCL |
| GPIO4 | IRQ |
| 5V | 5V |
| GND | GND |
Optional:
- GPIO2 -> LED status output
- Recommended I2C clock for bring-up: 100 kHz
Recommended I2C Examples
- ESP32_I2C_probe_chip – raw ACK, chip ID, and initialization test
- ESP32_I2C_scan_14443A – basic ISO14443A card detection
- ESP32_I2C_scan_14443A_15693 – extended scan example
- ESP32_I2C_polling_hotplug – continuous polling with insert and remove reporting
- ESP32_I2C_mf1_s70_read_write_test – MIFARE Classic S70 read/write test over I2C
Suggested Bring-Up Order
- Start with ESP32_I2C_probe_chip to confirm basic communication.
- Then run ESP32_I2C_scan_14443A to verify card detection.
- After that, try extended or continuous polling examples.
Expected Results
- The board responds on the I2C bus
- The chip ID or initialization message appears in Serial Monitor
- ISO14443A cards can be detected reliably
- Polling examples show stable insert and remove reporting
Troubleshooting
- No response on I2C: confirm the I2C pad has been bridged
- Initialization fails: re-check SDA, SCL, IRQ, 5V, and GND wiring
- No card detection: start with ISO14443A examples first and keep the card close to the antenna
- Unstable behavior: keep the I2C clock at 100 kHz during initial testing
- Compile issues: make sure both NFC-RFAL and ST25R3916_ELECHOUSE are installed from the latest GitHub repository
Which Interface Should You Use?
- Use SPI first if you want the simplest quick-start path
- Use I2C if your host system prefers a two-wire bus and you are comfortable modifying the hardware pad
