This circuit integrates an Arduino 101 microcontroller with an R307 Fingerprint Sensor, powered by a 5V DC source. The Arduino 101 communicates with the fingerprint sensor via serial communication to enroll and verify fingerprints. The DC source provides power to both the Arduino and the sensor. The circuit is designed for applications requiring biometric authentication.
/*
* Arduino Sketch for interfacing with an R307 Fingerprint Sensor
* using an Arduino 101. The Arduino will communicate with the
* fingerprint sensor to enroll and verify fingerprints.
*/
#include <Adafruit_Fingerprint.h>
#include <SoftwareSerial.h>
// Define the pins for the fingerprint sensor
#define rxPin 0
#define txPin 1
// Create a software serial port
SoftwareSerial mySerial(rxPin, txPin);
// Create a fingerprint sensor object
Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);
void setup() {
// Initialize serial communication
Serial.begin(9600);
while (!Serial);
Serial.println("Adafruit Fingerprint sensor enrollment");
// Initialize the fingerprint sensor
finger.begin(57600);
if (finger.verifyPassword()) {
Serial.println("Found fingerprint sensor!");
} else {
Serial.println("Did not find fingerprint sensor :(");
while (1) { delay(1); }
}
}
void loop() {
// Check if a finger is placed on the sensor
if (finger.getImage() == FINGERPRINT_OK) {
Serial.println("Image taken");
// Convert the image to a template
if (finger.image2Tz() == FINGERPRINT_OK) {
Serial.println("Image converted");
// Search for a match
if (finger.fingerFastSearch() == FINGERPRINT_OK) {
Serial.print("Found ID #");
Serial.print(finger.fingerID);
Serial.print(" with confidence ");
Serial.println(finger.confidence);
} else {
Serial.println("Did not find a match");
}
} else {
Serial.println("Image conversion failed");
}
} else {
Serial.println("No finger detected");
}
delay(1000); // Wait for a second before next check
}
This code is designed to run on the Arduino 101 and interfaces with the R307 Fingerprint Sensor. It initializes the sensor and continuously checks for a finger placement. When a finger is detected, it attempts to convert the image to a template and search for a match in the enrolled fingerprints. The results, along with any relevant messages, are output to the serial monitor.