Fingerprint Storage and Size

Hi !

I’m using a fingerprint sensor on my project, and I want to store many differents fingerprint. In the beginning I thought that I had to create a simple int table and store fingerprint inside of it using a loop, didn’t really work as it should, then I thougnt about the size, when we read a fingerprint how is it stored and where ? is it an integer or binary ? or something else ?

and as I was moving on, I’ve realized that in the function getfingerprint() only one variable has been used, p, in the beginning according to me I thought that it shouldn’t be a problem since it registers only one fingerprints and compares it with a new one, but this raised a new question, what do finger.image2Tz(1) ; finger.image2Tz(2) and finger.createModel() do **? since they use only variable to compare the previous fingerprint and the new one. **

So instead of only one variable I created an int table in my function as follow:

        for(i= 1; i<5; i++){ // I was trying to register just 4 fingerprints
          lcd.setCursor(0, 0);
          lcd.clear();
          lcd.print("Number ");
          lcd.setCursor(0, 1);
          lcd.print(i);
          delay(1000);
                     empr[i] = -1; 
              
          while(empr[i] != FINGERPRINT_OK){
          empr[i] = finger.getImage();
              switch (empr[i]){
                case FINGERPRINT_OK:
                break;
                case FINGERPRINT_NOFINGER:
                Serial.println(".");
                break;
                case FINGERPRINT_IMAGEFAIL:
                Serial.println(".");
                break;
                default:
                Serial.println(".");
                break;
                }
                
               empr[i] = finger.image2Tz(1);
               switch (empr[i]){
               case FINGERPRINT_OK:
               break;
               case FINGERPRINT_IMAGEMESS:
               return empr[i];
               break;
               case FINGERPRINT_PACKETRECIEVEERR:
               return empr[i];
               break;
               case FINGERPRINT_FEATUREFAIL:
               return empr[i];
               case FINGERPRINT_INVALIDIMAGE:
               return empr[i];
               default:
               return empr[i];
               }
          }
        }

in this code I just replaced the variable p used to store the first fingerprint(s) with a table I’ve called empr, then according to my understanding, if finger.image2Tz(1) registers the first fingerprint so finger.image2Tz(2) should register the second (inside a loop if there are many finerprint to register). I then created a function (which is actually the second part of the original function getfingertEnrolll() but modified) which gets the second fingerprint and compare it with all the previous fingerprint that are supposed to be registered inside may int table, as follow:

 int GETFingerprintEnroll(int empr[]) {
int i;
         lcd.clear();
         lcd.setCursor(0,0);
         lcd.print("  Replacer votre");
         lcd.setCursor(0,1);
         lcd.print("   doigt svp");
         
         for(i= 1; i<5; i++){
         empr[i] = -1;
         
         
  while (empr[i] != FINGERPRINT_OK) {
    empr[i] = finger.getImage();
    switch (empr[i]) {
    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!

  empr[i] = finger.image2Tz(2);
  switch (empr[i]) {
    case FINGERPRINT_OK:
      Serial.println("Image converted");
      break;
    case FINGERPRINT_IMAGEMESS:
      Serial.println("Image too messy");
      return empr[i];
    case FINGERPRINT_PACKETRECIEVEERR:
      Serial.println("Communication error");
      return empr[i];
    case FINGERPRINT_FEATUREFAIL:
      Serial.println("Could not find fingerprint features");
      return empr[i];
    case FINGERPRINT_INVALIDIMAGE:
      Serial.println("Could not find fingerprint features");
      return empr[i];
    default:
      Serial.println("Unknown error");
      return empr[i];
  }
 }
 
int k = 4;
for (i=0;i<5;i++){
  k--;
  empr[i] = finger.createModel();
 if(empr[i] == FINGERPRINT_OK){
  
         lcd.clear();
         lcd.setCursor(0,0);
         lcd.print("   ACCEPTER");
          setLocked (false);
         delay(1000);
         for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
                                              // in steps of 1 degree
            myservo.write(pos);              // tell servo to go to position in variable 'pos'
            delay(1);                       // waits 15ms for the servo to reach the position
  }
            delay(5000);  
         for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
             myservo.write(pos);              // tell servo to go to position in variable 'pos'
             delay(1);                       // waits 15ms for the servo to reach the position
  }
  break;
 }

 
 if(k == 0){
         lcd.clear();
         lcd.setCursor(0,0);
         lcd.print("  REFUSER");
          setLocked (true);
         delay(1000);
     }
}
}

Here it is, please I need your help.

with a table I've called empr[]

Of that type? Details matter, a great deal.

I need your help.

With what?

Post ALL of your code!

the empr table is an integer table

Find attached my full code

amelioration_1.ino (17 KB)

Which Arduino are you running that code on?

You’ve clearly copied and pasted code without understanding what the code is doing. You have return statements in loop() now, trying to return a value, when loop() does NOT return a value.

The device you have stores the fingerprint data, when you use the enroll example. It tells you which fingerprint was scanned, when you run the fingerprint example.

I can’t tell what your program is trying to do.

PaulS:
Which Arduino are you running that code on?

You've clearly copied and pasted code without understanding what the code is doing. You have return statements in loop() now, trying to return a value, when loop() does NOT return a value.

The device you have stores the fingerprint data, when you use the enroll example. It tells you which fingerprint was scanned, when you run the fingerprint example.

I can't tell what your program is trying to do.

I'm using an Arduino MEGA 2560

PaulS:
Which Arduino are you running that code on?

You've clearly copied and pasted code without understanding what the code is doing. You have return statements in loop() now, trying to return a value, when loop() does NOT return a value.

The device you have stores the fingerprint data, when you use the enroll example. It tells you which fingerprint was scanned, when you run the fingerprint example.

I can't tell what your program is trying to do.

M. PaulS, it is about fingerprint access system.
I'm using a servo, an LCD , a fingerprint sensor and keypad.
Initially the system asks you to type a specific code beforehand programmed which is (0694). when you type the that code it gives you access to the fingerprint sensor (you can niw use it) or allow you to use the fingerpring sensor, else, it'll print ACCESS DENIED. Then it'ill ask whether if you want to define many fingerprint by responding by YES (button B) OR NO (button C).

if YES, you are now supposed to register different fingerprints (which is 4 in my code). once finished it means only the fingerprints registered can be recognized, so assumid the servo is at zero at that moment (door closed) if you put a fingerprint which does not match the servo will not turn (ACCESS DENIED).

if you click on NO it'll then ask you whether you want to to change the password or move to the next step "next".

If you click on NEXT it will ask you it will ask you to register only one fingerprint, and so on.

Please re-read your description regarding what the system should do. Is there ANY reason for ONE function to do all of that? Of course not.

Now, model your system on your description, with functions for entering the system password, for selecting an option for enrolling many fingerprints, for enrolling one fingerprint, for checking enrolled fingerprints, etc.

Then, we can talk about the part(s) that don’t work correctly.

Pay attention to what each function should return, and don’t put return statements that return something else in the functions you write.

PaulS:
Please re-read your description regarding what the system should do. Is there ANY reason for ONE function to do all of that? Of course not.

Now, model your system on your description, with functions for entering the system password, for selecting an option for enrolling many fingerprints, for enrolling one fingerprint, for checking enrolled fingerprints, etc.

Then, we can talk about the part(s) that don’t work correctly.

Pay attention to what each function should return, and don’t put return statements that return something else in the functions you write.

Okay, thank you.