Page 1 of 1

ESP32 PSRAM Timer Camera X, FINGERPRINT

Posted: Mon Feb 05, 2024 10:38 am
by lubeno22
Hi guys please im having ESP32 PSRAM Timer Camera X and i bought Finger Print Sensor Unit (FPC1020A), please could someone help me create some test code if fingerprint sensor is working. Its connected via Grove Cable. I cant make it work.... like im not getting any value .. Maybe i just doing some mistake with rx, tx. i just dont know how to make it.

#include "M5_FPC1020A.h"

FingerPrint Finger;

void setup() {
Serial.begin(115200);
delay(2000);

Serial.println("FingerPrint Sensor Setup");


uint8_t rx = 13;
uint8_t tx = 4;

Finger.begin(&Serial2, rx, tx);
}

void loop() {

uint8_t addUserResult = Finger.fpm_addUser(1, 1);

if (addUserResult == ACK_SUCCESS) {
Serial.println("User added successfully!");
} else {
Serial.print("Failed to add user. Error code: ");
Serial.println(addUserResult);
}

// Compare fingerprints

uint8_t compareResult = Finger.fpm_compareFinger();

if (compareResult == ACK_SUCCESS) {
Serial.println("Fingerprints match!");
} else if (compareResult == ACK_NOUSER) {
Serial.println("No fingerprints enrolled.");
} else if (compareResult == ACK_TIMEOUT) {
Serial.println("Fingerprint matching timeout.");
} else {
Serial.print("Fingerprints do not match. Error code: ");
Serial.println(compareResult);
}

delay(10000);
}

Re: ESP32 PSRAM Timer Camera X, FINGERPRINT

Posted: Mon Feb 05, 2024 3:01 pm
by lubeno22
void loop() {
// Print the current add mode
Serial.println(Finger.fpm_readAddMode());

// Add a user with user number 21 and permission 1
uint8_t addUserResult = Finger.fpm_addUser(21, 1);
// Print the result of adding the user
Serial.print("Add user result: ");
Serial.println(addUserResult);

// Print additional details for debugging
for (int i = 0; i < 9; i++) {
Serial.print("RxBuf[");
Serial.print(i);
Serial.print("]: ");
Serial.println(Finger.RxBuf, HEX);
}

output when the finger is not placed on the fingerprint:
1
Add user result: 1
RxBuf[0]: FF
RxBuf[1]: 0
RxBuf[2]: 0
RxBuf[3]: 0
RxBuf[4]: 0
RxBuf[5]: 0
RxBuf[6]: 0
RxBuf[7]: 0
RxBuf[8]: 0

output when the finger is placed on the fingerprint:
Add user result: 1
RxBuf[0]: FF
RxBuf[1]: FF
RxBuf[2]: FF
RxBuf[3]: FF
RxBuf[4]: FF
RxBuf[5]: FF
RxBuf[6]: FF
RxBuf[7]: FF
RxBuf[8]: 0

Re: ESP32 PSRAM Timer Camera X, FINGERPRINT

Posted: Mon Feb 05, 2024 9:35 pm
by lbernstone
This should send the add user command to the device. It should spit out 7 characters or so. If you get nothing, maybe you have tx/rx reversed, or the device isn't getting enough/proper power. If you do get a response, then you will need to open an issue on the library repo.

Code: Select all

void setup() {
  Serial.begin(115200);
  uint8_t rx = 13;
  uint8_t tx = 4;
  Serial1.begin(19200, SERIAL_8N1, rx, tx);
  uint8_t TxBuf[6] = {0, 1, 0, 1, 1, 0};
  uint8_t checkSum = 0;
  Serial1.write(0xF5);
  for (int i = 1; i < 6; i++) {
      Serial1.write(TxBuf[i]);
      checkSum ^= TxBuf[i];
  }
  Serial1.write(checkSum);
  Serial1.write(0xF5);
  Serial1.flush();
  Serial.println("Command sent");
}

void loop() {
  while (Serial1.available()) {
    Serial.printf("%X\n", Serial1.read());
  }
  delay(10);
}

Re: ESP32 PSRAM Timer Camera X, FINGERPRINT

Posted: Tue Feb 06, 2024 9:07 am
by lubeno22
Thank you for your reply appreciate that. I try that code when i put finger on fingerprint i got this: 1
0
0
0
0
1
F5.
But it didn't go smoothly. Like in a loop there is a while loop and how it should spam 7 characters but it doesn't.


The code I sent you above output (RxBuf[0]: FF RxBuf[1]: FF RxBuf[2]: FF RxBuf[3]: FF RxBuf[4]: FF RxBuf[5]: FF RxBuf[6]: FF RxBuf[7]: FF RxBuf[8]: 0).

when I try to test 100x by putting my finger... I have Add user result: 0 but the chance is 1/100.
User added successfully!
RxBuf[0]: F5
RxBuf[1]: 3
RxBuf[2]: 0
RxBuf[3]: 0
RxBuf[4]: 0
RxBuf[5]: 0
RxBuf[6]: 3
RxBuf[7]: F5
RxBuf[8]: 0


So could it be the fingerprint unit is broken? Or voltage what do you think ? Thank you. Lubos.

Re: ESP32 PSRAM Timer Camera X, FINGERPRINT

Posted: Wed Feb 07, 2024 10:00 am
by lbernstone
The device is working. My code is not intended to be fully functional. If the library is not working properly, you will need to post an issue with the author.

Re: ESP32 PSRAM Timer Camera X, FINGERPRINT

Posted: Thu Feb 08, 2024 2:50 pm
by lubeno22
Thank you very much. You seem to know a lot about a lot of things, I would like to ask you one more question. Now I'm using AS608 fingerprint, Adafruit_Fingerprint.h library, although I googled it and it's probably not possible to be sure, I would like to ask you. I would like to get the raw data from the fingerprint sensor. I would like to create my own comparison method and technique for fingerprint recognition

Re: ESP32 PSRAM Timer Camera X, FINGERPRINT

Posted: Thu Feb 08, 2024 3:27 pm
by lbernstone
There is a datasheet somewhere (presumably on Adafruit's site) that describes the request/response transactions. That will explain the content of those messages. Using that and the existing library, it should be possible to get the device working.
If you are talking about making your own biometric system, that is well beyond my knowledge, and requires a strong background in mathematics.