🚘 Garage Fingerprint Sensor

Tags: #<Tag:0x00007fc417108398>

Today I wanted to share how I made a fingerprint sensor to control my garage.

It’s what got me in Home Assistant for the first time. I wanted to be able to control my garage from my phone. That’s some time ago, but now I can also control it with a fingerprint sensor :smiley:
I won’t cover how I control the garage itself in this topic, but mainly how to control the fingerprint sensor and how to build it into a wooden object.

What you need:

  • GROW R503 fingerprint sensor (Aliexpress)
  • ESP8266 or ESP32 running ESPHome
  • UTP cable
  • Drill
  • ± 35mm drill bit
  • ± 8mm drill bit
  • Soldering Iron with solder
  • (Optional) 3D printer to print the cover
  • (Optional) Premade cover for the sensor (Aliexpress)

The first step is to strip the UTP cable so you have all coloured wires visible and they can be soldered. The grow sensor has six wires. I soldered the white and red wire together because they both need 3.3v. The other wires I soldered to similar colours on the UTP cable.


After soldering, cover the solder with some electrical tape to isolate them from eachother.
For the other end of the cable, you have to solder them to the ESP8266 or ESP32 board. This are the colours and pins I used for my ESP8266.

  • Red and white: 3V
  • Black: G
  • Yellow: D1
  • Green: D0
  • Blue: D2

Once that’s done, load the ESPHome config on the ESP. This is my config.

uart:
  tx_pin: D0
  rx_pin: D1
  baud_rate: 57600

fingerprint_grow:
  sensing_pin: D2
  on_finger_scan_matched:
    - switch.turn_on: trigger_relay
    - fingerprint_grow.aura_led_control:
        state: BREATHING
        speed: 200
        color: BLUE
        count: 1
    - text_sensor.template.publish:
        id: fingerprint_state
        state: "Authorized finger"
  on_finger_scan_unmatched:
    - fingerprint_grow.aura_led_control:
        state: FLASHING
        speed: 25
        color: RED
        count: 2
    - text_sensor.template.publish:
        id: fingerprint_state
        state: "Unauthorized finger"
  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"
  on_enrollment_done:
    - fingerprint_grow.aura_led_control:
        state: BREATHING
        speed: 100
        color: BLUE
        count: 2
    - text_sensor.template.publish:
        id: fingerprint_state
        state: "Enrolled fingerprint"
  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"

text_sensor:
  - platform: template
    id: fingerprint_state
    name: "Garage Fingerprint State"

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

api:
  password: !secret api_password
  
  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;'
  - 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:

Like @mkloeckner mentioned, it’s important to also set a password for the fingerprint sensor to prevent physical attacks, like soldering another fingerprint sensor to the UTP cable. Please refer to the ESPHome documentation for more information.

When that’s done, you can enroll your fingerprint in the sensor by calling the service esphome.X_enroll where X is the device name, with the parameters finger_id and num_scans. For the first finger fill in id 0, the second finger id 1 and so on. The num scans is the amount of scans it takes to register the finger. I use 2 for that.

Everything worked? Good! Let's build it into a surface.

To get it in the wood I had to desolder the fingerprint sensor from the UTP cable. Grab the drill and a big drill bit, something like this.


Then drill a hole in the wood, deep enough so the fingerprint sensor and some wires can go in there. Then grab a smaller drill bit with the diameter of the UTP cable and drill a hole all the way through the wood so the cable can go trough there. This is how it looks under my cover.

Next step is to attach the cover to the fingerprint sensor. Do you have A 3D printer? Here is an STL file I made for this cover. Don’t have a 3D printer? I linked a fitting cover in the What you need section.

Then solder the fingerprint sensor to the UTP cable again and screw the cover to the wood and you’re all done!

ezgif.com-video-to-gif-4 ezgif.com-optimize

I hope this gave you guys some inspiration for your own projects :slight_smile:

If you’ve got any questions, just ask!

30 Likes

What is the maximum length of UTP from ESP8266 to make the sensor work reliably? Thanks

I use a cable of 5 meters and it works reliable. Not sure how long you can go with the cable.

Thank you. The length of 5 m is enough for me.
I have an optical sensor R307 and I am thinking about what project to use it for.

1 Like

Cool project. Would it be possible to sync fingerprints when using multiple readers? So is the fingerprint info stored on the reader or the ESP? And of it is on the reader, can you import/export?

1 Like

It’s currently not implemented in ESPHome but I believe the device supports exporting and importing of the image. The fingerprints are stored on the R503.

But I wonder if it would work if you import it in another reader. Because the readings of two readers would not be identical I think.

Well done good job. So what do you use the fingerprint sensor for in your garage? Doors?

1 Like

Yes it triggers the garage door. Here’s a video.

1 Like

Very nice setup!

However, I always wonder how such setups can be properly protected against physical attacks. E.g., the UTP cable is easily accessible and could simply be cut and soldered to a new R503 sensor containing the attackers fingerprint. You should at least make use of the password config in ESPHome for the sensor. It seems youre currently using the default password which would allow the attack above.

2 Likes

You’re right! In the config I shared I did not include the password but I’ll edit the post with a password so other people will be aware of this. Thanks :slight_smile:

AWesome setup, but how did you create the automation? The authorized state doesn’t change until an unauthorized finger is placed and vice-versa. Can you please post your automation or node-red whichever you are using?

1 Like

I use the same ESP to open my garage and where the fingerprint sensor is connected, so that makes it easier.

You can create a binary sensor in ESPHome that automatically turns off after X milliseconds if you want a changing state to create an automation on :slight_smile:

1 Like

ah that makes sense and thanks for the binary sensor tip, I was planning to go the input boolean route. Thank Again :slight_smile:

1 Like

Lol, it was a simple solution I’m a total idiot :expressionless:
add another template publish with “scan your finger” solved my problem.

 on_finger_scan_matched:
    - text_sensor.template.publish:
        id: fingerprint_state
        state: "Authorized"
    - fingerprint_grow.aura_led_control:
        state: BREATHING
        speed: 200
        color: BLUE
        count: 2        
    - delay: 10s
    - text_sensor.template.publish:
        id: fingerprint_state
        state: "Scan your finger"    


  on_finger_scan_unmatched:
    - text_sensor.template.publish:
        id: fingerprint_state
        state: "Unauthorized"
    - fingerprint_grow.aura_led_control:
        state: FLASHING
        speed: 25
        color: RED
        count: 3          
    - delay: 10s
    - text_sensor.template.publish:
        id: fingerprint_state
        state: "Scan your finger"
1 Like

Hey @parrel , kudos! Very nice job.
I did something similar (not so beautiful!) with esp32, esphome and R307. In my case, that fingerprint reader has an annoying issue: it seems to try to read a finger even if no fingers are there. The result is that it blinks way too often. Leds are too strong and annoying.
So I’m considering to replace R307 with the R503 you used.
Do you know whether your sensors has this issue, too?

Do you use ESPHome? And do you have a blue wire coming from the R307? If you connect the blue wire to the ‘sensing pin’ in ESPHome, it should only start scanning when a finger is on the sensor.

Btw my sensor does not have this issue due to the sensing pin :slight_smile:

Yes, I’m using ESPHome and the sensing pin.

If I don’t use the sensing pin → the fingerprint keeps scanning in loop
If I use the sensing pin → the fingerprint scans very often, irregularly, like it’s sensing a not-existent finger.
Probably an issue with my fingerprint reader, I’m considering to buy your model.

Thanks for your help!

1 Like

Awesome project! I was already thinking of having some sort of automated lock for the side gate to the rear garden, adding a fingerprint sensor would really make that a nice touch.

1 Like