Upload external fingerprint from DB to Adafruit Fingerprint Sensor

Hi everyone, i'm currently working with Fingerprint modules to develop an access control security system, i've been able to extract an already enrolled fingerprint from the sensor to my database (or at least i think i extracted it correctly, extracting a 534 bytes model).

The next step for me is using this template or model (the 534 bytes i have in the DB) and load it into another fingerprint module for later matching. To explain better the whole proyect, i want to enroll fingerprints in the first module, load them to the database and also load them to the second module, in order to be able to recognize the same fingerprint in the second module.

My problem is that i don't really know how the library functions work. I've read all the documentation and the getModel() and storeModel() functions are the ones i think i have to use, but there's no documentation whatsoever on where do this functions search for the model. So i don't know where to search for my fingerprint when i send it via UART (serial) to the arduino, and as i'm not enrolling a fingerprint using getFingerprintEnroll() i'm not sure if the getModel() function search for it in the buffer, or somewhere else.

In getFingerprintEnroll() after taking the two images to create the model, the storeModel() function is used, so i'm trying to replicate the process without taking the images and creating a model (because this model already exists from the first module) and i'm trying to store this already created model.

I don't know if anyone is familiar with this whole topic of if someone has already done this. For what i've read in the internet most of the people get stuck in extracting the fingerprint and i haven't read any post of someone with this problem.

Any help would be very helpfull. Than you :slight_smile: :smiley:

Hello Angux

I’m doing a potion like yours, and I also need to send the reader data to a database, can you tell me how you did it? And if you managed to finish the project? To see if it really is possible or not

You have the R307 fingerprint reader? Please let me know how you managed to enroll your finger prints, as the three I have just don't manage to do this.

For the finger print data: I remember the datasheet of those sensors only mention you can read it off the sensor, it doesn't give a way of uploading it onto another one. This is what I hoped to do so you can enroll on one, and later check in on a dozen.

Im trying to replicate the exact same thing, apart from what you've been trying to do by replicating the enrollment process and filling the images & models with already enrolled prints I've been doing so research on alternate functions, two I've found are; "getStructuredPacket()" & "writeStructuredPacket()", I'm not 100% on what these do but i think they may be used to extract the fingerprint & write it elsewhere. However there isn't too much information about it online so if someone could figure out how they work this may possibly help.

Hi all, i haven’t managed to solve the problem, but i’ll try to answer all of the things you’re asking.

@Joao_Simoes04 To upload the fingerprints to the database i’ve managed to do this thanks to this post:

Read all the “Don Jeronimo” posts, i think in page 5 he has all the steps to follow and he gives some adapted libraries he made himself. I’ll explain how i did it with all the information he provided.

First of all in the libraries he provides, the first thing he does is to configure the fingerprint sensor (@wvmarle R307 in my case, i think by doing this configurations perhaps you can save the fingerprints if you haven’t done it so far), he provides a sketch to do this (read the link and the datasheet so you can understand how). I am working with 57600 bauds and extracting the templates in two packages of 256 bytes each (11 bytes of headers for each package). Making a total template of 534 bytes (22 bytes of headers).

Here is a function to upload the fingerprints from the sensor and send it via serial, only works with the packet size of 256 bytes, you have to change the function if you want to send the templates in another format (if you have for example packages of 32 bytes it would be 32x16 = 512 for the template itself + 11x16 = 176 from the headers = 688 bytes in total, take this into account).

I’ve read a lot of forums and i don’t really remember how i made or obtained this function (lol), it is an adaptation from the original library and other stuff i’ve found reading. With this one you should be able to send the template via serial. After that i work with python to read the incoming template and i save it in the DB.

void loadFingerprints(uint16_t id) {
Serial.print("Loading fingerprint: "); Serial.println(id);
uint8_t p = finger.loadModel(id);

switch (p) {
Serial.print(“template “); Serial.print(id); Serial.println(” loaded”);
Serial.println(“Communication error”);
return p;
Serial.print("Unknown error "); Serial.println(p);
return p;

Serial.print(“Attempting to get #”); Serial.println(id);
p = finger.getModel();
switch (p) {
Serial.print(“Template “); Serial.print(id); Serial.println(” transferring:”);
Serial.print("Unknown error "); Serial.println(p);
return p;

// one data packet is 267 bytes. in one data packet, 11 bytes are ‘usesless’ :smiley:
uint8_t bytesReceived[534]; // 2 data packets
memset(bytesReceived, 0xff, 534);

uint32_t starttime = millis();
int i = 0;
while (i < 534 && (millis() - starttime) < 20000) {
if (mySerial.available()) {
bytesReceived = mySerial.read();

  • i++;*

  • }*

  • }*

  • Serial.print(i); Serial.println(" bytes read.");*

  • Serial.println(“Decoding packet…”);*

  • for (int i = 0; i < 534; ++i) {*
    _ printHex(bytesReceived*, 2);_
    void printHex(int num, int precision) {
    char tmp[16];_
    char format[128];*_

* sprintf(format, “%%.%dX”, precision);*

* sprintf(tmp, format, num);*
* //Serial.print(" 0x");*
* Serial.print(tmp);*
* arduino_port.listen();
//arduino_port.print(“Loading ID\n”);
This is what i have been using, as for what @ERolfe03 says, i’ve read those functions also, but as you say, i’m not entirely sure how they work or what they do. The documentation of the adafruit libraries is not very good and it doesn’t explain the functions in detail.
Right now the problem i have is that i’m working with an arduino nano (due to it’s size i’m required to) and the memory is very limited. I’ve managed to send the FP to the sensor and read it succesfully, but i don’t know what to do now in order to save that FP into the second sensor, as i don’t have enough memory to save it in a variable inside the arduino (i don’t even know if this would help).
Sorry it took me son long to answer but i haven’t managed to solve the problem. Let me know if you are able to follow this steps and to save the FP to the database succesfully :). If you find a way to solve this and to finish this project it would be great if you can complete the response lol.

I am using ESP32 and R307 to make a bio-metric attendance system.
I need to match the fingerprints outside the sensor.
I can extract the fingerprint templates from the sensor but i am not able to reconstruct the image from it.
Please help!!

You need to look for a different sensor, one that can do what you're looking for. Not the R307.