Giter Club home page Giter Club logo

Comments (80)

ricarduscat avatar ricarduscat commented on May 24, 2024 1

Yes, but I had to touch the fingerprint sensor packet size to adapt it to the datapackets I was sending

from adafruit-fingerprint-sensor-library.

adityadate1997 avatar adityadate1997 commented on May 24, 2024 1

I want to download and store the template in my server datatabase, I am using NodeMCU and Php with mysql on server side. This function is not provided in the library. Can anybody please guide me on this?

from adafruit-fingerprint-sensor-library.

AsifKhan991 avatar AsifKhan991 commented on May 24, 2024 1

I was also in need of such functionalities (to read, save and write back template data to similar sensor models) and thus came up with an update to the existing library. @Dygear what you said is correct. I have a pull request pending about this. Please checkout my repository about this update. Also checkout the changes I've made.

However, keep in mind that writing template data from one model to another won't serve the purpose as different sensor models might use different template matching algorithms.

Hope I was able to help!

from adafruit-fingerprint-sensor-library.

Gitare420 avatar Gitare420 commented on May 24, 2024 1

I made the change and left everything as it is and it still doesn't work, it reads the template and uploads it without problems, but when reading the fingerprint it can't find it in the database.

It occurs to me perhaps to filter the data that is not necessary and save the template in a string, and when reading it see the percentage of coincidence, and if it is greater than 80%, for example, I would take it as good. I'm going to sleep for a while and when I wake up I'll do that test and let you know how it goes, thanks for answering :)

from adafruit-fingerprint-sensor-library.

Gitare420 avatar Gitare420 commented on May 24, 2024 1

WORKS!!!!! Thank you very much, I have searched everywhere and your library was the best that worked for me, very simple and intuitive everything, really thank you very much, you are a genius, I enclose my code in case it helps someone

////////////////////////////////////////write_to_sensor////////////////////////////////////////

#include <Adafruit_Fingerprint.h>
Adafruit_Fingerprint finger = Adafruit_Fingerprint(&Serial2);

void setup() {
Serial.begin(115200);
finger.begin(57600); //set your sensor's baudrate
if (finger.verifyPassword()) {
Serial.println("Found fingerprint sensor!");
} else {
Serial.println("Did not find fingerprint sensor :(");
while (1);
}
write_template_data_to_sensor();
}

uint8_t readnumber(void) {
uint8_t num = 0;

while (num == 0) {
while (! Serial.available());
num = Serial.parseInt();
}
return num;
}

void write_template_data_to_sensor() {
int template_buf_size = 512; //usually hobby grade sensors have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17, 0x0, 0x1, 0x20, 0x1, 0x79, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x10, 0x0, 0xD, 0x0, 0x5D, 0x0, 0xC, 0x30, 0xCC, 0xF3, 0xF3, 0x3F, 0xFF, 0xFF, 0xEA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0x65, 0x54, 0x51, 0x51, 0x45, 0x44, 0x51, 0x4, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
};

Serial.println("Ready to write template to sensor...");
Serial.println("Enter the id to enroll against, i.e id (1 to 127)");
int id = readnumber();
if (id == 0) {// ID #0 not allowed, try again!
return;
}
Serial.print("Writing template against ID #"); Serial.println(id);

if (finger.write_template_to_sensor(template_buf_size, fingerTemplate)) { //telling the sensor to download the template data to it's char buffer from upper computer (this microcontroller's "fingerTemplate" buffer)
Serial.println("now writing to sensor...");
} else {
Serial.println("writing to sensor failed");
return;
}

Serial.print("ID "); Serial.println(id);
if (finger.storeModel(id) == FINGERPRINT_OK) { //saving the template against the ID you entered or manually set
Serial.print("Successfully stored against ID#"); Serial.println(id);
} else {
Serial.println("Storing error");
return ;
}
}

void loop() {}

////////////////////////////////////////write_to_sensor////////////////////////////////////////

from adafruit-fingerprint-sensor-library.

dody3030 avatar dody3030 commented on May 24, 2024 1

@AsifKhan991 WORKING.!!!!, Thank you too much, I ready don't know how to thank you,, Im sorry it's working, I forgot to copy the updated ccp. thanks alot

Waiting for valid finger....
Image taken
Image converted
Remove finger
Place same finger again, waiting....
Image taken
Image converted
Creating model...
Prints matched!
Template created
Attempting to get template...
Transferring Template....
Template data (comma sperated HEX):
0x2,0x0,0x5,0x52,0x8B,0x11,0xC3,0x0,0x84,0x0,0x14,0x2C,0x9E,0x13,0xB,0x1C,0xD4,0x5,0x15,0xC3,0xC,0x14,0x81,0x45,0x60,0xE1,0x41,0x88,0x51,0xC0,0x4C,0x57,0x52,0x14,0x66,0x17,0x93,0x46,0x45,0x17,0x46,0x4,0x1D,0x41,0x45,0xC1,0xC2,0x89,0xA4,0x50,0xF4,0x72,0x27,0x44,0x14,0x55,0x21,0x92,0x98,0x85,0x10,0xC9,0x61,0x51,0x41,0x44,0x82,0x75,0x99,0x50,0x52,0x34,0xB2,0x93,0x5A,0x14,0x40,0x2F,0x36,0x16,0x45,0x15,0x8C,0x12,0x26,0x61,0x47,0x43,0x9,0x7D,0x38,0x50,0xF0,0xEE,0xA2,0x62,0x14,0x53,0x46,0x91,0xD2,0x5,0x18,0x12,0xB6,0xC4,0xF1,0x49,0xC4,0xD0,0xC9,0x50,0x51,0xC1,0x50,0x4F,0x4A,0x14,0x77,0x8E,0x8B,0xB4,0xEB,0x0,0x84,0xD1,0x10,0xD4,
0x8A,0x55,0x7,0xA,0x9C,0x5,0x23,0x2,0xB1,0x26,0x81,0x48,0xA0,0xC0,0xB5,0x80,0x52,0xC,0x60,0xA0,0x70,0x14,0x60,0x1C,0x1D,0x9D,0x45,0x16,0x48,0x83,0x55,0x61,0x46,0x2,0x28,0x41,0xC0,0x51,0xF8,0x96,0x81,0x54,0x14,0x55,0x27,0x4,0xD8,0x5,0x17,0xD,0x5,0xA7,0x11,0x44,0xB4,0x9,0xD,0x80,0x51,0x75,0xD,0x1C,0x5A,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,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0

from adafruit-fingerprint-sensor-library.

AsifKhan991 avatar AsifKhan991 commented on May 24, 2024 1

@dody3030 I left the store fucntion as it is in the original library. Seems more likely a sensor issue. Will check anyways and get back if any solution is found.

from adafruit-fingerprint-sensor-library.

DharmikEC avatar DharmikEC commented on May 24, 2024 1

@AsifKhan991 , I am using R503 capacitive fingerprint sensor and wanted to store fingerprint data from cloud to new sensor. Your update woks fine with minor modification. Thank you very much for that.

I tried to merge your get fingerprint and store fingerprint examples in one. I failed initially and got error in write_template_to_sensor() function, later I added Serial2.read() as long as Serial2.available() remains true(Serial2 is a port I am using for my sensor). After this it works fine. What I don't understand is it gave me 447 bytes extra. What are those ?? Do you have any Idea about this ??

OK so I was using 768 size but it turns out that template size is 1536 for R503 as well. I have changed the template size and it is working fine. Datasheet I was following was old so I have asked GROW directly they provided updated manual that I have attached below.

R503 fingerprint module user manual-V1.2.2.pdf

Thank you.

from adafruit-fingerprint-sensor-library.

marianodato avatar marianodato commented on May 24, 2024

This function worked for you? Did you find another solution?

from adafruit-fingerprint-sensor-library.

marianodato avatar marianodato commented on May 24, 2024

@ricarduscat could you explain how to do that?

from adafruit-fingerprint-sensor-library.

milindrc avatar milindrc commented on May 24, 2024

@ricarduscat please explain the parameter you need to pass to this function.

from adafruit-fingerprint-sensor-library.

sand007man avatar sand007man commented on May 24, 2024

i am able to enroll ,search fingerprint but when i load show_fingperprint _template it is showing some "??" values in the serial monitor . even small help will be greatly appreciated . I am using this fingerprint with node_mcu esp 12e...i feel its something related to memory buffer !!

from adafruit-fingerprint-sensor-library.

hanifizzudinrahman avatar hanifizzudinrahman commented on May 24, 2024

recvPacket

what is "recvPacket"? the last packet, or what?

from adafruit-fingerprint-sensor-library.

jimmygyl avatar jimmygyl commented on May 24, 2024

i am able to enroll ,search fingerprint but when i load show_fingperprint _template it is showing some "??" values in the serial monitor . even small help will be greatly appreciated . I am using this fingerprint with node_mcu esp 12e...i feel its something related to memory buffer !!

Try using larger buffer for the software serial
something like
SoftwareSerial mySerial(D7, D8, false, 1024);

default is 64bytes
packages of template are 128bytes+11bytes
maybe it got overwritten

from adafruit-fingerprint-sensor-library.

shreeramkulkarni avatar shreeramkulkarni commented on May 24, 2024
uint8_t Adafruit_Fingerprint::downloadModel(uint16_t id, uint8_t packet_1[], uint8_t packet_2[], uint8_t slot) {
  uint8_t packet[] = {FINGERPRINT_DOWNLOAD, slot};
  writePacket(theAddress, FINGERPRINT_COMMANDPACKET, sizeof(packet)+2, packet);
  uint8_t len = getReply(recvPacket);
  
  if ((len != 1) && (recvPacket[0] != FINGERPRINT_ACKPACKET))
   return -1;
  if (recvPacket[1] == 0x00) {
    writePacket(theAddress, FINGERPRINT_DATAPACKET, 130, packet_1);
    writePacket(theAddress, FINGERPRINT_DATAPACKET, 130, packet_2);
    return recvPacket[1];
  } else {
    return recvPacket[1];
  }
}

I made this with the latest version of the code. I need to put templates back to the sensor when I free the memory. The documention of the sensor says it's allowed, but not implemented in the library. This does not work, it will be fine to improve the library.

@ricarduscat If possible can you please expand on this code ?(What are the parameters..etc). Is there any other way where I can load the templates from one sensor to other sensor. BTW I am using R307.

from adafruit-fingerprint-sensor-library.

hanifizzudinrahman avatar hanifizzudinrahman commented on May 24, 2024
uint8_t Adafruit_Fingerprint::downloadModel(uint16_t id, uint8_t packet_1[], uint8_t packet_2[], uint8_t slot) {
  uint8_t packet[] = {FINGERPRINT_DOWNLOAD, slot};
  writePacket(theAddress, FINGERPRINT_COMMANDPACKET, sizeof(packet)+2, packet);
  uint8_t len = getReply(recvPacket);
  
  if ((len != 1) && (recvPacket[0] != FINGERPRINT_ACKPACKET))
   return -1;
  if (recvPacket[1] == 0x00) {
    writePacket(theAddress, FINGERPRINT_DATAPACKET, 130, packet_1);
    writePacket(theAddress, FINGERPRINT_DATAPACKET, 130, packet_2);
    return recvPacket[1];
  } else {
    return recvPacket[1];
  }
}

I made this with the latest version of the code. I need to put templates back to the sensor when I free the memory. The documention of the sensor says it's allowed, but not implemented in the library. This does not work, it will be fine to improve the library.

@ricarduscat If possible can you please expand on this code ?(What are the parameters..etc). Is there any other way where I can load the templates from one sensor to other sensor. BTW I am using R307.

i suggest you to read this post
#9

i have written on there, how to send template fingerprint to module fingerprint

from adafruit-fingerprint-sensor-library.

hanifizzudinrahman avatar hanifizzudinrahman commented on May 24, 2024

I want to download and store the template in my server datatabase, I am using NodeMCU and Php with mysql on server side. This function is not provided in the library. Can anybody please guide me on this?

of course, i can help you. NodeMCU i think can use as Arduino, so it can be work with module fingerprint R307 or DY50

from adafruit-fingerprint-sensor-library.

adityadate1997 avatar adityadate1997 commented on May 24, 2024

I want to download and store the template in my server datatabase, I am using NodeMCU and Php with mysql on server side. This function is not provided in the library. Can anybody please guide me on this?

of course, i can help you. NodeMCU i think can use as Arduino, so it can be work with module fingerprint R307 or DY50

Can we connect through an email? I'll send in the required code for you to see.

from adafruit-fingerprint-sensor-library.

hanifizzudinrahman avatar hanifizzudinrahman commented on May 24, 2024

yes, you can see my profile to get my new phone number or email

from adafruit-fingerprint-sensor-library.

adityadate1997 avatar adityadate1997 commented on May 24, 2024

from adafruit-fingerprint-sensor-library.

rodrigotabsan avatar rodrigotabsan commented on May 24, 2024

Hello adityadate1997,

You need to store the template into your fingerprint sensor and compare it with the fingerprint that the sensor is receiving from the user. Probably, you will need to store templates from a database to the database of the sensor to check the fingerprint that your sensor has received and compare it with the fingerprints of the database.

Good luck

from adafruit-fingerprint-sensor-library.

shreeramkulkarni avatar shreeramkulkarni commented on May 24, 2024

@rodrigotabsan Are you able to get the templates out from the sensor and store those templates into another sensor's flash memory? If so what sensor are you using ?
I'm also trying to achieve the same thing using NodeMCU and R307.

from adafruit-fingerprint-sensor-library.

rodrigotabsan avatar rodrigotabsan commented on May 24, 2024

@shreeramk1998 I didn't try that. I can't get the fingerprint template I have stored in an external database to match the one I put on the sensor. I'm not sure this can be done... I've been working on this for several months with no results.

from adafruit-fingerprint-sensor-library.

6000850 avatar 6000850 commented on May 24, 2024

Hello
This is the 3-finger pattern output stored in the module
I have saved these templates in the server database. Can I restore these templates to another module (fingerprint) and be usable?

Attempting to load #1
Template 1 loaded
Attempting to get #1
Template 1 transferring:
534 bytes read.
Decoding packet...
FFFFFFFFFFFFFFFFFF09144BAE6B8A6845BEBE6E4D9D4272AA7B0C76BA77947A95EF9C7EB5E1A482ABC7D90DE993A30F54445703636883651396377E32A45E204D00EF0B091E0E7A7C98780A16A94E3047C3190CC0605F70DF82D390C61C921441F152FFBD1DDF57721022EA517970EE836D7086133DB05673935C1A141675D6504177F6000000003753EF01FFFFFFFF02008200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFD6EF01FFFFFFFF020082CB091455A6AB826425BE9E6E0D9D6272AA7B8C76BA77947A95EF9C7EB5E1A482ABC7590DEB973F378BC79A52D96E2F71B2907F7B42B8AD68EA6844BD85CE3C77C758AEEE5BA97F2ECAC12AD8CB7AFF74DDB03E1AA4F85C947949B472FE2C1F7F233F2D3C4A67EFCE93E63ECA302BB15A3516C04229C675D6C30F77F6000000004076EF01FFFFFFFF080082CB09144BAE6B8A6845BEBE6E4D9D4272AA7B0C76BA
done.
------------------------------------
Attempting to load #2
Template 2 loaded
Attempting to get #2
Template 2 transferring:
534 bytes read.
Decoding packet...
FFFFFFFFFFFFFFFFFF091852A1AA859405C6BE60CDAD0274AB5B0D74B937157556E72BC15598B7B4BA8439B2062970051716C200C3C9425E2D8D2AB7DFE33AD4A78F004DB69EA401FEF01FFFFFFFF020082DC95A39E80F4FAAE6BDCFEEE00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFAFEF01FFFFFFFF020082CB091B4FA26B826805B69E6E0D9D4272AA7B8C76BA77147A97EF1C7EB5E1A482ABC75909E9937B209045F75FF86F876003928D7C02A0445BA770BD45489EA73A5ED96F82C1797F80F8C38EEC44626FBC898E54BA20E0B59AAEC0722667BFB1E1B7DB3CC7D3EEFD5433683A26C94A6FCE05DA69D654287A3A06596BC785FCCBB74230EF01FFFFFFFF080082CB091852A1AA859405C6BE60CDAD0274AB5B0D74B9371578936F1D78B3E22584A7C95A11E7AB773FF847AE2C086D5A651390556E72BC1550EA68C44049DE07C1DB399AA64378E9D8CBC1DEC24E666D98B7B4BA8439FCF8
done.
Attempting to load #3
Template 3 loaded
Attempting to get #3
Template 3 transferring:
534 bytes read.
Decoding packet...
FFFFFFFFFFFFFFFFFF091A59BE4BFA6CC5A6FE6CCC8D8272A97B0D76B977157A93E5989C1802BC050F275855AF56A8FCBA692308EAB8C748CA430B384B17E3C87CF78BD7383E8629F68C2AE972222B5F230B8D5D634CCEFAEC69ADE5ABE1FFCFA41F0EF01FFFFFFFF0200825FFDFADD8565A01605E9A93E7318022FCED30C6F0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFF8EEF01FFFFFFFF020082CB09175EAE2BBA6C45B6FE6CCD9D0272A97B0D76B977157A93EF1D7EB3E12582AFC55801EF9B3303F344E23D536F7E10239C541372B0B7746940F56E68EE7D3586992A6E9B2AA9504344DF464A68B8E2DF8E118CAA9432BECC28F79A804E3D83C738B80B3AE8FC1790407E70BB216FC28A564332FB3945BA191BDA4B669A54DE3D14EF01FFFFFFFF080082CB091A59BE4BFA6CC5A6FE6CCC8D8272A97B0D76B977157A93EF1D7CB3E02580A7C15A01E78B0F1F79C48608736FF63B95989C1802BC050F275854038
done.

please guide me
Thanks

from adafruit-fingerprint-sensor-library.

hanifizzudinrahman avatar hanifizzudinrahman commented on May 24, 2024

from adafruit-fingerprint-sensor-library.

a2br avatar a2br commented on May 24, 2024

I want to download and store the template in my server datatabase, I am using NodeMCU and Php with mysql on server side. This function is not provided in the library. Can anybody please guide me on this?

of course, i can help you. NodeMCU i think can use as Arduino, so it can be work with module fingerprint R307 or DY50

Can we connect through an email? I'll send in the required code for you to see.

I'd be really interested to find out how you did that. Could you please reach out to me or make what you learned public by any means?

from adafruit-fingerprint-sensor-library.

mlinaje avatar mlinaje commented on May 24, 2024

After reading all the datasheets I have found. Does someone knows if the template/signature of the fingerprint format follows some kind of standard such as ISO, ANSI,...?
Thanks in advance!

from adafruit-fingerprint-sensor-library.

Dygear avatar Dygear commented on May 24, 2024

So, I read the datasheet, looks like this uses the DownImage function documented here on page 19. You can also upload an image to the sensor with UpImage (found on page 18.)

The images themselves and the formatting used are documented on page 8 (under the title 4.1.1 Image Buffer) says that the captured images are 256x288 pixels in size.

When uploading or downloading images though the UART port, in order to speed up the speed, only the upper four bits of the pixel byte are used that is, 16-level grayscale is used, and each byte represents two pixels (the high four bits are one pixel, and the low four bits are the same. A pixel in the next adjacent column of the row, that is to pixels are combined into one byte and transmitted). Since the image is16 grayscale levels, uploaded to PC When displaying (corresponding to BMP format), the grayscale should be expanded (expanded to 256 grayscale, i.e. 8bit bitmap format.)
Transmission though the USB port is a full 8-bit pixel, that is, 256 gray levels.

What I think is needed is for the image to tz function Img2Tz page 19 again, after capturing / sending two images with that function it stores the first image in CharBuffer1 and CharBuffer2. Then you can run the RegModel function (page 20) that takes the contents of CharBuffer1 and CharBuffer1 and tries to make a template model out of it.

On page 21 it looks like you can straight up take the template model (they are now calling it characteristics) and "upload" that to the host computer. On page 21 again it has the DownChar function that allows you to download into the characestirics buffers and then you can save them into the flash memory with the store function call.

I think the only functions you really need are the UpChar, DownChar and Store functions in order to sync a database across multiple devices and have it return the same position ID. If they became out of sync you can always delete the database and copy one fingerprint reader to another using the Empty function (documented on page 24).

Edit: I call all of these functions, but really they are called "Instructions" in the document parlance.

from adafruit-fingerprint-sensor-library.

Gitare420 avatar Gitare420 commented on May 24, 2024

Hi, I'm having trouble pasting the template.

get.template gives me this

57,1,7E,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,0,2,0,83,0,0,30,C,F3,33,F3,CF,FF,FE,EF,FF,FB,FB,EE,EF,EA,AA,AA,A9,95,66,59,55,55,65,55,55,51,54,40,44,4,40,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,.
3E,8A,EC,DE,4E,8B,57,1E,33,9D,52,BE,58,21,3,7E,46,A3,42,9E,24,A7,50,1E,5B,AA,46,1E,2E,2C,4F,9E,33,B9,27,3E,33,C2,E,7E,3E,8F,0,FF,6B,14,19,5F,51,14,D7,9F,4D,A5,17,FF,21,B6,E5,3F,48,37,95,1F,67,BB,DD,BF,25,41,CE,7F,57,C2,C7,9F,40,C3,9,BF,4D,43,88,DF,3B,2B,52,FA,36,2C,69,78,26,C6,4F,1E,38,50,4D,3C,3E,C6,D,DA,2A,50,A4,18,4A,D1,7,78,3D,C9,4D,99,42,C9,C9,B9,5A,4B,8,B9,42,CE,C,39,.
46,51,9,99,59,CD,9F,F5,59,CE,8,55,2E,50,65,95,2E,D0,8E,D5,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,.
3,3,56,17,0,1,20,1,85,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,0,2,0,77,0,0,30,C,F3,33,F3,CF,FF,FE,EF,FF,EF,BB,BA,AA,AA,AA,AA,65,55,55,95,55,55,45,51,10,44,4,40,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,.

and I paste it in write_to_sensor like this

uint8_t fingerTemplate[512] = {3, 3, 58, 25, 14, 1, 57, 1, 7E, 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, 0, 2, 0, 83, 0, 0, 30, C, F3, 33, F3, CF, FF, FE, EF, FF, FB, FB, EE, EF, EA, AA, AA, A9, 95, 66, 59, 55, 55, 65, 55, 55, 51, 54, 40, 44, 4, 40, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3E, 8A, EC, DE, 4E, 8B, 57, 1E, 33, 9D, 52, BE, 58, 21, 3, 7E, 46, A3, 42, 9E, 24, A7, 50, 1E, 5B, AA, 46, 1E, 2E, 2C, 4F, 9E, 33, B9, 27, 3E, 33, C2, E, 7E, 3E, 8F, 0, FF, 6B, 14, 19, 5F, 51, 14, D7, 9F, 4D, A5, 17, FF, 21, B6, E5, 3F, 48, 37, 95, 1F, 67, BB, DD, BF, 25, 41, CE, 7F, 57, C2, C7, 9F, 40, C3, 9, BF, 4D, 43, 88, DF, 3B, 2B, 52, FA, 36, 2C, 69, 78, 26, C6, 4F, 1E, 38, 50, 4D, 3C, 3E, C6, D, DA, 2A, 50, A4, 18, 4A, D1, 7, 78, 3D, C9, 4D, 99, 42, C9, C9, B9, 5A, 4B, 8, B9, 42, CE, C, 39, .46, 51, 9, 99, 59, CD, 9F, F5, 59, CE, 8, 55, 2E, 50, 65, 95, 2E, D0, 8E, D5, 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, 3, 3, 56, 17, 0, 1, 20, 1, 85, 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, 0, 2, 0, 77, 0, 0, 30, C, F3, 33, F3, CF, FF, FE, EF, FF, EF, BB, BA, AA, AA, AA, AA, 65, 55, 55, 95, 55, 55, 45, 51, 10, 44, 4, 40, 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};

and it throws me the error exponent has no digits

What can be? Thanks in advance :)

from adafruit-fingerprint-sensor-library.

AsifKhan991 avatar AsifKhan991 commented on May 24, 2024

Hi, I'm having trouble pasting the template.

get.template gives me this

57,1,7E,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,0,2,0,83,0,0,30,C,F3,33,F3,CF,FF,FE,EF,FF,FB,FB,EE,EF,EA,AA,AA,A9,95,66,59,55,55,65,55,55,51,54,40,44,4,40,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,.
3E,8A,EC,DE,4E,8B,57,1E,33,9D,52,BE,58,21,3,7E,46,A3,42,9E,24,A7,50,1E,5B,AA,46,1E,2E,2C,4F,9E,33,B9,27,3E,33,C2,E,7E,3E,8F,0,FF,6B,14,19,5F,51,14,D7,9F,4D,A5,17,FF,21,B6,E5,3F,48,37,95,1F,67,BB,DD,BF,25,41,CE,7F,57,C2,C7,9F,40,C3,9,BF,4D,43,88,DF,3B,2B,52,FA,36,2C,69,78,26,C6,4F,1E,38,50,4D,3C,3E,C6,D,DA,2A,50,A4,18,4A,D1,7,78,3D,C9,4D,99,42,C9,C9,B9,5A,4B,8,B9,42,CE,C,39,.
46,51,9,99,59,CD,9F,F5,59,CE,8,55,2E,50,65,95,2E,D0,8E,D5,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,.
3,3,56,17,0,1,20,1,85,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,0,2,0,77,0,0,30,C,F3,33,F3,CF,FF,FE,EF,FF,EF,BB,BA,AA,AA,AA,AA,65,55,55,95,55,55,45,51,10,44,4,40,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,.

and I paste it in write_to_sensor like this

uint8_t fingerTemplate[512] = {3, 3, 58, 25, 14, 1, 57, 1, 7E, 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, 0, 2, 0, 83, 0, 0, 30, C, F3, 33, F3, CF, FF, FE, EF, FF, FB, FB, EE, EF, EA, AA, AA, A9, 95, 66, 59, 55, 55, 65, 55, 55, 51, 54, 40, 44, 4, 40, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3E, 8A, EC, DE, 4E, 8B, 57, 1E, 33, 9D, 52, BE, 58, 21, 3, 7E, 46, A3, 42, 9E, 24, A7, 50, 1E, 5B, AA, 46, 1E, 2E, 2C, 4F, 9E, 33, B9, 27, 3E, 33, C2, E, 7E, 3E, 8F, 0, FF, 6B, 14, 19, 5F, 51, 14, D7, 9F, 4D, A5, 17, FF, 21, B6, E5, 3F, 48, 37, 95, 1F, 67, BB, DD, BF, 25, 41, CE, 7F, 57, C2, C7, 9F, 40, C3, 9, BF, 4D, 43, 88, DF, 3B, 2B, 52, FA, 36, 2C, 69, 78, 26, C6, 4F, 1E, 38, 50, 4D, 3C, 3E, C6, D, DA, 2A, 50, A4, 18, 4A, D1, 7, 78, 3D, C9, 4D, 99, 42, C9, C9, B9, 5A, 4B, 8, B9, 42, CE, C, 39, .46, 51, 9, 99, 59, CD, 9F, F5, 59, CE, 8, 55, 2E, 50, 65, 95, 2E, D0, 8E, D5, 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, 3, 3, 56, 17, 0, 1, 20, 1, 85, 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, 0, 2, 0, 77, 0, 0, 30, C, F3, 33, F3, CF, FF, FE, EF, FF, EF, BB, BA, AA, AA, AA, AA, 65, 55, 55, 95, 55, 55, 45, 51, 10, 44, 4, 40, 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};

and it throws me the error exponent has no digits

What can be? Thanks in advance :)

These are actually hex values. You need to put '0x' before the hex values. Like this: 0xFE

@Gitare420 check this repo again after 4hrs (busy with other stuffs) , I will update the get template example to show hex values with '0x'.
I know it's hard to put '0x' before 512 values.

from adafruit-fingerprint-sensor-library.

Gitare420 avatar Gitare420 commented on May 24, 2024

Thanks for answering, it was easy to put the 0x using the replace tool of the notepad, I stay like this

uint8_t fingerTemplate[512] = {0x3, 0x3, 0x59, 0x16, 0x0, 0x1, 0x20, 0x1, 0x7D, 0x0, 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, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xF, 0x0, 0x1, 0x0, 0x6D, 0x0, 0xC, 0xC, 0x33, 0xCF, 0xCC, 0xFF, 0x3F, 0xEE, 0xFF, 0xEF, 0xEE, 0xEB, 0xAE, 0xBB, 0xA6, 0x99, 0x99, 0x95, 0x95, 0x56, 0x51, 0x55, 0x15, 0x11, 0x54, 0x41, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0};

Then I used the write function and it uploaded without problems, but when using the fingerprint scheme to read it tells me

"Image taken
Image converted
Did not find a match"

Did I do something wrong?

from adafruit-fingerprint-sensor-library.

AsifKhan991 avatar AsifKhan991 commented on May 24, 2024

@Gitare420 Did you use the same sensor for reading the template from and writing to back it? What is the model pf the sensor? Also what id you enrolled against?

from adafruit-fingerprint-sensor-library.

Gitare420 avatar Gitare420 commented on May 24, 2024

use the same model 071405 finger to read and write, with the id 1

from adafruit-fingerprint-sensor-library.

Gitare420 avatar Gitare420 commented on May 24, 2024

I am attaching my codes, I am using the example ones that the library brings, sorry for my bad English, I am using google translator, greetings from Chile :)

//////////////////////////////////// get_template ////////////////////////////////////
#include <Adafruit_Fingerprint.h>
Adafruit_Fingerprint finger = Adafruit_Fingerprint(&Serial2);

uint8_t f_buf[512]; //here is where the template data is sotred

void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
finger.begin(57600);
while (!Serial); // For Yun/Leo/Micro/Zero/...
delay(100);
Serial.println("\n\nAdafruit finger detect test");

if (finger.verifyPassword()) {
Serial.println("Found fingerprint sensor!");
} else {
Serial.println("Did not find fingerprint sensor :(");
while (1) { delay(1); }
}
store_template_to_buf();
}

void store_template_to_buf(){

Serial.println("Waiting for valid finger....");
while (finger.getImage() != FINGERPRINT_OK) { // press down a finger take 1st image
}
Serial.println("Image taken");

if (finger.image2Tz(1) == FINGERPRINT_OK) { //creating the charecter file for 1st image
Serial.println("Image converted");
} else {
Serial.println("Conversion error");
return;
}

Serial.println("Remove finger");
delay(2000);
uint8_t p = 0;
while (p != FINGERPRINT_NOFINGER) {
p = finger.getImage();
}

Serial.println("Place same finger again, waiting....");
while (finger.getImage() != FINGERPRINT_OK) { // press the same finger again to take 2nd image
}
Serial.println("Image taken");

if (finger.image2Tz(2) == FINGERPRINT_OK) { //creating the charecter file for 2nd image
Serial.println("Image converted");
} else {
Serial.println("Conversion error");
return;
}

Serial.println("Creating model...");

if (finger.createModel() == FINGERPRINT_OK) { //creating the template from the 2 charecter files and saving it to char buffer 1
Serial.println("Prints matched!");
Serial.println("Template created");
} else {
Serial.println("Template not build");
return;
}

Serial.println("Attempting to get template...");
if (finger.getModel() == FINGERPRINT_OK) { //requesting sensor to transfer the template data to upper computer (this microcontroller)
Serial.println("Transferring Template....");
} else {
Serial.println("Failed to transfer template");
return;
}

if (finger.get_template_buffer(512, f_buf) == FINGERPRINT_OK) { //read the template data from sensor and save it to buffer f_buf
Serial.println("Template data (comma sperated HEX):");
for (int k = 0; k < (512/finger.packet_len); k++) { //printing out the template data in seperate rows, where row-length = packet_length
for (int l = 0; l < finger.packet_len; l++) {
Serial.print(f_buf[(k * finger.packet_len) + l], HEX);
Serial.print(",");
}
Serial.println(".");
}
}

}

void loop() {}
//////////////////////////////////// get_template ////////////////////////////////////

//////////////////////////////////// write_to_sensor ////////////////////////////////////
#include <Adafruit_Fingerprint.h>
Adafruit_Fingerprint finger = Adafruit_Fingerprint(&Serial2);

void setup() {
Serial.begin(115200);
finger.begin(57600); //set your sensor's baudrate
if (finger.verifyPassword()) {
Serial.println("Found fingerprint sensor!");
} else {
Serial.println("Did not find fingerprint sensor :(");
while (1);
}
write_template_data_to_sensor();
}

uint8_t readnumber(void) {
uint8_t num = 0;

while (num == 0) {
while (! Serial.available());
num = Serial.parseInt();
}
return num;
}

void write_template_data_to_sensor() {
uint8_t fingerTemplate[512] = {0x3, 0x3, 0x59, 0x1A, 0x8, 0x1, 0x28, 0x1, 0x81, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x9, 0x0, 0x0, 0x0, 0x81, 0x0, 0x0, 0x0, 0x0, 0xC, 0xC3, 0xCF, 0x33, 0xCF, 0xFF, 0xFF, 0xFF, 0xEE, 0xFF, 0xBB, 0xEE, 0xEB, 0xAA, 0xAA, 0xAA, 0xA9, 0x99, 0x95, 0x99, 0x55, 0x65, 0x55, 0x45, 0x55, 0x11, 0x54, 0x51, 0x4, 0x1, 0x1, 0x1, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x32, 0x15, 0x52, 0x7E, 0x5C, 0xA1, 0x6, 0x9E, 0x37, 0x3A, 0x4E, 0x3E, 0x59, 0xBA, 0x87, 0x9E, 0x27, 0xBF, 0x8F, 0x3E, 0x3B, 0x87, 0x0, 0xFF, 0x4E, 0x8B, 0xD7, 0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0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3, 0x3, 0x5B, 0x1A, 0x0, 0x1, 0x20, 0x1, 0x7F, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xA, 0x0, 0x0, 0x0, 0x81, 0x0, 0x0, 0x0, 0x0, 0x33, 0x33, 0x3C, 0xF3, 0xCF, 0xFF, 0xFF, 0xFE, 0xFB, 0xFE, 0xEF, 0xBA, 0xEB, 0xAA, 0xAA, 0xAA, 0xA9, 0x99, 0x56, 0x65, 0x55, 0x95, 0x55, 0x15, 0x54, 0x45, 0x51, 0x11, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0};
memset(fingerTemplate, 0xff, 512);

Serial.println("Ready to write template to sensor...");
Serial.println("Enter the id to enroll against, i.e id (1 to 127)");
int id = readnumber();
if (id == 0) {// ID #0 not allowed, try again!
return;
}
Serial.print("Writing template against ID #"); Serial.println(id);

if (finger.write_template_to_sensor(fingerTemplate)) { //telling the sensor to download the template data to it's char buffer from upper computer (this microcontroller's "fingerTemplate" buffer)
Serial.println("now writing to sensor...");
} else {
Serial.println("writing to sensor failed");
return;
}

Serial.print("ID "); Serial.println(id);
if (finger.storeModel(id) == FINGERPRINT_OK) { //saving the template against the ID you entered or manually set
Serial.print("Successfully stored against ID#"); Serial.println(id);
} else {
Serial.println("Storing error");
return ;
}
}

void loop() {}
//////////////////////////////////// write_to_sensor ////////////////////////////////////

//////////////////////////////////// fingerprint ////////////////////////////////////
#include <Adafruit_Fingerprint.h>
Adafruit_Fingerprint finger = Adafruit_Fingerprint(&Serial2);

void setup()
{
Serial.begin(115200);
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); }
}

Serial.println(F("Reading sensor parameters"));
finger.getParameters();
Serial.print(F("Status: 0x")); Serial.println(finger.status_reg, HEX);
Serial.print(F("Sys ID: 0x")); Serial.println(finger.system_id, HEX);
Serial.print(F("Capacity: ")); Serial.println(finger.capacity);
Serial.print(F("Security level: ")); Serial.println(finger.security_level);
Serial.print(F("Device address: ")); Serial.println(finger.device_addr, HEX);
Serial.print(F("Packet len: ")); Serial.println(finger.packet_len);
Serial.print(F("Baud rate: ")); Serial.println(finger.baud_rate);

finger.getTemplateCount();

if (finger.templateCount == 0) {
Serial.print("Sensor doesn't contain any fingerprint data. Please run the 'enroll' example.");
}
else {
Serial.println("Waiting for valid finger...");
Serial.print("Sensor contains "); Serial.print(finger.templateCount); Serial.println(" templates");
}
}

void loop() // run over and over again
{
getFingerprintID();
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.fingerSearch();
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);
return finger.fingerID;
}
//////////////////////////////////// fingerprint ////////////////////////////////////

from adafruit-fingerprint-sensor-library.

AsifKhan991 avatar AsifKhan991 commented on May 24, 2024

@Gitare420 in the "write_to_sensor" example you have to comment out or delete the line "memset(fingerTemplate, 0xff, 512);" if you've manually put the template data in the array buffer before this line. (as you have done). This line was simply done to initiate the array buffer when it was previously empty. So comment out his line and let me know if it works or not.
IMG_20220906_185054.jpg

from adafruit-fingerprint-sensor-library.

hanifizzudinrahman avatar hanifizzudinrahman commented on May 24, 2024

I was also in need of such functionalities (to read, save and write back template data to similar sensor models) and thus came up with an update to the existing library. @Dygear what you said is correct. I have a pull request pending about this. Please checkout my repository about this update. Also checkout the changes I've made.

However, keep in mind that writing template data from one model to another won't serve the purpose as different sensor models might use different template matching algorithms.

Hope I was able to help!

yap, that's right

from adafruit-fingerprint-sensor-library.

AsifKhan991 avatar AsifKhan991 commented on May 24, 2024

@Gitare420 @hanifizzudinrahman I made some changes in the write_template_to_sensor() function. Check if it works now. Also currently I don't have access to the modules. Tomorrow I will have them and check again thoroughly.

from adafruit-fingerprint-sensor-library.

Gitare420 avatar Gitare420 commented on May 24, 2024

Hello, I updated the library and it's still the same, from what I've seen my model 071405 is the least used, it may be the reason why it doesn't work, these are the data that the fingerprint example gives me:

Reading sensor parameters
Status: 0x0
SysID: 0x0
Capacity: 300
Security level: 3
Device address: FFFFFFFF
Packet length: 128
Baud rate: 57600
Waiting for valid finger...
Sensor contains 1 templates

I think I'll buy the 307 model through AliExpress (it doesn't exist in Chile) and I'll keep trying there so as not to waste my time, I'll be attentive to the updates, thank you very much :)

from adafruit-fingerprint-sensor-library.

Gitare420 avatar Gitare420 commented on May 24, 2024

I leave the last test I did in case it helps someone :)

//////////////////////////////////// write_to_sensor ////////////////////////////////////

#include <Adafruit_Fingerprint.h>
Adafruit_Fingerprint finger = Adafruit_Fingerprint(&Serial2);

void setup() {
Serial.begin(115200);
finger.begin(57600); //set your sensor's baudrate
if (finger.verifyPassword()) {
Serial.println("Found fingerprint sensor!");
} else {
Serial.println("Did not find fingerprint sensor :(");
while (1);
}
write_template_data_to_sensor();
}

uint8_t readnumber(void) {
uint8_t num = 0;

while (num == 0) {
while (! Serial.available());
num = Serial.parseInt();
}
return num;
}

void write_template_data_to_sensor() {
uint8_t fingerTemplate[512] = {0x3, 0x3, 0x50, 0x16, 0x0, 0x1, 0x20, 0x1, 0x7F, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 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0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x10, 0x0, 0x3, 0x0, 0x6D, 0x0, 0x33, 0xCC, 0x3F, 0x3, 0xFC, 0x3F, 0xFF, 0xEF, 0xFF, 0xFE, 0xFF, 0xAA, 0xAA, 0xAA, 0xAA, 0xA9, 0x95, 0x55, 0x55, 0x54, 0x55, 0x51, 0x51, 0x54, 0x40, 0x4, 0x44, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0};

Serial.println("Ready to write template to sensor...");
Serial.println("Enter the id to enroll against, i.e id (1 to 127)");
int id = readnumber();
if (id == 0) {// ID #0 not allowed, try again!
return;
}
Serial.print("Writing template against ID #"); Serial.println(id);

if (finger.write_template_to_sensor(fingerTemplate)) { //telling the sensor to download the template data to it's char buffer from upper computer (this microcontroller's "fingerTemplate" buffer)
Serial.println("now writing to sensor...");
} else {
Serial.println("writing to sensor failed");
return;
}

Serial.print("ID "); Serial.println(id);
if (finger.storeModel(id) == FINGERPRINT_OK) { //saving the template against the ID you entered or manually set
Serial.print("Successfully stored against ID#"); Serial.println(id);
} else {
Serial.println("Storing error");
return ;
}
}

void loop() {}

//////////////////////////////////// write_to_sensor ////////////////////////////////////

from adafruit-fingerprint-sensor-library.

AsifKhan991 avatar AsifKhan991 commented on May 24, 2024

There were indeed some issues with template buffer size. Those are now fixed. @Gitare420 sorry to bother, but will you please let me know if the issue is now solved or not? (use the new "get_direct_template.ino" example to get the template)

from adafruit-fingerprint-sensor-library.

AsifKhan991 avatar AsifKhan991 commented on May 24, 2024

Create an example to add fingerprints and get the templates at the same time. I use an esp32.

////////////////////////////////////////enrol+get_direct_template////////////////////////////////////////
#include <Adafruit_Fingerprint.h>

Adafruit_Fingerprint finger = Adafruit_Fingerprint(&Serial2);

uint8_t f_buf[512]; //here is where the template data is sotred
uint8_t id = 6;
char Button;
int Condition_Read_Finger = '1';

void store_template_to_buf() {

Serial.println("Waiting for valid finger....");
while (finger.getImage() != FINGERPRINT_OK) { // press down a finger take 1st image
}
Serial.println("Image taken");

if (finger.image2Tz(1) == FINGERPRINT_OK) { //creating the charecter file for 1st image
Serial.println("Image converted");
} else {
Serial.println("Conversion error");
return;
}
Serial.println("Remove finger");
delay(2000);
uint8_t p = 0;
while (p != FINGERPRINT_NOFINGER) {
p = finger.getImage();
}

Serial.println("Place same finger again, waiting....");
while (finger.getImage() != FINGERPRINT_OK) { // press the same finger again to take 2nd image
}
Serial.println("Image taken");

if (finger.image2Tz(2) == FINGERPRINT_OK) { //creating the charecter file for 2nd image
Serial.println("Image converted");
} else {
Serial.println("Conversion error");
return;
}

Serial.println("Creating model...");
if (finger.createModel() == FINGERPRINT_OK) { //creating the template from the 2 charecter files and saving it to char buffer 1
Serial.println("Prints matched!");
Serial.println("Template created");
} else {
Serial.println("Template not build");
return;
}

Serial.print("ID "); Serial.println(id);
if (finger.storeModel(id) == FINGERPRINT_OK) {
p = finger.storeModel(id); if (p == FINGERPRINT_OK) {
Serial.println("Stored!");
} else {
Serial.println("Unknown error");
return;
}

Serial.println("Attempting to get template...");
if (finger.getModel() == FINGERPRINT_OK) {  //requesting sensor to transfer the template data to upper computer (this microcontroller)
  Serial.println("Transferring Template....");
} else {
  Serial.println("Failed to transfer template");
  return;
}


if (finger.get_template_buffer(512, f_buf) == FINGERPRINT_OK) { //read the template data from sensor and save it to buffer f_buf
  Serial.println("Template data (comma sperated HEX):");
  for (int k = 0; k < (512 / finger.packet_len); k++) { //printing out the template data in seperate rows, where row-length = packet_length
    for (int l = 0; l < finger.packet_len; l++) {
      Serial.print("0x");
      Serial.print(f_buf[(k * finger.packet_len) + l], HEX);
      Serial.print(",");
    }
  }
}
delay(2000);
Condition_Read_Finger = '1';

}
}

void setup() {
Serial.begin(115200);
finger.begin(57600); //set your sensor's baudrate
if (finger.verifyPassword()) {
Serial.println("Found fingerprint sensor!");
} else {
Serial.println("Did not find fingerprint sensor :(");
while (1);
}

Serial.print("write 't' to the serial monitor followed by the 'id' ");
Serial.println("EXAMPLE 't21' for id 21");

Serial.println("write 'Y' in the serial monitor to delete all fingerprints");
}

void loop()
{
if (Condition_Read_Finger == '1') {
getFingerprintID();
delay(50); //don't ned to run this at full speed.
}

if (Serial.available() != 0) {
Button = Serial.read();

if (Button == 't') {
  Condition_Read_Finger = '0';
  id = Serial.parseInt();
  Serial.print("Enrolling ID #");
  Serial.println(id);
  store_template_to_buf();
}

if (Button == 'Y') {
  finger.emptyDatabase();
  Serial.println("Now database is empty :)");
}

}
}

uint8_t getFingerprintID() {
uint8_t p = finger.getImage();
switch (p) {
case FINGERPRINT_OK:
Serial.println("Image taken");
break;
case FINGERPRINT_NOFINGER:
return p;
}

// OK success!

p = finger.image2Tz();
switch (p) {
case FINGERPRINT_OK:
Serial.println("Image converted");
break;
}

// OK converted!
p = finger.fingerSearch();
if (p == FINGERPRINT_OK) {
Serial.println("Found a print match!");
} 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);
return finger.fingerID;
}
////////////////////////////////////////enrol+get_direct_template////////////////////////////////////////

it's better to keep your work in your repository and share the repository link in the comment section.

from adafruit-fingerprint-sensor-library.

Gitare420 avatar Gitare420 commented on May 24, 2024

Sorry, I made an account here 4 days ago and I'm learning how this works :)

from adafruit-fingerprint-sensor-library.

Gitare420 avatar Gitare420 commented on May 24, 2024

Hello, sorry for so many doubts, this is the last one hahaha, how can I write the templates from an sd card? I use an esp32 and the libraries:

#include "FS.h"
#include "SD.h"
#include "SPI.h"

I have a txt that stores only 1 template:

0x3, 0x3, 0x5B, 0x16, 0x14, 0x1, 0x3C, 0x1, 0x84, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x12, 0x0, 0x4, 0x0, 0x85, 0x0, 0x3C, 0x0, 0xC0, 0x3C, 0xCC, 0xCF, 0xFF, 0xF3, 0xFE, 0xFF, 0xFF, 0xBE, 0xEB, 0xAA, 0xBA, 0xAA, 0xAA, 0xAA, 0xBA, 0xA9, 0x95, 0x65, 0x55, 0x55, 0x55, 0x55, 0x51, 0x15, 0x54, 0x0, 0x0, 0x0, 0x44, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x57, 0x12, 0x5A, 0x5E, 0x1C, 0x99, 0x53, 0x5E, 0x56, 0x98, 0x4, 0x3E, 0x35, 0x1A, 0xD5, 0xBE, 0x67, 0x9A, 0x84, 0x3E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, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3, 0x3, 0x57, 0x15, 0x0, 0x1, 0x20, 0x1, 0x85, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x5, 0x0, 0x4, 0x0, 0x7D, 0x0, 0x0, 0x0, 0x0, 0xC, 0x0, 0xCC, 0xC, 0xF3, 0xF3, 0xFF, 0xFF, 0xEF, 0xFF, 0xBF, 0xBE, 0xBA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xA9, 0x95, 0x55, 0x55, 0x55, 0x54, 0x55, 0x54, 0x11, 0x54, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,

How can I write all that in the function

uint8_t fingerTemplate[512]={0x03,0x0E,....your template data.....};

As I understand
memset(fingerTemplate, 0xff, 512);
has something to do with it.

Thank you very much in advance :)

from adafruit-fingerprint-sensor-library.

dody3030 avatar dody3030 commented on May 24, 2024

Hello everybody, I'm confused about the template size, I got R503 fingerprint when I read the datasheet I noticed that the template size is 768 bytes not 512, is there is anything I need to change in AssifKhan991's libraries. Thanks in advance

from adafruit-fingerprint-sensor-library.

AsifKhan991 avatar AsifKhan991 commented on May 24, 2024

@dody3030 just change the array buffer size to 768. I.e : finger.get_template_buffer(768,your_arr_buff) to get the template data and finger.write_template_to_sensor(768, your_arr_buff) to write template back to sensor.

from adafruit-fingerprint-sensor-library.

dody3030 avatar dody3030 commented on May 24, 2024

write_template_to_sensor

@AsifKhan991 what about the memset(ref_buf, 0xff, 512) in Adafruit_Fingerprint.cpp

from adafruit-fingerprint-sensor-library.

AsifKhan991 avatar AsifKhan991 commented on May 24, 2024

write_template_to_sensor

@AsifKhan991 what about the memset(ref_buf, 0xff, 512) in Adafruit_Fingerprint.cpp

Updated this to take value from 'bufsize' variable

from adafruit-fingerprint-sensor-library.

dody3030 avatar dody3030 commented on May 24, 2024

The controller get crash and reboot immediately after successfully store the model finger.storeModel, so the finger is stored successfully, then the model is loaded successfully, getModel(), the crash start after calling the function finger.get_template_buffer
` Serial.print("ID "); Serial.println(id);
s = finger.storeModel(id);
if (s == FINGERPRINT_OK) {
//id = (finger.templateCount + 1);
Serial.println("Stored!");
finger.LEDcontrol(FINGERPRINT_LED_FLASHING, 25, FINGERPRINT_LED_BLUE, 20);
finger.LEDcontrol(FINGERPRINT_LED_GRADUAL_ON, 200, FINGERPRINT_LED_BLUE);
delay(2000);
finger.LEDcontrol(FINGERPRINT_LED_GRADUAL_OFF, 200, FINGERPRINT_LED_BLUE);
delay(2000);
finger.LEDcontrol(FINGERPRINT_LED_GRADUAL_ON, 200, FINGERPRINT_LED_BLUE);
delay(2000);
finger.LEDcontrol(FINGERPRINT_LED_GRADUAL_OFF, 200, FINGERPRINT_LED_BLUE);
delay(2000);
} else if (s == FINGERPRINT_PACKETRECIEVEERR) {
Serial.println("Communication error");
return s;
} else if (s == FINGERPRINT_BADLOCATION) {
Serial.println("Could not store in that location");
return s;
} else if (s == FINGERPRINT_FLASHERR) {
Serial.println("Error writing to flash");
return s;
} else {
Serial.println("Unknown error");
return s;
}

// Try to get the template //
Serial.println("Attempting to get template...");
if (finger.getModel() == FINGERPRINT_OK) { //requesting sensor to transfer the template data to upper computer (this microcontroller)
Serial.println("Transferring Template....");
} else {
Serial.println("Failed to transfer template");
return s;
}

if (finger.get_template_buffer(768, f_buf) == FINGERPRINT_OK) { //read the template data from sensor and save it to buffer f_buf
Serial.println("Template data (comma sperated HEX):");
for (int k = 0; k < (512 / finger.packet_len); k++) { //printing out the template data in seperate rows, where row-length = packet_length
for (int l = 0; l < finger.packet_len; l++) {
Serial.print("0x");
Serial.print(f_buf[(k * finger.packet_len) + l], HEX);
Serial.print(",");
}
}
}`

ID 2
Stored!
Attempting to get template...
Transferring Template....

User exception (panic/abort/assert)
--------------- CUT HERE FOR EXCEPTION DECODER ---------------

Panic core_esp8266_main.cpp:215 loop_task

stack>>>

ctx: sys
sp: 3fffeee0 end: 3fffffb0 offset: 0000
3fffeee0: 4020d968 00009ba3 3ffeefa4 4020d99b
3fffeef0: 000000fe 00000000 00000000 00000000
3fffef00: 00000000 00000000 00000000 3ffeea78
3fffef10: 3ffeea98 3ffeea98 3ffee450 3ffeea34
3fffef20: 3fffdad0 00000000 3ffe85e4 40203f02
3fffef30: 40236b02 3fffdab0 00000000 40203f6f
3fffef40: 00000000 3fffdad0 3ffeea34 402038fc
3fffef50: 40000f49 40000f49 3fffdab0 40000f49
3fffef60: 40000e19 00044f11 00000000 00000005
3fffef70: 00000000 aa55aa55 000000d4 40105951
3fffef80: 40105957 00000000 00000005 40100f08
3fffef90: 4010000d 30602020 00044f11 401000ac
3fffefa0: 40226e40 3fffef3c 40226df9 3ffffd28
3fffefb0: 3fffffc0 00000000 00000000 feefeffe
3fffefc0: feefeffe feefeffe feefeffe feefeffe
3fffefd0: feefeffe feefeffe feefeffe feefeffe
3fffefe0: feefeffe feefeffe feefeffe feefeffe
3fffeff0: feefeffe feefeffe feefeffe feefeffe
3ffff000: feefeffe feefeffe feefeffe feefeffe
3ffff010: feefeffe feefeffe feefeffe feefeffe
3ffff020: feefeffe feefeffe feefeffe feefeffe
3ffff030: feefeffe feefeffe feefeffe feefeffe
3ffff040: feefeffe feefeffe feefeffe feefeffe
3ffff050: feefeffe feefeffe feefeffe feefeffe
3ffff060: feefeffe feefeffe feefeffe feefeffe
3ffff070: feefeffe feefeffe feefeffe feefeffe
3ffff080: feefeffe feefeffe feefeffe feefeffe
3ffff090: feefeffe feefeffe feefeffe feefeffe
3ffff0a0: feefeffe feefeffe feefeffe feefeffe
3ffff0b0: feefeffe feefeffe feefeffe feefeffe
3ffff0c0: feefeffe feefeffe feef
--------------- CUT HERE FOR EXCEPTION DECODER ---------------

Panic core_esp8266_main.cpp:215 loop_task

stack>>>

from adafruit-fingerprint-sensor-library.

AsifKhan991 avatar AsifKhan991 commented on May 24, 2024

@dody3030 need to see your code

from adafruit-fingerprint-sensor-library.

dody3030 avatar dody3030 commented on May 24, 2024

@AsifKhan991 I'm using the default example, I just added the changes at the end of the function. and added uint8_t f_buf[512]; at the beginning.

> uint8_t getFingerprintEnroll() {

uint8_t f_buf[512]; //here is where the template data is sotred
int s = -1;
Serial.print("Waiting for valid finger to enroll as #"); Serial.println(id);
finger.LEDcontrol(FINGERPRINT_LED_FLASHING, 25, FINGERPRINT_LED_PURPLE, 0);
while (s != FINGERPRINT_OK) {
s = finger.getImage();
switch (s) {
case FINGERPRINT_OK:
Serial.println("Image taken");
finger.LEDcontrol(FINGERPRINT_LED_FLASHING, 25, FINGERPRINT_LED_PURPLE, 1);
delay(2000);
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!

s = finger.image2Tz(1);
switch (s) {
case FINGERPRINT_OK:
Serial.println("Image converted");
break;
case FINGERPRINT_IMAGEMESS:
Serial.println("Image too messy");
return s;
case FINGERPRINT_PACKETRECIEVEERR:
Serial.println("Communication error");
return s;
case FINGERPRINT_FEATUREFAIL:
Serial.println("Could not find fingerprint features");
return s;
case FINGERPRINT_INVALIDIMAGE:
Serial.println("Could not find fingerprint features");
return s;
default:
Serial.println("Unknown error");
return s;
}

Serial.println("Remove finger");
finger.LEDcontrol(FINGERPRINT_LED_FLASHING, 25, FINGERPRINT_LED_BLUE, 0);
//////////////// delay(2000);
s = 0;
while (s != FINGERPRINT_NOFINGER) {
s = finger.getImage();
}
Serial.print("ID "); Serial.println(id);
s = -1;
Serial.println("Place same finger again");
finger.LEDcontrol(FINGERPRINT_LED_FLASHING, 25, FINGERPRINT_LED_PURPLE, 0);
while (s != FINGERPRINT_OK) {
s = finger.getImage();
switch (s) {
case FINGERPRINT_OK:
Serial.println("Image taken");
finger.LEDcontrol(FINGERPRINT_LED_FLASHING, 25, FINGERPRINT_LED_PURPLE, 1);
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!

s = finger.image2Tz(2);
switch (s) {
case FINGERPRINT_OK:
Serial.println("Image converted");
break;
case FINGERPRINT_IMAGEMESS:
Serial.println("Image too messy");
return s;
case FINGERPRINT_PACKETRECIEVEERR:
Serial.println("Communication error");
return s;
case FINGERPRINT_FEATUREFAIL:
Serial.println("Could not find fingerprint features");
return s;
case FINGERPRINT_INVALIDIMAGE:
Serial.println("Could not find fingerprint features");
return s;
default:
Serial.println("Unknown error");
return s;
}

// OK converted!
Serial.print("Creating model for #"); Serial.println(id);

s = finger.createModel();
if (s == FINGERPRINT_OK) {
Serial.println("Prints matched!");
} else if (s == FINGERPRINT_PACKETRECIEVEERR) {
Serial.println("Communication error");
return s;
} else if (s == FINGERPRINT_ENROLLMISMATCH) {
Serial.println("Fingerprints did not match");
newfingerprint() ;
// return s;
} else {
Serial.println("Unknown error");
return s;
}

Serial.print("ID "); Serial.println(id);
s = finger.storeModel(id);
if (s == FINGERPRINT_OK) {
//id = (finger.templateCount + 1);
Serial.println("Stored!");
finger.LEDcontrol(FINGERPRINT_LED_FLASHING, 25, FINGERPRINT_LED_BLUE, 20);
finger.LEDcontrol(FINGERPRINT_LED_GRADUAL_ON, 200, FINGERPRINT_LED_BLUE);
delay(2000);
finger.LEDcontrol(FINGERPRINT_LED_GRADUAL_OFF, 200, FINGERPRINT_LED_BLUE);
delay(2000);
finger.LEDcontrol(FINGERPRINT_LED_GRADUAL_ON, 200, FINGERPRINT_LED_BLUE);
delay(2000);
finger.LEDcontrol(FINGERPRINT_LED_GRADUAL_OFF, 200, FINGERPRINT_LED_BLUE);
delay(2000);
} else if (s == FINGERPRINT_PACKETRECIEVEERR) {
Serial.println("Communication error");
return s;
} else if (s == FINGERPRINT_BADLOCATION) {
Serial.println("Could not store in that location");
return s;
} else if (s == FINGERPRINT_FLASHERR) {
Serial.println("Error writing to flash");
return s;
} else {
Serial.println("Unknown error");
return s;
}

// Try to get the template //
Serial.println("Attempting to get template...");
if (finger.getModel() == FINGERPRINT_OK) { //requesting sensor to transfer the template data to upper computer (this microcontroller)
Serial.println("Transferring Template....");
} else {
Serial.println("Failed to transfer template");
return s;
}

if (finger.get_template_buffer(768, f_buf) == FINGERPRINT_OK) { //read the template data from sensor and save it to buffer f_buf
Serial.println("Template data (comma sperated HEX):");
for (int k = 0; k < (512 / finger.packet_len); k++) { //printing out the template data in seperate rows, where row-length = packet_length
for (int l = 0; l < finger.packet_len; l++) {
Serial.print("0x");
Serial.print(f_buf[(k * finger.packet_len) + l], HEX);
Serial.print(",");
}
}
}
// End getting template.
delay(2000);
return true;
}

from adafruit-fingerprint-sensor-library.

AsifKhan991 avatar AsifKhan991 commented on May 24, 2024

@dody3030 issues with your code:

  1. You are using f_buf[512] when you mentioned your template size is 768 bytes. So replace all 512 to 768 in your code

  2. Did not call the finger.loadModel(id) before calling finger.getModel(). Refer to "show_saved_template.ino" example.

from adafruit-fingerprint-sensor-library.

dody3030 avatar dody3030 commented on May 24, 2024

@dody3030 issues with your code:

1. You are using `f_buf[512]` when you mentioned your template size is 768 bytes. So replace all 512 to 768 in your code

2. Did not call the `finger.loadModel(id)` before calling `finger.getModel()`. Refer to "show_saved_template.ino" example.

Actually am trying to get the hex values during the enrollment, so do I need to loadModel() before I getModel?? I checked your previous code examples trying to understand in which stage exactly I have to get the hex, taking into account the template size is different, I will use your example get_direct_template. thank you for your replies really appreciated.

from adafruit-fingerprint-sensor-library.

AsifKhan991 avatar AsifKhan991 commented on May 24, 2024

Actually am trying to get the hex values during the enrollment, so do I need to loadModel() before I getModel??

Usually the template remains on the char buffer if no other operation's done after enrollment. But it might be otherwise due to model variation. So yeah, safe to do so.

from adafruit-fingerprint-sensor-library.

dody3030 avatar dody3030 commented on May 24, 2024

@AsifKhan991 from the example you have shared before, store_template_to_buf ,, I added only else statement to check if the function "get_template_buffer" is executed successfully or not, I changed all 512 to 768 but not working.

uint8_t f_buf[768]; //here is where the template data is sotred

void store_template_to_buf(){

Serial.println("Waiting for valid finger....");
while (finger.getImage() != FINGERPRINT_OK) { // press down a finger take 1st image
}
Serial.println("Image taken");

if (finger.image2Tz(1) == FINGERPRINT_OK) { //creating the charecter file for 1st image
Serial.println("Image converted");
} else {
Serial.println("Conversion error");
return;
}

Serial.println("Remove finger");
delay(2000);
uint8_t p = 0;
while (p != FINGERPRINT_NOFINGER) {
p = finger.getImage();
}

Serial.println("Place same finger again, waiting....");
while (finger.getImage() != FINGERPRINT_OK) { // press the same finger again to take 2nd image
}
Serial.println("Image taken");

if (finger.image2Tz(2) == FINGERPRINT_OK) { //creating the charecter file for 2nd image
Serial.println("Image converted");
} else {
Serial.println("Conversion error");
return;
}

Serial.println("Creating model...");

if (finger.createModel() == FINGERPRINT_OK) { //creating the template from the 2 charecter files and saving it to char buffer 1
Serial.println("Prints matched!");
Serial.println("Template created");
} else {
Serial.println("Template not build");
return;
}

Serial.println("Attempting to get template...");
if (finger.getModel() == FINGERPRINT_OK) { //requesting sensor to transfer the template data to upper computer (this microcontroller)
Serial.println("Transferring Template....");
} else {
Serial.println("Failed to transfer template");
return;
}

if (finger.get_template_buffer(768, f_buf) == FINGERPRINT_OK) { //read the template data from sensor and save it to buffer f_buf
Serial.println("Template data (comma sperated HEX):");
for (int k = 0; k < (768/finger.packet_len); k++) { //printing out the template data in seperate rows, where row-length = packet_length
for (int l = 0; l < finger.packet_len; l++) {
Serial.print("0x");
Serial.print(f_buf[(k * finger.packet_len) + l], HEX);
Serial.print(",");
}
Serial.println("");
}
}else{
Serial.println("Failed to get the template into buffer..!!");
}

}

from adafruit-fingerprint-sensor-library.

AsifKhan991 avatar AsifKhan991 commented on May 24, 2024

@AsifKhan991 from the example you have shared before, store_template_to_buf ,, I added only else statement to check if the function is executed successfully or not, I changed all 512 to 768 but not working.

There was another issue with the function. Fixed it, can you check?

from adafruit-fingerprint-sensor-library.

dody3030 avatar dody3030 commented on May 24, 2024

@AsifKhan991 now I will try your example write_to_sensor and I will change the buffer size or all 512 to 768, you really saved my day .. you are really helpful genius guy thanks again and again. i was trying with the code for long time ago , eventually I start reading the datasheet, and I found that most of the capacitive fingerprint template size 768.

from adafruit-fingerprint-sensor-library.

dody3030 avatar dody3030 commented on May 24, 2024

@AsifKhan991 returns Storing error. I changed all 512 to 768.

_void write_template_data_to_sensor() {

int template_buf_size=768; //usually hobby grade sensors have 512 byte template data, watch datasheet to know the info
uint8_t fingerTemplate[768] = {0x2,0x0,0x7,0x3,0x8B,0x20,0xBB,0x0,0x84,0x7F,0x12,0x84,0x4C,0x87,0xE,0x2D,0x8B,0x5,0x1F,0xC4,0x51,0xD2,0xA1,0x48,0x21,0x32,0xD4,0x4C,0x51,0xD4,0x82,0x1E,0xFF,0x14,0x78,0x21,0xC5,0x4B,0x5,0x1B,0x89,0xEA,0xE3,0xC1,0x44,0xC3,0x93,0x1C,0xC0,0x50,0xFC,0xE8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x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0};
/*
you can manually save the data got from "get_template.ino" example like this

uint8_t fingerTemplate[512]={0x03,0x0E,....your template data.....};

*/
memset(fingerTemplate, 0xff, 768); //comment this line if you've manually put data to the line above

Serial.println("Ready to write template to sensor...");
Serial.println("Enter the id to enroll against, i.e id (1 to 127)");
int id = readnumber();
if (id == 0) {// ID #0 not allowed, try again!
return;
}
Serial.print("Writing template against ID #"); Serial.println(id);

if (finger.write_template_to_sensor(template_buf_size,fingerTemplate)) { //telling the sensor to download the template data to it's char buffer from upper computer (this microcontroller's "fingerTemplate" buffer)
Serial.println("now writing to sensor...");
} else {
Serial.println("writing to sensor failed");
return;
}

Serial.print("ID "); Serial.println(id);
if (finger.storeModel(id) == FINGERPRINT_OK) { //saving the template against the ID you entered or manually set
Serial.print("Successfully stored against ID#");Serial.println(id);
} else {
Serial.println("Storing error");
return ;
}
}_

from adafruit-fingerprint-sensor-library.

AsifKhan991 avatar AsifKhan991 commented on May 24, 2024

@AsifKhan991 returns Storing error. I changed all 512 to 768.

You are supposed to comment the line memset(fingerTemplate,0xff,768). Also use a valid Id to store the print (1-127)

from adafruit-fingerprint-sensor-library.

dody3030 avatar dody3030 commented on May 24, 2024

@AsifKhan991
1- I added two users.
2- I got the hex for the id 2.
2- I ran the example that delete all users. now the sensor db is clear.
3- I added the admin id =1 , now only one user is registered.
4- I opened write_to_sensor example and I commented out the memset line, and I added the hex to the variable uint8_t fingerTemplate[768] = {0x2,0x0,0xDD,0x2
5- Compiled, run
6- Added 2 as id for the required id. but got Storing error. I don't know why.

Output:
Found fingerprint sensor!
Ready to write template to sensor...
Enter the id to enroll against, i.e id (1 to 127)
Writing template against ID #2
now writing to sensor...
ID 2
Storing error

from adafruit-fingerprint-sensor-library.

dody3030 avatar dody3030 commented on May 24, 2024

@AsifKhan991 Writing to the sensor work... I just added a delay for 10 seconds after writing the template and before storing to the sensor. everything is working fine now. your library is fine don't waste your time to check it. my sensor is R503 capacitive fingerprint and I think there is slowness while writing to the sensor. thanks for your code.

from adafruit-fingerprint-sensor-library.

dody3030 avatar dody3030 commented on May 24, 2024

@AsifKhan991 . I changed the text file content to store the template id and '%' as separator between the template id and template data I collect from fingerprint Sensor (1). The following is an example of the text file content stored in SD.

1%211061813920559013222916229362166156220133281972458657216117625016812361...........#
2%282351381391613013209011615817213413363194464822579240221124148832521201...........#
3%251532061397119013216918167150165449186197296513892225701921642032248452...........#

As you can see the file contain three different IDs and percentage sign as separator in addition to the template data. the problem is that am able to collect the data successfully but not able to send it to the write_template_data_to_sensor function, that accept two parameters one is int and the other is uint8_t. Thanks in advance.

void loadTempFromFile(){
  File myFile;
  myFile = SD.open("fprint.fdb");
  while(myFile.available()){
      String t_pkt;
      int t_pid;
      char buf[2000];
      t_pkt = myFile.readStringUntil('%');
      t_pid = t_pkt.toInt();
      int max_len = 2000;
      int read_len = myFile.readBytesUntil('#', buf, max_len);
      Serial.println("Packet id: " + String(t_pid));              //Debugging
      Serial.println("CONTENT:");                                 //Debugging
      Serial.print(buf);                                          //Debugging
      write_template_data_to_sensor(t_pid, buf);
  }
  myFile.close();
}

void write_template_data_to_sensor(int t_id, uint8_t fingerTemplate[768]) {
  int template_buf_size = 768; 
  Serial.println("Ready to write template to sensor...");
  Serial.println("Enter the id to enroll against, i.e id (1 to 127)");
  if (t_id == 0){
    Serial.println("Not possible..!!");
  }else{
    Serial.print("Writing template against ID #"); Serial.println(t_id);
    if (finger.write_template_to_sensor(template_buf_size, fingerTemplate)) { //telling the sensor to download the template data   to it's char buffer from upper computer (this microcontroller's "fingerTemplate" buffer)
      Serial.println("now writing to sensor...");
    } else {
      Serial.println("writing to sensor failed");
      return;
    }
    delay(10000);
    Serial.print("ID "); Serial.println(t_id);
    if (finger.storeModel(t_id) == FINGERPRINT_OK) { //saving the template against the ID you entered or manually set
      Serial.print("Successfully stored against ID#"); Serial.println(t_id);
    } else {
      Serial.println("Storing error");
      return ;
    }  
  }
}

from adafruit-fingerprint-sensor-library.

AsifKhan991 avatar AsifKhan991 commented on May 24, 2024

Not a good idea to use seperator. What if the template contains a hex value that refers to the seperator in char?

from adafruit-fingerprint-sensor-library.

dody3030 avatar dody3030 commented on May 24, 2024

@AsifKhan991

Not a good idea to use seperator. What if the template contains a hex value that refers to the seperator in char?

but the template stored in non-hex , and the data passed to buf array is filtered by readBytesUntil from the position after the '%' sign till '#' sign, so it will be the same data that is collected from the sensor before. and I didn't change it to hex, because what I understand from your example the same data can be passed to uint8_t without changing to hex to be written back to different sensor of the same type.

from adafruit-fingerprint-sensor-library.

AsifKhan991 avatar AsifKhan991 commented on May 24, 2024

I see that your template data contains only decimal numbers. If you stored in decimal format and read directly as hex using readBytesUntil() then it's not gonna work. This is no issue with the library, mere the use of wrong data type. Please have a thorough look at the Arduino data types.

from adafruit-fingerprint-sensor-library.

dody3030 avatar dody3030 commented on May 24, 2024
  int read_len = myFile.readBytesUntil('#', buf, max_len);

Here's the issue, you are reading from the beginning of line. Also I see that you template contains decimal numbers. Did you write template to the file as integers? If yes, then please thoroughly go through Arduino data types documentation to see how yo reconvert them. This is not an issue with the library, mere wrong data types and indexing.

before that line there are two lines to get the template id

t_pkt = myFile.readStringUntil('%');
t_pid = t_pkt.toInt();

the first line put the next reading after the % sign int read_len = myFile.readBytesUntil('#', buf, max_len); and when I print the buf it showing exactly the data is collected for that template. but the issue is how to pass that buf to uint8_t as argument for the write_template_to_sensor function. the following is an example of buf output for each line.

2110618139205590132229162293621661562201332819724586572............ till the end of the output. I verified this and I found it is same as the data collected from the sensor for template 1

from adafruit-fingerprint-sensor-library.

AsifKhan991 avatar AsifKhan991 commented on May 24, 2024

Please read my most recent comment. Anyways there's an easy solution, just create seperate files for seperate templates and name the file with id number. Then just read the directory and save by the name.
Write the template data as byte/hex on the file.

from adafruit-fingerprint-sensor-library.

dody3030 avatar dody3030 commented on May 24, 2024

Please read my most recent comment. Anyways there's an easy solution, just create seperate files for seperate templates and name the file with id number. Then just read the directory and save by the name. Write the template data as byte/hex on the file.

@AsifKhan991 I changed the function to load the template from the file that contain only hex stored from the sensor for only one template.

void loeadTempFromFile(){
  File myFile;
  myFile = SD.open("fprint.fdb");
  uint8_t t_buf[768] = {};
  int t_data = myFile.readBytesUntil('\n', t_buf, sizeof(t_buf));
  for (int i = 0; i < 768; i++){
     Serial.print(t_buf[i]);
  }
  myFile.close();
}

Output from file after loading to uint8_t:
4812050444812049444812054654448120495044481205666444812067684448120516644481204844481205652444812069534448120494844481206953444812050524448120685644481205444481205767444812068674448120565344481204967444812067534448120705344481205644481205249444812052564448120654944481206648444812070654448120494844481205349444812069674448120546744481206850444812056564448120495244481205451444812049674448120575644481205366444812053444812049674448120554448120525744481206956444812067494448120525344481206749444812069484448120705344481206848444812053494448120685644481205754444812065534448120554844481204952444812053534448120506744481205344481206548444812053444812049534448120676744481205544481205056444812068494448120525144481207051444812065574448120506844481206756444812053494448120504844481206967444812049494448120554844481204952444812054494448120525544481205049444812049704448120525344481204954444812053514448120514448120675544481206749444812052544448120575244481206952444812052574448120684844481205350444812049534448120516744481206752444812055524448120495244481205548444812056694448120566644481206669444812070514448120484448120565244481206868444812049494448120686944481205753444812069574448120494944481204965444812050494448120534448120504944481206752444812056704448120695644481206549444812052544448120494448120506544481205068444812066484448120534944481205648444812052704448120555644481205648444812049524448120574944481204952444812049574448120686844481205344481205050444812052534448120674448120525644481205249444812052534448120564944481205549444812050484448120544844481205349444812054674448120544844481205353444812051684448120495244481205650444812049674448120515144481206868444812053444812049524448120675644

Not showing the same decimal from the original while reading the template from the sensor which is

Output from sensor while reading the same template.
21106181392055901322291622936216615622013328197245865721611762501681236108210136209928152915287732321936919322424520881216150165112208544516052120474020967243169452008132236171122097713331692283319919370148228732088221601961162011214213919024301322211722214923317263353319614323216170142451768112879120128201452025221534691272656912911332968110896856120130285122152020010081681141061146012024419259112208348156222515143106167209691003313808112923561202013388159221534127142139128190132185221881248105822152536671657111322619488152124211112208931701656925712447216170983418920081641385811920824020216518744987656966186263281122022241492062593022277920716386569163240149208811242541751282066731494523146193136657022818720232811135215813820688220115952885982316170175142000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

from adafruit-fingerprint-sensor-library.

Gitare420 avatar Gitare420 commented on May 24, 2024

Hello, were you able to solve your problem? i'm stuck on the same

from adafruit-fingerprint-sensor-library.

dody3030 avatar dody3030 commented on May 24, 2024

Hello, were you able to solve your problem? i'm stuck on the same

me too, waiting Asifkhan to reply, beside I have encountered one more issue, I have to add the first ID "Admin" or ID 1 using Adafruit example, I can not upload the first template to the sensor directly using Asifkhan code, beside at least one finger of five templates is not recognized by the sensor. I don't know why, I checked the template length, the library, but still stuck.

from adafruit-fingerprint-sensor-library.

AsifKhan991 avatar AsifKhan991 commented on May 24, 2024

Please read my most recent comment. Anyways there's an easy solution, just create seperate files for seperate templates and name the file with id number. Then just read the directory and save by the name. Write the template data as byte/hex on the file.

@AsifKhan991 I changed the function to load the template from the file that contain only hex stored from the sensor for only one template.

void loeadTempFromFile(){
  File myFile;
  myFile = SD.open("fprint.fdb");
  uint8_t t_buf[768] = {};
  int t_data = myFile.readBytesUntil('\n', t_buf, sizeof(t_buf));
  for (int i = 0; i < 768; i++){
     Serial.print(t_buf[i]);
  }
  myFile.close();
}

Output from file after loading to uint8_t:
4812050444812049444812054654448120495044481205666444812067684448120516644481204844481205652444812069534448120494844481206953444812050524448120685644481205444481205767444812068674448120565344481204967444812067534448120705344481205644481205249444812052564448120654944481206648444812070654448120494844481205349444812069674448120546744481206850444812056564448120495244481205451444812049674448120575644481205366444812053444812049674448120554448120525744481206956444812067494448120525344481206749444812069484448120705344481206848444812053494448120685644481205754444812065534448120554844481204952444812053534448120506744481205344481206548444812053444812049534448120676744481205544481205056444812068494448120525144481207051444812065574448120506844481206756444812053494448120504844481206967444812049494448120554844481204952444812054494448120525544481205049444812049704448120525344481204954444812053514448120514448120675544481206749444812052544448120575244481206952444812052574448120684844481205350444812049534448120516744481206752444812055524448120495244481205548444812056694448120566644481206669444812070514448120484448120565244481206868444812049494448120686944481205753444812069574448120494944481204965444812050494448120534448120504944481206752444812056704448120695644481206549444812052544448120494448120506544481205068444812066484448120534944481205648444812052704448120555644481205648444812049524448120574944481204952444812049574448120686844481205344481205050444812052534448120674448120525644481205249444812052534448120564944481205549444812050484448120544844481205349444812054674448120544844481205353444812051684448120495244481205650444812049674448120515144481206868444812053444812049524448120675644

Not showing the same decimal from the original while reading the template from the sensor which is

Output from sensor while reading the same template.
21106181392055901322291622936216615622013328197245865721611762501681236108210136209928152915287732321936919322424520881216150165112208544516052120474020967243169452008132236171122097713331692283319919370148228732088221601961162011214213919024301322211722214923317263353319614323216170142451768112879120128201452025221534691272656912911332968110896856120130285122152020010081681141061146012024419259112208348156222515143106167209691003313808112923561202013388159221534127142139128190132185221881248105822152536671657111322619488152124211112208931701656925712447216170983418920081641385811920824020216518744987656966186263281122022241492062593022277920716386569163240149208811242541751282066731494523146193136657022818720232811135215813820688220115952885982316170175142000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

From what it looks like you are facing data type or file format issue. Please share the code you used to write to the file. Also, how about using ".txt" as the file format?

from adafruit-fingerprint-sensor-library.

Gitare420 avatar Gitare420 commented on May 24, 2024

Hi, has anyone found a solution? The truth is I don't have much to contribute, I've tried everything and I can't load the fingerprints from the txt file to the fingerprint reader, what most complicates me is adding the 0x to the templates, I don't understand very well what they do or how to put it before prefix in the uint8_t. Thank you very much in advance. @dody3030 @AsifKhan991

from adafruit-fingerprint-sensor-library.

cheotrix avatar cheotrix commented on May 24, 2024

Good evening everyone, did anyone manage to solve the problem?
I have the 502-f and I have tried several ways but I can not write the template in the FP, I have changed the buffer size to 768, I put a delay as the companion said and nothing, the error Storing Error still appears. @AsifKhan991 plss help us

from adafruit-fingerprint-sensor-library.

AsifKhan991 avatar AsifKhan991 commented on May 24, 2024

Are u getting error msg in serial console? If yes share the error msg please.

from adafruit-fingerprint-sensor-library.

cheotrix avatar cheotrix commented on May 24, 2024

Hi, thanks for your answer, I explain: when I try to send a template using your library I get error storing, doing debug I managed to see that the FP sends a code 18H that corresponds to error to save in flash. Looking at the datasheet of the R502-F I noticed that the template must have 1536 bytes of data, so I modified the buffer and still with your library gives me error.

With the help of Grow support people I did a test directly using a serial debug software, I finally got the sensor to save the template. Here is the file they sent me and it helped me.


使用串口助手实现,发送格式必为16进制 HEX格式
Using the CommAssistant implementation,send format must be hexadecimal,HEX format

上传模板所需发送的指令The instruction that needs to be sent to upload the template
1:EF 01 FF FF FF FF 01 00 06 07 01 00 00 00 0F//读出指纹库为00位置的模板Read template of fingerprint datasheet at position 00
2:EF 01 FF FF FF FF 01 00 04 08 01 00 0E //上传模板 缓冲区1 Upload template buffer 1
3:接收后续指纹模块发送的数据包Receive packets sent by the subsequent fingerprint module

下载指纹模板Download fingerprint Template
1:EF 01 FF FF FF FF 01 00 04 09 01 00 0F//下载缓冲区Download buffer
2:接收到00确认码后,发送准备好的数据包 After receiving the 00 confirmation code, send the prepared packet
3:EF 01 FF FF FF FF 01 00 06 06 01 00 10 00 1E//将模板存储存储在16号位置 Store the template in location 16

R建议将503上传的模板文件不做拆包合并处理,直接进行存储,发送的时候直接按循序发送即可,大部分人是在这一步出错.
It is suggested that the 503 uploaded template files should be stored directly instead of unpacking and merging. When you send it, just send it in order. Most people make mistakes in this step.

示例指纹模板数据,可以直接下载至指纹模块Example code of fingerprint template data, it can be downloaded to the fingerprint module directly
EF 01 FF FF FF FF 02 00 82 02 00 3F 6D 8B C1 0B 00 84 DD 18 DE 9F 03 05 B4 EB 85 16 04 C3 D6 71 47 A1 73 B6 A4 50 FC 6D 66 31 14 42 1C 2D 5D 05 11 07 B1 1C 71 B4 02 1C 88 58 88 F8 8A E1 63 1A 3C 26 CE 10 06 D0 49 C7 D5 61 44 F2 EC 64 88 84 F4 BC B1 3A 14 3E 32 35 C9 0A 4F 0C D3 F2 A1 44 43 54 9C 34 60 F0 D7 55 36 14 44 38 4F 3F C5 11 CE 95 70 61 44 A3 C5 2B 90 51 25 04 EA FF 24 3C 43 29 06 C5 13 91 12 FD 81 36 35 EF 01 FF FF FF FF 02 00 82 A4 44 DD 68 38 51 3D 7B 04 F4 14 5B 8E 8B BF 03 00 84 DC 17 DD BF 4F 05 B4 EB 85 16 02 41 95 B1 49 31 38 F5 9C 51 E8 5C EF A7 14 41 1B 2D 5E 85 13 06 D6 63 11 44 21 EC 47 14 6D 04 87 22 16 22 44 22 B8 58 C6 4F 09 B3 84 01 B4 12 EC 64 88 84 F8 BC AF 3C 14 46 32 35 C9 08 CF 0C D3 F2 A1 64 73 54 9C 34 60 F0 DB 57 3A 14 46 38 4F 3F C5 12 0E B5 B0 81 44 33 C5 2B 90 51 25 04 EA FF 21 3C 35 66 EF 01 FF FF FF FF 02 00 82 43 29 06 C5 14 D1 12 FD 81 64 44 DD 68 58 51 57 8E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 07 AB EF 01 FF FF FF FF 02 00 82 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 84 EF 01 FF FF FF FF 02 00 82 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 84 EF 01 FF FF FF FF 02 00 82 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 84 EF 01 FF FF FF FF 02 00 82 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 7B B3 B0 02 19 42 A3 01 80 11 D5 14 58 1F 58 90 B1 14 75 23 BC 91 D2 14 3F 29 AC 92 16 14 42 2D 48 11 BA 14 45 31 04 92 E1 1B 41 37 28 12 09 22 3F 3A A4 91 AF 1B 3E 41 54 12 1E 1B 40 54 44 11 9C 14 3F 5A 94 11 90 29 3C 7C 38 91 0B 14 4E 51 18 12 8F 21 3E 59 64 12 1B 63 EF 01 FF FF FF FF 02 00 82 93 15 43 5E 34 92 84 18 3C 5F 94 12 9A 14 45 63 64 92 7D 14 49 67 9C 12 82 14 42 6B 80 12 70 14 49 7C 48 12 EA 1B 43 77 C0 91 7D 23 3C 8E A4 12 07 14 4F 10 04 80 AA 14 8D 43 E0 00 AB 14 4C B2 F0 01 7A 14 5D 7E FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 52 9C EF 01 FF FF FF FF 02 00 82 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 80 04 EF 01 FF FF FF FF 02 00 82 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 80 04 EF 01 FF FF FF FF 02 00 82 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 80 04 EF 01 FF FF FF FF 08 00 82 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 80 0A

from adafruit-fingerprint-sensor-library.

cheotrix avatar cheotrix commented on May 24, 2024

@AsifKhan991 I still can't send template using your library, I think it has to do with the buffer size, it seems that being so big it generates some kind of error and the data is not sent complete.

from adafruit-fingerprint-sensor-library.

AsifKhan991 avatar AsifKhan991 commented on May 24, 2024

Could be. Or may be the Hex commands are different for your module. Cross check your sensor's datasheet with standard adafruit one.

from adafruit-fingerprint-sensor-library.

cheotrix avatar cheotrix commented on May 24, 2024

@AsifKhan991 uses exactly the same commands, the error occurred because for some reason this module does not accept a template with all the values in FF.

in conclusion to use your library with the R502-F you just have to change the buffer and send real templates, not use the memcpy.

Thanks for your help

from adafruit-fingerprint-sensor-library.

DharmikEC avatar DharmikEC commented on May 24, 2024

@AsifKhan991 , I am using R503 capacitive fingerprint sensor and wanted to store fingerprint data from cloud to new sensor. Your update woks fine with minor modification. Thank you very much for that.

I tried to merge your get fingerprint and store fingerprint examples in one. I failed initially and got error in write_template_to_sensor() function, later I added Serial2.read() as long as Serial2.available() remains true(Serial2 is a port I am using for my sensor). After this it works fine. What I don't understand is it gave me 447 bytes extra. What are those ?? Do you have any Idea about this ??

from adafruit-fingerprint-sensor-library.

Dygear avatar Dygear commented on May 24, 2024

@DharmikEC Hey! That's awesome thanks for attaching the sheet as well!

from adafruit-fingerprint-sensor-library.

WalsonJerry avatar WalsonJerry commented on May 24, 2024

@AsifKhan991 WORKING.!!!!, Thank you too much, I ready don't know how to thank you,, Im sorry it's working, I forgot to copy the updated ccp. thanks alot

Waiting for valid finger.... Image taken Image converted Remove finger Place same finger again, waiting.... Image taken Image converted Creating model... Prints matched! Template created Attempting to get template... Transferring Template.... Template data (comma sperated HEX): 0x2,0x0,0x5,0x52,0x8B,0x11,0xC3,0x0,0x84,0x0,0x14,0x2C,0x9E,0x13,0xB,0x1C,0xD4,0x5,0x15,0xC3,0xC,0x14,0x81,0x45,0x60,0xE1,0x41,0x88,0x51,0xC0,0x4C,0x57,0x52,0x14,0x66,0x17,0x93,0x46,0x45,0x17,0x46,0x4,0x1D,0x41,0x45,0xC1,0xC2,0x89,0xA4,0x50,0xF4,0x72,0x27,0x44,0x14,0x55,0x21,0x92,0x98,0x85,0x10,0xC9,0x61,0x51,0x41,0x44,0x82,0x75,0x99,0x50,0x52,0x34,0xB2,0x93,0x5A,0x14,0x40,0x2F,0x36,0x16,0x45,0x15,0x8C,0x12,0x26,0x61,0x47,0x43,0x9,0x7D,0x38,0x50,0xF0,0xEE,0xA2,0x62,0x14,0x53,0x46,0x91,0xD2,0x5,0x18,0x12,0xB6,0xC4,0xF1,0x49,0xC4,0xD0,0xC9,0x50,0x51,0xC1,0x50,0x4F,0x4A,0x14,0x77,0x8E,0x8B,0xB4,0xEB,0x0,0x84,0xD1,0x10,0xD4, 0x8A,0x55,0x7,0xA,0x9C,0x5,0x23,0x2,0xB1,0x26,0x81,0x48,0xA0,0xC0,0xB5,0x80,0x52,0xC,0x60,0xA0,0x70,0x14,0x60,0x1C,0x1D,0x9D,0x45,0x16,0x48,0x83,0x55,0x61,0x46,0x2,0x28,0x41,0xC0,0x51,0xF8,0x96,0x81,0x54,0x14,0x55,0x27,0x4,0xD8,0x5,0x17,0xD,0x5,0xA7,0x11,0x44,0xB4,0x9,0xD,0x80,0x51,0x75,0xD,0x1C,0x5A,0x14,0x88,0x45,0x2,0xD7,0x5,0x1C,0x92,0x29,0x46,0x61,0x46,0x4,0xBB,0x49,0x78,0x51,0xE1,0x48,0x4A,0x68,0x14,0x6D,0x8E,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x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0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0

please can someone help me here nothing is printing in my serial monitor

from adafruit-fingerprint-sensor-library.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.