Biometric security is definitely a thing of the future, from fingers to eye retinas, even earlobes can be used to uniquely identify a human being. That is why we have decided to offer our customers a platform to develop biometric systems as efficiently as possible - get familiar with the Fingerprint click.
The click carries the GTS-511E2 fingerprint module. The module has a CMOS image sensor covered with a lens. The CMOS sensor is built smart enough to recognize whether the fingerprint is real or a 2D copy. Along with the image sensor, the click also carries the STM32F415 MCU, which is the main operating unit of this click board. The STM32F415 contains firmware developed by our engineers. The firmware is designed so that the click can be used either as a standalone USB HID with a Windows PC application or as a SPI slave communicating with a host MCU. Since the first batch of Fingerprint clicks has been released with a previous firmware, designed only for standalone use, if you have bought the click before this article, you will need to perform a firmware update.
How to update the firmware
The current Fingerprint click comes equipped with our USB HID bootloader. If your PC recognizes the bootloader, the only thing you need to do is download the firmware from Libstock and upload it onto the click using the bootloader. The instructions on how to use our bootloader can be found here.
Now that you have the new firmware uploaded, you can use the click either as a standalone device with our Fingerprint click PC application, or with a host MCU.
Using the click with the PC application
The application can be downloaded from Libstock. Here's how to use it:
Start the application, and connect your PC with the click with a USB mini connector. For the first 5 or so seconds, the PC will recognize the click as "Mikroelektronika USB HID bootloader". This is because our bootloader has been designed to wait 5 seconds for the PC to connect, if 5 seconds pass, the MCU will jump out of bootloader mode and proceed with the user code. Once the click is out of bootloader mode your PC should detect the click as "Mikroelektronika FINGERPRINT", and you should see the status "Ready" on the bottom left of the application.
Fingerprint application
Now you can fully operate your Fingerprint click! If you click on the fingerprint icon, the click will capture an image and send it to the PC. The image will be displayed on the main window. The status label should read "Fingerprint transferred"
Fingerprint scanning
If you want to save this image, just hit the save icon on the right.
Saving the image
In the settings window, you can set the different CMOS image sensor settings such as the exposure time or global gain. Once you hit SAVE, these settings will be sent from the PC to the click and stored in the clicks EEPROM.
Fingerprint click settings
Using the click with a host MCU
The click can also communicate with an external host over SPI. We have made a simple example that shows how to do it. Let's look at the example in which we will interface a STM32F107 host MCU with the Fingerprint click.
We start of by initializing SPI communication and the TFT display, after which we will ping the click until we get a FP_READY byte as a response.
SPI3_Init_Advanced( _SPI_FPCLK_DIV2, _SPI_MASTER | _SPI_8_BIT | _SPI_CLK_IDLE_LOW | _SPI_FIRST_CLK_EDGE_TRANSITION | _SPI_MSB_FIRST | _SPI_SS_DISABLE | _SPI_SSM_ENABLE | _SPI_SSI_1, &_GPIO_MODULE_SPI3_PC10_11_12 ); GPIO_Digital_Output( &GPIOD_BASE, _GPIO_PINMASK_13 ); Delay_ms(3000); TFT_Init_ILI9341_8bit(320, 240); TFT_Set_Pen(CL_BLACK, 1); TFT_Set_Font(TFT_defaultFont, CL_BLACK, FO_HORIZONTAL); TFT_Fill_Screen(CL_Aqua); TFT_Write_Text("TFT Initialized, waiting for fingerprint click",10,10); Delay_ms(1000); TFT_Set_Address_Ptr(0,0); delay_ms(10000); // wait for the click to go out of bootloader mode TFT_Write_Text("Fingerprint ready test...", 10, 50); fingerprint_is_ready();
Every command sent has it's appropriate response, therefore, all the commands will ping the click until they get the right response. If something goes wrong, the MCU will continue to ping and be stuck forever in this loop. This is the case for all the functions used here. Let's take a look at the fingerprint_is_ready function for a clear example:
void fingerprint_is_ready() { uint8_t temp_spi_buffer; CS_PIN = 0; delay_ms(10); Spi_Write(FP_TEST); delay_ms(20); CS_PIN = 1; temp_spi_buffer = 0; while ( temp_spi_buffer != FP_READY ) { CS_PIN = 0; delay_ms(10); temp_spi_buffer = SPI_Read(FP_DUMMY); temp_spi_buffer = SPI_Read(FP_DUMMY); CS_PIN = 1; delay_ms(1000); } }
You can see here that we first send a FP_TEST command, once the click receives this command, the internal buffer of the click will be set to FP_READY as a response. Once we issue an SPI_Read command, we should receive this response. The same goes for all other functions: we send a command, and then the internal buffer of the click will be set to the appropriate response.
#include#include "fingerprint.h" sbit CS_PIN at GPIOD_ODR.b13; unsigned int TFT_DataPort at GPIOE_ODR; sbit TFT_RST at GPIOE_ODR.B8; sbit TFT_RS at GPIOE_ODR.B12; sbit TFT_CS at GPIOE_ODR.B15; sbit TFT_RD at GPIOE_ODR.B10; sbit TFT_WR at GPIOE_ODR.B11; sbit TFT_BLED at GPIOE_ODR.B9; void main() { SPI3_Init_Advanced( _SPI_FPCLK_DIV2, _SPI_MASTER | _SPI_8_BIT | _SPI_CLK_IDLE_LOW | _SPI_FIRST_CLK_EDGE_TRANSITION | _SPI_MSB_FIRST | _SPI_SS_DISABLE | _SPI_SSM_ENABLE | _SPI_SSI_1, &_GPIO_MODULE_SPI3_PC10_11_12 ); GPIO_Digital_Output( &GPIOD_BASE, _GPIO_PINMASK_13 ); Delay_ms(3000); TFT_Init_ILI9341_8bit(320, 240); TFT_Set_Pen(CL_BLACK, 1); TFT_Set_Font(TFT_defaultFont, CL_BLACK, FO_HORIZONTAL); TFT_Fill_Screen(CL_Aqua); TFT_Write_Text("TFT Initialized, waiting for fingerprint click",10,10); Delay_ms(1000); TFT_Set_Address_Ptr(0,0); delay_ms(10000); // wait for the click to go out of bootloader mode TFT_Write_Text("Fingerprint ready test...", 10, 50); fingerprint_is_ready(); TFT_Write_Text("passed", 200, 50); TFT_Write_Text("Fingerprint capture image...", 10, 70); fingerprint_capture_image(); TFT_Write_Text("passed", 200, 70); TFT_Write_Text("Displaying image", 10, 90); delay_ms(3000); fingerprint_display_image(); fingerprint_end_image_transfer(); }
Let's look at the whole code now. After we are sure that the click is ready, we send a command for the click to capture an image, and then for the click to send us the image bytes. For every SPI_Read we issue, we will get one byte of the image. Each byte is then sent to the TFT display.
void fingerprint_display_image() { uint8_t temp_spi_buffer; uint64_t temp_i; CS_PIN = 0; delay_ms(10); Spi_Write(FP_GET_IMAGE); delay_ms(20); CS_PIN = 1; delay_ms(20); TFT_CS = 0; TFT_Set_Address_Ptr(0,0); for (temp_i = 0; temp_i < 240*320; temp_i++) { CS_PIN = 0; temp_spi_buffer = SPI_READ(FP_DUMMY); CS_PIN = 1; TFT_Write_Data_ptr(temp_spi_buffer); } TFT_CS = 0; }
And that's the whole deal. Getting a fingerprint scan has never been easier. Use the images whoever you seem fit and create your unique biometric security system! All the software mentioned here can be found on Libstock or GitHub. Good luck!
References
wikipedia.org "Biometrics" wikipedia 2016
wikipedia.org "CMOS" wikipedia 2016
wikipedia.org "USB Human Interface Device" wikipedia 2016