Hi
I have an fingerprint sensor just like the one from Adafruit but with red light.
I've connected it to an original Arduino Uno Rev3 via SoftwareSerial (Pins 2&3) and it worked flawlessly.
But when I connect it to an ESP32 DOIT Devkit V1 via HardwareSerial(UART2: Pins 16&17), the ESP32 won't recognize the fingerprint sensor.
I am using the fingerprint sensor library from Adafruit and the fingerprint example sketch from it.
This is my code without void loop:
#include <Adafruit_Fingerprint.h>
// On Leonardo/Micro or others with hardware serial, use those! #0 is green wire, #1 is white
// uncomment this line:
// #define mySerial Serial1
HardwareSerial mySerial(2);
// For UNO and others without hardware serial, we must use software serial...
// pin #2 is IN from sensor (GREEN wire)
// pin #3 is OUT from arduino (WHITE wire)
// comment these two lines if using hardware serial
//#include <SoftwareSerial.h>
//SoftwareSerial mySerial(2, 3);
Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);
void setup()
{
Serial.begin(9600);
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);
if (finger.verifyPassword()) {
Serial.println("Found fingerprint sensor!");
} else {
Serial.println("Did not find fingerprint sensor :(");
while (1) { delay(1); }
}
finger.getTemplateCount();
Serial.print("Sensor contains "); Serial.print(finger.templateCount); Serial.println(" templates");
Serial.println("Waiting for valid finger...");
}
On my Serial Monitor I always get this output:
"Did not find fingerprint sensor : ("
My circuit is shown the image in the attachment. In it I used the LunaNode, but it should be the ESP32 Devkit-board.
How do I get the fingerprint sensor working with the ESP32?