Establishing Communication Between ESP32 and R307 Fingerprint Sensor: Initialization Issues

How do I set up and establish communication between the ESP32 and the R307 fingerprint sensor, ensuring that the sensor can be recognized and initialized by the ESP32? My aim is to connect the ESP32 to the R307 fingerprint sensor and establish communication using serial interfaces. I am encountering the error Fingerprint sensor not found

#include <Adafruit_Fingerprint.h>
#include <HardwareSerial.h>

HardwareSerial mySerial(2);  // Use Serial2 for communication
Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);

void setup()
{
  Serial.begin(115200);
  mySerial.begin(57600, SERIAL_8N1, 16, 17);  // RX, TX pins for ESP32
  
  Serial.println("Initializing fingerprint sensor...");
  
  finger.begin(57600);
  
  if (finger.verifyPassword())
    Serial.println("Fingerprint sensor initialized successfully!");
  else
    Serial.println("Fingerprint sensor not found, check wiring!");
}

void loop() {
  // Main loop can be empty for now
}
Was this page helpful?