Fingerprint-Based Biometric Attendance System Using Arduino

Biometric Attendance System: In today’s innovative world, biometric is an advanced technology used for people identification. Biometric technology is defined as the automatic identification of a person based on biological characters such as fingerprint, iris scan, facial recognition, etc.

In this project, we will be going to build a fingerprint-based biometric attendance system using Arduino. The attendance system in educational institutions, industries, offices will require more paper works and time. To avoid such complexity, an automatic biometric attendance system using fingerprints was developed.

Here, we are going to explain in detail how to design a circuit of fingerprint-based biometric attendance system and its working principle.

Principle Behind Fingerprint Based Biometric Attendance System

The basic principle of this project is to take the attendance using the fingerprint module and show results in the display when necessary.

Fingerprint identification is based on the purpose that no another persons have the same fingerprint in this whole world. Because no one on earth can have the same genetic code of DNA. The main function of the fingerprint module is to distinguish between the ridges and valleys of two fingers. When the fingerprint is given, it stores the structural points where there are changes in the direction of ridges and valleys using some technical algorithms. Inside a fingerprint module, a DSP processor is present to implement and analyze the algorithm.

This module sends commands to the controller of the device whenever the fingerprint is matched. The microcontroller (Arduino) receives these commands from the fingerprint print module and uses the internal EEPROM to store the attendance as data. A keypad is used here to send the requests to the controller to either enroll a new one or save the attendance or exit. LCD display shows the information related to the commands received.

Project

Fingerprint based biometric attendance system using Arduino
Fingerprint Based Biometric Attendance System

Circuit Diagram

Fingerprint Based Biometric Attendance System Circuit
Fingerprint Based Biometric Attendance System Circuit

Components Required

  • Arduino Nano
  • Finger Print Module
  • RTC Module
  • 4×3 Keypad
  • 16×2 LCD Display
  • Push Buttons (x4)
  • 1K Resistor (x2)
  • 2.2K Resistor
  • Wires
  • Case

Circuit Connection of Fingerprint Based Biometric Attendance System

Here, we used an Arduino ATmega328 microcontroller which is an AVR family microcontroller. It is an 8-bit microcontroller and has 8 analog and 13 digital pins. Arduino has 32 KB of flash memory, 1 KB of EEPROM, 2 KB of SRAM.

The push-buttons for enrolling, deleting, selecting IDs and for attendance. A buzzer here for alerting, LEDs for indication and LCD to display the results.

As shown in the circuit diagram, a push-button is directly connected to pin A0 for enrollment purposes, A1 for delete, A2 and A3 are for up and down the selection of Arduino with respect to the ground. A red LED is connected to pin D7 of the Arduino with respect to ground through a 1K resistor. The fingerprint module’s RX and TX pins are directly connected to serial pins D2 and D3 of the Arduino respectively. A 5V supply is used here to power up the fingerprint module taken from Arduino. A buzzer is also connected at pin A5 for alerting purposes. A 16×2 LCD is also configured in 4-bit mode and its RS, EN, D4, D5, D6, and D7 are directly connected at digital pins D13, D12, D11, D10, D9, and D8 of the Arduino.

PCB Design

For removing messy wiring and give a clean look, I designed a PCB prototype for this project. It is also helpful for troubleshooting that runs great without any errors. To design this PCB board, I used EasyEDA as it is too easy to use. For ordering PCB for this, I personally prefer PCBWay.

Gerber file for Fingerprint Based Biometric Attendance System.

You can view the Gerber file from here Gerber File Viewer.

PCB View

Fingerprint Based Biometric Attendance System 2D View
2D View
Fingerprint Based Biometric Attendance System 3D View
3D View

Order PCB From PCBWay

This project is sponsored by PCBWay.com. PCBs are required everywhere in the electronics industry. So it needs to be good enough and have to serve the purpose for which they are needed without costing exorbitant amounts. PCBway offers all your needs come true. PCBWay is one of the largest PCB (Printed Circuit Board) manufacturing companies in china. It offers PCB prototype, PCB Assembly, SMD Stencil, and Flexible PCB.

They ship to more than 170 countries worldwide and process more than 2100 PCB orders a day. It feels like PCBWay gives an excellent price and customer service factor in one single serving. I personally ordered PCBs from PCBWay for my projects for just 5 dollars. I’ve used other PCB manufacturers too, but PCBWay has been offering the most reliable and consistent that I have tried. What is also spectacular about PCBWay to me, as a maker and customer, is their service. From their friendly support staff to their intuitive, user-friendly website features, it all counts towards what makes PCBWay an ideal company and brand for any electronics hobbyists.

Standard quality for any product needs to be maintained using some parameters. PCBWay gives that opportunity by quality control in designing and manufacturing. At first, they ensure accuracy, clarity, validity of the PCB files that we sent to them.

Then all the boards will go through the most stringent tests other than the basic visual check. They adopt most of the testing and inspecting equipment used in the industry, such as Flying Probe Tester, X-Ray Inspection Machine, Automated Optical Inspection (AOI) Machine. They are having 50+ new engineers on the daily basis around the world using PCBs for their work, who trust for their reliable quality.

Features of PCBWay

PCB Prototyping & Manufacturing: PCBWay produces FR-4 and Aluminum boards and advanced PCBs like Rogers, HDI, Flexible and Rigid-Flex boards, at a very reasonable price. Just check this Instant Quote to order premium PCBs for your hobby projects.

PCB Assembly: It not only offers PCB Prototyping but also offers PCB Assembly service. You can order a full PCB board with attached components by uploading your file. SMT & THT assembly starts from only 30$ including free stencil and worldwide shipping. The components can be sourced and provided by PCBWay, or by clients themselves.

Open Source Community: It not only offers PCB Prototype & Assembly service but also gives opportunities to students for sponsorships. I think this is so great. They feature their projects on the website also.

3D Printing & CNC: It also produces Rapid Prototyping like 3D printing, CNC Machining, Sheet Metal Fabrication, and Injection Molding. The quality of the product is too premium and reliable. And also the best part is that you will receive your order within a minimum of 3 days.

Services: PCBWay offers great servicing of their products. It takes only 3 to 15 days according to courier service to deliver your products. Also, it has a live support facility. Whenever you have any problems, you can always reach a live customer service person to respond to your emails or messages. They have the “Return and Refund” principle, for every unusable board caused by PCBWay, they will rebuild and refund the order soon.

PCB Design Contest: The 4th PCBWay contest is finally here. This year, they have introduced mainly 2 themes of the entries: One is IoT, which will include home automation, wearable or other interesting projects and the other one is robotics, which could be combined with smart cars, drones or other automated projects. For enquiries about the rules and regulations and prize pools just check out this link PCBWay 4Th PCB Design Contest.

Guide for Ordering PCB From PCBWay

Working of Fingerprint Based Biometric Attendance System

The working principle of this fingerprint attendance system is quite simple. At first, the user needs to enroll their fingerprints with the help of push-button. To do this, the user needs to press the “ENROLL” button and then LCD prompts to asks for entering ID for the fingerprint to save it in the memory by ID name individually. So now the user needs to enter their ID by pressing the “UP/DOWN” buttons. After selecting ID, the user needs to press the “OK” button. Now LCD display will ask to place the user’s finger over the fingerprint module and then the module immediately captures the finger’s image sample. Then, the LCD display will indicate to remove finger from the module and ask to place his finger again.

Now the user needs to put his finger again The module takes an image, converts it into structural dots, and stores it by selected ID. Finally, the user is registered successfully and he can do their attendance by pressing their finger over the fingerprint module. By the same process, all the users can be registered into the system.

If someone wants to remove or delete his/her stored ID or fingerprint, then he/she needs to press DEL (OK) button. Once the delete button is pressed, the LCD display will ask to select the ID that needs to be deleted. Now user needs to select ID and press the “OK” button (DEL button). Now LCD will let you know that fingerprint has been deleted successfully.

Application of Fingerprint Based Biometric Attendance System

  • Biometric attendance system can be used in educational institutions, offices, industries, etc.
  • It can be also used in ATM for authentication.
  • For security access control, it can be also used.

Disadvantages of This Biometric Attendance System

  • There is a chance of using fake fingerprints.
  • This device is very sensitive, so it needs proper handling.

Arduino Code

#include<EEPROM.h>
#include<LiquidCrystal.h>
LiquidCrystal lcd(13,12,11,10,9,8);
#include <SoftwareSerial.h>
SoftwareSerial fingerPrint(2, 3);
#include <Wire.h>
#include "RTClib.h"
RTC_DS1307 rtc;
#include "Adafruit_Fingerprint.h"
uint8_t id;
Adafruit_Fingerprint finger = Adafruit_Fingerprint(&fingerPrint);
#define enroll 14
#define del 15
#define up 16
#define down 17
#define match 5
#define indFinger 7
#define buzzer 5
#define records 4  // 5 for 5 user
int user1,user2,user3,user4,user5;
DateTime now;
void setup()
{
    delay(1000);
    lcd.begin(16,2);
    Serial.begin(9600);
    pinMode(enroll, INPUT_PULLUP);
    pinMode(up, INPUT_PULLUP);
    pinMode(down, INPUT_PULLUP);
    pinMode(del, INPUT_PULLUP);
    pinMode(match, INPUT_PULLUP);
    pinMode(buzzer, OUTPUT);
    pinMode(indFinger, OUTPUT);
    digitalWrite(buzzer, LOW);
    if(digitalRead(enroll) == 0)
    {
      digitalWrite(buzzer, HIGH);
      delay(500);
      digitalWrite(buzzer, LOW);
      lcd.clear();
      lcd.print("Please Wait");
      lcd.setCursor(0,1);
      lcd.print("Downloding Data");
      Serial.println("Please Wait");
      Serial.println("Downloding Data");
      Serial.println();
      Serial.print("Sr.No.         ");
      for(int i=0;i<records;i++)
      {
              digitalWrite(buzzer, HIGH);
      delay(500);
      digitalWrite(buzzer, LOW);
        Serial.print("         User ID");
        Serial.print(i+1);
        Serial.print("                   ");
      }
      Serial.println();
      int eepIndex=0;
      for(int i=0;i<30;i++)
      {
        if(i+1<10)
        Serial.print('0');
        Serial.print(i+1);
        Serial.print("          ");
        eepIndex=(i*7);
        download(eepIndex);
        eepIndex=(i*7)+210;
        download(eepIndex);
        eepIndex=(i*7)+420;
        download(eepIndex);
        eepIndex=(i*7)+630;
        download(eepIndex);
      //  eepIndex=(i*7)+840;   // 5th user
      //  download(eepIndex);
        Serial.println();
      }
    }
    if(digitalRead(del) == 0)
    {
      lcd.clear();
      lcd.print("Please Wait");
      lcd.setCursor(0,1);
      lcd.print("Reseting...");
      for(int i=1000;i<1005;i++)
      EEPROM.write(i,0);
      for(int i=0;i<841;i++)
      EEPROM.write(i, 0xff);
      lcd.clear();
      lcd.print("System Reset");
      delay(1000);
    }
    
    lcd.clear();
    lcd.print("   Attendance   ");
    lcd.setCursor(0,1);
    lcd.print("     System     ");
    delay(2000);
    lcd.clear();
    lcd.print("Biometric Attendance System");
    lcd.setCursor(0,1);
    lcd.print("Electro Gadget");
    delay(2000);
          digitalWrite(buzzer, HIGH);
      delay(500);
      digitalWrite(buzzer, LOW);
  for(int i=1000;i<1000+records;i++)
  {
    if(EEPROM.read(i) == 0xff)
        EEPROM.write(i,0);
   }
    finger.begin(57600);
    Serial.begin(9600);
    lcd.clear();
    lcd.print("Finding Module");
    lcd.setCursor(0,1);
    delay(1000);
    if (finger.verifyPassword())
    {
      Serial.println("Found fingerprint Sensor");
      lcd.clear();
      lcd.print("Found Module ");
      delay(1000);
    }
    else
    {
    Serial.println("Did Not Find Fingerprint Sensor :(");
    lcd.clear();
    lcd.print("Module Not Found");
    lcd.setCursor(0,1);
    lcd.print("Check Connection");
    while (1);
    }
     if (! rtc.begin())
       Serial.println("Couldn't Find RTC");
    // rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
    if (! rtc.isrunning())
    {
    Serial.println("RTC Is NOT Running");
       rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
    }
lcd.setCursor(0,0);
 lcd.print("Press Match To ");
 lcd.setCursor(0,1);
 lcd.print("Start System");
 delay(2000);
 user1=EEPROM.read(1000);
  user2=EEPROM.read(1001);
   user3=EEPROM.read(1002); 
   user4=EEPROM.read(1003);
    user5=EEPROM.read(1004);
    lcd.clear();
    digitalWrite(indFinger, HIGH);
    
}
void loop()
{
    now = rtc.now();
    lcd.setCursor(0,0);
    lcd.print("Time:");
    lcd.print(now.hour(), DEC);
    lcd.print(':');
    lcd.print(now.minute(), DEC);
    lcd.print(':');
    lcd.print(now.second(), DEC);
    lcd.print("    ");
    lcd.setCursor(0,1);
    lcd.print("Date:");
    lcd.print(now.day(), DEC);
    lcd.print('/');
    lcd.print(now.month(), DEC);
    lcd.print('/');
    lcd.print(now.year(), DEC);
    lcd.print("     ");
    delay(500);
    int result=getFingerprintIDez();
    if(result>0)
    {
              digitalWrite(indFinger, LOW);
              digitalWrite(buzzer, HIGH);
              delay(100);
              digitalWrite(buzzer, LOW);
              lcd.clear();
              lcd.print("ID:");
              lcd.print(result);
              lcd.setCursor(0,1);
              lcd.print("Please Wait...");
              delay(1000);
              attendance(result);
              lcd.clear();
              lcd.print("Attendance ");
              lcd.setCursor(0,1);
              lcd.print("Registed");
              delay(1000);
        digitalWrite(indFinger, HIGH);
        return;
 }
 checkKeys();
 delay(300);
}
//     dmyyhms - 7 bytes
void attendance(int id)
{
  int user=0,eepLoc=0;
  if(id == 1)
  {
    eepLoc=0;
    user=user1++;
  }
  else if(id == 2)
  {
    eepLoc=210;
    user=user2++;
  }
  else if(id == 3)
  {
    eepLoc=420;
    user=user3++;
  }
  else if(id == 4)
  {
    eepLoc=630;
    user=user4++;
  }
  /*else if(id == 5)   // fifth user
  {
    eepLoc=840;
    user=user5++;
  }*/
  else 
  return;
  
    int eepIndex=(user*7)+eepLoc;
    EEPROM.write(eepIndex++, now.hour());
    EEPROM.write(eepIndex++, now.minute());
    EEPROM.write(eepIndex++, now.second());
    EEPROM.write(eepIndex++, now.day());
    EEPROM.write(eepIndex++, now.month());
    EEPROM.write(eepIndex++, now.year()>>8 );
    EEPROM.write(eepIndex++, now.year());
    EEPROM.write(1000,user1);
    EEPROM.write(1001,user2);
    EEPROM.write(1002,user3);
    EEPROM.write(1003,user4);
  //  EEPROM.write(4,user5);   // figth user
}
void checkKeys()
{
   if(digitalRead(enroll) == 0)
   {
    lcd.clear();
    lcd.print("Please Wait");
    delay(1000);
    while(digitalRead(enroll) == 0);
    Enroll();
   }
   else if(digitalRead(del) == 0)
   {
    lcd.clear();
    lcd.print("Please Wait");
    delay(1000);
    delet();
   }
}
void Enroll()
{
   int count=1;
   lcd.clear();
   lcd.print("Enter Finger ID:");
   while(1)
   {
    lcd.setCursor(0,1);
     lcd.print(count);
     if(digitalRead(up) == 0)
     {
       count++;
       if(count>records)
       count=1;
       delay(500);
     }
     else if(digitalRead(down) == 0)
     {
       count--;
       if(count<1)
       count=records;
       delay(500);
     }
     else if(digitalRead(del) == 0)
     {
          id=count;
          getFingerprintEnroll();
          for(int i=0;i<records;i++)
          {
            if(EEPROM.read(i) != 0xff)
            {
              EEPROM.write(i, id);
              break;
            }
          }
          return;
     }
       else if(digitalRead(enroll) == 0)
     {
          return;
     }
 }
}
void delet()
{
   int count=1;
   lcd.clear();
   lcd.print("Enter Finger ID");
   while(1)
   {
    lcd.setCursor(0,1);
     lcd.print(count);
     if(digitalRead(up) == 0)
     {
       count++;
       if(count>records)
       count=1;
       delay(500);
     }
     else if(digitalRead(down) == 0)
     {
       count--;
       if(count<1)
       count=records;
       delay(500);
     }
     else if(digitalRead(del) == 0)
     {
          id=count;
          deleteFingerprint(id);
          for(int i=0;i<records;i++)
          {
            if(EEPROM.read(i) == id)
            {
              EEPROM.write(i, 0xff);
              break;
            }
          }
          return;
     }
       else if(digitalRead(enroll) == 0)
     {
          return;
     }
 }
}
uint8_t getFingerprintEnroll()
{
  int p = -1;
  lcd.clear();
  lcd.print("Finger ID:");
  lcd.print(id);
  lcd.setCursor(0,1);
  lcd.print("Place Finger");
  delay(2000);
  while (p != FINGERPRINT_OK)
  {
    p = finger.getImage();
    switch (p)
    {
    case FINGERPRINT_OK:
      Serial.println("Image Taken");
      lcd.clear();
      lcd.print("Image Taken");
      break;
    case FINGERPRINT_NOFINGER:
      Serial.println("No Finger");
      lcd.clear();
      lcd.print("No Finger");
      break;
    case FINGERPRINT_PACKETRECIEVEERR:
      Serial.println("Communication Error");
      lcd.clear();
      lcd.print("Comm Error");
      break;
    case FINGERPRINT_IMAGEFAIL:
      Serial.println("Imaging Error");
      lcd.clear();
      lcd.print("Imaging Error");
      break;
    default:
      Serial.println("Unknown Error");
       lcd.clear();
      lcd.print("Unknown Error");
      break;
    }
  }
  p = finger.image2Tz(1);
  switch (p) {
    case FINGERPRINT_OK:
      Serial.println("Image Converted");
      lcd.clear();
      lcd.print("Image converted");
      break;
    case FINGERPRINT_IMAGEMESS:
      Serial.println("Image Too Messy");
       lcd.clear();
       lcd.print("Image Too Messy");
      return p;
    case FINGERPRINT_PACKETRECIEVEERR:
      Serial.println("Communication Error");
            lcd.clear();
      lcd.print("Comm Error");
      return p;
    case FINGERPRINT_FEATUREFAIL:
      Serial.println("Could Not Find Fingerprint Features");
            lcd.clear();
      lcd.print("Feature Not Found");
      return p;
    case FINGERPRINT_INVALIDIMAGE:
      Serial.println("Could Not Find Fingerprint Features");
                  lcd.clear();
      lcd.print("Feature Not Found");
      return p;
    default:
      Serial.println("Unknown Error");
                  lcd.clear();
      lcd.print("Unknown Error");
      return p;
  }
  Serial.println("Remove Finger");
  lcd.clear();
  lcd.print("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");
   lcd.clear();
      lcd.print("Place Finger");
      lcd.setCursor(0,1);
      lcd.print("   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");
      return;
    }
  }
  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");
      return p;
    case FINGERPRINT_INVALIDIMAGE:
      Serial.println("Could Not Find Fingerprint");
      return p;
    default:
      Serial.println("Unknown Error");
      return p;
  }
  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");
    lcd.clear();
    lcd.print("Stored");
    delay(2000);
  } 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;
  }
}
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)
  {
   lcd.clear();
   lcd.print("Finger Not Found");
   lcd.setCursor(0,1);
   lcd.print("Try Later");
   delay(2000);
  return -1;
  }
  // found a match!
  Serial.print("Found ID #");
  Serial.print(finger.fingerID);
  return finger.fingerID;
}
uint8_t deleteFingerprint(uint8_t id)
{
  uint8_t p = -1;
  lcd.clear();
  lcd.print("Please Wait");
  p = finger.deleteModel(id);
  if (p == FINGERPRINT_OK)
  {
    Serial.println("Deleted");
    lcd.clear();
    lcd.print("Finger Deleted");
    lcd.setCursor(0,1);
    lcd.print("Successfully");
    delay(1000);
  }
  else
  {
    Serial.print("Something Wrong");
    lcd.clear();
    lcd.print("Something Wrong");
    lcd.setCursor(0,1);
    lcd.print("Try Again Later");
    delay(2000);
    return p;
  }
}
void download(int eepIndex)
{
            
            if(EEPROM.read(eepIndex) != 0xff)
            {
              Serial.print("T:");
              if(EEPROM.read(eepIndex)<10)
              Serial.print('0');
              Serial.print(EEPROM.read(eepIndex++));
              Serial.print(':');  
              if(EEPROM.read(eepIndex)<10)
              Serial.print('0');
              Serial.print(EEPROM.read(eepIndex++));
              Serial.print(':'); 
              if(EEPROM.read(eepIndex)<10)
              Serial.print('0');
              Serial.print(EEPROM.read(eepIndex++));
              Serial.print("   D:");
              if(EEPROM.read(eepIndex)<10)
              Serial.print('0');
              Serial.print(EEPROM.read(eepIndex++));
              Serial.print('/');
              if(EEPROM.read(eepIndex)<10)
              Serial.print('0');           
              Serial.print(EEPROM.read(eepIndex++));
              Serial.print('/');            
              Serial.print(EEPROM.read(eepIndex++)<<8 | EEPROM.read(eepIndex++));
            }
            else
            {
               Serial.print("---------------------------");
            }
            Serial.print("         ");
}

1 thought on “Fingerprint-Based Biometric Attendance System Using Arduino”

Leave a Comment