中级
30 分钟

使用A-172-MRQ和PIC18LF45K42通过独特的指纹图案验证和认证个人身份

超越密码

Fingerprint 2 Click with EasyPIC v8

已发布 6月 25, 2024

点击板

Fingerprint 2 Click

开发板

EasyPIC v8

编译器

NECTO Studio

微控制器单元

PIC18LF45K42

实施生物指纹识别,实现对个人的准确和唯一身份识别,从而为数字系统和物理空间提供安全访问。

A

A

硬件概览

它是如何工作的?

Fingerprint 2 Click 基于A-172-MRQ,这是一款来自ByNew Technology的2D电容指纹传感器,具有8.8 x 8.8 mm的有效扫描区域和176 x 176像素的分辨率。该传感器基于电容接触技术,具有硬化表面和增强的ESD免疫能力。板载Nuvoton M2301 MCU作为接口IC和控制单元,通过高速SPI接口连接此传感器,并具有内置指纹匹配功能,同时将

大部分芯片资源留给应用开发人员。开发人员可以根据通信协议开发指纹相关产品,而无需具备高级指纹识别知识。Fingerprint 2 Click性能稳定,结构简单。简化的功能包括指纹比较、图像扫描传输、搜索、注册指纹存储和系统的独特内部代码保护机制。指纹比较程序最多可以注册24个指纹,比较速度快,正确率非常高。得益于Nuvoton MCU的

片上加密加速器、Cortex-M23 TrustZone和XOM设施,Fingerprint 2 Click板可以通过UART协议(波特率115200)或USB 2.0全速与主机通信。Fingerprint 2 Click需要提供3.3V和5V电源才能正常工作。然而,请注意,此板仅设计为在3.3V逻辑电平下运行。因此,在使用逻辑电平为5V的MCU之前,应进行适当的逻辑电压电平转换。

Fingerprint 2 Click hardware overview image

功能概述

开发板

EasyPIC v8 是一款专为快速开发嵌入式应用的需求而特别设计的开发板。它支持许多高引脚计数的8位PIC微控制器,来自Microchip,无论它们的引脚数量如何,并且具有一系列独特功能,例如首次集成的调试器/程序员。开发板布局合理,设计周到,使得最终用户可以在一个地方找到所有必要的元素,如开关、按钮、指示灯、连接器等。得益于创新的制造技术,EasyPIC v8 提供了流畅而沉浸式的工作体验,允许在任何情况下、任何地方、任何时候都能访问。

EasyPIC v8 开发板的每个部分都包含了使同一板块运行最高效的必要组件。除了先进的集成CODEGRIP程 序/调试模块,该模块提供许多有价值的编程/调试选项和与Mikroe软件环境的无缝集成外,该板还包括一个干净且调节过的开发板电源供应模块。它可以使用广泛的外部电源,包括电池、外部12V电源供应和通过USB Type-C(USB-C)连接器的电源。通信选项如USB-UART、USB DEVICE和CAN也包括在内,包括 广受好评的mikroBUS™标准、两种显示选项(图形和

基于字符的LCD)和几种不同的DIP插座。这些插座覆盖了从最小的只有八个至四十个引脚的8位PIC MCU的广泛范围。EasyPIC v8 是Mikroe快速开发生态系统的一个组成部分。它由Mikroe软件工具原生支持,得益于大量不同的Click板™(超过一千块板),其数量每天都在增长,它涵盖了原型制作和开发的许多方面。

EasyPIC v8 horizontal image

微控制器概述 

MCU卡片 / MCU

PIC18LF45K42

建筑

PIC

MCU 内存 (KB)

32

硅供应商

Microchip

引脚数

40

RAM (字节)

2048

使用的MCU引脚

mikroBUS™映射器

Compare Indicator
RA2
AN
Reset
RE1
RST
General Purpose I/0
RE0
CS
NC
NC
SCK
NC
NC
MISO
NC
NC
MOSI
Power Supply
3.3V
3.3V
Ground
GND
GND
General Purpose I/O
RC0
PWM
Compare Indicator
RB0
INT
UART TX
RC6
TX
UART RX
RC7
RX
NC
NC
SCL
NC
NC
SDA
Power Supply
5V
5V
Ground
GND
GND
1

“仔细看看!”

Click board™ 原理图

Fingerprint 2 Click Schematic schematic

一步一步来

项目组装

EasyPIC v8 front image hardware assembly

从选择您的开发板和Click板™开始。以EasyPIC v8作为您的开发板开始。

EasyPIC v8 front image hardware assembly
Buck 22 Click front image hardware assembly
MCU DIP 40 hardware assembly
EasyPIC v8 DIP MB 1 - upright/background hardware assembly
Necto image step 2 hardware assembly
Necto image step 3 hardware assembly
Necto image step 4 hardware assembly
NECTO Compiler Selection Step Image hardware assembly
NECTO Output Selection Step Image hardware assembly
Necto image step 6 hardware assembly
Necto DIP image step 7 hardware assembly
Necto image step 8 hardware assembly
Necto image step 9 hardware assembly
Necto image step 10 hardware assembly
Necto PreFlash Image hardware assembly

实时跟踪您的结果

应用程序输出

1. 应用程序输出 - 在调试模式下,“应用程序输出”窗口支持实时数据监控,直接提供执行结果的可视化。请按照提供的教程正确配置环境,以确保数据正确显示。

2. UART 终端 - 使用UART Terminal通过USB to UART converter监视数据传输,实现Click board™与开发系统之间的直接通信。请根据项目需求配置波特率和其他串行设置,以确保正常运行。有关分步设置说明,请参考提供的教程

3. Plot 输出 - Plot功能提供了一种强大的方式来可视化实时传感器数据,使趋势分析、调试和多个数据点的对比变得更加直观。要正确设置,请按照提供的教程,其中包含使用Plot功能显示Click board™读数的分步示例。在代码中使用Plot功能时,请使用以下函数:plot(insert_graph_name, variable_name);。这是一个通用格式,用户需要将“insert_graph_name”替换为实际图表名称,并将“variable_name”替换为要显示的参数。

软件支持

库描述

该库包含 Fingerprint 2 Click 驱动程序的 API。

关键功能:

  • fingerprint2_reg_one_fp - 此功能在索引处注册指纹

  • fingerprint2_delete_one_fp - 此功能在索引处删除指纹

  • fingerprint2_reset - 此功能重新启动设备

开源

代码示例

完整的应用程序代码和一个现成的项目可以通过NECTO Studio包管理器直接安装到NECTO Studio 应用程序代码也可以在MIKROE的GitHub账户中找到。

/*!
 * \file 
 * \brief Fingerprint2 Click example
 * 
 * # Description
 * This example demonstrates the use of Fingerprint 2 click board.
 *
 * The demo application is composed of two sections :
 * 
 * ## Application Init 
 * Initializes the driver, enables the click board, and then executes a command for 
 * registering a fingerprint.
 * 
 * ## Application Task  
 * Compares a fingerprint on input to the registered fingerprint and 
 * displays the results on the USB UART every 5 seconds.
 * 
 * ## Additional Functions
 * - fingerprint2_process ( ) - The general process of collecting data the module sends.
 * - fp_reg_one ( uint8_t fngr_number ) - Registers a fingerprint at a specific index number.
 * - fp_clr_one ( uint8_t fngr_number ) - Deletes a fingerprint from a specific index number.
 * - fp_clr_all ( ) - Clears all fingerprints.
 * - fp_curr_state (  ) - Lists the registration status and returns the number of registered fingerprints.
 * - fp_compare ( ) - Compares a fingerprint on input to all other fingerprints that are memorized.
 * 
 * @note
 * In the registration state each fingerprint needs to be enrolled 3 times.
 * 
 * \author MikroE Team
 *
 */
// ------------------------------------------------------------------- INCLUDES

#include "board.h"
#include "log.h"
#include "fingerprint2.h"
#include "string.h"

#define PROCESS_COUNTER 100
#define PROCESS_RX_BUFFER_SIZE 800

// ------------------------------------------------------------------ VARIABLES

static fingerprint2_t fingerprint2;
static log_t logger;

uint8_t flag;

// ------------------------------------------------------- ADDITIONAL FUNCTIONS

static void fingerprint2_process ( void )
{
    int32_t rsp_size;

    uint8_t check_buf_cnt;
    uint8_t process_cnt = PROCESS_COUNTER;
    char uart_rx_buffer[ PROCESS_RX_BUFFER_SIZE ] = { 0 };
    flag = 0;
    
    while( process_cnt != 0 )
    {
        rsp_size = fingerprint2_generic_read( &fingerprint2, &uart_rx_buffer, PROCESS_RX_BUFFER_SIZE );

        if ( rsp_size > 0 )
        {  
            // Validation of the received data
            for ( check_buf_cnt = 0; check_buf_cnt < rsp_size; check_buf_cnt++ )
            {
                if ( uart_rx_buffer[ check_buf_cnt ] == 0 ) 
                {
                    uart_rx_buffer[ check_buf_cnt ] = 13;
                }
            }

            log_printf( &logger, "%s", uart_rx_buffer );
            
            if ( strstr( uart_rx_buffer, "</R>" ) )
            {
                flag = 1;
                process_cnt = 5;
            }
            
            // Clear RX buffer
            memset( uart_rx_buffer, 0, PROCESS_RX_BUFFER_SIZE );
        }
        else 
        {
            process_cnt--;
            
            // Process delay 
            Delay_100ms( );
        }
    }
}

//Write index number of fingeprint to be store: from 0 to 23
void fp_reg_one ( uint8_t fngr_number )
{
    log_printf( &logger, "Registration process\r\n" );
    Delay_ms( 500 );
   
    fingerprint2_reg_one_fp( &fingerprint2, fngr_number );
    do
    {
        fingerprint2_process(  );
    } 
    while ( flag == 0 );
}

// Write index number of fingeprint to be deleted: from 0 to 23
void fp_clr_one ( uint8_t fngr_number )
{
    log_printf( &logger, "Deleting process\r\n" );
    Delay_ms( 500 );
    
    fingerprint2_delete_one_fp( &fingerprint2, fngr_number );
    do
    {
        fingerprint2_process(  );
    } 
    while ( flag == 0 );
}

// Delete all fingeprints: from 0 to 23
void fp_clr_all ( )
{
    uint8_t cnt = 0;
    log_printf( &logger, "Process of deleting all fingeprints\r\n" );
    Delay_ms( 500 );
    
    while ( cnt < 23 )
    {
        fingerprint2_delete_one_fp( &fingerprint2, cnt );
        cnt++;
        do
        {
            fingerprint2_process(  );
        } 
        while ( flag == 0 );
    }
}

// Current state ( number of memorized fingerprints )
void fp_curr_state ( )
{
    fingerprint2_generic_write( &fingerprint2, FINGERPRINT2_CMD_FP_REG_NO, strlen( FINGERPRINT2_CMD_FP_REG_NO ) );
    do
    {
        fingerprint2_process(  );
    } 
    while ( flag == 0 );
}

// Compare fingerprint on input with all other fingerprints that are memorized.
void fp_compare ( )
{
    fingerprint2_generic_write( &fingerprint2, FINGERPRINT2_CMD_FP_CMP, strlen( FINGERPRINT2_CMD_FP_CMP ) );
    fingerprint2_process(  );
    
    do
    {
        fingerprint2_process(  );
    }
    while ( flag == 0 );
}

// ------------------------------------------------------ APPLICATION FUNCTIONS

void application_init ( void )
{
    log_cfg_t log_cfg;
    fingerprint2_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 ----" );

    //  Click initialization.

    fingerprint2_cfg_setup( &cfg );
    FINGERPRINT2_MAP_MIKROBUS( cfg, MIKROBUS_1 );
    fingerprint2_init( &fingerprint2, &cfg );
    
    fingerprint2_reset ( &fingerprint2 );
    Delay_ms( 1000 );
    
    fp_reg_one( 0 );
    Delay_ms( 1000 );
}

void application_task ( void )
{    
    fp_compare( );
    Delay_ms( 5000 );
}

void main ( void )
{
    application_init( );

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


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

额外支持

资源

喜欢这个项目吗?

'购买此套件' 按钮会直接带您进入购物车,您可以在购物车中轻松添加或移除产品。