维修爱好者

 找回密码
 邀请注册

QQ登录

只需一步,快速开始

查看: 166|回复: 0

适用于 Arduino 的 R307 光学指纹扫描仪库 – 文档

[复制链接]
  • TA的每日心情
    无聊
    2024-3-25 09:23
  • 签到天数: 67 天

    [LV.6]维修爱好者2级网红

    81

    主题

    457

    回帖

    1254

    积分

    中级会员

    Rank: 3Rank: 3

    积分
    1254

    2023优秀会员VIP

    发表于 2023-9-19 11:56:06 | 显示全部楼层 |阅读模式
                  适用于 Arduino 的 R307 光学指纹扫描仪库 – 文档


    这是Vishnu Mohanan开发的R307 指纹扫描仪 Arduino 库的文档。有关 R307 扫描仪与 Arduino 兼容板连接的教程可在单独的页面上找到。

    R307指纹识别教程
    R30X 系列模块使用最广泛的库是 Adafruit 指纹传感器 库。它发布于 7 年前,由于缺乏文档且功能有限,很难理解。那时我决定自己写一篇。编写库已经成为我的一项练习。

    由于指令集和确认码与许多版本的指纹扫描仪兼容,因此您可以轻松修改此库以连接不同类型。该代码易于理解,并作为开源项目共享。该库尚未完成。许多功能尚未实现。但基本的注??册、搜索和匹配功能都可以使用。所有工作都在 Arduino 草图示例中进行了演示。

    该库由头文件组成 R30X_Fingerprint.h 和 CPP 文件 R30X_Fingerprint.cpp。头文件将给出库的概述,它包括所有指令代码、默认值、类声明、参数和函数声明。

    由于模块使用UART进行通信,因此您可以选择您想要的串口。对于带有单 UART 的Arduino Uno等板  ,您可以使用 SoftwareSerial 连接指纹模块和硬件串行进行调试。调试是可选的。目前SoftwareSerial用于 AVR 和 ESP8266 板。所以在初始化的时候,必须创建一个SoftwareSerial对象并将其发送到构造函数。我使用 Arduino Due 测试了该模块并使用了硬件串行。


    最新版本:v1.3.1
    作者:毗湿奴·莫哈南
    来源:  https ://github.com/vishnumaiea/R30X-Fingerprint-Sensor-Library
    文档:  https :// Circuitstate.com/r307doc
    教程:  https :// Circuitstate.com/r307tut
    首次发布:2019 年 8 月 4 日星期一 IST 07:35 PM
    许可证:麻省理工学院
    安装
    该库现在是官方 Arduino 库集的一部分。要将其安装到您的计算机上,请  从 Arduino IDE打开库管理器 并搜索“R30X 指纹扫描仪”。然后安装列表中的最新版本。


    另一种方法是从 GitHub 下载 ZIP 库并将内容解压到Arduino sketches 文件夹内的库文件夹中。


    依赖关系
    如果您的主板没有额外的硬件 UART,则需要 SoftwareSerial 接头。

    Arduino.h
    SoftwareSerial.h

    常数
    所有常量都在主头文件中定义。它包括所有命令、响应代码和默认值。 FPS_DEBUG 是一个用于启用或禁用调试信息显示的宏。如果您不想打印调试信息,请注释掉该行。调试信息发送到的串行端口由宏设置 debugPort 。默认的是 Serial,板上的第一个/默认串行端口。

    //=========================================================================//

    #define FPS_DEBUG   //uncomment this line to enable debug info to be printed

    #define debugPort Serial  //the serisl port to which debug info will be sent

    //=========================================================================//
    //Response codes from FPS to the commands sent to it
    //FPS = Fingerprint Scanner

    #define FPS_RESP_OK                      0x00U   //command executed successfully
    #define FPS_RESP_RECIEVEERR              0x01U   //packet receive error
    #define FPS_RESP_NOFINGER                0x02U   //no finger detected
    #define FPS_RESP_ENROLLFAIL              0x03U   //failed to enroll the finger
    #define FPS_RESP_OVERDISORDERFAIL        0x04U   //failed to generate character file due to over-disorderly fingerprint image
    #define FPS_RESP_OVERWETFAIL             0x05U   //failed to generate character file due to over-wet fingerprint image
    #define FPS_RESP_OVERDISORDERFAIL2       0x06U   //failed to generate character file due to over-disorderly fingerprint image
    #define FPS_RESP_FEATUREFAIL             0x07U   //failed to generate character file due to over-wet fingerprint image
    #define FPS_RESP_DONOTMATCH              0x08U   //fingers do not match
    #define FPS_RESP_NOTFOUND                0x09U   //no valid match found
    #define FPS_RESP_ENROLLMISMATCH          0x0AU   //failed to combine character files (two character files (images) are used to create a template)
    #define FPS_RESP_BADLOCATION             0x0BU   //addressing PageID is beyond the finger library
    #define FPS_RESP_INVALIDTEMPLATE         0x0CU   //error when reading template from library or the template is invalid
    #define FPS_RESP_TEMPLATEUPLOADFAIL      0x0DU   //error when uploading template
    #define FPS_RESP_PACKETACCEPTFAIL        0x0EU   //module can not accept more packets
    #define FPS_RESP_IMAGEUPLOADFAIL         0x0FU   //error when uploading image
    #define FPS_RESP_TEMPLATEDELETEFAIL      0x10U   //error when deleting template
    #define FPS_RESP_DBCLEARFAIL             0x11U   //failed to clear fingerprint library
    #define FPS_RESP_WRONGPASSOWRD           0x13U   //wrong password
    #define FPS_RESP_IMAGEGENERATEFAIL       0x15U   //fail to generate the image due to lackness of valid primary image
    #define FPS_RESP_FLASHWRITEERR           0x18U   //error when writing flash
    #define FPS_RESP_NODEFINITIONERR         0x19U   //no definition error
    #define FPS_RESP_INVALIDREG              0x1AU   //invalid register number
    #define FPS_RESP_INCORRECTCONFIG         0x1BU   //incorrect configuration of register
    #define FPS_RESP_WRONGNOTEPADPAGE        0x1CU   //wrong notepad page number
    #define FPS_RESP_COMPORTERR              0x1DU   //failed to operate the communication port
    #define FPS_RESP_INVALIDREG              0x1AU   //invalid register number
    #define FPS_RESP_SECONDSCANNOFINGER      0x41U   //secondary fingerprint scan failed due to no finger
    #define FPS_RESP_SECONDENROLLFAIL        0x42U   //failed to enroll second fingerprint
    #define FPS_RESP_SECONDFEATUREFAIL       0x43U   //failed to generate character file due to lack of enough features
    #define FPS_RESP_SECONDOVERDISORDERFAIL  0x44U   //failed to generate character file due to over-disorderliness
    #define FPS_RESP_DUPLICATEFINGERPRINT    0x45U   //duplicate fingerprint

    //-------------------------------------------------------------------------//
    //Received packet verification status codes from host device

    #define FPS_RX_OK                        0x00U  //when the response is correct
    #define FPS_RX_BADPACKET                 0x01U  //if the packet received from FPS is badly formatted
    #define FPS_RX_WRONG_RESPONSE            0x02U  //unexpected response
    #define FPS_RX_TIMEOUT                   0x03U  //when no response was received

    //-------------------------------------------------------------------------//
    //Packet IDs

    #define FPS_ID_STARTCODE              0xEF01U
    #define FPS_ID_STARTCODEHIGH          0xEFU
    #define FPS_ID_STARTCODELOW           0x01U
    #define FPS_ID_COMMANDPACKET          0x01U
    #define FPS_ID_DATAPACKET             0x02U
    #define FPS_ID_ACKPACKET              0x07U
    #define FPS_ID_ENDDATAPACKET          0x08U

    //-------------------------------------------------------------------------//
    //Command codes

    #define FPS_CMD_SCANFINGER            0x01U    //scans the finger and collect finger image
    #define FPS_CMD_IMAGETOCHARACTER      0x02U    //generate char file from a single image and store it to one of the buffers
    #define FPS_CMD_MATCHTEMPLATES        0x03U    //match two fingerprints precisely
    #define FPS_CMD_SEARCHLIBRARY         0x04U    //search the fingerprint library
    #define FPS_CMD_GENERATETEMPLATE      0x05U    //combine both character buffers and generate a template
    #define FPS_CMD_STORETEMPLATE         0x06U    //store the template on one of the buffers to flash memory
    #define FPS_CMD_LOADTEMPLATE          0x07U    //load a template from flash memory to one of the buffers
    #define FPS_CMD_EXPORTTEMPLATE        0x08U    //export a template file from buffer to computer
    #define FPS_CMD_IMPORTTEMPLATE        0x09U    //import a template file from computer to sensor buffer
    #define FPS_CMD_EXPORTIMAGE           0x0AU    //export fingerprint image from buffer to computer
    #define FPS_CMD_IMPORTIMAGE           0x0BU    //import an image from computer to sensor buffer
    #define FPS_CMD_DELETETEMPLATE        0x0CU    //delete a template from flash memory
    #define FPS_CMD_CLEARLIBRARY          0x0DU    //clear fingerprint library
    #define FPS_CMD_SETSYSPARA            0x0EU    //set system configuration register
    #define FPS_CMD_READSYSPARA           0x0FU    //read system configuration register
    #define FPS_CMD_SETPASSWORD           0x12U    //set device password
    #define FPS_CMD_VERIFYPASSWORD        0x13U    //verify device password
    #define FPS_CMD_GETRANDOMCODE         0x14U    //get random code from device
    #define FPS_CMD_SETDEVICEADDRESS      0x15U    //set 4 byte device address
    #define FPS_CMD_PORTCONTROL           0x17U    //enable or disable comm port
    #define FPS_CMD_WRITENOTEPAD          0x18U    //write to device notepad
    #define FPS_CMD_READNOTEPAD           0x19U    //read from device notepad
    #define FPS_CMD_HISPEEDSEARCH         0x1BU    //highspeed search of fingerprint
    #define FPS_CMD_TEMPLATECOUNT         0x1DU    //read total template count
    #define FPS_CMD_SCANANDRANGESEARCH    0x32U    //read total template count
    #define FPS_CMD_SCANANDFULLSEARCH     0x34U    //read total template count

    #define FPS_DEFAULT_TIMEOUT                 2000  //UART reading timeout in milliseconds
    #define FPS_DEFAULT_BAUDRATE                57600 //9600*6
    #define FPS_DEFAULT_RX_DATA_LENGTH          64    //the max length of data in a received packet
    #define FPS_DEFAULT_SECURITY_LEVEL          3     //the threshold at which the fingerprints will be matched
    #define FPS_DEFAULT_SERIAL_BUFFER_LENGTH    300   //length of the buffer used to read the serial data
    #define FPS_DEFAULT_PASSWORD                0xFFFFFFFF
    #define FPS_DEFAULT_ADDRESS                 0xFFFFFFFF
    #define FPS_BAD_VALUE                       0x1FU //some bad value or paramter was delivered

    //=========================================================================//

    课程
    带有变量和函数的主类。

    R30X_FPS

    成员变量
    这些是公共和私有成员变量。某些参数具有数组和整位版本,例如 devicePasswordL 哪个是 32 位值,哪个 devicePassword[4] 是四个 8 位值的数组。这样做只是为了方便,不要让您感到困惑。创建和提取数据包时,将使用不同的变量集,前缀为 rx 和 tx。有些值的长度是可变的,因此  使用 指针*txDataBuffer,例如。 mySerial 是一个指向 Stream 用于与不同接口进行通信的对象的指针。 swSerial 是一个仅用于 SoftwareSerial 接口的指针, hwSerial 仅用于 HardwareSerial 接口。编译器将根据您要编译的平台有条件地包含它们。

    //common parameters
    public:

    uint16_t startCodeL;  //packet start marker
    uint8_t startCode[2]; //packet start marker

    uint32_t devicePasswordL;  //32-bit single value version of password (L = long)
    uint32_t deviceAddressL;   //module's address
    uint8_t devicePassword[4]; //array version of password
    uint8_t deviceAddress[4];  //device address as an array

    uint16_t statusRegister; //contents of the FPS status register
    uint16_t systemID;       //fixed value 0x0009
    uint16_t librarySize;    //library memory size
    uint16_t securityLevel;  //threshold level for fingerprint matching
    uint16_t dataPacketLengthCode;
    uint16_t dataPacketLength; //the max length of data in packet. can be 32, 64, 128 or 256
    uint16_t baudMultiplier;   //value between 1-12
    uint32_t deviceBaudrate;   //UART speed (9600 * baud multiplier)

    //transmit packet parameters
    uint8_t txPacketType;        //type of packet
    uint16_t txPacketLengthL;    //length of packet (Data + Checksum)
    uint8_t txInstructionCode;   //instruction to be sent to FPS
    uint16_t txPacketChecksumL;  //checksum long value
    uint8_t txPacketLength[2];   //packet length as an array
    uint8_t *txDataBuffer;       //packet data buffer
    uint16_t txDataBufferLength; //length of actual data in a packet
    uint8_t txPacketChecksum[2]; //packet checksum as an array

    //receive packet parameters
    uint8_t rxPacketType;        //type of packet
    uint16_t rxPacketLengthL;    //packet length long
    uint8_t rxConfirmationCode;  //the return codes from the FPS
    uint16_t rxPacketChecksumL;  //packet checksum long
    uint8_t rxPacketLength[2];   //packet length as an array
    uint8_t *rxDataBuffer;       //packet data buffer
    uint32_t rxDataBufferLength; //the length of the data only. this doesn't include instruction or confirmation code
    uint8_t rxPacketChecksum[2]; //packet checksum as array

    uint16_t fingerId;      //location of fingerprint in the library
    uint16_t matchScore;    //the match score of comparison of two fingerprints
    uint16_t templateCount; //total number of fingerprint templates in the library

    private:

    Stream *mySerial; //stream class is used to facilitate communication
    SoftwareSerial *swSerial; //for those devices with only one hardware UART
    HardwareSerial *hwSerial; //for those devices with multiple hardware UARTs

    会员功能
    并非所有这些功能都已完全实现。所有这些工作都在 Arduino 草图示例中进行了演示。

    R30X_FPS(HardwareSerial *hs, uint32_t password = FPS_DEFAULT_PASSWORD, uint32_t address = FPS_DEFAULT_ADDRESS);

    void begin(uint32_t baud);  //initializes the communication port
    void resetParameters(void); //initialize and reset and all parameters
    uint8_t verifyPassword(uint32_t password = FPS_DEFAULT_PASSWORD); //verify the user supplied password
    uint8_t setPassword(uint32_t password); //set FPS password
    uint8_t setAddress(uint32_t address = FPS_DEFAULT_ADDRESS); //set FPS address
    uint8_t setBaudrate(uint32_t baud); //set UART baudrate, default is 57000
    uint8_t reinitializePort(uint32_t baud);
    uint8_t setSecurityLevel(uint8_t level);  //set the threshold for fingerprint matching
    uint8_t setDataLength(uint16_t length);  //set the max length of data in a packet
    uint8_t portControl(uint8_t value); //turn the comm port on or off
    uint8_t sendPacket(uint8_t type, uint8_t command, uint8_t *data = NULL, uint16_t dataLength = 0); //assemble and send packets to FPS
    uint8_t receivePacket(uint32_t timeout = FPS_DEFAULT_TIMEOUT);  //receive packet from FPS
    uint8_t readSysPara(void);  //read FPS system configuration
    uint8_t captureAndRangeSearch(uint16_t captureTimeout, uint16_t startId, uint16_t count); //scan a finger and search a range of locations
    uint8_t captureAndFullSearch(void); //scan a finger and search the entire library
    uint8_t generateImage(void);  //scan a finger, generate an image and store it in the buffer
    uint8_t exportImage(void);  //export a fingerprint image from the sensor to the computer
    uint8_t importImage(uint8_t *dataBuffer); //import a fingerprint image from the computer to sensor
    uint8_t generateCharacter(uint8_t bufferId);  //generate character file from image
    uint8_t generateTemplate(void); //combine the two character files and generate a single template
    uint8_t exportCharacter(uint8_t bufferId);  //export a character file from the sensor to computer
    uint8_t importCharacter(uint8_t bufferId, uint8_t *dataBuffer); //import a character file to the sensor from computer
    uint8_t saveTemplate(uint8_t bufferId, uint16_t location);  //store the template in the buffer to a location in the library
    uint8_t loadTemplate(uint8_t bufferId, uint16_t location);  //load a template from library to one of the buffers
    uint8_t deleteTemplate(uint16_t startLocation, uint16_t count); //delete a set of templates from library
    uint8_t clearLibrary(void); //delete all templates from library
    uint8_t matchTemplates(void); //match the templates stored in the two character buffers
    uint8_t searchLibrary(uint8_t bufferId, uint16_t startLocation, uint16_t count);  //search the library for a template stored in the buffer
    uint8_t getTemplateCount(void); //get the total no. of templates in the library

    功能说明如下。

    R30X_Fingerprint (HardwareSerial *hs, uint32_t password = FPS_DEFAULT_PASSWORD, uint32_t address = FPS_DEFAULT_ADDRESS);
    R30X_Fingerprint (SoftwareSerial *ss, uint32_t password = FPS_DEFAULT_PASSWORD, uint32_t address = FPS_DEFAULT_ADDRESS);

    这些是硬件和软件串行接口的构造函数。这些不是重载的,而是有条件地选择的。示例草图中显示了用法。第一个参数是要用于与模块通信的串行端口,它与调试端口不同。接下来您必须发送 32 位密码和地址。如果您想使用默认值,则无需发送任何内容。

    begin()

    void begin (uint32_t baud);

    这将以指定的波特率初始化串行端口。

    resetParameters()

    void resetParameters (void);

    将所有参数重置为默认值。

    verifyPassword()

    uint8_t verifyPassword (uint32_t password = FPS_DEFAULT_PASSWORD);

    验证给定的密码。在执行任何操作之前,您需要验证密码。否则模块将始终以 0x21 错误代码响应。如果您想测试默认密码,请不要传递任何内容。否则发送您的自定义密码。返回确认码。

    setPassword()

    uint8_t setPassword (uint32_t password);

    这会更新模块上的密码。密码也保存到参数变量中。返回确认码。

    setAddress()

    uint8_t setAddress (uint32_t address = FPS_DEFAULT_ADDRESS);

    更新设备地址。成功更改后,所有后续数据包都必须包含新地址。返回确认码。

    setBaudrate()

    uint8_t setBaudrate (uint32_t baud);

    这会修改模块通信的波特率。它首先更改模块上的波特率倍增器,关闭当前串行端口并使用新的波特率重新初始化串行端口。有时这可能很困难。返回确认码。

    reinitializePort()

    uint8_t reinitializePort (uint32_t baud);

    使用新的波特率重新初始化端口。

    setSecurityLevel()

    uint8_t setSecurityLevel (uint8_t level);

    设置安全级别。值可以是 1-5。返回确认码。

    setDataLength()

    uint8_t setDataLength (uint16_t length);

    设置数据长度。值可以是 32、64、128、256 字节。返回确认码。

    portControl()

    uint8_t portControl (uint8_t value);

    从模块侧打开或关闭通信端口。值可以是 1 = 打开或 0 = 关闭。返回确认码。

    sendPacket()

    uint8_t sendPacket (uint8_t type, uint8_t command, uint8_t* data = NULL, uint16_t dataLength = 0);

    创建包含命令和数据的数据包,并将其发送到模块。当命令没有数据时,可以将 data 和 dataLength 参数留空。如果启用调试,数据包将打印到调试端口。返回确认码。

    receivePacket()

    uint8_t receivePacket (uint32_t timeout=FPS_DEFAULT_TIMEOUT);

    从串行监视器读取数据,从数据包中提取参数并将其保存到变量中。您可以选择发送主机必须等待回复的超时时间。如果将其留空, FPS_DEFAULT_TIMEOUT 将使用 2 秒。返回确认码。

    readSysPara()

    vuint8_t readSysPara (void);

    读取系统配置寄存器(16 个字节)的内容  并将值保存到变量中。返回确认码。

    captureAndRangeSearch()

    uint8_t captureAndRangeSearch (uint16_t captureTimeout, uint16_t startId, uint16_t count);

    扫描手指并在指纹库中的一系列位置之间进行搜索。您应该发送扫描超时、起始位置和要搜索的位置数。如果操作成功,结果将存储在 fingerId 和 中matchScore。返回确认码。

    captureAndFullSearch()

    uint8_t captureAndFullSearch (void);

    扫描手指并在整个指纹库中搜索匹配项。无法控制超时或其他任何事情。该模块自己完成所有事情。如果要指定超时,请使用 captureAndRangeSearch() 并使用整个范围进行搜索。如果操作成功,结果将存储在 fingerId 和 中matchScore。返回确认码。

    generateImage()

    uint8_t generateImage (void);

    扫描一次手指并将捕获的图像存储到 图像缓冲区。执行此命令后,您可以读取缓冲区的内容。返回确认码。

    downloadImage()

    uint8_t downloadImage (void);

    这会将图像缓冲区的内容检索  到主机。模块端确认后,开始传输数据。主机必须准备好接受数据。返回确认码。 该功能尚未完全实现。

    generateCharacter()

    uint8_t generateCharacter (uint8_t bufferId);

    从图像缓冲区中存储的图像生成字符文件 。生成的字符文件保存到两个字符缓冲区之一,必须为函数指定该缓冲区。返回确认码。

    generateTemplate()

    uint8_t generateTemplate (void);

    生成组合两个字符文件缓冲区的模板文件。因此必须执行两次扫描才能生成模板文件。生成的模板文件将存储到 CharBuffer1. 返回确认码。

    downloadCharacter()

    uint8_t downloadCharacter (uint8_t bufferId);

    从两个缓冲区之一检索字符文件内容。您应该指定缓冲区编号,可以是1或2。收到确认包后,模块将开始发送数据。主机必须准备好接受数据。返回确认码。 该功能尚未完全实现。

    uploadCharacter()

    uint8_t uploadCharacter (uint8_t bufferId, uint8_t* dataBuffer);

    这允许您将已有的字符文件发送到模块内的缓冲区之一。这将允许您保存和恢复指纹数据库。您应该发送缓冲区编号和数据。主机确认后必须将数据发送给模块。返回确认码。 该功能尚未完全实现。

    saveTemplate()

    uint8_t saveTemplate (uint8_t bufferId, uint16_t location);

    该函数将缓冲区之一中的模板文件保存到指纹库中的任意位置。您应该指定缓冲区 ID 和要保存到的位置。返回确认码。

    loadTemplate()

    uint8_t loadTemplate (uint8_t bufferId, uint16_t location);

    使用指纹库中的模板加载字符缓冲区之一。您应该指定要使用的缓冲区以及要从中加载模板的指纹库中的位置。返回确认码。

    deleteTemplate()

    uint8_t deleteTemplate (uint16_t startLocation, uint16_t count);

    删除指纹库中指定范围内的一个或多个模板。返回确认码。

    clearLibrary()

    uint8_t clearLibrary (void);

    擦除指纹库的所有内容。此动作不可逆转。返回确认码。

    matchTemplates()

    uint8_t matchTemplates (void);

    精确匹配两个字符文件缓冲区的内容。结果存储在 matchScore 变量中。返回确认码。

    searchLibrary()

    uint8_t searchLibrary (uint8_t bufferId, uint16_t startLocation, uint16_t count);

    在指纹库中搜索存储在字符缓冲区之一中的模板。您应该指定缓冲区编号、起始位置和要匹配的模板数量。结果存储在 fingerId 和 中matchScore。返回确认码。

    getTemplateCount()

    uint8_t getTemplateCount (void);

    获取指纹库中可用的模板总数。结果保存在 templateCount. 返回确认码。

    示例草图
    用于测试指纹扫描仪的 Arduino 草图示例可在此处获取 – https://github.com/vishnumaiea/R ... t/R30X-FPS-Test.ino

    我为 Arduino Due编写了这段代码 ,它有 4 个硬件串行端口。我使用第一个串行端口 Serial 进行调试和 Serial1 指纹扫描仪接口。密码和地址都是默认的 0xFFFFFFFF。其中三个参数传递给构造函数。如果模块的密码和地址发生更改,您必须使用它们。

    在 setup() 函数中,我们首先初始化调试端口和指纹模块。 fps 是我们正在使用的对象。然后我们必须在做其他事情之前验证密码。否则扫描仪将拒绝执行我们的命令。您可以选择设置新地址,或验证现有地址。

    在里面 loop() 函数中,我们定期检查串行端口是否有传入数据。当数据可用时,它被作为字符串读取,并检查有效的命令和参数。如果它是有效命令,则按照 firstParam、 secondParam 和 的顺序从字符串中提取其余参数thirdParam。然后将参数发送给相应的函数执行。一旦命令被执行,结果就会存储在变量中,我们等待新的指令。以下是您可以通过串行监视器发送的可用命令的列表。通过串行监视器发送命令时不应附加行结束字符。这可以通过在 Arduino 串行监视器中将行结束设置为无行结束来完成。

    clrlib – 清晰的库
    tmpcnt – 获取模板数量
    readsys – 读取系统参数
    setdatlen <data length> – 设置数据长度
    capranser <timeout> <start location> <quantity> – 指纹捕获和范围搜索库
    capfulser – 捕获并全面搜索指纹库
    enroll <location> – 注册新指纹
    verpwd <password> – 验证 4 字节设备密码
    setpwd <password> – 设置新的 4 字节设备密码
    setaddr <address> – 设置新的 4 字节设备地址
    setbaud <baudrate> – 设置波特率
    reinitprt <baudrate> – 重新初始化端口而不更改设备配置
    setseclvl <level> – 设置安全级别
    genimg – 生成图像
    genchar <buffer id> – 从图像生成字符文件
    gentmp – 从字符缓冲区生成模板
    savtmp <buffer id> <location> – 将模板从缓冲区保存到库中
    lodtmp <buffer id> <location> – 将模板从库加载到缓冲区
    deltmp <start location> <quantity> – 从库中删除一个或多个模板
    mattmp – 精确匹配缓冲区上可用的两个模板
    serlib <buffer id> <start location> <quantity> – 搜索库以查找缓冲区上的内容
    < 和 > 之间出现的是必须与命令一起发送的参数(不应包含 < 或 >)。命令和参数必须用 单个空格分隔。例如,“注册 12”将在位置 #12 注册新指纹。

    enrollFinger() 示例草图中的函数实现了指纹注册过程。

    如果您发现文档或代码有任何错误,无论多么小,请随时告诉我。随时欢迎您提出问题。

    测试板
    该库  使用 R307指纹扫描仪通过Arduino Due 和 Arduino Uno进行了测试 。接线时,将 TX 和 RX 引脚连接到 Due 或 Mega 的 TX1 和 RX1 引脚。如果您使用的是 Uno 或类似的板,只有一个硬件 UART,请使用 SoftwareSerial 作为指纹传感器,使用硬件 UART 进行调试。

    尽管未经测试,该库预计可与其他 Arduino 兼容的微控制器和板配合使用,例如 ESP8266、ESP32、STM32 Nucleo、TI Launchpad 等。

    故障排除
    当某些功能无法正常工作时,请将示例草图上传到您的主板并运行命令以检查它们是否按预期工作。您可能遇到的一些问题是,

    收到“密码不正确”消息
    新模块将带有默认密码和设备地址 0xFFFFFFFF。如果示例草图抱怨密码错误,请尝试运行 setpwd 命令。例如,setpwd FFFFFFFF
    收到“无效命令”消息
    如果您的串行终端应用程序自动发送 NL/CR 字符,请尝试将其关闭。例如,您可以通过选择No lineending在 Arduino 串行监视器上关闭此功能。

    GitHub
    https://github.com/vishnumaiea/R30X-Fingerprint-Sensor-Library







    该会员没有填写今日想说内容.
    回复

    使用道具 举报

  • TA的每日心情
    开心
    2023-7-14 22:39
  • 签到天数: 3 天

    [LV.2]维修爱好者1级粉丝

    0

    主题

    636

    回帖

    867

    积分

    注册会员

    Rank: 2

    积分
    867
    发表于 2023-9-19 11:56:06 | 显示全部楼层
    感谢分享!论坛有您更精彩!
    回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 邀请注册

    本版积分规则

    QQ|手机版|家电电工资料网 ( 辽ICP备17010435号-3 )|网站地图|辽公网安备 21140202000087号

    GMT+8, 2024-5-21 20:54

    Powered by Discuz! X3.4

    © 2001-2023 Discuz! Team.

    快速回复 返回顶部 返回列表