R502-A Fingerprint Module User Manual-V1.2
R502-A Fingerprint Module User Manual-V1.2
R502-A Fingerprint Module User Manual-V1.2
User Manual
1 www.hzgrow.com
Preface & Declaration
Thank you for you selection of R502-A Fingerprint Identification Module of GROW.
The Manual is targeted for hardware & software development engineer, covering
module function, hardware and software interface etc. To ensure the developing process
goes smoothly, it is highly recommended the Manual is read through carefully.
Because of the products constantly upgraded and improved, module and the manual
content may be changed without prior notice. If you want to get the latest information,
please visit our company website (www.hzgrow.com).
We have been trying our best to enssure you the correctness of the Manual. However, if
you have any question or find errorst, feel free to contact us or the authorized agent. We
would be very grateful.
The Manual contains proprietary information of Hangzhou Grow Technology Co., Ltd.,
which shall not be used by or disclosed to third parties without the permission of GROW,
nor for any reproduction and alteration of information without any associated warranties,
conditions, limitations, or notices.
No responsibility or liability is assumed by GROW for the application or use, nor for
any infringements of patents or other intellectual property rights of third parties that may
result from its use.
www.hzgrow.com
I www.hzgrow.com
I Introduction
Operation Principle
Fingerprint processing includes two parts: fingerprint enrollment and fingerprint matching (the
matching can be 1:1 or 1:N).
When enrolling, user needs to enter the finger two times. The system will process the two time
finger images, generate a template of the finger based on processing results and store the template.
When matching, user enters the finger through optical sensor and system will generate a template
of the finger and compare it with templates of the finger library. For 1:1 matching, system will
compare the live finger with specific template designated in the Module; for 1:N matching, or
searching, system will search the whole finger library for the matching finger. In both
circumstances, system will return the matching result, success or failure.
-1- www.hzgrow.com
II Hardware Interface
Exterior Interface
Connector: MX1.0--6P
Serial Communication
-2- www.hzgrow.com
Hardware connection
Via serial interface, the Module may communicate with MCU of 3.3V or 5V power: TD (pin 3 of
P1) connects with RXD (receiving pin of MCU), RD (pin 4 of P1) connects with TXD (transferring
pin of MCU). Should the upper computer (PC) be in RS-232 mode, please add level converting
circuit, like MAX232, between the Module and PC.
Reset time
At power on, it takes about 200ms for initialization. During this period, the Module can’t accept
commands for upper computer.
Notepad
The system sets aside a 512-bytes memory (16 pages* 32 bytes) for user’s notepad, where data
requiring power-off protection can be stored. The host can access the page by instructions of
PS_WriteNotepad and PS_Read Notepad.
Note: when write on one page of the pad, the entire 32 bytes will be written in wholly covering the
original contents.
Buffer
The module RAM resources are as follows:
An ImageBuffer: ImageBuffer
6 feature buffers: CharBuffer[1:6]
All buffer contents are not saved without power.
Fingerprint Library
Synstem sets aside a certain space within Flash for fingerprint template storage, that’s fingerprint
library. Contents of the library remain at power off.
-3- www.hzgrow.com
Capacity of the library changes with the capacity of Flash, system will recognize the latter
automatically. Fingerprint template’s storage in Flash is in sequential order. Assume the fingerprint
capacity N, then the serial number of template in library is 0, 1, 2, 3 … N. User can only access
library by template number.
The Parameter controls the UART communication speed of the Modul. Its value is an integer N,
N= [1/2/4/6/12]. Cooresponding baud rate is 9600*N bps。
The Parameter controls the matching threshold value of fingerprint searching and matching.
Security level is divided into 5 grades, and cooresponding value is 1, 2, 3, 4, 5. At level 1, FAR is
the highest and FRR is the lowest; however at level 5, FAR is the lowest and FRR is the highest.
The parameter decides the max length of the transferring data package when communicating with
upper computer. Its value is 0, 1, 2, 3, corresponding to 32 bytes, 64 bytes, 128 bytes, 256 bytes
respectively.
Module password
The default password of the module is 0x00000000. If the default password is modified, the first
instruction of the upper computer to communicate with the module must be verify password. Only
after the password verification is passed, the module will enter the normal working state and
receive other instructions.
The new modified password is stored in Flash and remains at power off.(the modified password
cannot be obtained through the communication instruction. If forgotten by mistake, the module
cannot communicate, please use with caution)
Refer to instruction SetPwd and VfyPwd.
-4- www.hzgrow.com
Module address
Each module has an identifying address. When communicating with upper computer, each
instruction/data is transferred in data package form, which contains the address item. Module
system only responds to data package whose address item value is the same with its identifying
address.
The address length is 4 bytes, and its default factory value is 0xFFFFFFFF. User may modify the
address via instruction SetAdder. The new modified address remains at power off.
-5- www.hzgrow.com
IV Communication Protocol
The protocol defines the data exchanging format when R502-A series communicates with upper
computer. The protocol and instruction sets apples for both UART and USB communication mode.
For PC, USB interface is strongly recommended to improve the exchanging speed, especially in
fingerprint scanning device.
Header Start 2 bytes Fixed value of 0xEF01; High byte transferred first.
-6- www.hzgrow.com
Upon receipt of commands, Module will report the commands execution status and results to upper
computer through acknowledge packet. Acknowledge packet has parameters and may also have
following data packet. Upper computer can’t ascertain Module’s package receiving status or
command execution results unless through acknowledge packet sent from Module. Acknowledge
packet includes 1 byte confirmation code and maybe also the returned parameter.
Confirmation code’s definition is :
00h: commad execution complete;
01h: error when receiving data package;
02h: no finger on the sensor;
03h: fail to enroll the finger;
06h: fail to generate character file due to the over-disorderly fingerprint image;
07h: fail to generate character file due to lackness of character point or over-smallness of
fingerprint image
08h: finger doesn’t match;
09h: fail to find the matching finger;
0Ah: fail to combine the character files;
0Bh: addressing PageID is beyond the finger library;
0Ch: error when reading template from library or the template is invalid;
0Dh: error when uploading template;
0Eh: Module can’t receive the following data packages.
0Fh: error when uploading image;
10h: fail to delete the template;
11h: fail to clear finger library;
13h: wrong password!
15h: fail to generate the image for the lackness of valid primary image;
18h: error when writing flash;
19h: No definition error;
1Ah: invalid register number;
1Bh: incorrect configuration of register;
1Ch: wrong notepad page number;
1Dh: fail to operate the communication port;
others: system reserved;
-7- www.hzgrow.com
V Module Instruction System
R30X series provide 23 instructions. Through combination of different instructions, application
program may realize muti finger authentication functions. All commands/data are transferred in
package format. Refer to 5.1 for the detailed information of package.
System-related instructions
-9- www.hzgrow.com
Input Parameter: control code
Control code ”0” means turns off the port;
Control code ”1” means turns on the port;
Return Parameter: confirmation code;
Instruction code: 17H
Command (or instruction) package format:
Description: Read Module’s status register and system basic configuration parameters;
Input Parameter:none
Return Parameter:Confirmation code (1 byte) + basic parameter(16bytes)
Instuction code: 0fH
Command (or instruction) package format:
2 bytes 4bytes 1 byte 2 bytes 1 byte 2 bytes
Header Module Package Package length Instruction Checksum
address identifier code
0xEF01 Xxxx 01H 03H 0fH sum
Acknowledge package format:
2 bytes 4bytes 1 byte 2 bytes 1 byte 16 bytes 2 bytes
Header Module Package Package Confirmation Basic parameter Checksum
address identifier length code list
0xEF01 xxxx 07H 3+16 xxH See following sum
table
Note: Confirmation code=00H: read complete;
Confirmation code=01H: error when receiving package;
Name Description Offset (word) Size (word)
Status register Contents of system status register 0 1
System identifier code Fixed value: 0x0009 1 1
Finger library size Finger library size 2 1
Security level Security level (1, 2, 3, 4, 5) 3 1
Device address 32-bit device address 4 2
Data packet size Size code (0, 1, 2, 3) 6 1
- 10 - www.hzgrow.com
Baud settings N (baud = 9600*N bps) 7 1
Fingerprint-processing instructions
- 12 - www.hzgrow.com
Upload image UpImage
- 13 - www.hzgrow.com
Header Module Package Package Confirmation Checksum
address identifier length code
0xEF01 Xxxx 07H 03H xxH sum
Note: 1:Confirmation code=00H: ready to transfer the following data packet;
Confirmation code=01H: error when receiving package;
Confirmation code=0eH: fail to transfer the following data packet;
2: Module shall transfer the following data packet after responding to the upper computer.
Data package length must be 64, 128, or 256。
Data package format:
2 bytes 4bytes 1 byte 2 bytes N byte 2 bytes
Header Module Package identifier Package Package Checksum
address length content
0xEF01 xxxx 0x02- have N+2 Image data sum
following packet
0x08 - end packet
Description: to generate character file from the original finger image in ImageBuffer and
store the file in CharBuffer1 or CharBuffer2.
Input Parameter: BufferID (character file buffer number)
Return Parameter: Confirmation code (1 byte)
Instuction code: 02H
Command (or instruction) package format:
2 bytes 4bytes 1 byte 2 bytes 1 byte 1 byte 2 bytes
Header Module Package Package Instruction Buffer Checksum
address identifier length code number
0xEF01 xxxx 01H 04H 02H BufferID sum
CharBufferID: Character buffer number, starting at 1, range 1-6.
When this function is called during fingerprint recognition, the user only needs to
specify any characteristic buffer number in 1-6.
The features extracted in the most recent extraction are subsequently identified.
When registering a fingerprint, the serial number 1-6 must be specified in order from
number 1.
The algorithm fuses multiple fingerprint features into a single large fingerprint
template.
Acknowledge package format:
2 bytes 4bytes 1 byte 2 bytes 1 byte 2 bytes
- 14 - www.hzgrow.com
Confirmation code=07H: fail to generate character file due to lackness of character
point or over-smallness of fingerprint image;
Confirmation code=15H: fail to generate the image for the lackness of valid primary
image;
Description: To combine information of character files from CharBuffer1 and CharBuffer2 and
generate a template which is stroed back in both CharBuffer1 and CharBuffer2.
Input Parameter:none
Return Parameter:Confirmation code (1 byte)
Instuction code: 05H
Command (or instruction) package format:
2 bytes 4bytes 1 byte 2 bytes 1 byte 2 bytes
Header Module Package Package Instruction Checksum
address identifier length code
0xEF01 xxxx 01H 03H 05H 09H
Acknowledge package format:
2 bytes 4bytes 1 byte 2 bytes 1 byte 2 bytes
Header Module Package Package Confirmation Checksum
address identifier length code
0xEF01 xxxx 07H 03H xxH sum
Note: Confirmation code=00H: operation success;
Confirmation code=01H: error when receiving package;
Confirmation code=0aH: fail to combine the character files. That’s, the character files
don’t belong to one finger.
- 15 - www.hzgrow.com
2: Module shall transfer following data packet after responding to the upper computer.;
3: The instruction doesn’t affect buffer contents.
Data package format:
2 bytes 4bytes 1 byte 2 bytes N byte 2 bytes
Header Module Package identifier Package Package Checksum
address length content
0xEF01 xxxx 0x02- have N+2 Template sum
following packet data
0x08 - end packet
- 16 - www.hzgrow.com
Return Parameter: Confirmation code (1 byte)
Instuction code: 06H
Command (or instruction) package format:
2 bytes 4bytes 1 byte 2 bytes 1 byte 1 byte 2 bytes 2 bytes
Header Module Package Package Instruction buffer Location Checksum
address identifier length code number number
0xEF01 xxxx 01H 06H 06H BufferID PageID sum
Description: to load template at the specified location (PageID) of Flash library to template buffer
CharBuffer1/CharBuffer2
Input Parameter: BufferID(buffer number), PageID (Flash location of the template, two bytes with
high byte front and low byte behind)。
Return Parameter: Confirmation code (1 byte)
Instuction code: 07H
Command (or instruction) package format:
2 bytes 4bytes 1 byte 2 bytes 1 byte 1 byte 2 bytes 2 bytes
Header Module Package Package Instruction buffer Page Checksum
address identifier length code number number
0xEF01 xxxx 01H 06H 07H BufferID PageID sum
Acknowledge package format:
2 bytes 4bytes 1 byte 2 bytes 1 byte 2 bytes
Header Module address Package Package Confirmation Checksum
identifier length code
0xEF01 xxxx 07H 03H XxH sum
Note: Confirmation code=00H: load success;
Confirmation code=01H: error when receiving package;
Confirmation code=0cH: error when reading template from library or the readout template is
invalid;
Confirmation code=0BH: addressing PageID is beyond the finger library;
- 17 - www.hzgrow.com
Input Parameter: PageID (template number in Flash), N (number of templates to be deleted)
Return Parameter: Confirmation code (1 byte)
Instuction code: 0cH
Command (or instruction) package format:
2 bytes 4bytes 1 byte 2 bytes 1 byte 2 bytes 2bytes 2 bytes
Header Module Package Package Instruction Page number of Checksum
address identifier length code number templates to
be deleted
0xEF01 Xxxx 01H 07H 0cH PageID N sum
Acknowledge package format:
2 bytes 4bytes 1 byte 2 bytes 1 byte 2 bytes
Header Module Package identifier Package Confirmation Checksum
address length code
0xEF01 Xxxx 07H 03H xxH sum
Note: Confirmation code=00H: delete success;
Confirmation code=01H: error when receiving package;
Confirmation code=10H: faile to delete templates;
- 18 - www.hzgrow.com
Command (or instruction) package format:
2 bytes 4bytes 1 byte 2 bytes 1 byte 2 bytes
Header Module Package Package length Instruction code Checksum
address identifier
0xEF01 Xxxx 01H 03H 03H 07H
Acknowledge package format:
2 bytes 4bytes 1 byte 2 bytes 1 byte 2 bytes 2 bytes
Header Module Package Package Confirmation Matching Checksum
address identifier length code score
0xEF01 Xxxx 07H 05H XxH XxH sum
Note 1: Confirmation code=00H: templates of the two buffers are matching!
Confirmation code=01H: error when receiving package;
Confirmation code=08H: templates of the two buffers aren’t matching;
2: The instruction doesn’t affect the contents of the buffers.
Description: to search the whole finger library for the template that matches the one in CharBuffer1
or CharBuffer2. When found, PageID will be returned.
Input Parameter: BufferID, StartPage (searching start address), PageNum(searching numbers)
Return Parameter: Confirmation code (1 byte), PageID (matching templates location)
Instuction code: 04H
Command (or instruction) package format:
2 bytes 4bytes 1 byte 2 bytes 1 byte 1 byte 2 bytes 2 bytes 2 bytes
Description: Detect the finger, record the fingerprint image and store it in ImageBuffer, return it
and record the successful confirmation code;If no finger is detected, return no finger confirmation
code(the module responds quickly to each instruction,therefore, for continuous detection, cycle
processing is required, which can be limited to the number of cycles or the total time).
- 19 - www.hzgrow.com
Differences between GetImageEx and the GetImage:
GetImage: return the confirmation code 0x00 when the image quality is too bad (image
collection succeeded)
GetImageEx: return the confirmation code 0x07 when the image quality is too bad (poor
collection quality)
Input Parameter: none
Return Parameter: Confirmation code
Instuction code: 0x28
Command (or instruction) package format:
2 bytes 4bytes 1 byte 2 bytes 1 byte 2 bytes
Header Module Package Package length Instruction code Checksum
address identifier
0xEF01 xxxx 0x01 0x0003 0x28 sum
Acknowledge package format:
2 bytes 4bytes 1 byte 2 bytes 1 byte 2 bytes
Header Module Package Package Confirmation Checksum
address identifier length code
0xEF01 xxxx 0x07 0x0003 X sum
Note 1: Confirmation code=0x00: read success
Confirmation code=0x01: error when receiving package;
Confirmation code=0x02: no fingers on the sensor;
Confirmation code=0x03: unsuccessful entry
Confirmation code=0x07: poor image quality;
- 20 - www.hzgrow.com
HandShake HandShake(0x40)
Description: Send handshake instructions to the module. If the module works normally, the
confirmation code 0x00 will be returned. The upper computer can continue to send instructions to
the module.If the confirmation code is other or no reply, it means that the device is abnormal.
Input Parameter: none
Return Parameter: Confirmation code
Instuction code: 0x40
Command (or instruction) package format:
2 bytes 4bytes 1 byte 2 bytes 1 byte 2 bytes
Header Module Package Package length Instruction code Checksum
address identifier
0xEF01 xxxx 0x01 0x0003 0x40 sum
- 21 - www.hzgrow.com
Get the algorithm library version GetAlgVer (0x39)
- 22 - www.hzgrow.com
Command (or instruction) package format:
2 bytes 4bytes 1 byte 2 bytes 1 byte 2 bytes
Header Module Package Package length Instruction code Checksum
address identifier
0xEF01 xxxx 0x01 0x0003 0x3C sum
Acknowledge package format:
2 bytes 4bytes 1 byte 2 bytes 1 byte 46 byte 2 bytes
Header Module Package Package Confirmation Product Checksu
address identifier length code information m
0xEF01 xxxx 0x07 0x0031 X ProdInfo sum
Note 1: Confirmation code=0x00: success;
Confirmation code=0x01: error when receiving package;
Product information: store in the following order.For Numbers, the high byte comes first.For a
string, the insufficient part is 0x00.
Code Bytes Meaning
PARAM_FPM_MODEL 16 module type, ASCII
PARAM_BN 4 Module batch number, ASCII
PARAM_SN 8 Module serial number, ASCII
For the hardware version, the first byte represents the
PARAM_HW_VER 2 main version and the second byte represents the
sub-version
PARAM_FPS_MODEL 8 Sensor type, ASCII
PARAM_FPS_WIDTH 2 Sensor image width
PARAM_FPS_HEIGHT 2 Sensor image height
PARAM_TMPL_SIZE 2 Template size
PARAM_TMPL_TOTAL 2 Fingerprint database size
Description: Send soft reset instruction to the module. If the module works normally, return
confirmation code 0x00, and then perform reset operation.
Input Parameter: none
Return Parameter: Confirmation code
Instuction code: 0x3D
Command (or instruction) package format:
2 bytes 4bytes 1 byte 2 bytes 1 byte 2 bytes
Header Module Package Package length Instruction code Checksum
address identifier
0xEF01 xxxx 0x01 0x0003 0x3D sum
Acknowledge package format:
2 bytes 4bytes 1 byte 2 bytes 1 byte 2 bytes
Header Module Package Package Confirmation Checksum
address identifier length code
- 23 - www.hzgrow.com
0xEF01 xxxx 0x07 0x0003 X sum
Note 1: Confirmation code=0x00: success;
Confirmation code=other: device is abnormal
After module reset, 0x55 will be automatically sent as a handshake sign. After the single-chip
microcomputer detects 0x55, it can immediately send commands to enter the working state.
Control Code:
Control 0x01 0x02 0x03 0x04 0x05 0x06
code
Function breathing Flashing Light Light Light Light
light light Always Always gradually gradually
on off on off
Speed: 0x00-0xff, 256 gears,Minimum 5s cycle.
It is effective for breathing lamp and flashing lamp,Light gradually on,Light gradually off
ColorIndex:
Code 0x01 0x02 0x03
Color Red Blue Purple
Number of cycles: 0- infinite, 1-255.
It is effective for with breathing light and flashing light.
- 24 - www.hzgrow.com
Other instructions
Description: to command the Module to generate a random number and return it to upper computer;
Input Parameter: none
Return Parameter: Confirmation code (1 byte)
Instuction code: 14H
Command (or instruction) package format:
2 bytes 4bytes 1 byte 2 bytes 1 byte 2 bytes
Header Module Package Package length Instruction Checksum
address identifier code
0xEF01 xxxx 01H 03H 14H 0018H
Acknowledge package format:
2 bytes 4bytes 1 byte 2 bytes 1 byte 4 bytes 2 bytes
Header Module Package Package Confirmation Random Checksum
address identifier length code number
0xEF01 xxxx 07H 07H xxH xxxx sum
Note: Confirmation code=00H: generation success;
Confirmation code=01H: error when receiving package;
- 25 - www.hzgrow.com
address length content
0xEF01 xxxx 0x02- have N+2 Information sum
following packet page
0x08 - end packet
- 26 - www.hzgrow.com
Instruction Table
Classified by functions
Finerprint processing
Parameter
5 17H Port control 17 0CH to delete tempates
6 0FH To read system 18 0DH to empty the library
Parameter
7 1DH To read finger 19 03H Carry out precise
template numbers matching of two
templates;
8 01H Collect finger image 20 04H Search the finger library
Finerprint processing
- 27 - www.hzgrow.com
0AH UpImage To upload image 18H WriteNotepad to write note pad
0BH DownImage To download image 19H ReadNotepad To read note pad
0CH DeletChar to delete tempates 1DH TempleteNum To read finger template
numbers
0x1F ReadIndexT Read fingerprint template 0x28 GetImageEx Fingerprint image collection
able index table extension command
0x30 Cancel Cancel instruction 0x40 HandShake HandShake
0x36 Check CheckSensor 0x39 GetAlgVer Get the algorithm library
Sensor version
0x3A GetFwVer Get the firmware version 0x3C ReadProdInfo Read product
information
0x3D SoftRst Soft reset 0x35 Aura control AuraLedConfig
Ⅶ Reference Circuit
- 28 - www.hzgrow.com