Fingerprint sensor
The R30x and AS608 optical fingerprint sensor: templates in its own flash and a serial protocol. Aliases: R307, AS608, ZFM-20, fingerprint reader.
The sensor does all the work itself. It takes an image of the finger on the glass, turns it into a character file in one of two buffers, combines two of those into a template, stores templates by number and searches them. The board only sends commands and reads the answers.
Pins
| Pin | What it does |
|---|---|
VCC |
Supply. |
GND |
Ground. |
TX |
Out of the sensor: wire it to the board's receive pin. |
RX |
Into the sensor: wire it to the board's transmit pin. |
Properties
| Property | Default | Meaning |
|---|---|---|
baud |
57600 | The serial speed. |
enrolled |
2 | Fingers already in the library: finger n at page n. |
capacity |
162 | Templates the library holds, the figure Adafruit's sensor reports. |
password |
0 | The password verifyPassword() checks against. |
While it runs
Hold one of the three fingertips under the sensor to put that finger on the glass. After a search, the window shows a tick if the finger was found and a cross if not.
What the model gets right
The packets. EF 01, the address, a packet identifier, a length, the contents and
a checksum, both ways, as the module's manual lays them out. A packet with a wrong
checksum is answered with an error.
The commands. Take an image (no finger answers 0x02), image to character file, compare, search, combine two files into a template (two different fingers will not combine), store, load, delete, empty the library, read the system parameters, verify the password and count the templates.
Enrolling. Two images of the same finger, combined and stored at a page, are found by a search afterwards; the template count goes up.
What it does not model
Real prints: a finger is a number, and two images match when they are the same finger. The match score is a fixed 100, a placeholder. The image upload commands, the LED, the security levels and the time a real search takes are not modeled; the answers come after a fixed 5 ms.
Libraries
Adafruit Fingerprint Sensor Library (Adafruit_Fingerprint.h):
finger.getImage(), finger.image2Tz(), finger.fingerFastSearch(), then
finger.fingerID.
Common mistakes
Swapping TX and RX. The sensor's TX goes to the board's receive pin.
Calling image2Tz() without a fresh getImage(): the character file is made from the
last image, whatever finger that was.
See it in action
Fingerprint door lock opens a servo latch for the enrolled fingers and turns a stranger away. Open it at /templates.