INCREASE BIOMETRIC ID

I am interfacing Arduino Mega with Biometric Fingerprint module R307.
How can I increase more than 162 Biometric ID fingerprints ? Is there any way to increase or that is the maximum ID limit ? I am using Arduino Adafruit FingerPrint Sensor Library.
I am new to Arduino kindly help .
Thanks in Advance,
Stark.

with Biometric Fingerprint module R307.

That link doesn't work.

How can I increase more than 162 Biometric ID fingerprints ?

Think about how much space is needed to record one fingerprint. Think about where they are stored. Think about how much storage space is available. Does that limit seem unreasonable?

I believe that you can dump fingerprint data out of the device and equally, upload it. So conceivably, you could maintain a library of templates and switch them out as needed, but since you can't have more than 162 loaded at once, it seems it would be of limited use.

wildbill:
I believe that you can dump fingerprint data out of the device and equally, upload it. So conceivably, you could maintain a library of templates and switch them out as needed, but since you can't have more than 162 loaded at once, it seems it would be of limited use.

How to take fingerprint data ? how to dump fingerprint data and upload it into arduino for more than 300 fingerprints ?
Is there any possiblities to store fingerprint bmp file?

PaulS:
That link doesn't work.
Think about how much space is needed to record one fingerprint. Think about where they are stored. Think about how much storage space is available. Does that limit seem unreasonable?

Since im very begineer to Arduino I am searching how to record one Fingerprint in storage space of BioMetric.
How to analyse where it is stored ?
How to check how much storage space available ?

Thank you, for the response. Now, I got to store and detect biometric ID's upto 1000.Because, I modified that library file(adafurit fingerprint sensor).

starksoundar:
Thank you, for the response. Now, I got to store and detect biometric ID's upto 1000.Because, I modified that library file(adafurit fingerprint sensor).

Hi sir.
How or what did you modify in the library please? I have been trying with no result...

philipnganda:
Hi sir.
How or what did you modify in the library please? I have been trying with no result...

Thanks though. I got it. Changed 0xA3 to 0x3E8 for 1000 fingerprints, or 0xFF for 255 fingerprints

philipnganda:
Thanks though. I got it. Changed 0xA3 to 0x3E8 for 1000 fingerprints, or 0xFF for 255 fingerprints

... the capacity increased to 255, not 1000.i think that I'll have to mess around with the uint8_t s in the library....

philipnganda:
... the capacity increased to 255, not 1000.i think that I'll have to mess around with the uint8_t s in the library....

here, I changed that 0x01 to 0x02 in the library where the Id store and get.

[quote author=starksoundar date=1548234483 link=msg=4029694]
 
here, I changed that 0x01 to 0x02 in the library where the Id store and get.
[/quote]



Thanks for the response. 
I can't yet figure it out. 

Here's the cpp.h

[     /***************************************************
  This is a library for our optical Fingerprint sensor

  Designed specifically to work with the Adafruit Fingerprint sensor
  ----> http://www.adafruit.com/products/751

  These displays use TTL Serial to communicate, 2 pins are required to
  interface
  Adafruit invests time and resources providing this open source code,
  please support Adafruit and open-source hardware by purchasing
  products from Adafruit!

  Written by Limor Fried/Ladyada for Adafruit Industries.
  BSD license, all text above must be included in any redistribution
 ****************************************************/

#include "Adafruit_Fingerprint.h"

#if defined(__AVR__) || defined(ESP8266)
    #include <SoftwareSerial.h>
#endif

//#define FINGERPRINT_DEBUG

#if defined(__AVR__) || defined(ESP8266)
Adafruit_Fingerprint::Adafruit_Fingerprint(SoftwareSerial *ss) {
  thePassword = 0;
  theAddress = 0xFFFFFFFF;

  hwSerial = NULL;
  swSerial = ss;
  mySerial = swSerial;
}
#endif

Adafruit_Fingerprint::Adafruit_Fingerprint(HardwareSerial *ss) {
  thePassword = 0;
  theAddress = 0xFFFFFFFF;

#if defined(__AVR__) || defined(ESP8266)
  swSerial = NULL;
#endif
  hwSerial = ss;
  mySerial = hwSerial;
}

void Adafruit_Fingerprint::begin(uint16_t baudrate) {
  delay(1000);  // one second delay to let the sensor 'boot up'

  if (hwSerial) hwSerial->begin(baudrate);
#if defined(__AVR__) || defined(ESP8266)
  if (swSerial) swSerial->begin(baudrate);
#endif
}

#define GET_CMD_PACKET(...) \
  uint8_t data[] = {__VA_ARGS__}; \
  Adafruit_Fingerprint_Packet packet(FINGERPRINT_COMMANDPACKET, sizeof(data), data); \
  writeStructuredPacket(packet); \
  if( getStructuredPacket(&packet) != FINGERPRINT_OK || packet.type != FINGERPRINT_ACKPACKET ) { return FINGERPRINT_PACKETRECIEVEERR; }

#define SEND_CMD_PACKET(...) GET_CMD_PACKET(__VA_ARGS__); return packet.data[0];

boolean Adafruit_Fingerprint::verifyPassword(void) {
  GET_CMD_PACKET(FINGERPRINT_VERIFYPASSWORD,
                  (uint8_t)(thePassword >> 24), (uint8_t)(thePassword >> 16),
                  (uint8_t)(thePassword >> 8), (uint8_t)(thePassword & 0xFF));
  return packet.data[0] == FINGERPRINT_OK;
}

uint8_t Adafruit_Fingerprint::getImage(void) {
  SEND_CMD_PACKET(FINGERPRINT_GETIMAGE);
}

uint8_t Adafruit_Fingerprint::image2Tz(uint8_t slot) {
  SEND_CMD_PACKET(FINGERPRINT_IMAGE2TZ,slot);
}

uint8_t Adafruit_Fingerprint::createModel(void) {
  SEND_CMD_PACKET(FINGERPRINT_REGMODEL);
}

uint8_t Adafruit_Fingerprint::storeModel(uint16_t id) {
  SEND_CMD_PACKET(FINGERPRINT_STORE, 0x02, (uint8_t)(id >> 8), (uint8_t)(id & 0xFF));
}

//read a fingerprint template from flash into Char Buffer 1
uint8_t Adafruit_Fingerprint::loadModel(uint16_t id) {
  SEND_CMD_PACKET(FINGERPRINT_LOAD, 0x01, (uint8_t)(id >> 8), (uint8_t)(id & 0xFF));
}

//transfer a fingerprint template from Char Buffer 1 to host computer
uint8_t Adafruit_Fingerprint::getModel(void) {
  SEND_CMD_PACKET(FINGERPRINT_UPLOAD, 0x02);
}

uint8_t Adafruit_Fingerprint::deleteModel(uint16_t id) {
  SEND_CMD_PACKET(FINGERPRINT_DELETE, (uint8_t)(id>>8), (uint8_t)(id & 0xFF), 0x00, 0x01);
}

uint8_t Adafruit_Fingerprint::emptyDatabase(void) {
  SEND_CMD_PACKET(FINGERPRINT_EMPTY);
}

uint8_t Adafruit_Fingerprint::fingerFastSearch(void) {
  // high speed search of slot #1 starting at page 0x0000 and page #0x00A3
  GET_CMD_PACKET(FINGERPRINT_HISPEEDSEARCH, 0x01, 0x00, 0x00, 0x00, 0x3E8);
  fingerID = 0xFFFF;
  confidence = 0xFFFF;

  fingerID = packet.data[1];
  fingerID <<= 8;
  fingerID |= packet.data[2];

  confidence = packet.data[3];
  confidence <<= 8;
  confidence |= packet.data[4];

  return packet.data[0];
}

uint8_t Adafruit_Fingerprint::getTemplateCount(void) {
  GET_CMD_PACKET(FINGERPRINT_TEMPLATECOUNT);

  templateCount = packet.data[1];
  templateCount <<= 8;
  templateCount |= packet.data[2];

  return packet.data[0];
}

#if ARDUINO >= 100
  #define SERIAL_WRITE(...) mySerial->write(__VA_ARGS__)
#else
  #define SERIAL_WRITE(...) mySerial->write(__VA_ARGS__, BYTE)
#endif

#define SERIAL_WRITE_U16(v) SERIAL_WRITE((uint8_t)(v>>8)); SERIAL_WRITE((uint8_t)(v & 0xFF));

void Adafruit_Fingerprint::writeStructuredPacket(const Adafruit_Fingerprint_Packet & packet) {
  SERIAL_WRITE_U16(packet.start_code);
  SERIAL_WRITE(packet.address[0]);
  SERIAL_WRITE(packet.address[1]);
  SERIAL_WRITE(packet.address[2]);
  SERIAL_WRITE(packet.address[3]);
  SERIAL_WRITE(packet.type);

  uint16_t wire_length = packet.length + 2;
  SERIAL_WRITE_U16(wire_length);

  uint16_t sum = ((wire_length)>>8) + ((wire_length)&0xFF) + packet.type;
  for (uint8_t i=0; i< packet.length; i++) {
    SERIAL_WRITE(packet.data[i]);
    sum += packet.data[i];
  }

  SERIAL_WRITE_U16(sum);
  return;
}

uint8_t Adafruit_Fingerprint::getStructuredPacket(Adafruit_Fingerprint_Packet * packet, uint16_t timeout) {
  uint8_t byte;
  uint16_t idx=0, timer=0;

  while(true) {
    while(!mySerial->available()) {
      delay(1); timer++; if(timer>=timeout) return FINGERPRINT_TIMEOUT;
    }
    byte = mySerial->read();
    switch(idx) {
      case 0:
        if(byte != FINGERPRINT_STARTCODE>>8) continue;
        packet->start_code = byte << 8;
        break;
      case 1:
        packet->start_code |= byte & 0xFF;
        if(packet->start_code != FINGERPRINT_STARTCODE) return FINGERPRINT_BADPACKET;
        break;
      case 2:
      case 3:
      case 4:
      case 5:
        packet->address[idx-2] = byte;
        break;
      case 6: packet->type = byte; break;
      case 7: packet->length = byte << 8; break;
      case 8: packet->length |= byte & 0xFF; break;
      default:
        packet->data[idx-9] = byte;
        if((idx-8) == packet->length)
          return FINGERPRINT_OK;
        break;
    }
    idx++;
  }
}
 ]
[code][quote author=starksoundar date=1548234483 link=msg=4029694]
 
here, I changed that 0x01 to 0x02 in the library where the Id store and get.
[/quote]



Thanks for the response. 
I can't yet figure it out. 

Here's the cpp.h

[     /***************************************************
 This is a library for our optical Fingerprint sensor

 Designed specifically to work with the Adafruit Fingerprint sensor
 ----> http://www.adafruit.com/products/751

 These displays use TTL Serial to communicate, 2 pins are required to
 interface
 Adafruit invests time and resources providing this open source code,
 please support Adafruit and open-source hardware by purchasing
 products from Adafruit!

 Written by Limor Fried/Ladyada for Adafruit Industries.
 BSD license, all text above must be included in any redistribution
****************************************************/

#include "Adafruit_Fingerprint.h"

#if defined(__AVR__) || defined(ESP8266)
   #include <SoftwareSerial.h>
#endif

//#define FINGERPRINT_DEBUG

#if defined(__AVR__) || defined(ESP8266)
Adafruit_Fingerprint::Adafruit_Fingerprint(SoftwareSerial *ss) {
 thePassword = 0;
 theAddress = 0xFFFFFFFF;

 hwSerial = NULL;
 swSerial = ss;
 mySerial = swSerial;
}
#endif

Adafruit_Fingerprint::Adafruit_Fingerprint(HardwareSerial *ss) {
 thePassword = 0;
 theAddress = 0xFFFFFFFF;

#if defined(__AVR__) || defined(ESP8266)
 swSerial = NULL;
#endif
 hwSerial = ss;
 mySerial = hwSerial;
}

void Adafruit_Fingerprint::begin(uint16_t baudrate) {
 delay(1000);  // one second delay to let the sensor 'boot up'

 if (hwSerial) hwSerial->begin(baudrate);
#if defined(__AVR__) || defined(ESP8266)
 if (swSerial) swSerial->begin(baudrate);
#endif
}

#define GET_CMD_PACKET(...) \
 uint8_t data[] = {__VA_ARGS__}; \
 Adafruit_Fingerprint_Packet packet(FINGERPRINT_COMMANDPACKET, sizeof(data), data); \
 writeStructuredPacket(packet); \
 if( getStructuredPacket(&packet) != FINGERPRINT_OK || packet.type != FINGERPRINT_ACKPACKET ) { return FINGERPRINT_PACKETRECIEVEERR; }

#define SEND_CMD_PACKET(...) GET_CMD_PACKET(__VA_ARGS__); return packet.data[0];

boolean Adafruit_Fingerprint::verifyPassword(void) {
 GET_CMD_PACKET(FINGERPRINT_VERIFYPASSWORD,
                 (uint8_t)(thePassword >> 24), (uint8_t)(thePassword >> 16),
                 (uint8_t)(thePassword >> 8), (uint8_t)(thePassword & 0xFF));
 return packet.data[0] == FINGERPRINT_OK;
}

uint8_t Adafruit_Fingerprint::getImage(void) {
 SEND_CMD_PACKET(FINGERPRINT_GETIMAGE);
}

uint8_t Adafruit_Fingerprint::image2Tz(uint8_t slot) {
 SEND_CMD_PACKET(FINGERPRINT_IMAGE2TZ,slot);
}

uint8_t Adafruit_Fingerprint::createModel(void) {
 SEND_CMD_PACKET(FINGERPRINT_REGMODEL);
}

uint8_t Adafruit_Fingerprint::storeModel(uint16_t id) {
 SEND_CMD_PACKET(FINGERPRINT_STORE, 0x02, (uint8_t)(id >> 8), (uint8_t)(id & 0xFF));
}

//read a fingerprint template from flash into Char Buffer 1
uint8_t Adafruit_Fingerprint::loadModel(uint16_t id) {
 SEND_CMD_PACKET(FINGERPRINT_LOAD, 0x01, (uint8_t)(id >> 8), (uint8_t)(id & 0xFF));
}

//transfer a fingerprint template from Char Buffer 1 to host computer
uint8_t Adafruit_Fingerprint::getModel(void) {
 SEND_CMD_PACKET(FINGERPRINT_UPLOAD, 0x02);
}

uint8_t Adafruit_Fingerprint::deleteModel(uint16_t id) {
 SEND_CMD_PACKET(FINGERPRINT_DELETE, (uint8_t)(id>>8), (uint8_t)(id & 0xFF), 0x00, 0x01);
}

uint8_t Adafruit_Fingerprint::emptyDatabase(void) {
 SEND_CMD_PACKET(FINGERPRINT_EMPTY);
}

uint8_t Adafruit_Fingerprint::fingerFastSearch(void) {
 // high speed search of slot #1 starting at page 0x0000 and page #0x00A3
 GET_CMD_PACKET(FINGERPRINT_HISPEEDSEARCH, 0x01, 0x00, 0x00, 0x00, 0x3E8);
 fingerID = 0xFFFF;
 confidence = 0xFFFF;

 fingerID = packet.data[1];
 fingerID <<= 8;
 fingerID |= packet.data[2];

 confidence = packet.data[3];
 confidence <<= 8;
 confidence |= packet.data[4];

 return packet.data[0];
}

uint8_t Adafruit_Fingerprint::getTemplateCount(void) {
 GET_CMD_PACKET(FINGERPRINT_TEMPLATECOUNT);

 templateCount = packet.data[1];
 templateCount <<= 8;
 templateCount |= packet.data[2];

 return packet.data[0];
}

#if ARDUINO >= 100
 #define SERIAL_WRITE(...) mySerial->write(__VA_ARGS__)
#else
 #define SERIAL_WRITE(...) mySerial->write(__VA_ARGS__, BYTE)
#endif

#define SERIAL_WRITE_U16(v) SERIAL_WRITE((uint8_t)(v>>8)); SERIAL_WRITE((uint8_t)(v & 0xFF));

void Adafruit_Fingerprint::writeStructuredPacket(const Adafruit_Fingerprint_Packet & packet) {
 SERIAL_WRITE_U16(packet.start_code);
 SERIAL_WRITE(packet.address[0]);
 SERIAL_WRITE(packet.address[1]);
 SERIAL_WRITE(packet.address[2]);
 SERIAL_WRITE(packet.address[3]);
 SERIAL_WRITE(packet.type);

 uint16_t wire_length = packet.length + 2;
 SERIAL_WRITE_U16(wire_length);

 uint16_t sum = ((wire_length)>>8) + ((wire_length)&0xFF) + packet.type;
 for (uint8_t i=0; i< packet.length; i++) {
   SERIAL_WRITE(packet.data[i]);
   sum += packet.data[i];
 }

 SERIAL_WRITE_U16(sum);
 return;
}

uint8_t Adafruit_Fingerprint::getStructuredPacket(Adafruit_Fingerprint_Packet * packet, uint16_t timeout) {
 uint8_t byte;
 uint16_t idx=0, timer=0;

 while(true) {
   while(!mySerial->available()) {
     delay(1); timer++; if(timer>=timeout) return FINGERPRINT_TIMEOUT;
   }
   byte = mySerial->read();
   switch(idx) {
     case 0:
       if(byte != FINGERPRINT_STARTCODE>>8) continue;
       packet->start_code = byte << 8;
       break;
     case 1:
       packet->start_code |= byte & 0xFF;
       if(packet->start_code != FINGERPRINT_STARTCODE) return FINGERPRINT_BADPACKET;
       break;
     case 2:
     case 3:
     case 4:
     case 5:
       packet->address[idx-2] = byte;
       break;
     case 6: packet->type = byte; break;
     case 7: packet->length = byte << 8; break;
     case 8: packet->length |= byte & 0xFF; break;
     default:
       packet->data[idx-9] = byte;
       if((idx-8) == packet->length)
         return FINGERPRINT_OK;
       break;
   }
   idx++;
 }
}
]

[/code]

starksoundar:
here, I changed that 0x01 to 0x02 in the library where the Id store and get.

[/code]

I think that this is better

/**************************************************************************/
/*!
    @brief   Ask the sensor to convert image to feature template
    @param slot Location to place feature template (put one in 1 and another in 2 for verification to create model)
    @returns <code>FINGERPRINT_OK</code> on success
    @returns <code>FINGERPRINT_IMAGEMESS</code> if image is too messy
    @returns <code>FINGERPRINT_PACKETRECIEVEERR</code> on communication error
    @returns <code>FINGERPRINT_FEATUREFAIL</code> on failure to identify fingerprint features
    @returns <code>FINGERPRINT_INVALIDIMAGE</code> on failure to identify fingerprint features
*/
uint8_t Adafruit_Fingerprint::image2Tz(uint8_t slot) {
  SEND_CMD_PACKET(FINGERPRINT_IMAGE2TZ,slot);
}

/**************************************************************************/
/*!
    @brief   Ask the sensor to take two print feature template and create a model
    @returns <code>FINGERPRINT_OK</code> on success
    @returns <code>FINGERPRINT_PACKETRECIEVEERR</code> on communication error
    @returns <code>FINGERPRINT_ENROLLMISMATCH</code> on mismatch of fingerprints
*/
uint8_t Adafruit_Fingerprint::createModel(void) {
  SEND_CMD_PACKET(FINGERPRINT_REGMODEL);
}


/**************************************************************************/
/*!
    @brief   Ask the sensor to store the calculated model for later matching
    @param   location The model location #
    @returns <code>FINGERPRINT_OK</code> on success
    @returns <code>FINGERPRINT_BADLOCATION</code> if the location is invalid
    @returns <code>FINGERPRINT_FLASHERR</code> if the model couldn't be written to flash memory
    @returns <code>FINGERPRINT_PACKETRECIEVEERR</code> on communication error
*/
uint8_t Adafruit_Fingerprint::storeModel(uint16_t location) {
  SEND_CMD_PACKET(FINGERPRINT_STORE, 0x02, (uint8_t)(location >> 8), (uint8_t)(location & 0xFF));
}

/**************************************************************************/
/*!
    @brief   Ask the sensor to load a fingerprint model from flash into buffer 1
    @param   location The model location #
    @returns <code>FINGERPRINT_OK</code> on success
    @returns <code>FINGERPRINT_BADLOCATION</code> if the location is invalid
    @returns <code>FINGERPRINT_PACKETRECIEVEERR</code> on communication error
*/
uint8_t Adafruit_Fingerprint::loadModel(uint16_t location) {
  SEND_CMD_PACKET(FINGERPRINT_LOAD, 0x02, (uint8_t)(location >> 8), (uint8_t)(location & 0xFF));
}

/**************************************************************************/
/*!
    @brief   Ask the sensor to transfer 256-byte fingerprint template from the buffer to the UART
    @returns <code>FINGERPRINT_OK</code> on success
    @returns <code>FINGERPRINT_PACKETRECIEVEERR</code> on communication error
*/
uint8_t Adafruit_Fingerprint::getModel(void) {
  SEND_CMD_PACKET(FINGERPRINT_UPLOAD, 0x02);
}

/**************************************************************************/
/*!
    @brief   Ask the sensor to delete a model in memory
    @param   location The model location #
    @returns <code>FINGERPRINT_OK</code> on success
    @returns <code>FINGERPRINT_BADLOCATION</code> if the location is invalid
    @returns <code>FINGERPRINT_FLASHERR</code> if the model couldn't be written to flash memory
    @returns <code>FINGERPRINT_PACKETRECIEVEERR</code> on communication error
*/
uint8_t Adafruit_Fingerprint::deleteModel(uint16_t location) {
  SEND_CMD_PACKET(FINGERPRINT_DELETE, (uint8_t)(location >> 8), (uint8_t)(location & 0xFF), 0x00, 0x01);
}

/**************************************************************************/
/*!
    @brief   Ask the sensor to delete ALL models in memory
    @returns <code>FINGERPRINT_OK</code> on success
    @returns <code>FINGERPRINT_BADLOCATION</code> if the location is invalid
    @returns <code>FINGERPRINT_FLASHERR</code> if the model couldn't be written to flash memory
    @returns <code>FINGERPRINT_PACKETRECIEVEERR</code> on communication error
*/
uint8_t Adafruit_Fingerprint::emptyDatabase(void) {
  SEND_CMD_PACKET(FINGERPRINT_EMPTY);
}

/**************************************************************************/
/*!
    @brief   Ask the sensor to search the current slot 1 fingerprint features to match saved templates. The matching location is stored in <b>fingerID</b> and the matching confidence in <b>confidence</b>
    @returns <code>FINGERPRINT_OK</code> on fingerprint match success
    @returns <code>FINGERPRINT_NOTFOUND</code> no match made
    @returns <code>FINGERPRINT_PACKETRECIEVEERR</code> on communication error
*/
/**************************************************************************/
uint8_t Adafruit_Fingerprint::fingerFastSearch(void) {
  // high speed search of slot #1 starting at page 0x0000 and page #0x00A3
  GET_CMD_PACKET(FINGERPRINT_HISPEEDSEARCH, 0x01, 0x00, 0x00, 0x03, 0xFF);
  fingerID = 0xFFFF;
  confidence = 0xFFFF;

  fingerID = packet.data[1];
  fingerID <<= 8;
  fingerID |= packet.data[2];

  confidence = packet.data[3];
  confidence <<= 8;
  confidence |= packet.data[4];

  return packet.data[0];
}

/**************************************************************************/
/*!
    @brief   Ask the sensor for the number of templates stored in memory. The number is stored in <b>templateCount</b> on success.
    @returns <code>FINGERPRINT_OK</code> on success
    @returns <code>FINGERPRINT_PACKETRECIEVEERR</code> on communication error
*/
/**************************************************************************/
uint8_t Adafruit_Fingerprint::getTemplateCount(void) {
  GET_CMD_PACKET(FINGERPRINT_TEMPLATECOUNT);

  templateCount = packet.data[1];
  templateCount <<= 8;
  templateCount |= packet.data[2];

  return packet.data[0];
}

/**************************************************************************/
/*!
    @brief   Set the password on the sensor (future communication will require password verification so don't forget it!!!)
    @param   password 32-bit password code
    @returns <code>FINGERPRINT_OK</code> on success
    @returns <code>FINGERPRINT_PACKETRECIEVEERR</code> on communication error
*/
/**************************************************************************/
uint8_t Adafruit_Fingerprint::setPassword(uint32_t password) {
  SEND_CMD_PACKET(FINGERPRINT_SETPASSWORD, (password >> 24), (password >> 16), (password >> 8), password);
}

/**************************************************************************/
/*!
    @brief   Helper function to process a packet and send it over UART to the sensor
    @param   packet A structure containing the bytes to transmit
*/
/**************************************************************************/

void Adafruit_Fingerprint::writeStructuredPacket(const Adafruit_Fingerprint_Packet & packet) {
  SERIAL_WRITE_U16(packet.start_code);
  SERIAL_WRITE(packet.address[0]);
  SERIAL_WRITE(packet.address[1]);
  SERIAL_WRITE(packet.address[2]);
  SERIAL_WRITE(packet.address[3]);
  SERIAL_WRITE(packet.type);

  uint16_t wire_length = packet.length + 2;
  SERIAL_WRITE_U16(wire_length);

  uint16_t sum = ((wire_length)>>8) + ((wire_length)&0xFF) + packet.type;
  for (uint8_t i=0; i< packet.length; i++) {
    SERIAL_WRITE(packet.data[i]);
    sum += packet.data[i];
  }

  SERIAL_WRITE_U16(sum);
  return;
}

here i modified

starksoundar:

/**************************************************************************/

/*!
   @brief   Ask the sensor to convert image to feature template
   @param slot Location to place feature template (put one in 1 and another in 2 for verification to create model)
   @returns FINGERPRINT_OK on success
   @returns FINGERPRINT_IMAGEMESS if image is too messy
   @returns FINGERPRINT_PACKETRECIEVEERR on communication error
   @returns FINGERPRINT_FEATUREFAIL on failure to identify fingerprint features
   @returns FINGERPRINT_INVALIDIMAGE on failure to identify fingerprint features
*/
uint8_t Adafruit_Fingerprint::image2Tz(uint8_t slot) {
 SEND_CMD_PACKET(FINGERPRINT_IMAGE2TZ,slot);
}

/**************************************************************************/
/*!
   @brief   Ask the sensor to take two print feature template and create a model
   @returns FINGERPRINT_OK on success
   @returns FINGERPRINT_PACKETRECIEVEERR on communication error
   @returns FINGERPRINT_ENROLLMISMATCH on mismatch of fingerprints
*/
uint8_t Adafruit_Fingerprint::createModel(void) {
 SEND_CMD_PACKET(FINGERPRINT_REGMODEL);
}

/**************************************************************************/
/*!
   @brief   Ask the sensor to store the calculated model for later matching
   @param   location The model location #
   @returns FINGERPRINT_OK on success
   @returns FINGERPRINT_BADLOCATION if the location is invalid
   @returns FINGERPRINT_FLASHERR if the model couldn’t be written to flash memory
   @returns FINGERPRINT_PACKETRECIEVEERR on communication error
*/
uint8_t Adafruit_Fingerprint::storeModel(uint16_t location) {
 SEND_CMD_PACKET(FINGERPRINT_STORE, 0x02, (uint8_t)(location >> 8), (uint8_t)(location & 0xFF));
}

/**************************************************************************/
/*!
   @brief   Ask the sensor to load a fingerprint model from flash into buffer 1
   @param   location The model location #
   @returns FINGERPRINT_OK on success
   @returns FINGERPRINT_BADLOCATION if the location is invalid
   @returns FINGERPRINT_PACKETRECIEVEERR on communication error
*/
uint8_t Adafruit_Fingerprint::loadModel(uint16_t location) {
 SEND_CMD_PACKET(FINGERPRINT_LOAD, 0x02, (uint8_t)(location >> 8), (uint8_t)(location & 0xFF));
}

/**************************************************************************/
/*!
   @brief   Ask the sensor to transfer 256-byte fingerprint template from the buffer to the UART
   @returns FINGERPRINT_OK on success
   @returns FINGERPRINT_PACKETRECIEVEERR on communication error
*/
uint8_t Adafruit_Fingerprint::getModel(void) {
 SEND_CMD_PACKET(FINGERPRINT_UPLOAD, 0x02);
}

/**************************************************************************/
/*!
   @brief   Ask the sensor to delete a model in memory
   @param   location The model location #
   @returns FINGERPRINT_OK on success
   @returns FINGERPRINT_BADLOCATION if the location is invalid
   @returns FINGERPRINT_FLASHERR if the model couldn’t be written to flash memory
   @returns FINGERPRINT_PACKETRECIEVEERR on communication error
*/
uint8_t Adafruit_Fingerprint::deleteModel(uint16_t location) {
 SEND_CMD_PACKET(FINGERPRINT_DELETE, (uint8_t)(location >> 8), (uint8_t)(location & 0xFF), 0x00, 0x01);
}

/**************************************************************************/
/*!
   @brief   Ask the sensor to delete ALL models in memory
   @returns FINGERPRINT_OK on success
   @returns FINGERPRINT_BADLOCATION if the location is invalid
   @returns FINGERPRINT_FLASHERR if the model couldn’t be written to flash memory
   @returns FINGERPRINT_PACKETRECIEVEERR on communication error
*/
uint8_t Adafruit_Fingerprint::emptyDatabase(void) {
 SEND_CMD_PACKET(FINGERPRINT_EMPTY);
}

//
/*!
   @brief   Ask the sensor to search the current slot 1 fingerprint features to match saved templates. The matching location is stored in fingerID and the matching confidence in confidence
   @returns FINGERPRINT_OK on fingerprint match success
   @returns FINGERPRINT_NOTFOUND no match made
   @returns FINGERPRINT_PACKETRECIEVEERR on communication error
*/
/
/
uint8_t Adafruit_Fingerprint::fingerFastSearch(void) {
 // high speed search of slot #1 starting at page 0x0000 and page #0x00A3
 GET_CMD_PACKET(FINGERPRINT_HISPEEDSEARCH, 0x01, 0x00, 0x00, 0x03, 0xFF);
 fingerID = 0xFFFF;
 confidence = 0xFFFF;

fingerID = packet.data[1];
 fingerID <<= 8;
 fingerID |= packet.data[2];

confidence = packet.data[3];
 confidence <<= 8;
 confidence |= packet.data[4];

return packet.data[0];
}

//
/*!
   @brief   Ask the sensor for the number of templates stored in memory. The number is stored in templateCount on success.
   @returns FINGERPRINT_OK on success
   @returns FINGERPRINT_PACKETRECIEVEERR on communication error
*/
/
/
uint8_t Adafruit_Fingerprint::getTemplateCount(void) {
 GET_CMD_PACKET(FINGERPRINT_TEMPLATECOUNT);

templateCount = packet.data[1];
 templateCount <<= 8;
 templateCount |= packet.data[2];

return packet.data[0];
}

//
/*!
   @brief   Set the password on the sensor (future communication will require password verification so don’t forget it!!!)
   @param   password 32-bit password code
   @returns FINGERPRINT_OK on success
   @returns FINGERPRINT_PACKETRECIEVEERR on communication error
*/
/
/
uint8_t Adafruit_Fingerprint::setPassword(uint32_t password) {
 SEND_CMD_PACKET(FINGERPRINT_SETPASSWORD, (password >> 24), (password >> 16), (password >> 8), password);
}

//
/*!
   @brief   Helper function to process a packet and send it over UART to the sensor
   @param   packet A structure containing the bytes to transmit
*/
/
/

void Adafruit_Fingerprint::writeStructuredPacket(const Adafruit_Fingerprint_Packet & packet) {
 SERIAL_WRITE_U16(packet.start_code);
 SERIAL_WRITE(packet.address[0]);
 SERIAL_WRITE(packet.address[1]);
 SERIAL_WRITE(packet.address[2]);
 SERIAL_WRITE(packet.address[3]);
 SERIAL_WRITE(packet.type);

uint16_t wire_length = packet.length + 2;
 SERIAL_WRITE_U16(wire_length);

uint16_t sum = ((wire_length)>>8) + ((wire_length)&0xFF) + packet.type;
 for (uint8_t i=0; i< packet.length; i++) {
   SERIAL_WRITE(packet.data[i]);
   sum += packet.data[i];
 }

SERIAL_WRITE_U16(sum);
 return;
}




here i modified

Thanks a lot Starksoundar. It worked

if you could post the library edited version that will be of great help
thank you

starksoundar:

/**************************************************************************/

/*!
    @brief  Ask the sensor to convert image to feature template
    @param slot Location to place feature template (put one in 1 and another in 2 for verification to create

it worked thank you

i have "Re: INCREASE BIOMETRIC ID" can you fix error