pyupm_zfm20 module

class pyupm_zfm20.ZFM20(*args)[source]

Bases: object

API for the ZFM-20 Fingerprint Sensor Module.

ID: zfm20

Name: Fingerprint Sensor Module

Other Names: Grove Fingerprint Sensor

Category: touch

Manufacturer: seeed

Link:http://wiki.seeed.cc/Grove-Fingerprint_Sensor/

Connection: uart This class was tested on the Grove Fingerprint Sensor Module. It can store up to 163 fingerprints.

It is connected via a UART at 57,600 baud.

This example demonstrates how to register and store a new fingerprintThis example demonstrates reading a fingerprint and locating it in the DB

C++ includes: zfm20.hpp

CMD_DELETE_TMPL = 12
CMD_DOWNLOAD_IMAGE = 11
CMD_DOWNLOAD_TMPL = 9
CMD_EMPTYDB = 13
CMD_GEN_IMAGE = 1
CMD_GET_INDEX_TABLE = 31
CMD_GET_RANDOM_NUMBER = 20
CMD_GET_SYSPARAMS = 15
CMD_GET_TMPL_COUNT = 29
CMD_IMG2TZ = 2
CMD_LOAD_TMPL = 7
CMD_MATCH = 3
CMD_REGMODEL = 5
CMD_SET_ADDRESS = 21
CMD_SET_PASSWORD = 18
CMD_SET_SYSPARAMS = 14
CMD_STORE = 6
CMD_UPLOAD_IMAGE = 10
CMD_UPLOAD_TMPL = 8
CMD_VERIFY_PASSWORD = 19
ERR_BAD_LOCATION = 11
ERR_DB_ERROR = 12
ERR_EMPTY_DB_FAILED = 17
ERR_FP_ENROLLMISMATCH = 10
ERR_FP_IMAGE_FAILED = 3
ERR_FP_IMAGE_FEW_FEATURES = 7
ERR_FP_NOMATCH = 8
ERR_FP_NOTFOUND = 9
ERR_FP_TOO_MESSY = 6
ERR_INTERNAL_ERR = 255
ERR_INVALID_ADDR = 32
ERR_INVALID_IMAGE = 21
ERR_INVALID_PWD = 19
ERR_INVALID_REG = 26
ERR_NEEDS_PWD = 33
ERR_NO_FINGER = 2
ERR_NO_MORE_PACKETS = 14
ERR_OK = 0
ERR_PACKET_RX_ERROR = 1
ERR_RM_TMPL_FAILED = 16
ERR_RW_FLASH_ERROR = 24
ERR_UPLOAD_FEAT_FAILED = 13
ERR_UPLOAD_IMG_FAILED = 15
PKT_ACK = 7
PKT_COMMAND = 1
PKT_DATA = 2
PKT_END_DATA = 8
createModel()[source]

uint8_t createModel()

Based on the two characteristics buffers (1 & 2), creates a fingerprint model. Once a model is successfully created, it can be stored in the module with storeModel().

One of the ZFM20_ERRORS_T values

deleteDB()[source]

uint8_t deleteDB()

Deletes the model database (DB)

One of the ZFM20_ERRORS_T values

deleteModel(id)[source]

uint8_t deleteModel(uint16_t id)

Deletes a stored model

id: Location containing the model to delete

One of the ZFM20_ERRORS_T values

generateImage()[source]

uint8_t generateImage()

Generates a new fingerprint image (scans a fingerprint)

One of the ZFM20_ERRORS_T values

getMillis()[source]

uint32_t getMillis()

Returns the number of milliseconds elapsed since initClock() was last called

Elapsed milliseconds

getNumTemplates()[source]

int getNumTemplates()

Queries the module for the number of stored templates (fingerprints).

Number of currently stored templates

getResponse(pkt, len)[source]

bool getResponse(uint8_t *pkt, int len)

Gets the returned data from a request

pkt: Buffer to store the returned data

len: Expected response length; pkt should be at least this large

True if successful

image2Tz(slot)[source]

uint8_t image2Tz(int slot)

Converts the image in the image buffer (generated by generateImage()) and stores it in one of the two characteristics buffers, 1 or 2

slot: Characteristics buffer to use; must be 1 or 2

One of the ZFM20_ERRORS_T values

initClock()[source]

void initClock()

Resets the clock

match()[source]

uint8_t match(uint16_t &score)

Compares the features in characteristics buffers 1 and 2 and returns a score if they match

score: Score

One of the ZFM20_ERRORS_T values

readData(buffer, len)[source]

int readData(char *buffer, int len)

Reads any available data in a user-supplied buffer. Note: the call blocks until data is available to be read. Use dataAvailable() to determine whether there is data available beforehand, to avoid blocking.

buffer: Buffer to hold the data read

len: Length of the buffer

Number of bytes read

search(slot)[source]

uint8_t search(int slot, uint16_t &id, uint16_t &score)

Searches the fingerprint DB and returns an ID and score, if found

slot: Slot containing a converted image to search for

id: ID if found, 0 otherwise

score: Score if found, 0 otherwise

One of the ZFM20_ERRORS_T values

setAddress(addr)[source]

void setAddress(uint32_t addr)

Sets the address that should be used to access the module

addr: Address to use

setNewAddress(addr)[source]

bool setNewAddress(uint32_t addr)

Sets a new address for the module. This address is stored in the module, and is required to access the module in the future.

addr: New address to set on the module

True if successful

setNewPassword(pwd)[source]

bool setNewPassword(uint32_t pwd)

Sets a new password for the module. This passowrd is stored in the module, and is required to access the module in the future.

pwd: New password to set on the module

True if successful

setPassword(pw)[source]

void setPassword(uint32_t pw)

Sets the password that should be used to access the module

pw: Password to use

setupTty(baud=57600)[source]

bool setupTty(uint32_t baud=57600)

Sets up proper tty I/O modes and the baud rate. For this device, the default baud rate is 57,600.

baud: Desired baud rate.

True if successful

storeModel(slot, id)[source]

uint8_t storeModel(int slot, uint16_t id)

Once a fingerprint model is created, this method can be used to store it (via one of the characteristics buffers) in a given location.

slot: Characteristics buffer to store the model, 1 or 2

id: Location to store the model

One of the ZFM20_ERRORS_T values

verifyPacket(pkt, len)[source]

bool verifyPacket(uint8_t *pkt, int len)

Verifies the packet header and indicates its validity

pkt: Packet to check

len: Length of packet

True if the packet is valid, false otherwise

verifyPassword()[source]

bool verifyPassword()

Verifies and authenticates to the module. The password used is the last one set by setPassword().

True if successful

writeCmdPacket(pkt, len)[source]

int writeCmdPacket(uint8_t *pkt, int len)

Composes and writes a command packet

pkt: Packet

len: Length of packet

Number of bytes written

writeData(buffer, len)[source]

int writeData(char *buffer, int len)

Writes the data in the buffer to the device

buffer: Buffer to hold the data read

len: Length of the buffer

Number of bytes written

class pyupm_zfm20.uint16Array(nelements)[source]

Bases: object

cast()[source]
static frompointer()
class pyupm_zfm20.uint32Array(nelements)[source]

Bases: object

cast()[source]
static frompointer()
class pyupm_zfm20.uint8Array(nelements)[source]

Bases: object

cast()[source]
static frompointer()