0

Fingerprint question
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Re: Fingerprint question

by dpswt on Mon Feb 02, 2015 5:12 am

Yes, I also get more than 64 bytes but thats probably because we start reading incoming bytes as we are still receiving.. basically we only have 64 bytes at a point in time but we are still receiving bytes as we are reading.. double buffering was suggested and I guess that would attenuate this problem although I'm not sure the best way to implement... Now I'm probably talking out of my ass, but my best guess is that we either are receiving bytes faster than we can read them or we start reading them too late, or maybe both, I dont really know. I haven't really checked too deeply how software serial works nor am I an expert at this so I'm probably wrong.

dpswt
 
Posts: 5
Joined: Thu Jan 08, 2015 7:05 pm

Re: Fingerprint question

by adafruit_support_rick on Mon Feb 02, 2015 10:06 am

This is why I put in a tight loop to read the template data:
Code: Select all | TOGGLE FULL SIZE
  uint8_t templateBuffer[256];
  memset(templateBuffer, 0xff, 256);  //initialize template buffer
  int index=0;
  uint32_t starttime = millis();
  while ((index < 256) && ((millis() - starttime) < 1000))
  {
    if (mySerial.available())
    {
      templateBuffer[index] = mySerial.read();
      index++;
    }
  }


This loop will run much faster than the data arriving in Software Serial. So the Software Serial buffer will *not* overflow.

sercanaygun wrote:Because it should be 256x288 pixel image. 256*288 is nearly 72000 pixels and each is a byte.

Actually, each pixel is four bits. The sensor sends two pixels per byte.

Of course that doesn't explain why you only get 5000 bytes...

adafruit_support_rick
 
Posts: 35095
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: Fingerprint question

by dpswt on Mon Feb 02, 2015 6:24 pm

Hi, might as well start posting some code and see where it goes. I'll admit, this serial business must go way beyond my head because I can't seem to grasp it (in this particular instance). Either way, here's the code I added to the fingerprint library (based on the rest of the library code, so it can be wrong/non-sense):

Adafruit_Fingerprint.h
Code: Select all | TOGGLE FULL SIZE
#define FINGERPRINT_UPIMAGE 0x0A

Adafruit_Fingerprint.cpp
Code: Select all | TOGGLE FULL SIZE
uint8_t Adafruit_Fingerprint::uploadImage(void){
   uint8_t packet[] = {FINGERPRINT_UPIMAGE};
   writePacket(theAddress, FINGERPRINT_COMMANDPACKET, sizeof(packet)+2, packet);
   uint8_t len = getReply(packet);
   
   if((len != 1) && (packet[0] != FINGERPRINT_ACKPACKET)){
      return -1;
   }
   return packet[1];
}


On testing example (shortened for readability, i.e no error checking included)

Code: Select all | TOGGLE FULL SIZE
uint8_t getFingerprintID() {
  uint8_t p = finger.getImage();
  p = finger.uploadImage();

  int index=0;
  uint32_t starttime = millis();
  while (((millis() - starttime) < 9000)) // 9 secs is arbitrary (just to give enough time)
  {
    if (mySerial.available())
    {
      Serial.print(mySerial.read(), HEX);
      index++;
    }
  }
 
  Serial.println();
  Serial.println(index);
  if (mySerial.overflow()){
    Serial.println("It overflowed!");
  }
}
}


The output with Serial.print(mySerial.read())
Code: Select all | TOGGLE FULL SIZE
EF1FFFFFFFF2082E0FFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFECEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFEEFFFFFEEFEEEFEFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFEFEEFFFFFFEFFFFFFFFFFFFFFFEFFFFFFF82FFFFFFFFFFFFFFFFFFFFFFFFFEFFFE7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFEFFEFFFFC1FFFFFFFFEEFFFFFFFFFFFFFFFFFFFFFF2FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFEEFFFFFFFFFFFFFEFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF47FFFFFFFFEEFEFFFFFFFFFFFFEEFFFFFF1FFFFFFEEFFFFFFFF2FFFFFFEEFFFFFFFFFFFFFFEEEEFFFFFFFFFFFFFFEEFFFFFFFFFFFFEEEEFFFFFFFFFFFFFEEEFFFFFF1FFFFFFEEEEFFFFFFFFFFFFFFEEEEFFFFFFFFFFFFEEEEEFFFFF82FFFFFFEEEEFFFFFFFFFFFFEEEEFFFFD4FFFFFFEEEEFFFFFFFFFFFFEEEEFFFFFF2FFFFFEEEEEEFFFFFFFFFFFEEEEFFFFFF82FFFFEEEEEEFFFFFFFFFFEFEEEEFFFFE5FFFFFFFEEEFFFFFFFFFFFFDDEDEEFFFF0FFFFEEEDEEFFFFFFFFFFFEEEEEEEFFFFFFFFFFEDDDEFFFFFFFFFFFFFDDEEFFFFEFFFFFEEEECCEFFFFFFFFFFFDD99EFFFFFFFFFFFCBCCEFFFFFFFFFFFEE9BDDEEFFFFFFFFFFCDBAEFFFFF0FFFFED97EEFFFFFFFFFFEEDCABEEFFCCFFFFEEEE58EFFFFFFFFFFEDE87EEFFFF82FFFFEE89DDFFFFFFFFFFEEB78AEFFF1FFFFEEDD86FEFFFFFFFFEEDD12DEEEFFFFFFFFEECC99FFFF2FFFFFEEDD99FEFFFFFFFFFFDD63DDFFFF82FFEEDD42CDEFFFFFFFFFEEBA12EFFF1FFFFEECB64DDEFFF0FFEEDD10ABEEFFFFFFFEDD8914EEFFEFFFFFEDBB1EEFFFFFFFFEECC11DEFFFFFFFFDEBA2085FFFF0FFEEDD5865FEFFFFFFFEDD1277CDFFFFFFFFEE1165AAEEFF1FFFFDDAA78EEFFFFFFFFEEBB66BBFFFFFFFFEEA46225EFFF1FFFEDD3757EEFF62FFFFDD8A7599FFFFFFFFEEB96711EEFF1FFFECB8874EEFF8FFFFBB993186EFFF2FFEE99377EEFFFFFFEE56153DCFFADFFFF68673322FFFF0FFDD991210EEFFFFFFEEA93265DEFF1FFEE9A137676FFFFFFFFCC992544DDFFC3FFEE66108862FFFF0FFEE40042BBFF54FFEFBB887798EEFF2FFDC897685AAFFFFFFEE51254540EEFFFFEFAA342766DDFFFFFFDD918556CDFF2CFFEE8708744FFFFFFEE986601EEFFFFFFEE98328972FFFFFFEE992320EEFFFFFFB9772211CDFF1FFCB2656087FF4FFFEE99123299EFFFFFEE20776316EEFFFFFF9914657ABFFFFFFEEA8346665CCFFFFFF22214177AAFFEFFFEE141167779AFFFFFFA587107788ECFFFFFF317612154FF1FFBB27761276FF49FF467533277FFFF0FE34556620CDFFFFFF737456438AFFFFFFAA86435623FFEFFFAA8862432FF47FFA911875620EDFFFF9A9900226FF2EFF888866350FFFFFF668856426678FF44FF3289352522FFFFFFBB14200EEFFFFCC7876450EEFFFFEE88077330FFEFFF687706733FF45FFFEBB73776577EFFFFFCB8866203457EFFFFE076757688FFEFFFAA3655880FF42FFEE597731251EEFFFFEE123444088EFFFFFCB345677666EE41FFBB3505721EEFFFF9951362222EEFFFF299870540FFFFEE568807721FE1EE35AA86220DDFFFFEE119822783FF1FE11AA63561DDFFFF86655667856FFFFFF75AA111035DDFFFFA9268867077FFFFFF878667244311FF88FF668856421233FF2FE3678558822CE9FFE96758354266FFEFFF1887465350FFFFEE208710130FF1EE870213355EFCBFFA84588404076FF82CB5378256799FF2AC246644550FF3FFF1167436413EEFFFFAA782155087EECEFF665763676715FF0BB987743345558FFFFEE648822043FE1EE1567544266EE69FE65112200AAFF82AA7544216510EFEFEE450145555EE3EFFBB1067764378FF20740665642DE43EF20566311119BFFFF53850567733DE79EF0670151DD32FF4708701077EEEFEE18807677EFFFFF962771022FF82995144656680BBFFFFBC31054440FFFFA7440345410EEFFFF995601210EFFFEE267441400FEFFFF882400022EEFFFF861110754665EFFFFF13363107676FF82118746137756EEEFFE118865336677EEFFCC1125577100FF97EE430451401EEFFFF4489120437745FF826605320023FF22243007665EE35EE226607744DDFFEE987605542DDFFEE887631566678FFFFBA77541155055FF0ED156455567613FFFFCB6644676346DDFFEF988667664400EE1DE4398673366CCFFFE36870253032EEFFDC099667755EE1EE118806634EE9CFF0553220870EEFFEE677710670EEEFEE8766772210DE3DEE89256453466DDFFFE3055663366BCFFFFDD882216835CDFFEE778842137787FF39EE992155646511FF0BB842104566EE35EE1000107AFF825288510053EEEFEE9945526676EDAEDD8952565477DEFF0BA887745068FFFFDD606654013EFFFDD881356076DDFFEFCB226402277EDFFFFEEAA46671276CCEFFFEE55661400EDFFFE7744722220DCFFEEAA08808810EFFFEEAA110770CCFF0DC885435520FF52EE990776778DDFF0CC463466044EF2DD782367426FFFFDD2540412AAFF0DC530435478DE3FFFDC3103066AADEEFEE990065057EEFFDD77077776579EFFFDD1166115414EEFF0DD25078077DDFF82CC3476443543DDFFFFDD766646220BCFF0DD24153550DD33EE477778000DDFFEE64653440133EFFFDD76520088EEFFDD871536667ABEE72EE9866562177CCFEEEAA0664355DDEEEECC254688078BDEF82EE833442296EEEFFFEEBA56662041EEFEEEDD2320036ABEEFEEECC88001098EE1EE98457531ABEE7EE9911984477CCFE82BB88545654CBFFEFEE99061189CCFF82AB76755610BCFF2CC65434430BAEEFFEDBB065065DDEE0EEBA43424045CDFFFFDD07500CCDE1DDA955011ABEDEFDECC55241058DDFF82CC8A66110CCEEEFEDAA10523430CDEFEEBC53322142CBEE1EFCB42562478CDDEFFCCAA773276CCDDEFFFDDAB4666031DDEDEFDCBB996666BBED4EEEAB77177ABDDEE0CC88675547DDFFFFBC990551CCEEFFCCAA97114399DCEEEEBB77536698DDEE82BB775456AACBFF0CBBB9932198DD4FCEBBA934576DDEEEEBBAA6545AB87DDEEDDBA88442277CDEE2CBAB66568978DCEEEDBA66565668CCFFEEA999655657BBDEFFAA995456BB66DD1DD9988557643BBEEEECCAA89788977DEEFCC898899AA88CC51CD988879AA44BBFF2BA88427776BBFFFFCC8844999766EEFFCC8975986864EFEFED886799776699DD82BB88665652BBEE89A7788897789EF

2494
It overflowed!



The output with mySerial.read() ONLY (no Serial.print())
Code: Select all | TOGGLE FULL SIZE
17094
It overflowed!


As you can see, without Serial.println, the number of reads seems to be substantially higher. The number of reads (the index) also varies slightly from test to test.

dpswt
 
Posts: 5
Joined: Thu Jan 08, 2015 7:05 pm

Re: Fingerprint question

by adafruit_support_rick on Tue Feb 03, 2015 11:36 am

The problem is the Serial.print. If you have Serial running at 9600 bps and the fingerprint running at 57600, then the Serial.print will prevent the loop from running fast enough to keep up with the incoming data. See what happens if you set Serial to run at 115200,

adafruit_support_rick
 
Posts: 35095
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: Fingerprint question

by dpswt on Tue Feb 03, 2015 3:10 pm

Hi, that actually didn't help, the result was still the same. However the Serial.print really is slowing the loop down

This code
Code: Select all | TOGGLE FULL SIZE
  while (((millis() - starttime) < 9000))
  {
    if (mySerial.available())
    {
      Serial.print("ahaahahahahahahahah");
      mySerial.read();
      index++;
    }
  }

returns an index way lower than for example

Code: Select all | TOGGLE FULL SIZE
  while (((millis() - starttime) < 9000))
  {
    if (mySerial.available())
    {
      Serial.print("a");
      mySerial.read();
      index++;
    }
  }


Now, regardless of that, even without Serial.print, isn't 17k reads still too low? Shouldn't I receive about (255*288)/2 = 36k~ (assuming each pixel is 4-bit)?

dpswt
 
Posts: 5
Joined: Thu Jan 08, 2015 7:05 pm

Re: Fingerprint question

by Don_Jeronimo on Tue Feb 03, 2015 4:05 pm

Thanks a bunch for that!

I'm thinking the template is still not complete because loadModel is loading a template (512 byte) and getModel is coded to read a character file (256 byte)? As the packages are max 256, I'm guessing there's a follow up package..

Increasing the baudrate still gets me a different number of bytes..
It seems different templates have a different byte length too, I'm thinking that should not be the case.. based on these two points, I think the serial is dropping bytes...

I've noticed the differences in templates too, strange thing :(

Anyway.. Thanks so far, back to abusing the few brain cells I've got left..

Don_Jeronimo
 
Posts: 26
Joined: Sun Jan 11, 2015 6:39 am

Re: Fingerprint question

by sercanaygun on Tue Feb 03, 2015 9:00 pm

Dear All,
I have sent an e-mail to vendor firm with a detailed exlaination. Maybe they will help from China. (or even maybe the authorities in Ada fruit would contact with them).
Regarding the problem, I thought that if we cannot reach the speed of the sensor we can reduce its speed by changing the parameter as written in the datasheet. We need to send the related package I think.
********************************************************************************
4.4.1 Baud rate control (Parameter Number: 4)
The Parameter controls the UART communication speed of the Modul. Its value is an integer N, N= [1, 12]. Cooresponding baud rate is 9600*N bps
********************************************************************************
And even more, isn't it possible to flush() serial buffer or some solution like that?

sercanaygun
 
Posts: 9
Joined: Thu Jul 17, 2014 9:08 pm

Re: Fingerprint question

by Don_Jeronimo on Wed Feb 04, 2015 3:52 pm

Yup.. I had the same idea...

seems to work, at least I'm getting a full byte read and no FF ;)

here's the code..

library (set 3rd number in packet to corresponding baud)
Code: Select all | TOGGLE FULL SIZE
uint8_t Adafruit_Fingerprint::setSysPara(void) {
  uint8_t packet[] = {0x0e,0x4,0x1};
  writePacket(theAddress, FINGERPRINT_COMMANDPACKET, sizeof(packet)+2, packet);
  uint8_t len = getReply(packet);

  if ((len != 1) && (packet[0] != FINGERPRINT_ACKPACKET))
   return -1;
  return packet[1];
}


sketch:

Code: Select all | TOGGLE FULL SIZE
/***************************************************
  This is an example sketch for our optical Fingerprint sensor

  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("finger template test");

  // 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()
{
 
SetBaut_Finger();
    while (1);
}
void SetBaut_Finger(void){

  uint8_t p = finger.setSysPara();
 

}


run once (to save to flash) then set the baud rate in your original code

Don_Jeronimo
 
Posts: 26
Joined: Sun Jan 11, 2015 6:39 am

Re: Fingerprint question

by Don_Jeronimo on Sun Feb 08, 2015 7:09 am

Hi again,

I'm now getting the following

EF, 1, FF, FF, FF, FF, 2, 0, 82, 3, 1, 59, 1D, 0, 0, FF, FE, FF, FE, F0, FE, E0, 6, E0, 6, 0, 6, 0, 6, 0, 2, 0, 2, 0, 2, 0, 6, 0, 6, 0, 6, 0, 6, 0, E, 0, E, 0, 1E, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 8E, E2, 96, 54, 19, A4, FE, 1F, A1, DF, 3E, 5F, 22, A6, 7E, 68, A5, A7, 5E, F, B4, DC, 9E, 2C, BD, 19, FE, 4C, 42, 57, 1E, 26, C2, C2, 7E, 38, 93, E3, 7F, 12, 9E, DF, 1F, 15, 25, 6, 7F, 44, A8, AC, BF, 34, 2F, 5B, 7F, 5C, B2, 2A, 7F, 39, 40, 80, FF, 44, 19, 9F, BC, 4E, 95, E3, 1D, 29, CF,

EF, 1, FF, FF, FF, FF, 2, 0, 82, 62, 18, 24, BD, 2D, 26, 1D, 5D, 26, A7, 45, 3D, 46, 13, F, 7A, 59, 13, CD, FA, 57, B8, 81, B2, 5A, 41, 16, 92, 42, 16, 24, 93, 5C, 39, 17, 13, 5C, 96, 23, 19, 54, C1, 2B, 53, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, F, 24,

EF, 1, FF, FF, FF, FF, 2, 0, 82, 3, 1, 53, 17, 0, 0, FF, FE, FF, FE, FE, 1E, FC, 2, F8, 2, F8, 0, F0, 0, E0, 0, E0, 0, E0, 0, E0, 0, C0, 0, C0, 2, C0, 2, C0, 2, E0, 6, F0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 43, 8F, 63, 96, 48, 13, A5, 3E, 6F, 24, 27, 1E, 6D, 32, 2A, 9E, 1F, B5, 1C, 9E, 58, 40, 56, 5E, 2F, 22, 9F, 1F, 25, 24, C6, 9F, 56, A9, 0, 1F, 42, AE, 9B, FF, 3F, BC, 59, 7F, 48, C0, C0, 7F, 32, C1, 2, 9F, 56, 9A, 66, 7D, 3D, 25, DD, 9D, 37, 27, 5, 7D, 54, 17, 26, 13, 6B, 16, F, B8, 2C, FA,

EF, 1, FF, FF, FF, FF, 8, 0, 82, 62, 98, 23, 18, 6E, 18, A3, 99, 64, 1A, 65, 99, 58, 14, 4F, B4, 36, 9B, A0, 93, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 70,

Four packages (including the end package, hooray), 139 bytes each, with a combined total of 556 bytes..this seems about right to me as 556 - (4x11) = 512 (11 being the bytes for address and such) , which happens to be the template size (according to the datasheet). :)

I removed the line loop (from the code you guys posted,thanks again), as it seemed to be messing with printing out the correct values from the array and am getting the same result every time now.

However, I still don't understand the end bytes in the packages...should that not be the checksum? Could it be the checksum is not the amount of bytes but the sum of something else? Any ideas?

As always your wisdom is much appreciated.

Regs,
J

Don_Jeronimo
 
Posts: 26
Joined: Sun Jan 11, 2015 6:39 am

Re: Fingerprint question

by Don_Jeronimo on Sun Feb 22, 2015 8:36 am

Well I finally got my test setup to work!

Test (match finger with template from external source):
- Use downchar to get the template
- Use upchar to upload the downloaded template to buffer 2 (I hard coded the template for testing purposes, so no db conn yet)
- Use Match to find a match with buffer 1 (looping through the fingerprint sensors library for testing purposes)

To get the template to upload to the sensor properly I had to reduce the packet size to 32 (by changing the sysPara of the sensor)

To get a consistent non buggy template out I had to:
- lower the baudrate of the sensor to 9600.
- Up the baudrate of the serial to 57600.
- Since I changed the packet size I had to adjust the code from adafruit (posted earlier) for a 688 byte return (16 packages plus adress, adder, packet size and checksum).

Now on to actually matching by using my finger and pusing the templates to mach to from a DB :).

Cheers,
J

Don_Jeronimo
 
Posts: 26
Joined: Sun Jan 11, 2015 6:39 am

Re: Fingerprint question

by adafruit_support_rick on Sun Feb 22, 2015 10:21 am

Wow - that's impressive!

adafruit_support_rick
 
Posts: 35095
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: Fingerprint question

by abdulazizsakr on Mon Feb 23, 2015 7:04 pm

I have a question.. i am using the adafruit finger print and i want to map each finger print to a certain user in my database . i have a database which have user name and pasword and image and many other stuff and i have a column for the finger print so how can i take the finger print from the adafruit fingerprint scanner and map it to a certain user in my database ?

abdulazizsakr
 
Posts: 1
Joined: Mon Feb 23, 2015 7:01 pm

Re: Fingerprint question

by adafruit_support_rick on Mon Feb 23, 2015 8:58 pm

Each finger you enroll in the scanner is associated with a unique ID. You assign this ID when you enroll the finger. When you search, this ID is returned on a match.
So, all you have to do is associate the user with this ID in your database.

adafruit_support_rick
 
Posts: 35095
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: Fingerprint question

by sercanaygun on Sat Mar 21, 2015 5:28 am

Dear Don_Jeronimo,
I wonder if it is possible to share your codes. Thank you very much.

sercanaygun
 
Posts: 9
Joined: Thu Jul 17, 2014 9:08 pm

Re: Fingerprint question

by Don_Jeronimo on Tue Mar 24, 2015 3:42 pm

Hi,

sure..
I haven't worked on this since my last post so keep in mind this was a test...ergo no single sketch, crappy code and external matching simulated by a hardcoded print...
anyway, here it is;

Step 1 - Library
Replace the existing library with the .cpp and .h files in the attachment (make a backup! ;)).
As I said, for testing purposes I hard coded a fingerprint uploaded from the sensor (in the library), you'll need to change that to one of your own, if you want to use this test setup. More on that later...

Step 2 - Change baudrate
Upload and Run the setBaud sketch. There is no confirmation!
Note: it assumes you've got the sensor baud set to default 57600 and will change it to 9600. If you want to change it back change the number in uint8_t Adafruit_Fingerprint::setSysParaBaud(void) in the library (according to the data sheet, I think it was 8) and initiate the finger (in the sketch) with the current baudrate set.

Step 3 - Change packet size
In the setBaud sketch (I can't find the setPackageSize Sketch and am to lazy to create one now ;)), change the baud of the scanner to 9600 and change finger.setSysParaBaud(); to setSysParaSize.
Upload and Run
Again, no confirmation

Step 4 - Get some fingerprint templates from the scanner
Upload and Run the show_fingerprint_templates sketch and set the baudrate in the serial window to 57600. This should get you the fingerprint template #1 from your scanner (change code to get more or a different number).

It should put out a block of 688 bytes for each print.

Step 5 - Hard code the fingerprint template in the library (to simulate external match)

Copy paste the template gotten in the previous step to the editor of your choice and find the headers, which should look something like this; EF, 1, FF, FF, FF, FF, 2, 0, xx (don't remember the final byte). The final header or End Package should have an 8 instead of a 2 as the seventh byte. Separate the packages.

Find this in fingerprint.ccp: Adafruit_Fingerprint::uploadModel(void) --> replace the hex for each package with the packages from your template minus the package headers.

Step 6 - Run the simulation (hardcoded print against library)
Upload an Run the test_external_save1_7 Sketch.
This should give you a match against the template number you hard coded and none of the others, if so...hurray! if not grrrr

Step 6.5
I also experimented with using my actual finger (match against hardcoded template), this one is buggy but it works:

Upload and Run the extrenal_match sketch.
Place the finger matching the template you hardcoded on the scanner and keep it there for a while (usualy takes me 3 flashes/pictures to get a match), the others should not give you anything however long you keep your finger on there.

That's it. Hope it helps.

The code is copy pasted together and could use a lot of improvement, I would therefore appreciate it if you could share yours if you make any ;)

Regs,
J
Attachments
finger_test_files.rar
(8.71 KiB) Downloaded 717 times

Don_Jeronimo
 
Posts: 26
Joined: Sun Jan 11, 2015 6:39 am

Please be positive and constructive with your questions and comments.