0

Arduino Enrol Problem for fingerprint module
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Arduino Enrol Problem for fingerprint module

by wildan03 on Wed Jun 05, 2013 7:10 am

hi, i just downloaded and used the arduino enrol code to enrol the fingerprint, the problem is, i cant type in integer(1-9), i can only type character (a-z) and it will store in random id, is the program supposed to work that way or there is something wrong with the coding?
wildan03
 
Posts: 2
Joined: Sun Apr 28, 2013 4:24 am

Re: Arduino Enrol Problem for fingerprint module

by r0163 on Sun Apr 06, 2014 4:17 pm

Same here.
It ignores numbers and stores fingerprints only if I send a letter preceding a number (like a1, a2, a3, etc)
Could someone please comment?

r0163
 
Posts: 6
Joined: Sun Apr 06, 2014 3:21 pm

Re: Arduino Enrol Problem for fingerprint module

by adafruit_support_mike on Mon Apr 07, 2014 4:37 pm

We don't have source code for the fingerprint scanner's firmware, but that's a fairly common pattern matching constraint.

It's hard to write code that recognizes names and numbers if the names can begin with digits. Deciding whether "123JOE" is a 6-character name, or the number "123" followed by the name "JOE" is computationally difficult (technically, it creates an ambiguous left-recursive grammar). Forcing names to begin with at least one non-digit character makes the problem much easier to solve.

Is there a specific reason you need all-numeric names?

adafruit_support_mike
 
Posts: 52612
Joined: Thu Feb 11, 2010 2:51 pm

Re: Arduino Enrol Problem for fingerprint module

by r0163 on Tue Apr 08, 2014 9:04 am

Hello Mike!

Thanks for your reply.
I'm new to Arduino so please excuse if some ordinary questions asked.
Already read all 57 pages of search results for 'fingerprint' on this forum.

If someone could explain how 'enroll' and 'fingerprint' examples work line by line I would be very grateful.
I realize that this is not a good example to start studying programming on, but I urgently need fingerprint it in my project.

Is there a specific reason you need all-numeric names?

I need to combine 'enroll' and 'fingerprint' sketches into one function that will
a) return a id# stored if any found
b) store a fingerprint to id# (overwrite). In this case id# will be passed as a variable.

r0163
 
Posts: 6
Joined: Sun Apr 06, 2014 3:21 pm

Re: Arduino Enrol Problem for fingerprint module

by r0163 on Tue Apr 08, 2014 9:11 am

Code: Select all | TOGGLE FULL SIZE
void loop()                     // run over and over again
{
  Serial.println("Type in the ID # you want to save this finger as...");
  uint8_t id = 0;               // Unsigned integer 8 bit long.
  while (true) {                // Start and loop while     
    while (! Serial.available()); // there is nothing entered.
    char c = Serial.read();      // Write a user input to 'c'.
    if (! isdigit(c)) break;   // If 'c' is not a digit then exit loop.
    id *= 10;                  // ?
    id += c - '0';            // ?
  }
  Serial.print("Enrolling ID #");
  Serial.println(id);
 
  while (!  getFingerprintEnroll(id) );   // ?
}


Why 'id' (0) is multiplied by 10 and then 'c' (which is 'a1' for example) - 0 is assigned to 'id'?

r0163
 
Posts: 6
Joined: Sun Apr 06, 2014 3:21 pm

Re: Arduino Enrol Problem for fingerprint module

by ishtiaqengineer on Sat Mar 14, 2015 6:37 am

how to combine the 3 programs of ARDUINO ADAFRIUT
1.FINGERPRINT
2.ENROLL
3.DELETE
programming into a single program
i want to do such as that when i pass a number it calls one of the programs with the help of SWITCH statment

ishtiaqengineer
 
Posts: 1
Joined: Tue Mar 10, 2015 6:56 am

Re: Arduino Enrol Problem for fingerprint module

by omer908 on Thu Mar 26, 2015 8:12 am

adafruit library has enrol and fingerprint sketches... when ever i enrol with some id number and later check it with fingerprint sketche, it just founds the last finger tht i enrol and with id number "0"....
.
(i am using arduino UNO and SM20-fingerprint sensor with adafruit library)

omer908
 
Posts: 6
Joined: Wed Mar 25, 2015 2:47 am

Re: Arduino Enrol Problem for fingerprint module

by akdokur on Thu Aug 13, 2015 8:42 am

First, I do not know if you solve your problem , you will get the results you want if you change the code as follows not resolved .
Code: Select all | TOGGLE FULL SIZE
#include <Adafruit_Fingerprint.h>
#include <SoftwareSerial.h>

int8_t getFingerprintEnroll(int id);
 char  p ;

// 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);
   p = Serial.println("Bağlantı Kuruldu");

  // 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 :(");
    Digital.Write
    while (1);
  }
  // put your setup code here, to run once:

}

void loop() {
 Serial.println("Type in the ID # you want to save this finger as...");
 
  int8_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) );

}

int8_t getFingerprintEnroll(int8_t id) {
  int8_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("İz Bekleniyor");
      break; 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(1000);
  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;
  }   
 
  p = finger.storeModel(id);
  if (p == FINGERPRINT_OK) {
    Serial.println("Stored!");
    Serial.print("ID # ");
    Serial.println(id);
  } 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;
  }   
}


You can define desired ID between 0-126 years with this code. The system does not accept Height 126 from ID numbers. For now :)
I solved it.
When you open the Serial Port screen, enter an ID when you want t ask you for ID . ( I have given range ) and enter any letters after . Done. Next you have saved the sensor ID you want .

akdokur
 
Posts: 1
Joined: Mon Aug 10, 2015 11:32 am

Re: Arduino Enrol Problem for fingerprint module

by eanisha on Wed Sep 28, 2016 7:07 am

ishtiaqengineer wrote:how to combine the 3 programs of ARDUINO ADAFRIUT
1.FINGERPRINT
2.ENROLL
3.DELETE
programming into a single program
i want to do such as that when i pass a number it calls one of the programs with the help of SWITCH statment



OMG, this is exactly what i want to. Hvave you managed to hear from anybody? Please help!!

eanisha
 
Posts: 11
Joined: Thu Sep 15, 2016 12:10 am

Re: Arduino Enrol Problem for fingerprint module

by eanisha on Wed Sep 28, 2016 7:09 am

r0163 wrote:Hello Mike!

Thanks for your reply.
I'm new to Arduino so please excuse if some ordinary questions asked.
Already read all 57 pages of search results for 'fingerprint' on this forum.

If someone could explain how 'enroll' and 'fingerprint' examples work line by line I would be very grateful.
I realize that this is not a good example to start studying programming on, but I urgently need fingerprint it in my project.

Is there a specific reason you need all-numeric names?



I have the same objective. Have you been able to sort it out yet?
Please help!

I need to combine 'enroll' and 'fingerprint' sketches into one function that will
a) return a id# stored if any found
b) store a fingerprint to id# (overwrite). In this case id# will be passed as a variable.

eanisha
 
Posts: 11
Joined: Thu Sep 15, 2016 12:10 am

Re: Arduino Enrol Problem for fingerprint module

by eanisha on Sat Oct 01, 2016 11:00 pm

I'm quite new to arduino ( and coding) as well, but I've asked around and been able to figure out some details that maybe helpful to you.
I've received help from forums over the past few weeks and I think its only fair that I keep the chain going.
THIS RIGHT HERE IS THE CORRECTED CODE. I couldn't find this anywhere on the repository and had to work on it line by line to figure it out. ( please find comments in CAPITAL LETTERS, i tried helping to the best of my ability. If i have made any mistakes, please please please advice / inform me. THANKS!
/***************************************************
This is an example sketch for our optical Fingerprint sensor
Designed specifically to work with the Adafruit BMP085 Breakout
----> http://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); // THIS ENABLES THE PINS 2,3 TO NOW SERVE AS A RX AND TX EQUIVALENT PINS

Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);

// On Leonardo/Micro or others with hardware serial, use those! #0 is green wire, #1 is white
//Adafruit_Fingerprint finger = Adafruit_Fingerprint(&Serial1);

void setup()
{
while (!Serial); // For Yun/Leo/Micro/Zero/...

Serial.begin(9600);
Serial.println("Adafruit finger detect test"); // SERIAL COMMUNICATION BETWEEN COMPUTER AND ARDUINO

// set the data rate for the sensor serial port
finger.begin(57600); // SERIAL COMMUNICATION SPEED BETWEEN FINGERPRINT SCANNER AND ARDUINO. NOT QUITE SURE WHY THEY ARE DIFFERENT THO

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. // CALLING FOR THE FUNCTION
}


// returns -1 if failed, otherwise returns ID #
int getFingerprintIDez() {

uint8_t p = finger.getImage();
switch (p) {
case FINGERPRINT_OK:
Serial.println("Image taken");
break; // IF THIS CASE, THEN BREAKS AND EXITS OUT OF SWITCH, EVERYWHERE ELSE, RETURNS VALUE OF p AND DOES NOT PROCEED TO REST OF CODE
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;
}
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;
}
p = finger.fingerFastSearch();
if (p == FINGERPRINT_OK) {
Serial.println("Found a print match!");
Serial.print("Found ID #"); Serial.print(finger.fingerID);
Serial.print(" with confidence of "); Serial.println(finger.confidence);
return finger.fingerID;
}
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;
}
}
// HOPE I COULD HELP. I TRIED TO THE BEST OF MY ABILITY

eanisha
 
Posts: 11
Joined: Thu Sep 15, 2016 12:10 am

Please be positive and constructive with your questions and comments.