Capacitive Fingerprint Reader (B)

From Waveshare Wiki
Jump to: navigation, search
Capacitive Fingerprint Reader (B)
Capacitive Fingerprint Reader (B)

High Precision Capacitive Fingerprint Reader (B), UART/USB Dual Ports
{{{name2}}}

{{{name3}}}

{{{name4}}}

{{{name5}}}

{{{name6}}}

Overview

The Capacitive Fingerprint Reader (B) is a fast and stable capacitive fingerprint module specialized for secondary development, and 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, 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 files, 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 208 x 288
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 the fingerprint module
    • Low: Power off the fingerprint module

Hardware Connection

  • Connect the Reader to the PCBA as the picture showed:
Capacitive-Fingerprint-Reader-B-5.jpg
  • 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 the Fingerprint Reader to the 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 adapter 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, and 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 the fingerprint reader in the range of 1 ~ 255.
    • Security level: Set the security level in the range 1 ~ 5, the higher the level, the smaller the FAR, and the 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 a 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.

Correct
Capacitive Fingerprint Reader (B) 1.png
Wrong
Capacitive Fingerprint Reader (B) 2.png

Sensor Dimensions

Capacitive Fingerprint Reader (B) 3.png

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.

Demo Use

The function contents of Raspberry Pi, Arduino, and STM32 may be partially different, but the operation and functions are the same.

How to Connect

STM32 Connection Pin Correspondence
Module STM32 Function
VCC 5/3.3V Power Input
GND GND Ground
TXD PA10 Module UART Transmitting Pin
RXD PA9 Module UART Receiving Pin
RST PB5 Module Reset Pin, Low Active

Arduino Connection Pin Correspondence
Module Arduino Function
VCC 5/3.3V Power Input
GND GND Ground
TXD 10 Module UART Transmitting Pin
RXD 11 Module UART Receiving Pin
RST 9 Module Reset Pin, Low Active

Raspberry Pi Connection Pin Correspondence
Module Raspberry Pi Function
VCC 5/3.3V Power Input
GND GND Ground
TXD RXD Module UART Transmitting Pin
RXD TXD Module UART Receiving Pin
RST GPIO5(wiringpi code) Module Reset Pin, Low Active





Working with STM32/Arduino

Connect the corresponding STM32/Arduino and fingerprint module according to the connection method.
Connect the USB port of the Open103Z/Arduino UNO with the PC, and then choose the corresponding UART port:
Capacitive Fingerprint Reader (B) 28.png
CMD0: Check if the fingerprint is connected normally.
CMD1: Check if a finger is detected.
CMD2: Add a fingerprint.
CMD3: Delete the fingerprint.
CMD4: Verify the fingerprint (1:1).
CMD5: Verify fingerprints.
CMD6: Check the ID which is not being used (minimum number).
CMD7: Check the number of fingerprints 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.

Note: Arduino does not have CMD8 and CMD9 instructions because of the memory, and packet loss will occur when using the 115200 baud rate.
How to modify:
1. Use software to make changes.
2. Use the following command to make changes.
Capacitive Fingerprint Reader (B) 29.png
Set to 115200 baud rate:
55 AA 00 00 02 00 05 00 03 05 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0e 01
Set to 57600 baud rate:
55 AA 00 00 02 00 05 00 03 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0d 01
The return value after successful setup is:
AA 55 01 00 02 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 01

Working with Raspberry Pi

Open the Serial Port

Enter the commands:

sudo raspi-config

Capacitive Fingerprint Reader90.png
Capacitive Fingerprint Reader91.png
Capacitive Fingerprint Reader92.png
Capacitive Fingerprint Reader93.png
Capacitive Fingerprint Reader94.png
Reboot:

sudo reboot

Install wiringpi

sudo apt install git-core
sudo git clone https://github.com/WiringPi/WiringPi
cd WiringPi/
sudo ./build
#Check the wiringpi version, usually above 2.70
gpio -v

Install python Library

#python3's serial port library
sudo apt-get install python3-serial
#serial library for python2
sudo apt-get install python-serial

Download the Demo

wget https://files.waveshare.com/upload/1/1d/Capacitive-Fingerprint-Reader%28B%29-Code.zip
unzip unzip Capacitive-Fingerprint-Reader\(B\)-Code
cd cd Capacitive-Fingerprint-Reader\(B\)-Code/RaspberryPi/

How to Use

C

cd c
make 
sudo ./test

Python

cd python
sudo python main.py

Python3

cd python3
sudo python3 main.py

Demo 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 it 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;
}
  • Build 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;
}

Resources

Documents

Demo codes

Software

Support



Technical Support

If you need technical support or have any feedback/review, please click the Submit Now button to submit a ticket, Our support team will check and reply to you within 1 to 2 working days. Please be patient as we make every effort to help you to resolve the issue.
Working Time: 9 AM - 6 PM GMT+8 (Monday to Friday)