ESP32-S3 with PN532 wiring diagram on SPI

Hello,

I have the board ESP32-S3-WROOM-1-N16R8 and PN532 Blue board (same in PN532 NFC/RFID — ESPHome)

The switch on PN532 is configured same as the image for SPI mode

Wiring diagram:
esp32-s3-wroom-1-N16R8 PN532 BLUE Version
GPIO13/SCK ------------------------------ SCK
GPIO11/MISI ------------------------------ MI
GPIO12/MISO ----------------------------- MO/SDA/TX
GPIO10/SS --------------------------------- NSC/SCL/RX
GND ------------------------------------------ GND
5V --------------------------------------------- 5V

Here is ESPHOME config

esphome:
  name: esp32-s3
  friendly_name: ESP32-S3-WROOM-1-N16R8

esp32:
  board: esp32-s3-devkitc-1
  framework:
    type: arduino

# Enable logging
logger:

web_server:
  port: 80

# Enable Home Assistant API
api:
  encryption:
    key: "/oAGdSpUJSkfYsHsZ9JJmAVHFv1Lxj3I0clPn6gEZx4="

ota:
  password: "1f28aca325cee5a069b9ba3459912fb4"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Esp32-S3 Fallback Hotspot"
    password: "BR6eQssNJSDF"

captive_portal:

spi:
  clk_pin: GPIO10
  miso_pin: GPIO12
  mosi_pin: GPIO11

pn532_spi:
  cs_pin: GPIO13
  update_interval: 1s


binary_sensor:
  - platform: pn532
    uid: 74-10-37-94
    name: "PN532 NFC Tag"
  - platform: pn532
    uid: 53-ED-E6-AC-00-00-00
    name: "New Tag"
  - platform: pn532
    uid: 53-ED-E6-AC
    name: "New prefix tag"

I’m using ESPHome 2023.10.1

Here is the log:

INFO ESPHome 2023.10.1
INFO Reading configuration /config/esphome/esp32-s3.yaml...
INFO Starting log output from esp32-s3.local using esphome API
INFO Successfully connected to esp32-s3.local
[13:48:12][I][app:102]: ESPHome version 2023.10.1 compiled on Oct 21 2023, 13:31:52
[13:48:12][C][wifi:546]: WiFi:
[13:48:12][C][wifi:382]:   Local MAC: FILTERED
[13:48:12][C][wifi:383]:   SSID: [redacted]
[13:48:12][C][wifi:384]:   IP Address: FILTERED
[13:48:13][C][wifi:386]:   BSSID: [redacted]
[13:48:13][C][wifi:387]:   Hostname: 'esp32-s3'
[13:48:13][C][wifi:389]:   Signal strength: -47 dB ▂▄▆█
[13:48:13][C][wifi:393]:   Channel: 1
[13:48:13][C][wifi:394]:   Subnet: 255.255.255.0
[13:48:13][C][wifi:395]:   Gateway: FILTERED
[13:48:13][C][wifi:396]:   DNS1: FILTERED
[13:48:13][C][wifi:397]:   DNS2: 0.0.0.0
[13:48:13][C][logger:361]: Logger:
[13:48:13][C][logger:362]:   Level: DEBUG
[13:48:13][C][logger:363]:   Log Baud Rate: 115200
[13:48:13][C][logger:365]:   Hardware UART: UART0
[13:48:13][C][spi:067]: SPI bus:
[13:48:13][C][spi:068]:   CLK Pin: GPIO10
[13:48:13][C][spi:069]:   SDI Pin: GPIO12
[13:48:13][C][spi:070]:   SDO Pin: GPIO11
[13:48:13][C][spi:072]:   Using HW SPI: SPI
[13:48:13][C][pn532:375]: PN532:
[13:48:13][C][pn532:387]:   Update Interval: 1.0s
[13:48:13][C][pn532:390]:   Tag 'PN532 NFC Tag'
[13:48:13][C][pn532:390]:   Tag 'New Tag'
[13:48:13][C][pn532:390]:   Tag 'New prefix tag'
[13:48:13][C][pn532_spi:156]:   CS Pin: GPIO13
[13:48:13][C][captive_portal:088]: Captive Portal:
[13:48:13][C][web_server:161]: Web Server:
[13:48:13][C][web_server:162]:   Address: esp32-s3.local:80
[13:48:13][C][mdns:115]: mDNS:
[13:48:13][C][mdns:116]:   Hostname: esp32-s3
[13:48:13][C][ota:097]: Over-The-Air Updates:
[13:48:13][C][ota:098]:   Address: esp32-s3.local:3232
[13:48:13][C][ota:101]:   Using Password.
[13:48:13][C][api:138]: API Server:
[13:48:13][C][api:139]:   Address: esp32-s3.local:6053
[13:48:13][C][api:141]:   Using noise encryption: YES

However, when I approach the NFC tag, no message in the log for new tag. The tag is working on phone, I can read the uid by using NFC tool app.

Could you please help to check if

  • the wiring diagram is OK?
  • ESPHOME config is OK?

Thanks for your help.

Do you get any response in the logs if you remove the binary sensors?

Personally I use I2C for my PN532 but SPI should work just fine.

Ok - should have spotted it straight away - I think CLK is SCK and CS goes to SS - i.e. swap pins 10 and 13

@zoogara
Thanks for your reply. Swap the cable or just edit the esphome config?

After removing binrary sensor I don’t receive any log…

Either should work.

Thanks. Unfortunately, after doing the swap of esphome config from

...
spi:
  clk_pin: GPIO10
  miso_pin: GPIO12
  mosi_pin: GPIO11
pn532_spi:
  cs_pin: GPIO13
  update_interval: 1s
...

to

...
spi:
  clk_pin: GPIO13
  miso_pin: GPIO12
  mosi_pin: GPIO11
pn532_spi:
  cs_pin: GPIO10
  update_interval: 1s
...

The LED on PN532 isn’t turned on (position: Red circle in pic below). No log on NFC tag as well.

I had similar problems.
But if you dont see a burning LED my guess would be your wiring is not okay.

Assuming the wiring is as at the top of the post, and your config is as above, then you have also swapped MOSI and MISO…

With this wiring:

GPIO13/CLK ------------------------------ SCK
GPIO11/MISO ----------------------------- MI
GPIO12/MOSI ----------------------------- MO/SDA/TX
GPIO10/CS --------------------------------- NSS/SCL/RX
GND ------------------------------------------ GND
5V --------------------------------------------- 5V

this is the config:

spi:
  clk_pin: GPIO13
  miso_pin: GPIO11
  mosi_pin: GPIO12
pn532_spi:
  cs_pin: GPIO10
  update_interval: 1s

Has anyone managed to make this nfc board work with a ESP32-S3R8? It works with a ESP32 WROOM32 but haven’t managed to make it work witha Liligo T-Display-S3, which has a ESP32-S3R8.
This is what I’m working on:

I have a l logic level converter in between to convert 5V - 3.3V signals which again, works fine with the ESP32-WROOM32