🚘 Garage Fingerprint Sensor

Just Sharing the work i Did recently.
R503 Grow Sensor from Ali express. You may find Mounting plate and plastic/steel cover on Grow store on aliexpress.

I am using nodemcu esp8266, you may use D1 mini or ESp32.

ESP Configuration mentioned below has option to operate lock through 3.3v relay and a 3.3v buzzer for audio signal in case of matched or unmatched fingerprint.

Sensor Wires:

· Red and white: 3V
· Black: G
· Yellow: D1 , Rx Pin of Sensor
· Gree/Brown: D0 , Tx Pin of Sensor
· Blue: D2, sensing pin of grow sensor
LOCK relay=D5; //Lock-Connect at D5
BUZZER =D8; //Buzzer-Connect positve to D8

To Enroll in home assistant:
Developer tools> actions & Enter
ESPHome: lobby_biometric_esp_enroll
Light purple mean ready to scan finger
Flashes blue 2 time means scan is ok
Green Flashes means scan saved successfully

To Cancel Scan enroll which is initiated
Developer tools> actions & Enter
ESPHome: lobby_biometric_esp_cancel_enroll

To Delete a Finger Print:
Developer tools> actions & Enter
ESPHome: lobby_biometric_esp_delete

Here is the code:

substitutions:
  platform: ESP8266
  board: nodemcu
  device_name: lobby-biometric-esp
  friendly_name: "lobby_fingerprint_esp"
  reboot_timeout_wifi: 900s
  reboot_timeout_api: 1800s
  output_power: 17dB
#################################
esphome:
  name: ${device_name}
  on_boot:
    priority: 600  # Ensures it runs after sensors initialize
    then:
      - lambda: |-
          id(fingerprint_name).publish_state("Started");

esp8266:  # Define the correct platform here
  board: ${board}
wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  fast_connect: on
  reboot_timeout: ${reboot_timeout_wifi}
  output_power: ${output_power}
# Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "AP_${friendly_name}"
    password: !secret ap_password
# Enable logging
logger:
# Enable Home Assistant API
api:
  encryption:
    key: "add yours"
  services:
  - service: enroll
    variables:
      finger_id: int
      num_scans: int
    then:
      - fingerprint_grow.enroll:
          finger_id: !lambda 'return finger_id;'
          num_scans: !lambda 'return num_scans;'
      - fingerprint_grow.aura_led_control:
          state: ALWAYS_ON
          speed: 0
          color: PURPLE
          count: 0
  - service: cancel_enroll
    then:
      - fingerprint_grow.cancel_enroll:
  - service: delete
    variables:
      finger_id: int
    then:
      - fingerprint_grow.delete:
          finger_id: !lambda 'return finger_id;'
  - service: delete_all
    then:
      - fingerprint_grow.delete_all:
ota:
  - platform: esphome
    password: !secret ota_password
web_server:
  port: 80
captive_portal:
mdns:
debug:
  update_interval: 30s
#####################################################
uart:
  tx_pin: D0 # Or GPIO17 for ESP32
  rx_pin: D1 # Or GPIO16 for ESP32
  baud_rate: 57600
fingerprint_grow:
  sensing_pin: D2 # Or GPIO05 for ESP32
  on_finger_scan_matched:
#    - switch.turn_on: trigger_relay
    - fingerprint_grow.aura_led_control:
        state: BREATHING
        speed: 200
        color: Green
        count: 2
    - switch.turn_on: lobby_door_lock_esp
    - output.turn_on: buzzer
    - delay: 200ms
    - output.turn_off: buzzer    
    - text_sensor.template.publish:
        id: fingerprint_state
        state: "Authorized finger"
    - delay: 500ms
    - lambda: |-
        if (id(last_finger_id).state >= 1 && id(last_finger_id).state <= 10) {
          id(fingerprint_name).publish_state("Usman");
        } else if (id(last_finger_id).state >= 11 && id(last_finger_id).state <= 20) {
          id(fingerprint_name).publish_state("Aisha");
        } else if (id(last_finger_id).state >= 21 && id(last_finger_id).state <= 30) {
          id(fingerprint_name).publish_state("Ayan");
        } else if (id(last_finger_id).state >= 31 && id(last_finger_id).state <= 40) {
          id(fingerprint_name).publish_state("Ahmad");
        } else if (id(last_finger_id).state >= 41 && id(last_finger_id).state <= 50) {
          id(fingerprint_name).publish_state("Ser");
        } else {
          id(fingerprint_name).publish_state("Unknown");
        }

    - delay: 5s
    - text_sensor.template.publish:
        id: fingerprint_state
        state: "Ready for Scan"

  on_finger_scan_unmatched:
    - fingerprint_grow.aura_led_control:
        state: FLASHING
        speed: 35
        color: RED
        count: 5
    - repeat:
        count: 3
        then:
          - output.turn_on: buzzer
          - delay: 300ms
          - output.turn_off: buzzer
          - delay: 300ms
    - text_sensor.template.publish:
        id: fingerprint_state
        state: "Unauthorized finger"
    - text_sensor.template.publish:
        id: fingerprint_name
        state: "Unauthorized Person"
    - delay: 3s
    - text_sensor.template.publish:
        id: fingerprint_state
        state: "Ready for Scan"

  on_enrollment_scan:
    - fingerprint_grow.aura_led_control:
        state: FLASHING
        speed: 25
        color: BLUE
        count: 2
    - fingerprint_grow.aura_led_control:
        state: ALWAYS_ON
        speed: 0
        color: PURPLE
        count: 0
    - text_sensor.template.publish:
        id: fingerprint_state
        state: "Finger scanned"
    - delay: 8s
    - text_sensor.template.publish:
        id: fingerprint_state
        state: "Ready for Scan"

  on_enrollment_done:
    - fingerprint_grow.aura_led_control:
        state: BREATHING
        speed: 100
        color: GREEN
        count: 2
    - text_sensor.template.publish:
        id: fingerprint_state
        state: "Enrolled fingerprint"
    - delay: 10s
    - text_sensor.template.publish:
        id: fingerprint_state
        state: "Ready for Scan"

  on_enrollment_failed:
    - fingerprint_grow.aura_led_control:
        state: FLASHING
        speed: 25
        color: RED
        count: 4
    - text_sensor.template.publish:
        id: fingerprint_state
        state: "Failed to enroll fingerprint"
    - delay: 10s
    - text_sensor.template.publish:
        id: fingerprint_state
        state: "Ready for Scan"

text_sensor:
  - platform: template
    id: fingerprint_state
    name: "Lobby Fingerprint State"
  - platform: template
    id: fingerprint_name
    name: "Fingerprint Name"

sensor:
  - platform: fingerprint_grow
    fingerprint_count:
      name: "Lobby Fingerprint Count"
      id: fingerprint_count
    last_finger_id:
      name: "Lobby Fingerprint Last Finger ID"
      id: last_finger_id
    last_confidence:
      name: "Lobby Fingerprint Last Confidence"
    status:
      name: "Lobby Fingerprint Status"
    capacity:
      name: "Lobby Fingerprint Capacity"
    security_level:
      name: "Lobby Fingerprint Security Level"

output:
  - platform: gpio
    id: buzzer
    pin: D8   #Buzzer-Connect positve to D8

switch:
  - platform: gpio
    name: "Lobby Door Lock ESP"
    id: lobby_door_lock_esp
    pin: D5
    restore_mode: ALWAYS_OFF
    on_turn_on:
      - delay: 1s
      - switch.turn_off: lobby_door_lock_esp

In Home assistant: Add this to integration with IP address of you esp

Below are cards you may add to home Assistant.

  • type: sections
    max_columns: 4
    title: FingerPrint
    path: fingerprint
    sections:
    • type: grid
      cards:
      • type: heading
        heading: New section
      • type: glance
        entities:
        • entity: sensor.lobby_fingerprint_state
        • entity: sensor.fingerprint_name
          name: Last Scanned Person
          title: Lobby Biometric Sensor
      • type: custom:mushroom-lock-card
        entity: lock.lobby_door_lock_esp
2 Likes

Hi, thanks for the yaml, it works great. :+1:

For those interested, We built a similar setup using an ESP32 and wrote the ESPHome code from scratch. It includes some neat features, like assigning names to each fingerprint and removing all fingerprints linked to a specific user with a single click. Everything is handled directly on the ESP—no external management required.

5 Likes

I see that a lower resolution device - the r503s is available. Has anyone used this device successfully?

Hi,
FYI, here you can find an external component for FPC2532 sensor, which I made mainly in order to have a sensor that encrypts the sensitive info stored.
It also consumes way more power and have full documentation available and navigation gesture that can be used e.g. for Alarmo. I hope this could be helpful to someone.