Intermediate
30 min

Simplify user interactions by employing a fingerprint-based solution with 100018754 and STM32F091RC

Seamless authentication

Fingerprint 4 Click with Nucleo-64 with STM32F091RC MCU

Published Feb 26, 2024

Click board™

Fingerprint 4 Click

Dev Board

Nucleo-64 with STM32F091RC MCU

Compiler

NECTO Studio

MCU

STM32F091RC

This solution aims to provide real-time matching and validation of fingerprint patterns, establishing a seamless and robust authentication process

A

A

Hardware Overview

How does it work?

Fingerprint 4 Click is based on the FPC BM-Lite module (100018754), a standalone, compact biometric fingerprint solution from Fingerprints with a robust fingerprint sensor, biometric processor, and on-board template storage ready to be used out-of-the-box. This Click board™ can be integrated into any application and controlled by a host MCU sending some basic commands for enrollment and verification via the selectable serial interface. The BM-Lite module is based on capacitive technology and utilizes a reflective measurement method. It acquires the fingerprint image from the fingerprint sensor. It stores them in the internal flash memory, which is pre-loaded with firmware from Fingerprints and used for all biometric operations and template storage.

The BM-Lite module, with a 160x160px sensor matrix, uses a 3D pixel sensing technology that can read virtually any finger, dry or wet, and brings together superior biometric performance and a high standard of integrated quality components to offer an embedded solution for increased security and enhanced user convenience. The module has a protective coating that protects against ±15kV ESD, scratches, and daily wear and tear impact. It is also waterproof, making it suitable for demanding industrial conditions and all-weather applications. Fingerprint 4 Click allows the UART interface with commonly used UART RX and TX pins, operating at 115200bps by default configuration, to transmit and exchange data with the host MCU or SPI interface with a maximum

frequency of 20MHz. The selection can be made by positioning SMD jumpers labeled as COMM SEL in an appropriate position. While using the SPI interface, users can use the data ready pin, marked IRQ and routed to the INT pin of the mikroBUS™ socket, to inform the host MCU about detecting a finger on the module and general reset function routed on the RST pin of the mikroBUS™ socket. This Click board™ can be operated only with a 3.3V logic voltage level. The board must perform appropriate logic voltage level conversion before using MCUs with different logic levels. Also, it comes equipped with a library containing functions and an example code that can be used, as a reference, for further development.

Fingerprint 4 Click top side image
Fingerprint 4 Click bottom side image

Features overview

Development board

Nucleo-64 with STM32F091RC MCU offers a cost-effective and adaptable platform for developers to explore new ideas and prototype their designs. This board harnesses the versatility of the STM32 microcontroller, enabling users to select the optimal balance of performance and power consumption for their projects. It accommodates the STM32 microcontroller in the LQFP64 package and includes essential components such as a user LED, which doubles as an ARDUINO® signal, alongside user and reset push-buttons, and a 32.768kHz crystal oscillator for precise timing operations. Designed with expansion and flexibility in mind, the Nucleo-64 board features an ARDUINO® Uno V3 expansion connector and ST morpho extension pin

headers, granting complete access to the STM32's I/Os for comprehensive project integration. Power supply options are adaptable, supporting ST-LINK USB VBUS or external power sources, ensuring adaptability in various development environments. The board also has an on-board ST-LINK debugger/programmer with USB re-enumeration capability, simplifying the programming and debugging process. Moreover, the board is designed to simplify advanced development with its external SMPS for efficient Vcore logic supply, support for USB Device full speed or USB SNK/UFP full speed, and built-in cryptographic features, enhancing both the power efficiency and security of projects. Additional connectivity is

provided through dedicated connectors for external SMPS experimentation, a USB connector for the ST-LINK, and a MIPI® debug connector, expanding the possibilities for hardware interfacing and experimentation. Developers will find extensive support through comprehensive free software libraries and examples, courtesy of the STM32Cube MCU Package. This, combined with compatibility with a wide array of Integrated Development Environments (IDEs), including IAR Embedded Workbench®, MDK-ARM, and STM32CubeIDE, ensures a smooth and efficient development experience, allowing users to fully leverage the capabilities of the Nucleo-64 board in their projects.

Nucleo 64 with STM32F091RC MCU double side image

Microcontroller Overview

MCU Card / MCU

default

Architecture

ARM Cortex-M0

MCU Memory (KB)

256

Silicon Vendor

STMicroelectronics

Pin count

64

RAM (Bytes)

32768

You complete me!

Accessories

Click Shield for Nucleo-64 comes equipped with two proprietary mikroBUS™ sockets, allowing all the Click board™ devices to be interfaced with the STM32 Nucleo-64 board with no effort. This way, Mikroe allows its users to add any functionality from our ever-growing range of Click boards™, such as WiFi, GSM, GPS, Bluetooth, ZigBee, environmental sensors, LEDs, speech recognition, motor control, movement sensors, and many more. More than 1537 Click boards™, which can be stacked and integrated, are at your disposal. The STM32 Nucleo-64 boards are based on the microcontrollers in 64-pin packages, a 32-bit MCU with an ARM Cortex M4 processor operating at 84MHz, 512Kb Flash, and 96KB SRAM, divided into two regions where the top section represents the ST-Link/V2 debugger and programmer while the bottom section of the board is an actual development board. These boards are controlled and powered conveniently through a USB connection to program and efficiently debug the Nucleo-64 board out of the box, with an additional USB cable connected to the USB mini port on the board. Most of the STM32 microcontroller pins are brought to the IO pins on the left and right edge of the board, which are then connected to two existing mikroBUS™ sockets. This Click Shield also has several switches that perform functions such as selecting the logic levels of analog signals on mikroBUS™ sockets and selecting logic voltage levels of the mikroBUS™ sockets themselves. Besides, the user is offered the possibility of using any Click board™ with the help of existing bidirectional level-shifting voltage translators, regardless of whether the Click board™ operates at a 3.3V or 5V logic voltage level. Once you connect the STM32 Nucleo-64 board with our Click Shield for Nucleo-64, you can access hundreds of Click boards™, working with 3.3V or 5V logic voltage levels.

Click Shield for Nucleo-64 accessories 1 image

Used MCU Pins

mikroBUS™ mapper

NC
NC
AN
Reset
PC12
RST
SPI Chip Select
PB12
CS
SPI Clock
PB3
SCK
SPI Data OUT
PB4
MISO
SPI Data IN
PB5
MOSI
Power Supply
3.3V
3.3V
Ground
GND
GND
NC
NC
PWM
Data Ready
PC14
INT
UART TX
PA2
TX
UART RX
PA3
RX
NC
NC
SCL
NC
NC
SDA
NC
NC
5V
Ground
GND
GND
1

Take a closer look

Click board™ Schematic

Fingerprint 4 Click Schematic schematic

Step by step

Project assembly

Click Shield for Nucleo-64 front image hardware assembly

Start by selecting your development board and Click board™. Begin with the Nucleo-64 with STM32F091RC MCU as your development board.

Click Shield for Nucleo-64 front image hardware assembly
Nucleo 64 with STM32F401RE MCU front image hardware assembly
EEPROM 13 Click front image hardware assembly
Prog-cut hardware assembly
Nucleo-64 with STM32XXX MCU MB 1 Mini B Conn - upright/background hardware assembly
Necto image step 2 hardware assembly
Necto image step 3 hardware assembly
Necto image step 4 hardware assembly
Necto image step 5 hardware assembly
Necto image step 6 hardware assembly
Clicker 4 for STM32F4 HA MCU Step hardware assembly
Necto No Display image step 8 hardware assembly
Necto image step 9 hardware assembly
Necto image step 10 hardware assembly
Debug Image Necto Step hardware assembly

Track your results in real time

Application Output

1. Application Output - In Debug mode, the 'Application Output' window enables real-time data monitoring, offering direct insight into execution results. Ensure proper data display by configuring the environment correctly using the provided tutorial.

2. UART Terminal - Use the UART Terminal to monitor data transmission via a USB to UART converter, allowing direct communication between the Click board™ and your development system. Configure the baud rate and other serial settings according to your project's requirements to ensure proper functionality. For step-by-step setup instructions, refer to the provided tutorial.

3. Plot Output - The Plot feature offers a powerful way to visualize real-time sensor data, enabling trend analysis, debugging, and comparison of multiple data points. To set it up correctly, follow the provided tutorial, which includes a step-by-step example of using the Plot feature to display Click board™ readings. To use the Plot feature in your code, use the function: plot(*insert_graph_name*, variable_name);. This is a general format, and it is up to the user to replace 'insert_graph_name' with the actual graph name and 'variable_name' with the parameter to be displayed.

Software Support

Library Description

This library contains API for Fingerprint 4 Click driver.

Key functions:

  • fingerprint4_version - This function reads out version information from the device

  • fingerprint4_identify_finger - This function captures and identifies finger against existing templates in Flash storage

  • fingerprint4_wait_finger_not_present - This function waits until no finger is detected on the sensor

Open Source

Code example

The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.

/*!
 * @file main.c
 * @brief Fingerprint 4 Click example
 *
 * # Description
 * This example demonstrates the use of the Fingerprint 4 click boards by registering 3 fingerprints and
 * then waiting until a finger is detected on the sensor and identifying if the fingerprint matches one of
 * those stored in the Flash storage.
 *
 * The demo application is composed of two sections :
 * 
 * ## Application Init 
 * Initializes the driver and reads the sensor firmware version, then resets the sensor and removes all
 * stored fingerprint templates. After that it registers 3 new fingerprint templates and stores them in the Flash storage.
 * 
 * ## Application Task  
 * Waits until a finger is detected on the sensor, takes an image of the finger and checks if there's
 * a fingerprint in the library that matches the one it has just read. If it finds a match, a fingerprint template
 * ID will be displayed. All data is being logged on the USB UART where you can track the program flow.
 *
 * @author Stefan Filipovic
 *
 */

#include "board.h"
#include "log.h"
#include "fingerprint4.h"

#define LOCATION_IN_FLASH               0   // Starting location or template ID where the fingerprints will be stored.
#define NUMBER_OF_FINGERPRINTS          3   // Number of fingerprints to register.

static fingerprint4_t fingerprint4;
static log_t logger;

/**
 * @brief Fingerprint 4 error check function.
 * @details This function checks the @b error_flag and displays the result appended to @b message 
 * on the USB UART.
 * @param[in] message : Prefix message of the error_flag result.
 * @param[in] error_flag : Error flag, return value of the functions.
 * @return None.
 * @note None.
 */
static void fingerprint4_error_check ( char *message, err_t error_flag );

/**
 * @brief Fingerprint 4 enroll fingerprint function.
 * @details This function enrolls a single fingerprint by taking 3 image captures. Each step will be logged on the USB UART
 * where you can track the function flow.
 * @param[in] ctx : Click context object.
 * See #fingerprint4_t object definition for detailed explanation.
 * @return @li @c  0 - Success,
 *         @li @c <0 - Error.
 * See #fingerprint4_return_value_t definition for detailed explanation.
 * @note None.
 */
static err_t fingerprint4_enroll_fingerprint ( fingerprint4_t *ctx );

/**
 * @brief Fingerprint 4 register fingerprints function.
 * @details This function registers a desired number of fingerprints starting from the selected template ID.
 * Each step will be logged on the USB UART where you can track the function flow.
 * @param[in] ctx : Click context object.
 * See #fingerprint4_t object definition for detailed explanation.
 * @param[in] template_id : Starting template ID of fingerprints to store to Flash.
 * @param[in] num_fpc : Number of fingerprints to register.
 * @return None.
 * @note None.
 */
static void fingerprint4_register_fingerprints ( fingerprint4_t *ctx, uint16_t template_id, uint8_t num_fpc );

void application_init ( void )
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    fingerprint4_cfg_t fingerprint4_cfg;  /**< Click config object. */

    /** 
     * Logger initialization.
     * Default baud rate: 115200
     * Default log level: LOG_LEVEL_DEBUG
     * @note If USB_UART_RX and USB_UART_TX 
     * are defined as HAL_PIN_NC, you will 
     * need to define them manually for log to work. 
     * See @b LOG_MAP_USB_UART macro definition for detailed explanation.
     */
    LOG_MAP_USB_UART( log_cfg );
    log_init( &logger, &log_cfg );
    log_info( &logger, " Application Init " );

    // Click initialization.
    fingerprint4_cfg_setup( &fingerprint4_cfg );
    FINGERPRINT4_MAP_MIKROBUS( fingerprint4_cfg, MIKROBUS_1 );
    if ( FINGERPRINT4_RES_OK != fingerprint4_init( &fingerprint4, &fingerprint4_cfg ) )
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }

    fingerprint4_reset_device ( &fingerprint4 );
    
    fingerprint4.phy_rx_timeout = FINGERPRINT4_DEFAULT_PHY_RX_TIMEOUT_MS;
    
    uint8_t version[ 50 ] = { 0 };
    if ( FINGERPRINT4_RES_OK == fingerprint4_version ( &fingerprint4, version, 50 ) )
    {
        log_printf( &logger, " FW version: %s\r\n", version );
        log_printf( &logger, "---------------------------------\r\n\n" );
    }
    
    fingerprint4_error_check( "Sensor reset", fingerprint4_sensor_reset ( &fingerprint4 ) );
    
    fingerprint4_error_check( "Remove all templates", fingerprint4_template_remove_all ( &fingerprint4 ) );
    
    fingerprint4_register_fingerprints ( &fingerprint4, LOCATION_IN_FLASH, NUMBER_OF_FINGERPRINTS );
    
    log_info( &logger, " Application Task " );
}

void application_task ( void )
{
    uint16_t template_id;
    bool match;
    log_printf( &logger, " Put your finger on the sensor.\r\n" );
    err_t error_flag = fingerprint4_identify_finger ( &fingerprint4, FINGERPRINT4_INFINITE_TIMEOUT, &template_id, &match );
    if ( error_flag )
    {
        fingerprint4_error_check( "Identify finger", error_flag );
    }
    else
    {
        if ( match )
        {
            log_printf( &logger, " >>>>> Fingerprint MATCH - Template ID: %u <<<<<\r\n", template_id );
        }
        else
        {
            log_printf( &logger, " >>>>> NO MATCH in the library <<<<<\r\n" );
        }
    }
    log_printf( &logger, " Lift the finger of the sensor.\r\n" );
    fingerprint4_wait_finger_not_present ( &fingerprint4, FINGERPRINT4_INFINITE_TIMEOUT );
    log_printf( &logger, "---------------------------------\r\n\n" );
}

void main ( void )
{
    application_init( );

    for ( ; ; )
    {
        application_task( );
    }
}

static void fingerprint4_error_check ( char *message, err_t error_flag )
{
    log_printf( &logger, " %s: ", message );
    if ( error_flag )
    {
        log_printf( &logger, "FAIL! [ERROR] Num: %ld\r\n", error_flag );
    }
    else
    {
        log_printf( &logger, "DONE!\r\n" );
    }
    log_printf( &logger, "---------------------------------\r\n\n" );
}

static void fingerprint4_register_fingerprints ( fingerprint4_t *ctx, uint16_t template_id, uint8_t num_fpc )
{
    err_t error_flag = FINGERPRINT4_RES_OK;
    uint8_t cnt = 1;
    while ( cnt <= num_fpc )
    {
        log_printf( &logger, " >>> Registering fingerprint %u of %u <<<\r\n", ( uint16_t ) cnt, 
                                                                              ( uint16_t ) num_fpc );
        error_flag = fingerprint4_enroll_fingerprint ( ctx );
        if ( error_flag )
        {
            fingerprint4_error_check( "Enroll finger", error_flag );
        }
        else
        {
            error_flag = fingerprint4_template_save ( &fingerprint4, template_id + cnt - 1 );
            if ( error_flag )
            {
                fingerprint4_error_check( "Template save", error_flag );
            }
            else
            {
                log_printf( &logger, " Fingerprint template ID: %u\r\n", template_id + cnt - 1 );
                log_printf( &logger, "---------------------------------\r\n\n" );
                cnt++;
            }
        }
    }
}

static err_t fingerprint4_enroll_fingerprint ( fingerprint4_t *ctx )
{
    err_t error_flag = FINGERPRINT4_RES_OK;
    bool enroll_done = false;
    // Enroll start
    error_flag = fingerprint4_send_cmd ( ctx, FINGERPRINT4_CMD_ENROLL, FINGERPRINT4_ARG_START );
    if ( error_flag )
    {
        fingerprint4_error_check( "Enroll start", error_flag );
        return error_flag;
    }
    uint8_t cnt = 1;
    while ( cnt <= FINGERPRINT4_NUM_IMAGES )
    {
        log_printf( &logger, " >>> Taking image %u of %u <<<\r\n", ( uint16_t ) cnt, 
                                                                   ( uint16_t ) FINGERPRINT4_NUM_IMAGES );
        log_printf( &logger, " Put your finger on the sensor.\r\n" );
        // Capture image
        uint32_t prev_timeout = ctx->phy_rx_timeout;
        ctx->phy_rx_timeout = FINGERPRINT4_INFINITE_TIMEOUT;
        error_flag = fingerprint4_send_cmd_arg ( ctx, FINGERPRINT4_CMD_CAPTURE, FINGERPRINT4_ARG_NONE, 
                                                 FINGERPRINT4_ARG_TIMEOUT, &ctx->phy_rx_timeout, sizeof ( ctx->phy_rx_timeout ) );
        ctx->phy_rx_timeout = prev_timeout;
        if ( error_flag ) 
        {
            fingerprint4_error_check( "Capture image", error_flag );
            continue;
        }
        // Enroll add
        error_flag = fingerprint4_send_cmd ( ctx, FINGERPRINT4_CMD_ENROLL, FINGERPRINT4_ARG_ADD );
        if ( error_flag ) 
        {
            fingerprint4_error_check( "Enroll add", error_flag );
            continue;
        }
        cnt++;
        uint32_t samples_remaining;
        fingerprint4_copy_arg ( ctx, FINGERPRINT4_ARG_COUNT, ( uint8_t * ) &samples_remaining, 4 );
        // Break enrolling if we collected enough correct images
        if ( !samples_remaining ) 
        {
            enroll_done = true;
            break;
        }
        log_printf( &logger, " Lift the finger of the sensor.\r\n" );
        log_printf( &logger, "---------------------------------\r\n" );
        fingerprint4_wait_finger_not_present ( ctx, FINGERPRINT4_INFINITE_TIMEOUT );
    }
    error_flag = fingerprint4_send_cmd ( ctx, FINGERPRINT4_CMD_ENROLL, FINGERPRINT4_ARG_FINISH );
    if ( error_flag )
    {
        fingerprint4_error_check( "Enroll finish", error_flag );
        return error_flag;
    }
    log_printf( &logger, " Lift the finger of the sensor.\r\n" );
    log_printf( &logger, "---------------------------------\r\n" );
    fingerprint4_wait_finger_not_present ( ctx, FINGERPRINT4_INFINITE_TIMEOUT );
    return ( !enroll_done ) ? FINGERPRINT4_RES_ERROR : error_flag;
}

// ------------------------------------------------------------------------ END

Additional Support

Resources

Love this project?

'Buy This Kit' button takes you directly to the shopping cart where you can easily add or remove products.