Things used in this project

Hardware components:
11026 02
Jumper wires (generic)
×1
Adafruit fingerprint module
×1
Bread board b23zpsd8ys
PHPoC Bread Board
×1
MIcro SD card Module
×1
09590 01
LED (generic)
×1
Mfr 25frf52 10k sml
Resistor 10k ohm
×1
181 02
Adafruit Standard LCD - 16x2 White on Blue
×1

Schematics

Shematic diagram
Schematic diagram e1le0ybqmf

Code

Interfacing the SD-card, Arduino and Fingerprint SensorArduino
Codes to enrol finger
#include <Adafruit_Fingerprint.h>
#include <SoftwareSerial.h>
uint8_t getFingerprintEnroll(uint8_t 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...");
  uint8_t 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(uint8_t id) {
  uint8_t 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!
 = 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;
  }   
    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;
  }   
}
Codes to take fingerprint and log data
#include <Adafruit_Fingerprint.h>
#include <SoftwareSerial.h>
#include <SD.h>
int getFingerprintIDez();
File myFile;
// 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);
  }
  delay(5000);
  Serial.println("Waiting for valid finger...");
  Serial.print("Initializing SD card...");
  pinMode(10, OUTPUT);
   if (!SD.begin(4)) {
    Serial.println("initialization failed!");
    return;
  }Serial.println("initialization done.");
  delay(3000);
}void loop()                     // run over and over again{
  getFingerprintIDez();
}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!
  String toLog="";
  Serial.print("Found ID #"); Serial.print(finger.fingerID); 
  toLog+=finger.fingerID;
  Serial.print(" with confidence of "); Serial.println(finger.confidence);
  toLog+=finger.confidence;
  myFile=SD.open("storage.txt",FILE_WRITE);
  if(myFile)
  {
    myFile.println(toLog);
    myFile.close();
  }
  */
}// 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);
  int toLog = finger.fingerID;
  delay(500);
  Serial.println("logging...");
  logData(toLog);
  return finger.fingerID; 
}
void logData(int d)
{
  myFile=SD.open("storage.txt",FILE_WRITE);
  if(myFile)
  {
    myFile.println(d);
    Serial.println("data logged");
    myFile.close();
  }
  else{
        Serial.println("error logging data");
  }
}

Credits

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Similar projects you might like

Arduino UNO Home Automation using Bluetooth HC05 module
Easy
  • 15
  • 1

Protip

Home Automation Attributes: Turning ON/OFF light bulb (AC 220V). Automatically Turning the Led ON/OFF depending on light intensity.

ESP8266 Temperature Monitor
Easy
  • 1,947
  • 11

Full instructions

Get an alert if your fridge's temperature rises above 40 F (very dangerous!).

tinyGlow Smart LEDs
Easy
  • 963
  • 8

Protip

Bring the ATtiny85 and NeoPixels together in affordable, addressable lights!

Using 16x2 LCD with Arduino
Easy
  • 1,347
  • 15

Protip

Learn how to use the 16x2 LCD with Arduino for various projects.

WiFi Strength Meter
Easy
  • 58
  • 1

A meter that indicates the Wi-Fi signal strength in an intuitive way, using the parts I had on hand.

Shooting Laser to Measure Distance
Easy
  • 3,696
  • 7

Protip

Using the VL53LO and an Arduino for distance measurement.

Sign up / LoginProjectsPlatformsTopicsContestsLiveAppsBetaFree StoreBlog