RFID Wiegand Integration with ESP8266 D1 Mini

Hello everyone, and thank you in advance for your time!

Background:

We’ve been actively using HomeAssistant and wanted to open our front door using NFC (through a phone or a bank card) or standard RFID chips. Inspired by this idea, we implemented it using Adonno TagReader. We ordered an ESP8266 D1 Mini and NFC RFID PN532. We modified an example EspHome configuration file for HomeAssistant from Adonno TagReader to suit our situation (omitting the LED and buzzer), resulting in the following configuration. In this setup, everything worked fine. We applied chips and phones, and the doors opened through HA automation as expected.

First Problem:

It turns out that the NFC RFID PN532 has a very limited range. We tried installing it inside the door to conceal it, but the signal couldn’t penetrate even a thin layer of metal.

Proposed Solution:

We decided to switch from NFC RFID PN532 to an RFID reader with Wiegand interface. The advantages of this reader include minor vandalism protection, and we can hide the entire setup inside the door. Also, we believe it should operate reliably in cold weather.

Request for Assistance from the Knowledgeable Community:

We followed the below diagram and used the following EspHome configuration. However, when we present RFID chips and NFC cards, nothing happens (no signs of life in the HA - EspHome logs). I’ve read somewhere and seen that the Esp8266 and RFID Wiegand should share a common ground. I’m not sure how to do this or solve the problem…


Please help us get this setup running and make life a bit happier! :pray:t2::heart:

No idea if that’s your actual problem, although I’m sure it isn’t helping, but to do that just connect them together so all 3 grounds are connected.

BTW, I think you’re gonna have this problem with any device.

I have the exact same setup (mini reader + wemos d1) and having the same issue.

I have these logs showing:

When I pass a tag over the reader, the led blinks but nothing happens

This is my yaml:

esphome:
  name: esphome-wiegand-nfc-reader
  friendly_name: ESPHome Wiegand NFC Reader
  platform: ESP8266
  board: d1_mini


# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "12345678"

ota:
  password: "12345678"

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

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Esphome-Wiegand-Nfc-Reader"
    password: "12345678"

captive_portal:

sensor:
  - platform: wifi_signal # Reports the WiFi signal strength/RSSI in dB
    name: "WiFi Signal dB"
    id: wifi_signal_db
    update_interval: 60s
    entity_category: "diagnostic"

  - platform: copy # Reports the WiFi signal strength in %
    source_id: wifi_signal_db
    name: "WiFi Signal Percent"
    filters:
      - lambda: return min(max(2 * (x + 100.0), 0.0), 100.0);
    unit_of_measurement: "Signal %"
    entity_category: "diagnostic"
    device_class: ""

wiegand:
  - id: leitor
    d0: GPIO5
    d1: GPIO4
    on_key:
      - lambda: ESP_LOGI("KEY", "received key %d", x);
    on_tag:
      - lambda: ESP_LOGI("TAG", "received tag %s", x.c_str());
      - homeassistant.tag_scanned: !lambda 'return x.c_str();'
    on_raw:
      - lambda: ESP_LOGI("RAW", "received raw %d bits, value %llx", bits, value);

I digged into this issue over the weekend, and there are two things missing in your setup:

  1. The D0 (green wire) cannot be connected to D0 (GPIO16) of the wemos. You need to connect it to another GPIO (suggest GPIO4, or D2. This means your yaml would need to be adjusted to:
wiegand:
  - id: leitor
    d0: GPIO4
    d1: GPIO5
  1. You need to connect your GND wire (black wire) to the Wemos D1 GND pin