Adafruit-Fingerprint-Sensor-Library icon indicating copy to clipboard operation
Adafruit-Fingerprint-Sensor-Library copied to clipboard

Function to send templates from your controller to the sensor

Open ricarduscat opened this issue 7 years ago • 82 comments

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 avatar Dec 16 '17 17:12 ricarduscat

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

marianodato avatar Mar 10 '18 15:03 marianodato

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

ricarduscat avatar Mar 26 '18 14:03 ricarduscat

@ricarduscat could you explain how to do that?

marianodato avatar Mar 26 '18 18:03 marianodato

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

milindrc avatar Sep 27 '18 05:09 milindrc

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 !!

sand007man avatar Sep 28 '18 09:09 sand007man

recvPacket

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

hanifizzudinrahman avatar Feb 21 '19 04:02 hanifizzudinrahman

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

jimmygyl avatar Aug 10 '19 19:08 jimmygyl

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.

shreeramkulkarni avatar Jan 17 '20 18:01 shreeramkulkarni

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 https://github.com/adafruit/Adafruit-Fingerprint-Sensor-Library/issues/9

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

hanifizzudinrahman avatar Jan 29 '20 15:01 hanifizzudinrahman

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?

adityadate1997 avatar Mar 13 '20 10:03 adityadate1997

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

hanifizzudinrahman avatar Mar 14 '20 02:03 hanifizzudinrahman

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.

adityadate1997 avatar Mar 14 '20 09:03 adityadate1997

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

hanifizzudinrahman avatar Mar 14 '20 11:03 hanifizzudinrahman

Sir, we have downloaded the fingerprint template data from the module r305 using the show_finger_template library. It gives us an array of size 512....we want to compare this stored array on server side. What exactly do we need to do? We tried comparing the array byte by byte but it does not give proper output. Can you guide us on how to match these templates sir.

Thank you.

On Sat, 14 Mar 2020, 17:06 Hanif Izzudin Rahman, [email protected] wrote:

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

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/adafruit/Adafruit-Fingerprint-Sensor-Library/issues/36#issuecomment-599044581, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOKPALFHY4UX5XM4EOMG553RHNT2FANCNFSM4EIRSJTA .

adityadate1997 avatar Mar 18 '20 05:03 adityadate1997

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

rodrigotabsan avatar Jun 11 '20 12:06 rodrigotabsan

@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.

shreeramkulkarni avatar Jun 11 '20 16:06 shreeramkulkarni

@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.

rodrigotabsan avatar Jul 01 '20 08:07 rodrigotabsan

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

6000850 avatar Apr 15 '21 17:04 6000850

Do it with example code "Upload", so the template will move to another module fingerprint

On Fri, Apr 16, 2021 at 12:43 AM 6000850 @.***> wrote:

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

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/adafruit/Adafruit-Fingerprint-Sensor-Library/issues/36#issuecomment-820613492, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALMXTE4WJMMNPT4HTXP26MDTI4QT5ANCNFSM4EIRSJTA .

hanifizzudinrahman avatar Apr 16 '21 00:04 hanifizzudinrahman

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?

a2br avatar Jun 13 '21 10:06 a2br

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!

mlinaje avatar Sep 29 '21 11:09 mlinaje

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.

Dygear avatar Jun 20 '22 01:06 Dygear

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!

AsifKhan991 avatar Sep 05 '22 16:09 AsifKhan991

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 :)

Gitare420 avatar Sep 06 '22 11:09 Gitare420

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.

AsifKhan991 avatar Sep 06 '22 11:09 AsifKhan991

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

uint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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, 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?

Gitare420 avatar Sep 06 '22 11:09 Gitare420

@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?

AsifKhan991 avatar Sep 06 '22 11:09 AsifKhan991

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

Gitare420 avatar Sep 06 '22 12:09 Gitare420

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, 0xDF, 0x55, 0x17, 0xC3, 0xFF, 0x26, 0xA0, 0xD0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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, 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 ////////////////////////////////////

Gitare420 avatar Sep 06 '22 12:09 Gitare420

@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

AsifKhan991 avatar Sep 06 '22 12:09 AsifKhan991