Create an efficient access control application that will include an authentication solution
A
A
Hardware Overview
How does it work?
Fingerprint 3 Click is an adapter Click board™ that simplifies the connection of add-on boards to the mikroBUS™ socket. This Click board™ represents a small-size PCB that can be connected to the mikroBUS™ socket like any other Click board™, with a 1x6 1.0mm pitch vertical type wire to board connector placed on itself. Each of the header pins corresponds to a pin on the mikroBUS™ socket being used, such as UART lines (TX, RX), 3V3 power supply, finger detection signal, and Ring LED enable for GROW R503 module and ground. This Click board™ allows easy pin access and manipulation while always retaining a perfect connection quality. Fingerprint processing includes two parts: fingerprint recording and fingerprint matching. The first step is initializing all the necessary drivers, peripherals, and pins. At power-on, it takes about 200ms for initialization; during this period, the module can't accept any commands.
This is followed by checking the sensor and verifying the module password, after which a new fingerprint pattern begins if everything is done correctly. The 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, a user enters the finger through an optical sensor, and the system will generate a template of the finger and compare it with templates of the finger library. In both circumstances, the system will return the matching result, success or failure. This can also be seen in an example code that contains easy-to-use functions that may be used as a reference for further development. The Fingerprint 3 Click communicates with MCU using the UART interface with the default baud rate of 57600bps for the data transfer, while the GPIO pins on this Click board™ are used for finger detection and ring indicator LED
enable. Ring indicator LED light labeled as VD can be enabled by toggling the signal routed to the RST pin on the mikroBUS™, while the signal routed to the INT pin on the mikroBUS™ represents an interrupt and indicates the detection of a finger on the module. When the indicator glows purple, the module is in its Stand-By mode and waits for a finger to be pressed. In addition to purple, the module can also glow blue or red, indicating the fingerprint match's correctness (blue indicates that a pair is found, while red indicates that a pair was not found). This Click board™ can only be operated with a 3.3V logic voltage level. The board must perform appropriate logic voltage level conversion before using MCUs with different logic levels. However, the Click board™ comes equipped with a library containing functions and an example code that can be used as a reference for further development.
Features overview
Development board
EasyAVR v8 is a development board designed to rapidly develop embedded applications based on 8-bit AVR microcontrollers (MCUs). Redesigned from the ground up, EasyAVR v8 offers a familiar set of standard features, as well as some new and unique features standard for the 8th generation of development boards: programming and debugging over the WiFi network, connectivity provided by USB-C connectors, support for a wide range of different MCUs, and more. The development board is designed so that the developer has everything that might be needed for the application development, following the Swiss Army knife concept: a highly advanced programmer/debugger module, a reliable power supply module, and a USB-UART connectivity option. EasyAVR v8 board offers several different DIP sockets, covering a wide range of 8-bit AVR MCUs, from the smallest
AVR MCU devices with only eight pins, all the way up to 40-pin "giants". The development board supports the well-established mikroBUS™ connectivity standard, offering five mikroBUS™ sockets, allowing access to a huge base of Click boards™. EasyAVR v8 offers two display options, allowing even the basic 8-bit AVR MCU devices to utilize them and display graphical or textual content. One of them is the 1x20 graphical display connector, compatible with the familiar Graphical Liquid Crystal Display (GLCD) based on the KS108 (or compatible) display driver, and EasyTFT board that contains TFT Color Display MI0283QT-9A, which is driven by ILI9341 display controller, capable of showing advanced graphical content. The other option is the 2x16 character LCD module, a four-bit display module with an embedded character-based display controller. It
requires minimal processing power from the host MCU for its operation. There is a wide range of useful interactive options at the disposal: high-quality buttons with selectable press levels, LEDs, pull-up/pulldown DIP switches, and more. All these features are packed on a single development board, which uses innovative manufacturing technologies, delivering a fluid and immersive working experience. The EasyAVR v8 development board is also integral to the MIKROE rapid development ecosystem. Natively supported by the MIKROE Software toolchain, backed up by hundreds of different Click board™ designs with their number growing daily, it covers many different prototyping and development aspects, thus saving precious development time.
Microcontroller Overview
MCU Card / MCU

Architecture
AVR
MCU Memory (KB)
32
Silicon Vendor
Microchip
Pin count
40
RAM (Bytes)
2048
You complete me!
Accessories
Fingerprint Sensor with Two-Color LED Ring (GROW R503) is a capacitive fingerprint sensor module scanner with a two-color ring indicator. The module is designed in a circular shape with a diameter of 28mm. It's important to mention that this module represents an integrated image-collecting and algorithm chip together. GROW R503 module has an image buffer and six feature file buffers. An important note for users is that all buffer contents are not saved after power failure. A fingerprint pattern template can be composed of 2-6 feature files. If the composite template has more characteristic files, the fingerprint pattern template has better quality. The module's enclosure is dust resistant but not waterproof with a ring indicator LED light controlled by command, and it has a high recognition rate and the flexibility to adapt to different conditions of human fingers, whether it's dry, wet, or a person of different ages. This module can be connected to the Fingerprint 3 Click or to any other product that has a 1.0mm pitch vertical type wire-to-board connector as this module and the appropriate type of communication.
Used MCU Pins
mikroBUS™ mapper
Take a closer look
Click board™ Schematic

Step by step
Project 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 3 Click driver.
Key functions:
void fingerprint3_parser_rsp ( fingerprint3_rsp_t *response )
- Response parser function.uint8_t fingerprint3_byte_ready ( void )
- Check for new byte received.void fingerprint3_uart_write ( uint8_t *tx_data, uint8_t n_bytes )
- Uart write function.
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
* \brief Fingerprint 3 Click example
*
* # Description
* This example reads and processes data from Fingerprint 3 Clicks.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initializes the driver, configures the sensor, and enrolls fingerprints.
*
* ## Application Task
* Takes an image of the finger, then checks if there's a fingerprint in the library that matches the
* one it has just read. All data is being logged on the USB UART.
*
* ## Additional Function
* - static void display_error ( uint8_t *message )
* - static void display_full_rsp ( fingerprint3_t *ctx )
* - static void search_finger( fingerprint3_t *ctx )
* - static void match_finger( fingerprint3_t *ctx, uint16_t location )
* - static uint8_t enroll_finger( fingerprint3_t *ctx, uint16_t location, uint8_t features )
*
* \author MikroE Team
*
*/
// ------------------------------------------------------------------- INCLUDES
#include "board.h"
#include "log.h"
#include "fingerprint3.h"
#include "string.h"
// ------------------------------------------------------------------ VARIABLES
#define LOCATION_IN_LIBRARY 1 // Location in flash where the fingerprint template will be stored.
#define NUMBER_OF_FINGERPRINTS 2 // Number of fingerprints for enrolling.
#define NUMBER_OF_IMAGES 3 // Number of images it will take for a single fingerprint template.
static fingerprint3_t fingerprint3;
static log_t logger;
uint8_t package_content[ FINGERPRINT3_MAX_PACKAGE_LENGTH ];
uint8_t error_check = 0;
// ------------------------------------------------------- ADDITIONAL FUNCTIONS
/**
* @brief Display error function.
*
* @param message Input string.
*
* @details This function concatenates status of response to the input string and prints it on the USB UART.
*/
static void display_error ( uint8_t *message );
/**
* @brief Display full response function.
*
* @param ctx Click object.
*
* @details This function parses and displays full response to the previously sent command on the USB UART.
*/
static void display_full_rsp ( fingerprint3_t *ctx );
/**
* @brief Search finger function.
*
* @param ctx Click object.
*
* @details This function searches the whole finger library for the template that matches the one
* it stores in char_buffer 1. All data is being logged on the USB UART.
*/
static void search_finger( fingerprint3_t *ctx );
/**
* @brief Match finger function.
*
* @param ctx Click object.
* @param location Location in library.
*
* @details This function checks if the template stored at the desired location matches the fingerprint
* it reads. All data is being logged on the USB UART.
*/
static void match_finger( fingerprint3_t *ctx, uint16_t location );
/**
* @brief Enroll finger function.
*
* @param ctx Click object.
* @param location Location in library where the fingerprint template will be stored.
* @param features Number of fingerprint images it will combine in a template.
*
* @details This function enrolls the fingerprint, creates a template combining the taken images and
* stores it at the desired location. All data is being logged on the USB UART.
*/
static uint8_t enroll_finger( fingerprint3_t *ctx, uint16_t location, uint8_t features );
// ------------------------------------------------------ APPLICATION FUNCTIONS
void application_init ( void )
{
log_cfg_t log_cfg;
fingerprint3_cfg_t cfg;
/**
* 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 ----" );
Delay_ms ( 100 );
// Click initialization.
fingerprint3_cfg_setup( &cfg );
FINGERPRINT3_MAP_MIKROBUS( cfg, MIKROBUS_1 );
err_t init_flag = fingerprint3_init( &fingerprint3, &cfg );
if ( init_flag == UART_ERROR )
{
log_error( &logger, " Application Init Error. " );
log_info( &logger, " Please, run program again... " );
for ( ; ; );
}
Delay_ms ( 100 );
error_check = fingerprint3_set_config ( &fingerprint3, FINGERPRINT3_DEFAULT_ADDRESS,
FINGERPRINT3_DEFAULT_PASSWORD );
display_error( "Set Config" );
Delay_ms ( 500 );
error_check = fingerprint3_soft_reset ( &fingerprint3 );
display_error( "Soft Reset" );
Delay_ms ( 500 );
error_check = fingerprint3_check_sensor ( &fingerprint3 );
display_error( "Check Sensor" );
Delay_ms ( 500 );
error_check = fingerprint3_empty_library ( &fingerprint3 );
display_error( "Empty the Library" );
Delay_ms ( 500 );
uint8_t cnt = 0;
do
{
log_printf( &logger, " >>> Register fingerprint %u of %u <<<\r\n", ( uint16_t ) cnt + 1,
( uint16_t ) NUMBER_OF_FINGERPRINTS );
log_printf( &logger, "--------------------------------- \r\n" );
error_check = enroll_finger ( &fingerprint3, LOCATION_IN_LIBRARY + cnt, NUMBER_OF_IMAGES );
display_error( "Enroll finger" );
if ( FINGERPRINT3_OK != error_check )
{
log_printf( &logger, " Please enroll your fingerprint again.\r\n" );
log_printf( &logger, "--------------------------------- \r\n" );
}
else
{
cnt++;
}
Delay_ms ( 1000 );
}
while ( FINGERPRINT3_OK != error_check || cnt != NUMBER_OF_FINGERPRINTS );
}
void application_task ( void )
{
search_finger( &fingerprint3 );
}
int main ( void )
{
/* Do not remove this line or clock might not be set correctly. */
#ifdef PREINIT_SUPPORTED
preinit();
#endif
application_init( );
for ( ; ; )
{
application_task( );
}
return 0;
}
static void display_error ( uint8_t *message )
{
log_printf( &logger, " %s: ", message );
if ( FINGERPRINT3_OK == error_check )
{
log_printf( &logger, "DONE!\r\n" );
}
else
{
log_printf( &logger, "FAIL! [ERROR] Num: 0x%.2X\r\n", ( uint16_t ) error_check );
}
log_printf( &logger, "--------------------------------- \r\n" );
}
static void display_full_rsp ( fingerprint3_t *ctx )
{
log_printf( &logger, "* Header : 0x%.4X\r\n", ctx->rsp.header );
log_printf( &logger, "* Address : 0x%.8LX\r\n", ctx->rsp.addr );
log_printf( &logger, "* Package identifier: 0x%.2X\r\n", ( uint16_t ) ctx->rsp.pkg_id );
log_printf( &logger, "* Package length : 0x%.4X\r\n", ctx->rsp.pkg_len );
log_printf( &logger, "* Confirmation code :" );
if ( ctx->rsp.pkg_content[ 0 ] == FINGERPRINT3_CONF_CMD_OK )
{
log_printf( &logger, " OK!\r\n" );
}
else
{
log_error( &logger, " Num: 0x%.2X", ( uint16_t ) ctx->rsp.pkg_content[ 0 ] );
}
if ( ctx->rsp.pkg_len > 3 )
{
log_printf( &logger, "* Package Content: " );
for ( uint16_t n_cnt = 1; n_cnt < ctx->rsp.pkg_len - 2; n_cnt++ )
{
log_printf( &logger, "0x%.2X ", ( uint16_t ) ctx->rsp.pkg_content[ n_cnt ] );
}
log_printf( &logger, "\r\n" );
}
log_printf( &logger, "* Checksum : 0x%.4X \r\n", ctx->rsp.checksum );
}
static void search_finger( fingerprint3_t *ctx )
{
log_printf( &logger, " >>> Searching Fingerprints <<< \r\n" );
log_printf( &logger, "--------------------------------- \r\n" );
fingerprint3_aura_control ( &fingerprint3, FINGERPRINT3_AURA_CTRL_BREATH, 0xFF,
FINGERPRINT3_AURA_LED_PURPLE, FINGERPRINT3_AURA_TIME_INFINITE );
log_printf( &logger, " Put your finger on the sensor \r\n" );
log_printf( &logger, "--------------------------------- \r\n" );
while ( fingerprint3_finger_indicator( &fingerprint3 ) == FINGERPRINT3_DETECT_NO_FINGER );
while ( FINGERPRINT3_OK != fingerprint3_aura_control ( &fingerprint3, FINGERPRINT3_AURA_CTRL_OFF, 0xFF,
FINGERPRINT3_AURA_LED_PURPLE,
FINGERPRINT3_AURA_TIME_INFINITE ) )
{
Delay_ms ( 100 );
}
for ( ; ; )
{
error_check = fingerprint3_take_image ( &fingerprint3 );
if ( FINGERPRINT3_OK != error_check )
{
display_error( "Take Image" );
Delay_ms ( 1000 );
continue;
}
error_check = fingerprint3_extract_features ( &fingerprint3, 1 );
if ( FINGERPRINT3_OK != error_check )
{
display_error( "Extract Features" );
Delay_ms ( 1000 );
continue;
}
break;
}
uint16_t match_score, location;
error_check = fingerprint3_search_finger ( &fingerprint3, 1, &location, &match_score );
if ( FINGERPRINT3_OK == error_check )
{
log_printf( &logger, " >>>>> FINGERPRINT MATCH <<<<<< \r\n\r\n" );
log_printf( &logger, " Location: 0x%.4X Match score : %u\r\n", location, match_score );
log_printf( &logger, "---------------------------------\r\n" );
fingerprint3_aura_control ( &fingerprint3, FINGERPRINT3_AURA_CTRL_BREATH, 0x80,
FINGERPRINT3_AURA_LED_BLUE, 1 );
}
else if ( FINGERPRINT3_CONF_NOT_FOUND == error_check )
{
log_printf( &logger, " >>>>> NO MATCH in library <<<<<<\r\n\r\n" );
log_printf( &logger, "---------------------------------\r\n" );
fingerprint3_aura_control ( &fingerprint3, FINGERPRINT3_AURA_CTRL_BREATH, 0x80,
FINGERPRINT3_AURA_LED_RED, 1 );
}
else
{
display_error( "Search Finger" );
fingerprint3_aura_control ( &fingerprint3, FINGERPRINT3_AURA_CTRL_BREATH, 0x80,
FINGERPRINT3_AURA_LED_RED, 1 );
}
Delay_ms ( 100 );
log_printf( &logger, " Lift the finger of the sensor.\r\n" );
log_printf( &logger, "--------------------------------- \r\n" );
error_check = fingerprint3_take_image ( &fingerprint3 );
while ( error_check != FINGERPRINT3_CONF_NO_FINGER )
{
Delay_ms ( 100 );
error_check = fingerprint3_take_image ( &fingerprint3 );
}
while ( fingerprint3_finger_indicator( &fingerprint3 ) != FINGERPRINT3_DETECT_NO_FINGER );
Delay_ms ( 1000 );
}
static void match_finger( fingerprint3_t *ctx, uint16_t location )
{
error_check = fingerprint3_load_template ( &fingerprint3, 2, location );
display_error( "Load Template" );
Delay_ms ( 100 );
log_printf( &logger, " >>> Matching Fingerprints <<< \r\n" );
log_printf( &logger, "--------------------------------- \r\n" );
fingerprint3_aura_control ( &fingerprint3, FINGERPRINT3_AURA_CTRL_BREATH, 0xFF,
FINGERPRINT3_AURA_LED_PURPLE, FINGERPRINT3_AURA_TIME_INFINITE );
log_printf( &logger, " Put your finger on the sensor \r\n" );
log_printf( &logger, "--------------------------------- \r\n" );
while ( fingerprint3_finger_indicator( &fingerprint3 ) == FINGERPRINT3_DETECT_NO_FINGER );
while ( FINGERPRINT3_OK != fingerprint3_aura_control ( &fingerprint3, FINGERPRINT3_AURA_CTRL_OFF, 0xFF,
FINGERPRINT3_AURA_LED_PURPLE,
FINGERPRINT3_AURA_TIME_INFINITE ) )
{
Delay_ms ( 100 );
}
for ( ; ; )
{
error_check = fingerprint3_take_image ( &fingerprint3 );
if ( FINGERPRINT3_OK != error_check )
{
display_error( "Take Image" );
Delay_ms ( 1000 );
continue;
}
error_check = fingerprint3_extract_features ( &fingerprint3, 3 );
if ( FINGERPRINT3_OK != error_check )
{
display_error( "Extract Features" );
Delay_ms ( 1000 );
continue;
}
break;
}
uint16_t match_score;
error_check = fingerprint3_match_finger ( &fingerprint3, &match_score );
if ( FINGERPRINT3_OK == error_check )
{
log_printf( &logger, " >>>>> FINGERPRINT MATCH <<<<<< \r\n\r\n" );
log_printf( &logger, " Match score : %u\r\n", match_score );
log_printf( &logger, "---------------------------------\r\n" );
fingerprint3_aura_control ( &fingerprint3, FINGERPRINT3_AURA_CTRL_BREATH, 0x80,
FINGERPRINT3_AURA_LED_BLUE, 1 );
}
else if ( FINGERPRINT3_CONF_NO_MATCH == error_check )
{
log_printf( &logger, " >>>>> NO MATCH at location: 0x%.4X <<<<<<\r\n\r\n", location );
log_printf( &logger, "---------------------------------\r\n" );
fingerprint3_aura_control ( &fingerprint3, FINGERPRINT3_AURA_CTRL_BREATH, 0x80,
FINGERPRINT3_AURA_LED_RED, 1 );
}
else
{
display_error( "Match Finger" );
fingerprint3_aura_control ( &fingerprint3, FINGERPRINT3_AURA_CTRL_BREATH, 0x80,
FINGERPRINT3_AURA_LED_RED, 1 );
}
Delay_ms ( 100 );
log_printf( &logger, " Lift the finger of the sensor.\r\n" );
log_printf( &logger, "--------------------------------- \r\n" );
error_check = fingerprint3_take_image ( &fingerprint3 );
while ( error_check != FINGERPRINT3_CONF_NO_FINGER )
{
Delay_ms ( 100 );
error_check = fingerprint3_take_image ( &fingerprint3 );
}
while ( fingerprint3_finger_indicator( &fingerprint3 ) != FINGERPRINT3_DETECT_NO_FINGER );
Delay_ms ( 1000 );
}
static uint8_t enroll_finger( fingerprint3_t *ctx, uint16_t location, uint8_t features )
{
for ( uint8_t cnt = 1; cnt <= features; )
{
log_printf( &logger, " >>> Taking image %u of %u <<<\r\n", ( uint16_t ) cnt,
( uint16_t ) features );
log_printf( &logger, "--------------------------------- \r\n" );
log_printf( &logger, " Put your finger on the sensor \r\n" );
log_printf( &logger, "--------------------------------- \r\n" );
fingerprint3_aura_control ( &fingerprint3, FINGERPRINT3_AURA_CTRL_BREATH, 0xFF,
FINGERPRINT3_AURA_LED_PURPLE, FINGERPRINT3_AURA_TIME_INFINITE );
while ( fingerprint3_finger_indicator( &fingerprint3 ) == FINGERPRINT3_DETECT_NO_FINGER );
while ( FINGERPRINT3_OK != fingerprint3_aura_control ( &fingerprint3, FINGERPRINT3_AURA_CTRL_OFF, 0xFF,
FINGERPRINT3_AURA_LED_PURPLE,
FINGERPRINT3_AURA_TIME_INFINITE ) )
{
Delay_ms ( 100 );
}
error_check = fingerprint3_take_image ( &fingerprint3 );
display_error( "Take Image" );
if ( FINGERPRINT3_OK == error_check )
{
Delay_ms ( 100 );
error_check = fingerprint3_extract_features ( &fingerprint3, cnt );
display_error( "Extract Features" );
if ( FINGERPRINT3_OK == error_check )
{
cnt++;
}
Delay_ms ( 100 );
fingerprint3_aura_control ( &fingerprint3, FINGERPRINT3_AURA_CTRL_BREATH, 0x80,
FINGERPRINT3_AURA_LED_BLUE, 1 );
Delay_ms ( 100 );
}
log_printf( &logger, " Lift the finger of the sensor.\r\n" );
log_printf( &logger, "--------------------------------- \r\n" );
error_check = fingerprint3_take_image ( &fingerprint3 );
while ( error_check != FINGERPRINT3_CONF_NO_FINGER )
{
Delay_ms ( 100 );
error_check = fingerprint3_take_image ( &fingerprint3 );
}
while ( fingerprint3_finger_indicator( &fingerprint3 ) != FINGERPRINT3_DETECT_NO_FINGER );
Delay_ms ( 100 );
}
error_check = fingerprint3_create_template ( &fingerprint3 );
display_error( "Create Template" );
if ( FINGERPRINT3_OK != error_check )
{
return error_check;
}
Delay_ms ( 100 );
error_check = fingerprint3_store_template ( &fingerprint3, 1, location );
display_error( "Store Template" );
if ( FINGERPRINT3_OK != error_check )
{
return error_check;
}
Delay_ms ( 100 );
return FINGERPRINT3_OK;
}
// ------------------------------------------------------------------------ END