ZFM20 Class
- 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 fingerprint This example demonstrates reading a fingerprint and locating it in the DB
Item Index
Methods
Properties
- CMD_GEN_IMAGE
- CMD_IMG2TZ
- CMD_MATCH
- CMD_SEARCH
- CMD_REGMODEL
- CMD_STORE
- CMD_LOAD_TMPL
- CMD_UPLOAD_TMPL
- CMD_DOWNLOAD_TMPL
- CMD_UPLOAD_IMAGE
- CMD_DOWNLOAD_IMAGE
- CMD_DELETE_TMPL
- CMD_EMPTYDB
- CMD_SET_SYSPARAMS
- CMD_GET_SYSPARAMS
- CMD_SET_PASSWORD
- CMD_VERIFY_PASSWORD
- CMD_GET_RANDOM_NUMBER
- CMD_SET_ADDRESS
- CMD_GET_TMPL_COUNT
- CMD_GET_INDEX_TABLE
- ERR_OK
- ERR_PACKET_RX_ERROR
- ERR_NO_FINGER
- ERR_FP_IMAGE_FAILED
- ERR_FP_TOO_MESSY
- ERR_FP_IMAGE_FEW_FEATURES
- ERR_FP_NOMATCH
- ERR_FP_NOTFOUND
- ERR_FP_ENROLLMISMATCH
- ERR_BAD_LOCATION
- ERR_DB_ERROR
- ERR_UPLOAD_FEAT_FAILED
- ERR_NO_MORE_PACKETS
- ERR_UPLOAD_IMG_FAILED
- ERR_RM_TMPL_FAILED
- ERR_EMPTY_DB_FAILED
- ERR_INVALID_PWD
- ERR_INVALID_IMAGE
- ERR_RW_FLASH_ERROR
- ERR_INVALID_REG
- ERR_INVALID_ADDR
- ERR_NEEDS_PWD
- ERR_INTERNAL_ERR
- PKT_COMMAND
- PKT_DATA
- PKT_ACK
- PKT_END_DATA
Methods
ZFM20
-
uart
-
baud
ZFM20 constructor
Parameters:
-
uart
NumberTarget mraa UART index to use (0 or 1)
-
baud
NumberDesired baud rate
Returns:
ZFM20
-
uart_raw
-
baud
ZFM20 constructor
Parameters:
-
uart_raw
Stringundefined
-
baud
NumberDesired baud rate
Returns:
readData
-
buffer
-
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.
Parameters:
-
buffer
StringBuffer to hold the data read
-
len
NumberLength of the buffer
Returns:
Number of bytes read
writeData
-
buffer
-
len
Writes the data in the buffer to the device
Parameters:
-
buffer
StringBuffer to hold the data read
-
len
NumberLength of the buffer
Returns:
Number of bytes written
setupTty
-
baud
Sets up proper tty I/O modes and the baud rate. For this device, the default baud rate is 57,600.
Parameters:
-
baud
NumberDesired baud rate.
Returns:
True if successful
writeCmdPacket
-
pkt
-
len
Composes and writes a command packet
Parameters:
-
pkt
Uint8_t *Packet
-
len
NumberLength of packet
Returns:
Number of bytes written
verifyPacket
-
pkt
-
len
Verifies the packet header and indicates its validity
Parameters:
-
pkt
Uint8_t *Packet to check
-
len
NumberLength of packet
Returns:
True if the packet is valid, false otherwise
getMillis
()
Number
Returns the number of milliseconds elapsed since initClock() was last called
Returns:
Elapsed milliseconds
initClock
()
Resets the clock
setAddress
-
addr
Sets the address that should be used to access the module
Parameters:
-
addr
NumberAddress to use
setPassword
-
pw
Sets the password that should be used to access the module
Parameters:
-
pw
NumberPassword to use
getResponse
-
pkt
-
len
Gets the returned data from a request
Parameters:
-
pkt
Uint8_t *Buffer to store the returned data
-
len
NumberExpected response length; pkt should be at least this large
Returns:
True if successful
verifyPassword
()
Boolean
Verifies and authenticates to the module. The password used is the last one set by setPassword() .
Returns:
True if successful
getNumTemplates
()
Number
Queries the module for the number of stored templates (fingerprints).
Returns:
Number of currently stored templates
setNewPassword
-
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.
Parameters:
-
pwd
NumberNew password to set on the module
Returns:
True if successful
setNewAddress
-
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.
Parameters:
-
addr
NumberNew address to set on the module
Returns:
True if successful
generateImage
()
Number
Generates a new fingerprint image (scans a fingerprint)
Returns:
One of the ZFM20_ERRORS_T values
image2Tz
-
slot
Converts the image in the image buffer (generated by generateImage() ) and stores it in one of the two characteristics buffers, 1 or 2
Parameters:
-
slot
NumberCharacteristics buffer to use; must be 1 or 2
Returns:
One of the ZFM20_ERRORS_T values
createModel
()
Number
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() .
Returns:
One of the ZFM20_ERRORS_T values
storeModel
-
slot
-
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.
Parameters:
-
slot
NumberCharacteristics buffer to store the model, 1 or 2
-
id
NumberLocation to store the model
Returns:
One of the ZFM20_ERRORS_T values
deleteModel
-
id
Deletes a stored model
Parameters:
-
id
NumberLocation containing the model to delete
Returns:
One of the ZFM20_ERRORS_T values
deleteDB
()
Number
Deletes the model database (DB)
Returns:
One of the ZFM20_ERRORS_T values
search
-
slot
-
id
-
score
Searches the fingerprint DB and returns an ID and score, if found
Parameters:
-
slot
NumberSlot containing a converted image to search for
-
id
Uint16_t *ID if found, 0 otherwise
-
score
Uint16_t *Score if found, 0 otherwise
Returns:
One of the ZFM20_ERRORS_T values
match
-
score
Compares the features in characteristics buffers 1 and 2 and returns a score if they match
Parameters:
-
score
Uint16_t *Score
Returns:
One of the ZFM20_ERRORS_T values