esphome / issues

Issue Tracker for ESPHome
https://esphome.io/
290 stars 36 forks source link

PN532 RFID module consumes too much power when ESP is in deep sleep #4421

Closed tracestep closed 1 year ago

tracestep commented 1 year ago

The problem

When I put the board on deep sleep (e.g,: deep_sleep.enter), PN532 chip can be left in a state where it consumes too much power (around 20 - 40 mA). I have traced the issue to the fact that, before entering deep sleep, the chip is not properly powered down and can be left with the RF field on waiting for a tag.

Which version of ESPHome has the issue?

2023.3.2

What type of installation are you using?

pip

Which version of Home Assistant has the issue?

Indifferent

What platform are you using?

ESP32-IDF

Board

WT32-ETH01

Component causing the issue

pn532

Example YAML snippet

i2c:
  scl: GPIO32
  sda: GPIO33
  scan: True
  frequency: 100kHz
  timeout: 10ms

pn532_i2c:
  update_interval: 1s
  id: rfid
  on_tag:
    then:
      - binary_sensor.template.publish:
          id: tag_present
          state: ON
      - delay: 1s
      - binary_sensor.template.publish:
          id: tag_present
          state: OFF

binary_sensor:
  - id: tag_present
    platform: template
    name: RFID tag present

deep_sleep:
  id: sleeper
  touch_wakeup: false
  esp32_ext1_wakeup:
    pins: [GPIO39, GPIO35, GPIO14]
    mode: ANY_HIGH

button:
  - id: button_sleep
    platform: template
    name: Sleep
    icon: mdi:sleep
    on_press:
      then:
        - deep_sleep.enter:
            id: sleeper

Anything in the logs that might be useful for us?

No response

Additional information

I will link a PR tested with I²C, but will probably work with SPI as well.

malo1972 commented 1 year ago

have you tried to set RSTPD_N to low? see hard power down moe (HPD) doc: https://www.nxp.com/docs/en/nxp/data-sheets/PN532_C1.pdf