Fingerprint Scanner for Your Project – 2

This type of fingerprint scanner is more popular. Similar to the GT-521FX2, it is based on a Cortex-M processor, AS608 from SynoChip. AS608 is also equipped with CMOS image sensor interface just like Holtek HT32F22366, but its clock speed is much higher (144MHz vs 96MHz) and has twice Flash space (512KB vs 256KB).

A company called ZhianTec (couldn’t find homepage) seems to be responsible for the image processing algorithm and so the firmware. This type of scanners are known as ZFM-20 (ZhianTec part number) or DY50 (probably from copycats). I’ve got mine from an ebay seller for around $8.

Price of this module is remarkable considering its quality: fine PCB boards, nice glass prism, and not so bad enclosure. It is even more remarkable when compared to GT-521FX2 discussed previously. Price-wise it is only fraction but quality is superior including MCU power.

The gold round rectangular pattern is the capacitive touch sensor. It looks like the sensor works independently from the main MCU. There might be a variation that does not come with the touch sensor. You can tell from the pinout of the connector. In the older ones, Pin 5 and Pin 6 may not have connection (NC).

  • (Pin 1) GND
  • (Pin 2) UART_RX
  • (Pin 3) UART_TX
  • (Pin 4) 3V3
  • (Pin 5) Touch_Out
  • (Pin 6) Touch_Vcc

Touch sensor is located at the bottom of the prism. Two green LEDs illuminate the finger on the prism and the camera captures the image.

At the back of the device, you have a 6pin connector, pinout of which is shown above. There is a PCB pattern that looks like a USB interface. You may need custom USB driver. Or it just could be a USB-CDC device.

Best source for the information for this type of scanners is probably Adafruit. Alternatively you can google it with the key word ZFM-20 then you can find the manual without much difficulty.

(Protocol) Its protocol is much more sophisticated than GT-521FX2, which allows you greater flexibility in control the device. It also gives you detailed status output only if you don’t mind a bit lengthy programming.

(Enrolment) The device requires two consecutive image captures to generate a template. Surprisingly this process is very reliable and fast, exact opposite to the GT-521FX2. It might be partly because it has simpler image processing algorithm and partly because it uses internal FLASH to store the data. Also it has SRAM twice the size of GT-521FX2.

(Authentication) Authentication is also very fast and reliable. I didn’t do much test to have confident numbers but it has high enough specificity/ sensitivity so that it can be used for any personal project that requires medium security level.

1 to N match could be a bit different but in 1 to 1 match, this device brings up the template from the FLASH storage to SRAM buffer and does the match in the SRAM. So it is remarkably fast.

This fingerprint sensor is beyond my expectation both in and out especially after the deep frustration with the expensive GT-521FX2. Only downside is that the backlight LED is turned on always. You may want to have a load switch to control the power of the device directly. You can find my example code here.

NFC Tag Reader on Raspberry Pi

Venerable PN532 based NFC readers are cheap and easy to find. You can get one from ebay or aliexpress as low as $5 or even less.

And these readers are supported by libnfc so you can install driver directly from Debian package repository.

$ sudo apt install libnfc-bin libnfc-dev
$ sudo apt install libnfc-examples libnfc-pn53-examples

You need to enable I2C interface if not done already. If enabled, you should be able to see the device under /dev folder. Depending on the hardware it could be /dev/i2c-0.

libnfc checks its configuration file for hardware settings. Open up the file /etc/nfc/libnfc.conf and make sure it has following settings enabled. You may need to sudo to change the contents. For more information about the settings, check this page.

allow_autoscan = false
device.name = "PN532"
device.connstring = "pn532_i2c:/dev/i2c-1"

At this point you should be able to compile and run a program using C language. A simple example can be found here. If you need a reference manual of the library, download a stable source tar ball from this page and follow the instruction to generate documentation or simply run a doxygen.

To use python, you can use ctypes. Load the library and create python proxy for the following two header files

/usr/include/nfc/nfc.h
/usr/include/nfc/nfc-types.h

Then you can call the same functions in python.

A python example in this repository runs a separate thread for NFC tag reading. Thus main thread is free from doing other tasks instead of being blocked by the NFC function calls. It displays tag ID whenever new tag is detected until a certain tag is showed up.