Capacitive Fingerprint Reader (B)
| ||
Overview
The Capacitive Fingerprint Reader (B) is a fast and stable capacitive fingerprint module specialized for secondary development, suits integration applications.
By incorporating a high-performance Cortex core processor, high-security commercial fingerprint algorithm, and advanced semiconductor fingerprint sensor, this module is designed as an intelligent integration module with functions including fingerprint enrolling, image processing, the template generating and storing, fingerprint matching and searching, etc.
Features
- Easy to use by some simple commands, you don't have to know any fingerprint technology, or the module inter structure/calculation
- Commercial fingerprinting algorithm, stable performance, fast identification
- Sensitive detection, just touch the collecting window lightly, without pressing
- Allows to freely input/output fingerprint images, fingerprint feature file and other fingerprinting actions
- Dual communication, UART or USB.
- Comes with complete resources, manual, related tools and Raspberry/Arduino/STM32 demos.
Specifications
PARAMETER | VALUE |
Sensor | Semiconductor(capacitive) |
Module dimension | 34 x 28.5mm |
Sensor dimension | 33.4 x 20.4mm |
Image | DPI508 |
Image resolution | 208x288 |
Greyscale | 256(8-bit) |
Sensing area | 14.6 x 10.6mm |
Fingerprint capacity | 3000 |
Security level | 1-5 configurable, 3 by default the higher value, the lower FAR (False Acceptance Rate), yet the higher FRR (False Rejection Rate) |
Encryption key | 64-bit encryption |
Image collecting rate | 20fps |
Matching time | <0.5s |
Dynamic current | <40mA |
Sleep current | <4mA |
Operating voltage | 3.3 -5V |
Communication port | UART/USB |
ESD | SD IEC 61000-4-2 LEVEL 4 positive/negative 15KV air discharge |
Baudrate | configurable: 9600, 19200, 38400, 57600, 115200, 230400, 460800, 921600bps 115200bps by default |
Working Environment | Temperature: -20°C~60°C, Humidity: <90%RH (no frost) |
Storage Environment | Temperature: -40°C~85°C, Humidity: <90%RH (no frost) |
Pinouts
- VCC: Power input (3.3V/5V)
- GND: Ground
- RX: UART data input
- TX: UART data output
- RST: Reset pin
- High: Power on fingerprint module
- Low: Power off fingerprint module
Hardware connection
- Connect the Reader to the PCBA as picture shown:
- After getting the module, you can use the test software or test program to test the module first. After having a certain understanding of the module, you can use the instruction sheet for secondary development.
- The module can be controlled through the UART serial port or through the Type-C interface on the main control board.
- Connect the Fingerprint Reader to PC.
- If you want to use the USB interface, connect the type-C interface of Fingerprint Reader to PC by Type-C USB cable.
- If you want to use the UART interface, you need to buy a USB to UART adapter separately first. Connect the Fingerprint Reader to the adapter and then connect the apdater to PC by USB cable.
- Open the Capacitive-Fingerprint-Reader-(B)-Demo software (download from the Resources)
- If you connect the Fingerprint Reader by USB cable, choose Con Mode -> USB and then click Connect to connect the device
- If you use to connect the Fingerprint Reader by UART adapter, choose Con Mode -> Serial, then set the correct COMPort, Baudrate set to 115200 and then click Connect to connect the device
About the software
- 1. Configuration
- Param Type: This option can be used to configure some parameters of the fingerprint reader
- Device ID: Set the device ID of fingerprint reader in the range 1 ~ 255
- Security level: Set the security level in the range 1 ~ 5, higher the level, smaller the FAR, and higher the FRR
- Duplication Check: Enable/Disable the duplication check function (1 or 0)
- Baudrate: Set the baud rate of the serial port
- Auto Learn: Enable/Disable the Auto learn function (1 or 0)
- Param Value: Show or Edit the value according to the Param Type
- Set Param: Click this button to configure the module
- Get Param: Click this button to get the parameter value relates to the Typ
- 2. Add fingerprint
- Input the ID, it is the ID of the fingerprint
- Choose the Enroll Count, it is the times that you need to input the fingerprint image, default 3.
- Click the Enroll button to add fingerprint
- Put your finger on the reader three times (according to the Enroll Count)
Note that the fingerprint can only be added successfully when the success information is printed. If you get the failed information, you need to try it again.
- 3. Verify fingerprint (with finger)
There are two methods of verifying fingerprints with fingers.
- Verify 1:1: Verify the finger with ID, it will verify the finger input with a fingerprint which was saved in the module with the ID
- Set the ID
- Click the Verify button
- Put your finger on the sensor to verify
- Verify 1:N: Verify the finger with all the fingerprints, it will verify the finger input with all the fingerprints which were saved in the module
- Click the Identify button
- Put your finger on the sensor to verify
- It will keep verifying, if you want to exit the verifying mode, just click the Stop button.
For more details about the software, please check the Software Reference Manual from Resources.
Notices
This is a capacitive fingerprint reader, you just need to put your finger on the sensor softly.
Dimension of the sensor
For Development boards like the Raspberry Pi, Arduino, STM32, only the UART interface is supported.
Connection
Fingerprint Reader (B) | Raspberry Pi | Description |
---|---|---|
VCC | 3.3V | Power input |
GND | GND | Ground |
TXD | RXD | UART data output |
RXD | TXD | UART data input |
RST | GPIO5 | Reset pin (low active) |
Enable the Serial port of Pi
- Open the terminal of the Raspberry Pi
- Type command sudo raspi-config
- Choose Interface Options -> Serial -> No -> Yes
- Disabled the login shell function and enable the hardware serial port.
Download the demo codes
Open the terminal of the Raspberry Pi and run the following commands.
cd wget https://www.waveshare.com/w/upload/e/e3/Capacitive-Fingerprint-Reader-B-Code.zip unzip Capacitive-Fingerprint-Reader-B-Code.zip cd Capacitive-Fingerprint-Reader-B-Code/
Install Libraries
- Install wiringpi
sudo apt-get install wiringpi # An upgrade may be required for raspberry PI 4B: cd /tmp wget https://project-downloads.drogon.net/wiringpi-latest.deb sudo dpkg -i wiringpi-latest.deb gpio -v # Running gpio-v to check if the version is 2.52, If it is not, you need to check the installation again.
- BCM2835 library:
wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.60.tar.gz sudo tar zxvf bcm2835-1.60.tar.gz cd bcm2835-1.xx sudo ./configure make sudo make check sudo make install
- Note: You can also go to http://www.airspayce.com/mikem/bcm2835/index.html for newest libraries.
- Install the python2 library
sudo apt-get update sudo apt-get install python-pip sudo pip install RPi.GPIO sudo apt-get install python-serial
- Install the python3 library
sudo apt-get update sudo apt-get install python3-pip sudo pip3 install RPi.GPIO sudo apt-get install python3-serial
Testing the example
Open the terminal of the Raspberry Pi and run the following commands.
- C example
cd ~/Capacitive-Fingerprint-Reader-B-Code/RaspberryPi/c sudo make sudo ./test
- python example
cd ~/Capacitive-Fingerprint-Reader-B-Code/RaspberryPi/Python sudo python main.py
- python3 example
cd ~/Capacitive-Fingerprint-Reader-B-Code/RaspberryPi/Python3 sudo python3 main.py
After running the example, the prompt printed in the terminal, you need to type the defined commands to enable the testing function:
- CMD0:
- Check if the fingerprint is connected normally
- CMD1:
- Check if a finger is detected
- CMD2:
- Add a fingerprint
- CMD3:
- Detect fingerprints
- CMD4:
- Verify fingerprint (1:1)
- CMD5:
- Verify fingerprints
- CMD6:
- Check the ID which is not be used (minimum number)
- CMD7:
- Check the number of fingerprinted added
- CMD8:
- Upload a fingerprint image to the host from the Fingerprint Reader
- CMD9:
- Download a fingerprint image to the Fingerprint Reader from the host
Connection
Fingerprint Reader (B) | Arduino UNO | Description |
---|---|---|
VCC | 3.3V/5V | Power input |
GND | GND | Ground |
TXD | 10 | UART data output |
RXD | 11 | UART data input |
RST | 9 | Reset pin (low active) |
The examples provided are based on the Arduino UNO board.
Testing
- Install Arduino IDE to your PC
- Download the Demo code and find th Arduino code (.../Capacitive-Fingerprint-Reader-B-Code\Capacitive-Fingerprint-Reader(B)-Code\Arduino\Finger_Test)
- Open the Finger_Test.ino with IDE
- Build and upload the codes to your Arduino UNO board
- Open the serial monitor of the IDE
- Input the corresponding commands to test the function
- CMD0:Check if the fingerprint is connected normally
- CMD1: Check if a finger is detected
- CMD2:Add a fingerprint
- CMD3:Detect fingerprints
- CMD4:Verify fingerprint (1:1)
- CMD5: Verify fingerprints
- CMD6:Check the ID which is not be used (minimum number)
- CMD7:Check the number of fingerprinted added
Connection
Fingerprint Reader (B) | STM32 | Description |
---|---|---|
VCC | 3.3V | Power input |
GND | GND | Ground |
TXD | PA10 | UART data output |
RXD | PA9 | UART data input |
RST | PB5 | Reset pin (low active) |
The STM32 examples provide are based on the STM32F103RBT6.
Testing
- Install Keil software to your PC
- Download the demo codes and find the STM32 project.(.../Capacitive-Fingerprint-Reader-B-Code\Capacitive-Fingerprint-Reader(B)-Code\STM32\MDK-ARM)
- Open the project by the Keil software
- Build the project and program it to your STM32 board by a programmer
- Connect the UART1 interface of your STM32 board to PC
- Open a SSCOM port and check the serial information
- You can input the commands to test the Fingerprint Reader.
- CMD0:Check if the fingerprint is connected normally
- CMD1: Check if a finger is detected
- CMD2:Add a fingerprint
- CMD3:Detect fingerprints
- CMD4:Verify fingerprint (1:1)
- CMD5: Verify fingerprints
- CMD6:Check the ID which is not be used (minimum number)
- CMD7:Check the number of fingerprinted added
- CMD8:Upload a fingerprint image to the host from the Fingerprint Reader
- CMD9:Download a fingerprint image to the Fingerprint Reader from the host
Program Description
C
- fingerprint.h is used to save the main function of the program running.
- cmd.h is used to save your fingerprint image data.
Main Function
- Initialization processing
First process the data of the handshake signal. Then wait for the initialization of the module to complete, and finally send a handshake signal. If the handshake is successful, perform the following operations. If the handshake is successful, wait for 1 second to perform the handshake again, and perform a total of 3 times.
void CMD_Init(void) { uint8_t i = 0; Cmd_Packet_Init(); Handshake_Signal(); while(1) { Tx_cmd(); if( Rx_cmd(1) ) { printf("Connection closed by server\n\r"); printf("Try to reconnect\n\r"); if(i++ > 3) { printf("Power on the device again"); while(1); } } else break; HAL_Delay(1000); } }
- Waiting for module initialization mode selection
Cancel the comment on the fourth line: the waiting method is: wait for 0.5 seconds: the waiting method without canceling the comment on the fourth line is: waiting for the module to send the initialization completion flag (this method must connect the RST pin).
void Handshake_Signal(void) { // Select a power-on waiting mode //#define CMD_DELAY #ifdef CMD_DELAY HAL_Delay(500); #else Handshake_flag = 1; HAL_GPIO_WritePin(Finger_RST_GPIO_Port,Finger_RST_Pin,GPIO_PIN_RESET); HAL_Delay(250); HAL_GPIO_WritePin(Finger_RST_GPIO_Port,Finger_RST_Pin,GPIO_PIN_SET); while(1) { if(flag == 1) { if(Handshake_data == 0x55) { Handshake_flag = 0; flag = 0; break; } else { printf("The communication fails. Power on the device again"); while(1); } } HAL_Delay(1); } #endif #undef CMD_DELAY }
- Initialize the command structure
void Cmd_Packet_Init(void) { CMD.PREFIX = Command; CMD.SID = Command_SID; CMD.DID = Command_DID; CMD.CMD = CMD_TEST_CONNECTION; CMD.LEN = DATA_0; for(int i = 0 ; i < CMD_Len ; i++) CMD.DATA[i] = 0x00; }
- Receive user commands and process them
uint8_t Tx_Data_Process(void) { while(1) { if( Usart2_ReceiveStruct.RX_flag == 1 ) { Usart2_ReceiveStruct.RX_Size=0; Usart2_ReceiveStruct.RX_flag=0; flag = 0; if((Usart2_ReceiveStruct.RX_pData[0] == 'C') && (Usart2_ReceiveStruct.RX_pData[1] == 'M') && (Usart2_ReceiveStruct.RX_pData[2] == 'D')) { switch(Usart2_ReceiveStruct.RX_pData[3]) { case '0': CmdTestConnection( 0 ) ; break; case '1': CmdFingerDetect( 0 ) ; break; case '2': AddUser( ) ; break; case '3': ClearUser( 0 ) ; break; case '4': VerifyUser( ) ; break; case '5': ScopeVerifyUser( ) ; break; case '6': CmdGetEmptyID( 0 ) ; break; case '7': GetUserCount( 1 ) ; break; case '8': CmdUpImageCode( 1 ) ; break; case '9': CmdDownImage( ) ; break; } break; } } HAL_Delay(1); } return 0; }
- Set an array of commands and send.
void Tx_cmd(void) { uint16_t CKS = 0 ; if(mode == 0 || mode == 2) { cmd[0] = CMD.PREFIX & 0xff; cmd[1] = (CMD.PREFIX & 0xff00) >> 8; cmd[2] = CMD.SID; cmd[3] = CMD.DID; cmd[4] = CMD.CMD ; cmd[5] = 0x00 ; cmd[6] = CMD.LEN & 0xff; cmd[7] = (CMD.LEN & 0xff00) >> 8; for(int i = 0 ; i < CMD.LEN ; i++) cmd[8+i] = CMD.DATA[i]; for(int i = 0 ; i < 24 ; i++) CKS = CKS + cmd[i]; cmd[24] = CKS & 0xff; cmd[25] = (CKS & 0xff00) >> 8; HAL_UART_Transmit(&huart1,cmd, 26,2); } else { cmd_data[0] = CMD_DATA.PREFIX & 0xff ; cmd_data[1] = (CMD_DATA.PREFIX & 0xff00) >> 8 ; cmd_data[2] = CMD_DATA.SID ; cmd_data[3] = CMD_DATA.DID ; cmd_data[4] = CMD_DATA.CMD ; cmd_data[5] = 0x00 ; cmd_data[6] = CMD_DATA.LEN & 0xff; cmd_data[7] = (CMD_DATA.LEN & 0xff00) >> 8; if(SN <129 ) { for(int i = 0 ; i < CMD_DATA.LEN ; i++) cmd_data[8+i] = CMD_DATA.DATA[i]; for(int i = 0 ; i < 506 ; i++) CKS = CKS + cmd_data[i]; cmd_data[506] = CKS & 0xff; cmd_data[507] = (CKS & 0xff00) >> 8; HAL_UART_Transmit(&huart1,cmd_data, 508 , 44); } else { for(int i = 0 ; i < CMD_DATA.LEN ; i++) cmd_data[8+i] = CMD_DATA.DATA[i]; for(int i = 0 ; i < 398 ; i++) CKS = CKS + cmd_data[i]; cmd_data[398] = CKS & 0xff; cmd_data[399] = (CKS & 0xff00) >> 8; HAL_UART_Transmit(&huart1,cmd_data, 400,38); } } }
- Process the received response array:
uint8_t Rx_cmd( uint8_t back ) { uint8_t a=1; uint16_t CKS = 0; while(a) { if( flag == 1 ) { a = 0; flag = 0; if(rps[4] == 0xff) return 1; Rx_CMD_Process(); if(mode == 0) { for(int i=0 ; i<24 ; i++) CKS = CKS + rps[i]; if(CKS == RPS.CKS) return Rx_Data_Process(back); } else { for(int i=0 ; i<10 ; i++) CKS = CKS + rps[i]; if(CKS == RPS.CKS) return 0; else return RPS.CMD; } } HAL_Delay(1); } return 1; }
- Update receive command structure:
void Rx_CMD_Process(void) { RPS.PREFIX = rps[0] + rps[1] * 0x100; RPS.SID = rps[2]; RPS.DID = rps[3]; RPS.CMD = rps[4] + rps[5] * 0x100; RPS.LEN = rps[6] + rps[7] * 0x100; RPS.RET = rps[8] + rps[9] * 0x100; if(mode == 0) { for(int i=0 ; i<RPS_Len ; i++) RPS.DATA[i] = rps[10 +i]; RPS.CKS = rps[24] + rps[25] * 0x100; } else RPS.CKS = rps[10] + rps[11] * 0x100; }
- Process response data:
uint8_t Rx_Data_Process( uint8_t back ) { uint8_t a = 0; switch(RPS.CMD) { case CMD_TEST_CONNECTION: a = RpsTestConnection(back); break; case CMD_FINGER_DETECT: a = RpsFingerDetect(back) ; break; case CMD_GET_IMAGE: a = RpsGetImage(back); break; case CMD_GENERATE: a = RpsGenerate(back); break; case CMD_MERGE: a = RpsMerge(back); break; case CMD_DEL_CHAR : a = RpsDelChar(back); break; case CMD_STORE_CHAR: a =RpsStoreCher(back) ; break; case CMD_SEARCH: a = RpsSearch(back) ; break; case CMD_VERIFY: a= RpsVerify(back) ; break; case CMD_GET_EMPTY_ID : a = RpsGetEmptyID(back); break; case CMD_GET_ENROLL_COUNT : a = RpsGetEnrollCount(back); break; case CMD_DOWN_IMAGE : a = RpsDownImage(back); break; } return a; }
- List of response and error codes:
uint8_t RPS_RET(void) { switch(RPS.RET) { case ERR_SUCCESS: printf("Instruction processing succeeded\r\n"); break; case ERR_FAIL: printf("Instruction processing failure\r\n"); break; case ERR_TIME_OUT: printf("No prints were entered within the time limit\r\n"); break; case ERR_FP_NOT_DETECTED: printf("There is no fingerprint input on the collector\r\n"); break; case ERR_FP_CANCEL: printf("Instruction cancelled\r\n"); break; case ERR_INVALID_BUFFER_ID: printf("The Ram Buffer number is invalid\r\n"); break; case ERR_BAD_QUALITY: printf("Poor fingerprint image quality\r\n"); break; case ERR_GEN_COUNT: printf("Invalid number of combinations\r\n"); break; case ERR_INVALID_TMPL_NO: printf("The specified Template number is invalid\r\n"); break; case ERR_DUPLICATION_ID: printf("The fingerprint has been registered, and the id is : %d\r\n",RPS.DATA[0]+RPS.DATA[1]*0x100 ); break; case ERR_INVALID_PARAM: printf("Specified range invalid\r\n"); break; case ERR_TMPL_EMPTY: printf("Template is not registered in the specified range\r\n"); break; case ERR_VERIFY: printf("Description Failed to specify fingerprint comparison\r\n"); break; case ERR_IDENTIFY: printf("Fingerprint comparison failed for the specified range\r\n"); break; } return RPS.RET; }