Not long after support for fingerprint sensors was added to ESPHome, the first use of them was publicized in the Home Assistant Community. The Dutch community member, who goes by the name of
parrel and is known for their DIY Zigbee projects, recessed the fingerprint sensor in to a board outside their already automated garage. From there, they fed its wires indoors, where they are connected to an ESP8266 board.
As their garage was already automated, this projects is more of an add-on and doesn’t cover how to make a garage door opener smart. If that is what you are interested in, there are many guides for DIY solutions using ESPHome available online and pre-built devices to be bought in stores.
Table of Contents
- What you will need to build a fingerprint-activated garage door
- Wiring the fingerprint-activated garage door
- Writing the firmware using ESPHome
- Is a DIY fingerprint sensor using ESPHome secure?
What you will need to build a fingerprint-activated garage door
The main component of the fingerprint sensing garage door opener, besides the ESP8266 board powered by ESPHome, is the GROW R503 fingerprint sensor (buy on AliExpress). I previously predicted that I’m expecting this model to become the most popular fingerprint sensor for ESPHome and other DIY projects. It has a rugged metal body and allows for panel-mounting, making it perfect for embedding in to objects, such as wooden doors. The GROW R503 features a capacitive sensor and has a similar look, but bigger size, to fingerprint sensors you used to find on the back of Android smartphones, before the moved under the display.
What’s nice about the GROW R503 fingerprint sensor is that it features a handful of colour LEDs in a ring around the sensor itself. These can give the user visual feedback on whether the fingerprint was accepted or rejected.
As the GROW R503 fingerprint sensor only draws ~20 mA when in use, it can be directly attached to the ESP8266 and doesn’t need to be powered by an external power supply. In this case, an old 5V, 500 mA Micro-USB power supply should have enough power to juice the whole project. Generally, I don’t recommend powering an ESP8266 or ESP32 using the Micro-USB port, and I wouldn’t recommend it for this project if you were adding anything other than just the fingerprint sensor.
To make the project look more professional, you could 3D-print a cover for the GROW R503 fingerprint sensor, and make it flush with the wood. The creator of this project has even made their design freely available to download. However, this is one of the rare projects where a 3D printer is optional, as these covers can also be bought online. You will even find covers made from stainless steel on AliExpress, which could give your fingerprint sensor a premium look. You will also find enclosures for the sensor from the same seller, these should offer protection from “rain and dust” but aren’t waterproof.
There aren’t many sensors that communicate with the ESP8266 or ESP32 using the UART Bus, but the GROW R503 fingerprint sensor is one of them. If an ESP8266 is used, ESPHome has to use a software implementation of UART, which can have occasional data glitches. With the ESP32, which has three hardware UARTs, any pair of GPIO pins can be used, as long as they support the proper output/input modes. Therefore, the ESP32 might be the better choice for this project. On the other hand, though, the creator used an ESP8266 and hasn’t reported any issues yet.
Wiring the fingerprint-activated garage door
The two wires used to communicate using the UART Bus can be connected to any free pin on the ESP8266/ESP32, you just have to make sure you define the correct pins for TX and RX. There is a third wire, describe as WAKEUP in the documentation, which should also be connected to a sensing pin. This allows the polling function to quickly return when there’s no finger on the reader. In this project the creator has simply used
The red wire is connected to the power supply, which in this case is the
3.3V pin on the ESP8266/ESP32 and the black wire to a
GND pin on the same microcontroller. Overall, the fingerprint sensing garage door opening one of the easier projects to wire up, despite what your first impression might have been.
Writing the firmware using ESPHome
Finally, the firmware for the fingerprint sensing garage door opener can be written and flashed to the microcontroller. After getting the basics, such as the board type, access point, and Wi-Fi password, in place. The UART Bus, which is one of ESPHome’s core components, needs to be configured. This depends on which pins you used for
TX. The default baud rate of the GROW R503 fingerprint sensor is 57600 bps.
uart: tx_pin: D0 rx_pin: D1 baud_rate: 57600
Setting up the GROW R503 fingerprint sensor in ESPHome
You can optionally configure a sensor component for the GROW R503 fingerprint sensor in ESPHome and despite only being optional, I recommend you add the following lines to your configuration, so you can view a summary of what is happening in Home Assistant:
sensor: - platform: fingerprint_grow fingerprint_count: name: "Fingerprint Count" last_finger_id: name: "Fingerprint Last Finger ID" last_confidence: name: "Fingerprint Last Confidence" status: name: "Fingerprint Status" capacity: name: "Fingerprint Capacity" security_level: name: "Fingerprint Security Level"
Also optional, but highly recommended, is a text sensor, which can be used to display the status of a scanned fingerprint (e.g. authorized, unauthorized):
text_sensor: - platform: template id: fingerprint_state name: "Fingerprint State"
Defining a switch the fingerprint sensor controls
To make the ESP8266/ESP32 perform an action whenever a fingerprint has been authorized on the GROW R503, a switch can be added. This could be a relay, a lock, or anything else you can open and close:
switch: - platform: gpio pin: GPIO14 id: gate
Telling ESPHome what the GROW R503 fingerprint sensor does
The project wouldn’t be in working order, without configuring what exactly the fingerprint does. In the code below, you can see what each state does. For example, whenever a fingerprint is matched, it will turn on the gate, which was defined as a switch in the previous step. Additionally, it will also set the LED around the GROW R503 fingerprint sensor to breathe in a blue colour. The text sensor will then display the message “Authorized finger”.
When a fingerprint is unmatched, nothing will happen to the switch, but the LEDs will turn red colour and the text sensor will display the message “Unauthorized finger”.
fingerprint_grow: sensing_pin: D2 on_finger_scan_matched: - switch.turn_on: gate - 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"
Setting up user-defined services in ESPHome
The final step is to set up a couple of custom services in ESPHome. User-defined services make it possible to get data from Home Assistant to ESPHome. The declared services in the ESPHome project’s YAML code will automatically show up in Home Assistant, where they can be called directly.
In this case, I recommend copying the sample code from the ESPHome website directly, which is exactly what the creator of the fingerprint sensing garage door opener also did:
api: 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:
With this code in place, you can enrol a fingerprint by calling the service
esphome.fingerprint_grow.enroll (“fingerprint” needs to be replaced with the device’s name). The parameters
num_scans need to be added. The former defines in which slot the fingerprint you are about to scan is stored. The GROW R503 fingerprint sensor can store up to 200 fingerprints. The second parameter defines how many scans it takes to register the finger.
Is a DIY fingerprint sensor using ESPHome secure?
There is currently no reason to believe that a DIY solution, as described in this featured project, is any less secure than commercially available options. The riskiest thing in such a setup would almost certainly be your network and physical intrusion prevention, and not the ESPHome node.
There are no known ways of getting fingerprint data off the GROW R503 fingerprint sensor, and it is never communicated between it and the ESP8266/ESP32. As a capacitive sensor, there is also no way of easily tricking it using a printout of one’s fingerprint.
Personally, I would keep the fingerprint sensor accessible, but well hidden away from any curious eyes and fingers. Even if others wouldn’t be able to use it to gain entry to your home or garage, it would very likely be an easy target for vandalism.