指纹识别传感器

简介

本指纹模块能够在无需上位机参与管理的情况下,具有指纹录入、图像处理、指纹比对、搜索和模板储存等功能的智能型模块。对干湿手指均具有很高的灵敏度。 本模块应用广泛,只要涉及到授权、管理、开关等方面的功能,均可用模块的指纹识别功能来代替IC卡、密码、硬件开关等,适合从低端到高端的所有系统。

产品参数

  • 供电电压: DC 3.8 ~ 7.0V

  • 背光颜色:绿色

  • 亮灯方式:长亮/闪烁

  • 供电电流:工作电流: <65mA

  • 峰值电流:<95mA

  • 指纹图像录入时间:<0.5 秒

  • 窗口面积:14.5 ╳ 19.4 mm

  • 匹配方式:比对方式( 1:1) 搜索方式( 1:N)

  • 特征文件:256 字节

  • 模板文件:512 字节

  • 存储容量:1000 枚

  • 安全等级:5 级(从低到高: 1、 2、 3、 4、 5)

  • 认假率(FAR):<0.001% (安全等级为 3 时)

  • 拒真率(FRR):<1.0% (安全等级为 3 时)

  • 搜索时间:<1.0 秒(1:500 时,均值)

  • 上位机接口:UART(TTL 逻辑电平)

  • 通讯波特率(UART):(9600╳ N)bps 其中 N=1~12 (默认值 N=6,即 57600bps)

  • 工作环境:温 度:-20℃- +60℃ 相对湿度: 40%RH- 85%RH (无凝露)

  • 储存环境:温 度:-40℃- +85℃ 相对湿度:<85% H(无凝露)

  • 外形尺寸(L╳ W╳ H):一体式: 54 ╳ 20 ╳ 20.5mm

应用

  • 门禁系统、工控机、 POS 机、驾培、考勤等身份领域

  • 私人会所、管理软件、授权许可等管理领域

  • 医保领取、养老领取、指纹支付等金融领域

引脚说明

SEN0188-LINE.png

标号 颜色 功能描述
1 黑色 GND
2 白色 RD
3 绿色 TD
4 红色 电源正输入端
5 黄色 感应信号输出
6 蓝色 触摸感应电源输入端

使用教程

本教程将教会你怎样使用指纹模块录入和读取指纹

材料准备

  • UNO R3 ×1;
  • 指纹传感器 ×1;
  • UNO与指纹模块连接线 ×1;
  • UNO下载传输线 ×1;

连接示意图

模拟传感器连接示意图

指纹传感器引脚 UNO引脚
VIN 5V
TD 2 (Software Serial RX)
RD 3 (Software Serial TX)
GND GND

编译环境

下载Arduino IDE: https://www.arduino.cc/en/Main/Software
;
<File:nextredirectltr.png>指纹模块Arduino库
<File:nextredirectltr.png>导入库文件教程

使用步骤

录入指纹

程序下载
  • 打开下载下来的Fingerprint Library中fingerprint库文件夹中examples的enroll.ino文件;
  • 将数据线和UNO连接好以及UNO与指纹模块按照上面连接图连接好;
  • 首先在工具框中选好板和端口(下图箭头1所指处);
  • 然后把程序下载进UNO(下图箭头2所指处);
  • 下载完成后,打开串口窗(下图箭头3所指处);

烧录示意图

串口设置
  • 首先波特率设置9600
  • 没有结束符
  • 自动滚屏处勾选上

如果设置好后,接线没错,屏幕就会显示出如下图所示示意图:

串口注意事项示意图

切换模式
  • 将NL模式切换成NL+CR模式

输入指纹编号示意图

输入指纹编号
  • 在看到上图中让你输入你想要录入手指的指纹编号后,在串口输入框中输入你想要输入的数字(如下图),然后点击右边的发送按钮即可

输入指纹编号示意图

把待录入的手指放在指纹模块透明玻璃上
  • 在看到等待你按下指纹后再把指纹放入指纹模块上别动

等待放入手指示意图

移开手指
  • 在串口窗口处看到让你移开手指再移开手指

移开手指示意图

再次将手指放在指纹模块处
  • 在串口窗口处看到让你在此放同一根手指时再按下同一根手指
  • 按下后提示你再次移开手指再移开手指

再次放入手指示意图

存储成功,并可以再次录入下一根手指
  • 如果下图所示内容,即表示此次手指录入成功
  • 如果想继续录入,直接在输入框中输入下一根手指的编号即可,步骤同上

存储成功示意图

读取指纹

程序下载
  • 同录入指纹类似,将Exemples文件夹中fingerprint.ino文件下载进UNO中;
  • 注意板和端口设置;
  • 程序下载成功后打开串口;

程序烧录示意图

指纹读取
  • 如果指纹模块连接成功的话,就会一直提示你按下手指,此时按下手指即可

放入手指示意图

读取成功
  • 按下手指不要移动,此时可能还会提示你按下手指,但是它提示的速度已经慢了很多,如果它的储存的模板有你的手指指纹,就会出现下图所示内容

读取成功示意图

清除指纹

单个指纹删除
  • 同录入指纹类似,将Exemples文件夹中delete.ino文件下载进UNO中;
  • 在下图所示位置输入你想要删除的指纹ID后,点击发送

烧录示意图

指纹库清零
  • 将Exemples文件夹中emptyDatabase.ino文件下载进UNO中;
  • 在下图所示输入‘Y’后,点击发送,即可清空指纹库

烧录示意图

录入指纹样例代码

/***************************************************
  This is an example sketch for our optical Fingerprint sensor

  Designed specifically to work with the Adafruit BMP085 Breakout
  ----> https://www.adafruit.com/products/751

  These displays use TTL Serial to communicate, 2 pins are required to
  interface
  Adafruit invests time and resources providing this open source code,
  please support Adafruit and open-source hardware by purchasing
  products from Adafruit!

  Written by Limor Fried/Ladyada for Adafruit Industries.
  BSD license, all text above must be included in any redistribution
 ****************************************************/

#include <Adafruit_Fingerprint.h>
#include <SoftwareSerial.h>

uint8_t getFingerprintEnroll(int id);


// pin #2 is IN from sensor (GREEN wire)
// pin #3 is OUT from arduino  (WHITE wire)
SoftwareSerial mySerial(2, 3);

Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);

void setup()
{
  Serial.begin(9600);
  Serial.println("fingertest");

  // set the data rate for the sensor serial port
  finger.begin(57600);

  if (finger.verifyPassword()) {
    Serial.println("Found fingerprint sensor!");
  } else {
    Serial.println("Did not find fingerprint sensor :(");
    while (1);
  }
}

void loop()                     // run over and over again
{
  Serial.println("Type in the ID # you want to save this finger as...");
  int id = 0;
  while (true) {
    while (! Serial.available());
    char c = Serial.read();
    if (! isdigit(c)) break;
    id *= 10;
    id += c - '0';
  }
  Serial.print("Enrolling ID #");
  Serial.println(id);

  while (!  getFingerprintEnroll(id) );
}

uint8_t getFingerprintEnroll(int id) {
  int p = -1;
  Serial.println("Waiting for valid finger to enroll");
  while (p != FINGERPRINT_OK) {
    p = finger.getImage();
    switch (p) {
    case FINGERPRINT_OK:
      Serial.println("Image taken");
      break;
    case FINGERPRINT_NOFINGER:
      Serial.println(".");
      break;
    case FINGERPRINT_PACKETRECIEVEERR:
      Serial.println("Communication error");
      break;
    case FINGERPRINT_IMAGEFAIL:
      Serial.println("Imaging error");
      break;
    default:
      Serial.println("Unknown error");
      break;
    }
  }

  // OK success!

  p = finger.image2Tz(1);
  switch (p) {
    case FINGERPRINT_OK:
      Serial.println("Image converted");
      break;
    case FINGERPRINT_IMAGEMESS:
      Serial.println("Image too messy");
      return p;
    case FINGERPRINT_PACKETRECIEVEERR:
      Serial.println("Communication error");
      return p;
    case FINGERPRINT_FEATUREFAIL:
      Serial.println("Could not find fingerprint features");
      return p;
    case FINGERPRINT_INVALIDIMAGE:
      Serial.println("Could not find fingerprint features");
      return p;
    default:
      Serial.println("Unknown error");
      return p;
  }

  Serial.println("Remove finger");
  delay(2000);
  p = 0;
  while (p != FINGERPRINT_NOFINGER) {
    p = finger.getImage();
  }

  p = -1;
  Serial.println("Place same finger again");
  while (p != FINGERPRINT_OK) {
    p = finger.getImage();
    switch (p) {
    case FINGERPRINT_OK:
      Serial.println("Image taken");
      break;
    case FINGERPRINT_NOFINGER:
      Serial.print(".");
      break;
    case FINGERPRINT_PACKETRECIEVEERR:
      Serial.println("Communication error");
      break;
    case FINGERPRINT_IMAGEFAIL:
      Serial.println("Imaging error");
      break;
    default:
      Serial.println("Unknown error");
      break;
    }
  }

  // OK success!

  p = finger.image2Tz(2);
  switch (p) {
    case FINGERPRINT_OK:
      Serial.println("Image converted");
      break;
    case FINGERPRINT_IMAGEMESS:
      Serial.println("Image too messy");
      return p;
    case FINGERPRINT_PACKETRECIEVEERR:
      Serial.println("Communication error");
      return p;
    case FINGERPRINT_FEATUREFAIL:
      Serial.println("Could not find fingerprint features");
      return p;
    case FINGERPRINT_INVALIDIMAGE:
      Serial.println("Could not find fingerprint features");
      return p;
    default:
      Serial.println("Unknown error");
      return p;
  }


  // OK converted!
  p = finger.createModel();
  if (p == FINGERPRINT_OK) {
    Serial.println("Prints matched!");
  } else if (p == FINGERPRINT_PACKETRECIEVEERR) {
    Serial.println("Communication error");
    return p;
  } else if (p == FINGERPRINT_ENROLLMISMATCH) {
    Serial.println("Fingerprints did not match");
    return p;
  } else {
    Serial.println("Unknown error");
    return p;
  }

  Serial.print("ID "); Serial.println(id);
  p = finger.storeModel(id);
  if (p == FINGERPRINT_OK) {
    Serial.println("Stored!");
  } else if (p == FINGERPRINT_PACKETRECIEVEERR) {
    Serial.println("Communication error");
    return p;
  } else if (p == FINGERPRINT_BADLOCATION) {
    Serial.println("Could not store in that location");
    return p;
  } else if (p == FINGERPRINT_FLASHERR) {
    Serial.println("Error writing to flash");
    return p;
  } else {
    Serial.println("Unknown error");
    return p;
  }
}

读取指纹样例代码

/***************************************************
  This is an example sketch for our optical Fingerprint sensor

  Designed specifically to work with the Adafruit BMP085 Breakout
  ----> https://www.adafruit.com/products/751

  These displays use TTL Serial to communicate, 2 pins are required to
  interface
  Adafruit invests time and resources providing this open source code,
  please support Adafruit and open-source hardware by purchasing
  products from Adafruit!

  Written by Limor Fried/Ladyada for Adafruit Industries.
  BSD license, all text above must be included in any redistribution
 ****************************************************/


#include <Adafruit_Fingerprint.h>
#include <SoftwareSerial.h>

int getFingerprintIDez();

// pin #2 is IN from sensor (GREEN wire)
// pin #3 is OUT from arduino  (WHITE wire)
SoftwareSerial mySerial(2, 3);


Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);

void setup()
{
  Serial.begin(9600);
  Serial.println("fingertest");

  // set the data rate for the sensor serial port
  finger.begin(57600);

  if (finger.verifyPassword()) {
    Serial.println("Found fingerprint sensor!");
  } else {
    Serial.println("Did not find fingerprint sensor :(");
    while (1);
  }
  Serial.println("Waiting for valid finger...");
}

void loop()                     // run over and over again
{
  getFingerprintIDez();
  delay(50);            //don't ned to run this at full speed.
}

uint8_t getFingerprintID() {
  uint8_t p = finger.getImage();
  switch (p) {
    case FINGERPRINT_OK:
      Serial.println("Image taken");
      break;
    case FINGERPRINT_NOFINGER:
      Serial.println("No finger detected");
      return p;
    case FINGERPRINT_PACKETRECIEVEERR:
      Serial.println("Communication error");
      return p;
    case FINGERPRINT_IMAGEFAIL:
      Serial.println("Imaging error");
      return p;
    default:
      Serial.println("Unknown error");
      return p;
  }

  // OK success!

  p = finger.image2Tz();
  switch (p) {
    case FINGERPRINT_OK:
      Serial.println("Image converted");
      break;
    case FINGERPRINT_IMAGEMESS:
      Serial.println("Image too messy");
      return p;
    case FINGERPRINT_PACKETRECIEVEERR:
      Serial.println("Communication error");
      return p;
    case FINGERPRINT_FEATUREFAIL:
      Serial.println("Could not find fingerprint features");
      return p;
    case FINGERPRINT_INVALIDIMAGE:
      Serial.println("Could not find fingerprint features");
      return p;
    default:
      Serial.println("Unknown error");
      return p;
  }

  // OK converted!
  p = finger.fingerFastSearch();
  if (p == FINGERPRINT_OK) {
    Serial.println("Found a print match!");
  } else if (p == FINGERPRINT_PACKETRECIEVEERR) {
    Serial.println("Communication error");
    return p;
  } else if (p == FINGERPRINT_NOTFOUND) {
    Serial.println("Did not find a match");
    return p;
  } else {
    Serial.println("Unknown error");
    return p;
  }

  // found a match!
  Serial.print("Found ID #"); Serial.print(finger.fingerID);
  Serial.print(" with confidence of "); Serial.println(finger.confidence);
}

// returns -1 if failed, otherwise returns ID #
int getFingerprintIDez() {
  uint8_t p = finger.getImage();
  if (p != FINGERPRINT_OK)  return -1;

  p = finger.image2Tz();
  if (p != FINGERPRINT_OK)  return -1;

  p = finger.fingerFastSearch();
  if (p != FINGERPRINT_OK)  return -1;

  // found a match!
  Serial.print("Found ID #"); Serial.print(finger.fingerID);
  Serial.print(" with confidence of "); Serial.println(finger.confidence);
  return finger.fingerID;
}

疑难解答

更多

指纹识别手册

更多问题及有趣的应用,请访问论坛(链接

<File:nextredirectltr.png>DFRobot商城购买链接

category: Product_Manual category: DFR_Series category: Sensors category:source category:Diagram