IOT

Fingerprint Sensor Based Self Bike Starter using Arduino

Due to an increase in vehicle thefts, vehicle security is a crucial concern nowadays. The handling of car keys is yet another problem. Keys must be carried, and losing or misplacing them will result in a significant problem. Here, we offer the use of a fingerprint-authenticated vehicle starter system as a solution to this issue.

In this project, we will interface an Arduino with a fingerprint sensor to create a self-starting bike that uses a fingerprint sensor. We are using the R305 Fingerprint Scanner Module type of fingerprint module.

Proposed System

One of the safest bike starting systems is fingerprint sensor-based because it can accurately identify and separate each person as an individual without making any mistakes. The module is also so compact that it can be stored anywhere, and because of its portability and low power requirements, you can bring it wherever you go.

Although biometrics and fingerprint identification has existed in some form for well over a century, the rise of the maker community is largely responsible for the R305 Fingerprint Module’s success. With the help of a potent DSP at its core, R305 is a commonly utilized module in fingerprint scanners. A set of hex codes in a particular format can be used to communicate with it.

Hardware Specifications

  • Arduino UNO R3 Development Board
  • R305/R307 Fingerprint Sensor
  • 1 Channel 5V Relay Module
  • Connecting Wires
  • Breadboard

R305 Fingerprint Scanner Sensor Module

This fingerprint sensor module has a TTL UART interface for connecting directly to a microcontroller UART or to a computer using a MAX232 or USB-Serial adapter. When recognising a person, the user can configure the module to operate in 1:1 or 1: N mode and save the fingerprint data there.

Interfacing Fingerprint Sensor with Arduino

Any microcontroller, including the Arduino Board, can be directly interfaced with the fingerprint module. With excellent capabilities, this optical biometric fingerprint reader may be integrated into a wide range of finished goods, including access control systems, attendance systems, safe deposit boxes, and automobile door locking systems.

Features

  • Power DC: 3.6V-6.0V
  • Interface : UART (TTL logical level)/ USB 1.1)
  • Working current: 100mA
  • Peak Current: 150mA
  • Matching mode (1: 1)
  • Search method (1: N)
  • Connecting cable length (cm): 8.5
  • Baud rate (9600*N)bps, N=1-12 (default N=6 57600bps)
  • Character file size: 256 bytes
  • Image acquiring time: <0.5s
  • Template size: 512 bytes
  • Storage capacity: 256
  • FAR : <0.001%; FRR: <0.1%
  • Average searching time: < 0.8s (1:880)
  • Working environment: Temp: -10degree to +40degree C
  • Storage environment Temp: -40degree to +85degree C
  • RH: 40%-85% RH: <85%
  • Integrated image collecting and algorithm chip together, ALL-in-One.
  • Low power consumption, low cost, small size, excellent performance.
  • Professional optical technology, precise module manufacturing techniques.

Circuit Diagram & Connections

Fingerprint Sensor Based Self Bike Starter using Arduino

Make the connections as indicated in the above figure. Relay module input should be connected to Arduino’s digital pin 8. Similarly, join the Tx and RX pins of the fingerprint sensor to Arduino Uno’s digital pins 3 and 2.

Source Code/program for Enrolling Fingerprint

The desired finger must first be registered. By registering in the fingerprint, the registration is completed. On the basis of the command displayed in the serial monitor, enrollment is completed by placing the finger on the top of the glass. To register your fingerprint, follow the video tutorial below.

Upload this code to your Arduino board by copying it. The Adafruit Fingerprint Sensor library must first be added before that. So click here to download the library:Download Adafruit Fingerprint Sensor Library

#include <Adafruit_Fingerprint.h>

SoftwareSerial mySerial(2, 3);

Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);

uint8_t id;

void setup()
{
Serial.begin(9600);
while (!Serial); // For Yun/Leo/Micro/Zero/…
delay(100);
Serial.println(“\n\nAdafruit Fingerprint sensor enrollment”);

// 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); }
}
}

uint8_t readnumber(void) {
uint8_t num = 0;

while (num == 0) {
while (! Serial.available());
num = Serial.parseInt();
}
return num;
}

void loop() // run over and over again
{
Serial.println(“Ready to enroll a fingerprint!”);
Serial.println(“Please type in the ID # (from 1 to 127) you want to save this finger as…”);
id = readnumber();
if (id == 0) {// ID #0 not allowed, try again!
return;
}
Serial.print(“Enrolling ID #”);
Serial.println(id);

while (! getFingerprintEnroll() );
}

uint8_t getFingerprintEnroll() {

int p = -1;
Serial.print(“Waiting for valid finger to enroll as #”); Serial.println(id);
while (p != FINGERPRINT_OK) {
p = finger.getImage();
switch (p) {
case FINGERPRINT_OK:
Serial.println(“Image taken”);
break;
case FINGERPRINT_NOFINGER:
Serial.println(“.”);
break;
case FINGERPRINT_PACKETRECIEVEERR:
Serial.println(“Communication error”);
break;
case FINGERPRINT_IMAGEFAIL:
Serial.println(“Imaging error”);
break;
default:
Serial.println(“Unknown error”);
break;
}
}

// OK success!

p = finger.image2Tz(1);
switch (p) {
case FINGERPRINT_OK:
Serial.println(“Image converted”);
break;
case FINGERPRINT_IMAGEMESS:
Serial.println(“Image too messy”);
return p;
case FINGERPRINT_PACKETRECIEVEERR:
Serial.println(“Communication error”);
return p;
case FINGERPRINT_FEATUREFAIL:
Serial.println(“Could not find fingerprint features”);
return p;
case FINGERPRINT_INVALIDIMAGE:
Serial.println(“Could not find fingerprint features”);
return p;
default:
Serial.println(“Unknown error”);
return p;
}

Serial.println(“Remove finger”);
delay(2000);
p = 0;
while (p != FINGERPRINT_NOFINGER) {
p = finger.getImage();
}
Serial.print(“ID “); Serial.println(id);
p = -1;
Serial.println(“Place same finger again”);
while (p != FINGERPRINT_OK) {
p = finger.getImage();
switch (p) {
case FINGERPRINT_OK:
Serial.println(“Image taken”);
break;
case FINGERPRINT_NOFINGER:
Serial.print(“.”);
break;
case FINGERPRINT_PACKETRECIEVEERR:
Serial.println(“Communication error”);
break;
case FINGERPRINT_IMAGEFAIL:
Serial.println(“Imaging error”);
break;
default:
Serial.println(“Unknown error”);
break;
}
}

// OK success!

p = finger.image2Tz(2);
switch (p) {
case FINGERPRINT_OK:
Serial.println(“Image converted”);
break;
case FINGERPRINT_IMAGEMESS:
Serial.println(“Image too messy”);
return p;
case FINGERPRINT_PACKETRECIEVEERR:
Serial.println(“Communication error”);
return p;
case FINGERPRINT_FEATUREFAIL:
Serial.println(“Could not find fingerprint features”);
return p;
case FINGERPRINT_INVALIDIMAGE:
Serial.println(“Could not find fingerprint features”);
return p;
default:
Serial.println(“Unknown error”);
return p;
}

// OK converted!
Serial.print(“Creating model for #”); Serial.println(id);

p = finger.createModel();
if (p == FINGERPRINT_OK) {
Serial.println(“Prints matched!”);
} else if (p == FINGERPRINT_PACKETRECIEVEERR) {
Serial.println(“Communication error”);
return p;
} else if (p == FINGERPRINT_ENROLLMISMATCH) {
Serial.println(“Fingerprints did not match”);
return p;
} else {
Serial.println(“Unknown error”);
return p;
}

Serial.print(“ID “); Serial.println(id);
p = finger.storeModel(id);
if (p == FINGERPRINT_OK) {
Serial.println(“Stored!”);
} else if (p == FINGERPRINT_PACKETRECIEVEERR) {
Serial.println(“Communication error”);
return p;
} else if (p == FINGERPRINT_BADLOCATION) {
Serial.println(“Could not store in that location”);
return p;
} else if (p == FINGERPRINT_FLASHERR) {
Serial.println(“Error writing to flash”);
return p;
} else {
Serial.println(“Unknown error”);
return p;
}
}

Source Code/program for Bike Starting Using Fingerprint

You must upload this code to your Arduino board after enrolling or registering the chosen finger’s fingerprint. When a right finger is detected, this code has the ability to start the bike automatically. The bike won’t start if an unregistered finger is inserted.

#include <Adafruit_Fingerprint.h>
SoftwareSerial mySerial(2, 3);

Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);

void setup()
{
pinMode (8,OUTPUT);
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…”);
}

void loop() // run over and over again
{
getFingerprintIDez();
delay(50); //don’t ned to run this at full speed.
}

uint8_t getFingerprintID() {
uint8_t p = finger.getImage();
switch (p) {
case FINGERPRINT_OK:
Serial.println(“Image taken”);
break;
case FINGERPRINT_NOFINGER:
Serial.println(“No finger detected”);
return p;
case FINGERPRINT_PACKETRECIEVEERR:
Serial.println(“Communication error”);
return p;
case FINGERPRINT_IMAGEFAIL:
Serial.println(“Imaging error”);
return p;
default:
Serial.println(“Unknown error”);
return p;
}

// OK success!

p = finger.image2Tz();
switch (p) {
case FINGERPRINT_OK:
Serial.println(“Image converted”);
break;
case FINGERPRINT_IMAGEMESS:
Serial.println(“Image too messy”);
return p;
case FINGERPRINT_PACKETRECIEVEERR:
Serial.println(“Communication error”);
return p;
case FINGERPRINT_FEATUREFAIL:
Serial.println(“Could not find fingerprint features”);
return p;
case FINGERPRINT_INVALIDIMAGE:
Serial.println(“Could not find fingerprint features”);
return p;
default:
Serial.println(“Unknown error”);
return p;
}

// OK converted!
p = finger.fingerFastSearch();
if (p == FINGERPRINT_OK) {
Serial.println(“Found a print match!”);
} else if (p == FINGERPRINT_PACKETRECIEVEERR) {
Serial.println(“Communication error”);
return p;
} else if (p == FINGERPRINT_NOTFOUND) {
Serial.println(“Did not find a match”);
return p;
} else {
Serial.println(“Unknown error”);
return p;
}

// found a match!
Serial.print(“Found ID #”); Serial.print(finger.fingerID);
Serial.print(” with confidence of “); Serial.println(finger.confidence);

return finger.fingerID;
}

// returns -1 if failed, otherwise returns ID #
int getFingerprintIDez() {
uint8_t p = finger.getImage();
if (p != FINGERPRINT_OK) return -1;

p = finger.image2Tz();
if (p != FINGERPRINT_OK) return -1;

p = finger.fingerFastSearch();
if (p != FINGERPRINT_OK) return -1;

// found a match!
digitalWrite(8,HIGH);
delay(1500);
digitalWrite(8,LOW);

Serial.print(“Found ID #”); Serial.print(finger.fingerID);
Serial.print(” with confidence of “); Serial.println(finger.confidence);
return finger.fingerID;
}

ConclusionI hope all of you have understood how to interface  Interfacing Fingerprint Sensor with Arduino to design Fingerprint Sensor Based Self Bike Starter using Arduino.. We MATHA ELECTRONICS will be back soon with more informative blogs.

Leave a Reply

Your email address will not be published.