Difference between revisions of "Rectangle capacitive fingerprint scanner breathing light fingerprint AS608 sensor"

From Elecrow
Jump to navigation Jump to search
 
Line 109: Line 109:
  
 
== Building a  Smart fingerprint box ==
 
== Building a  Smart fingerprint box ==
'''Download files:https://www.elecrow.com/wiki/index.php?title=File:Smart_fingerprint_box.zip'''
+
'''Download files:[https://www.elecrow.com/wiki/index.php?title=File:Smart_fingerprint_box.zip Smart fingerprint box]'''
 
:'''Implement a box that can lock and unlock by fingerprint identification:'''
 
:'''Implement a box that can lock and unlock by fingerprint identification:'''
 
:'''1. Fingerprint sensor cable details:'''<br>
 
:'''1. Fingerprint sensor cable details:'''<br>

Latest revision as of 11:03, 30 August 2022

Description

This fingerprint module can store 300 fingerprints and has the functions of collecting fingerprints, reading fingerprints, and identifying fingerprints. It is not only small in size, low in power consumption, simple in interface, high in reliability, and also has fast recognition speed and good adaptability to wet and dry fingers.
When the fingerprint image is read, it has a sensitive response and judgment to dry and wet fingers and obtains the best imaging quality, which is suitable for a wide range of people. At the same time, it has the function of self-learning, which can achieve better matching. The module also has the function of sensing the finger. When the finger is pressed on the fingerprint collection surface, the module Touch pin outputs a high level. The module communication interface is UART communication interface.
Model:DPI50249S
Rectangle fingerprint.png

Module dimension drawing (unit: mm)

Module dimension drawing.png

Feature

  • Compact size and simple structure
  • Low power consumption, simple interface, high reliability
  • Fast recognition speed, good adaptability to wet and dry fingers, and fast fingerprint search


Parameter VALUE
Sensor Capacitive touch sensor
Resolution 508 DPI
Image pixels 160*160
Fingerprint image collection time <110ms
Fingerprint capacity 300
Algorithmic search time <30ms(100pcs)
Matching method 1:1,1:N
Overall recognition time <1s(100pcs)
False acceptance rate <0.001%
False rejection rate <1%
Operating voltage 3.3±0.3(v)
Operating current <55mA
Communication port UART


Pin Definition

Pin Number Name Type Function Description
1 Vsen In Fingerprint sensor power input, +3.3V
2 Touch Out Fingerprint sensor touch sensing signal output, active high by default
3 VDD In Module DSP power positive input, +3.3V
4 TX Out Serial data output, TTL logic level
5 RX In Serial data input, TTL logic level
6 GND - Signal ground, internally connected to power ground


Rectangle fingerprint pin.png

The Wiring diagram:

The order of the pins is from right to left, ① in the figure is the No. 1 pin
Rectangle fingerprint wiring diagram.png

Building a Smart fingerprint box

Download files:Smart fingerprint box

Implement a box that can lock and unlock by fingerprint identification:
1. Fingerprint sensor cable details:

IMG 3996.JPG IMG 3997.JPG IMG 3999.JPG

Smart fingerprint box.png

2. Uploading code:

Upload code with Arduino:
4001.png

#include <Adafruit_Fingerprint.h>
// For UNO and others without hardware serial, we must use software serial...
// pin #2 is IN from sensor (GREEN wire)
// pin #3 is OUT from Arduino  (WHITE wire)
// comment these two lines if using hardware serial
#include <Servo.h>
SoftwareSerial mySerial(2, 3);
Servo myservo;  // create servo object to control a servo
int i = 0;
int potpin = A0;  // analog pin used to connect the potentiometer
int val;    // variable to read the value from the analog pin

Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);

void setup()  
{
  Serial.begin(9600);
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object
  myservo.write(80);
  while (!Serial);  // For Yun/Leo/Micro/Zero/...
  delay(100);
  Serial.println("\n\nAdafruit finger detect test");

  // set the data rate for the sensor serial port
  finger.begin(57600);
  delay(5);
  if (finger.verifyPassword()) {
    Serial.println("Found fingerprint sensor!");
  } 
  else {
    Serial.println("Did not find fingerprint sensor :(");
    while (1) { delay(1); }
  }

  finger.getTemplateCount();
  Serial.print("Sensor contains "); Serial.print(finger.templateCount); Serial.println(" templates");
  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); 

  return finger.fingerID;
}

// 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);
  if(finger.confidence > 80){
    if (i > 0){
      myservo.write(80);
      delay(1000);
      i = 0;
      Serial.print(i);
    }
    else{
      myservo.write(160);
      delay(1000);
      i = 1;
      Serial.print(i);
      }
    
    }
 
  return finger.fingerID; 
}