Altium
Arduino Projects

Fingerprint Based Biometric Attendance System using Arduino & VB.net

Description:

fingerprint attendance

Fingerprint Based Biometric Attendance System– This Tutorial is about the Arduino-based Fingerprint attendance which is also called a Biometric attendance system. The students are marked Present, Late, and absent depending on the time, The attendance application will be designed in Microsoft visual basic 2010 express edition and the Arduino programming will be done in the Arduino IDE “C Language”.

Another more advanced version of the student’s attendance system is based on Firebase Database, RFID, GSM, and Nodemcu ESP8266.

 A few days backs I posted a tutorial on the fingerprint module in which I covered all the basics, including its interfacing with Arduino, and how to enroll fingers. In that tutorial, I already enrolled three fingers, so I will be using the same fingers to represent student1, student 2, and student3. I highly recommend first you should watch this tutorial.

This is a very basic student’s attendance system without a database, while in the upcoming tutorial I will modify this project and include a database, then each student record can be edited, checked, deleted, or updated.

For the complete step-by-step explanation, you can watch the Video Tutorial given at the end of this article.


Amazon Links:

12v Adaptor:

Arduino Uno

Arduino Nano

Mega 2560:

Fingerprint Module:

Other Tools and Components:

Top Arduino Sensors:

Super Starter kit for Beginners

Digital Oscilloscopes

Variable Supply

Digital Multimeter

Soldering iron kits

PCB small portable drill machines

*Please Note: These are affiliate links. I may make a commission if you buy the components through these links. I would appreciate your support in this way!

Fingerprint Module that we will be using with the Arduino:

fingerprint attendance

fingerprint attendance

This is the fingerprint module that we will be using today with the Arduino. It has a total of six wires. While some fingerprint modules have 4 wires, but their use is exactly the same. As you can this module has six wires, but we will be using only 4 wires, Red, green, white and black.

fingerprint attendance

We don’t need the yellow and blue wires.

fingerprint attendance

connect the red wire with the Arduino’s 5v.

Connect the black wire of the fingerprint module with the Arduino’s ground.

Connect the green wire with pin 4 of the Arduino and connect the white wire with pin5 of the Arduino. so now our interfacing is completed.

fingerprint attendance
Now it’s time to enroll fingers. For Fingers enrolling watch my Previous Tutorial “Click Here

Circuit Diagram:

Circuit Diagram of the Arduino FingerPrint Attendance system.
fingerprint attendance

As you can see in the circuit Diagram a 433Mhz RF transmitter is also used which will be used in the future project. In this tutorial, you can neglect this RF Transmitter. The Finger Print module is connected with the Arduino’s pin number 4 and Pin number 5. The 5v pin of the Finger Print Module will be connected with the Arduino 5v pin and ground of the Finger Print module will be connected with the ground of Arduino.


fingerprint attendance Programming:

This project is based on two programs, Arduino programming, and Vb.net Programming. Before, you start the programming, first of all, make sure that you download the necessary libraries.

fingerprint attendance Arduino Programming:

#include <Adafruit_Fingerprint.h>
#include <SoftwareSerial.h>

int getFingerprintIDez();
char data ;

// pin #4 is IN from sensor (GREEN wire)
// pin #5 is OUT from arduino (WHITE wire)
SoftwareSerial mySerial(4, 5);

Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);

void setup()
{
Serial.begin(9600);
// Bits per sec

Serial.println(“fingertest”);

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

Serial.println(“Waiting for valid finger…”);

}

void loop() // run over and over again
{

getFingerprintIDez();
}

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

// 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!
// Serial.print(“Found ID #”); Serial.print(finger.fingerID);
// Serial.print(” with confidence of “); Serial.println(finger.confidence);

if(finger.fingerID == 11)
{

Serial.println(“stu1”);

delay(1000);

}
if(finger.fingerID == 2)
{

Serial.println(“stu2”);

delay(1000);

}
if(finger.fingerID == 3)
{

Serial.println(“stu3”);

delay(1000);
}

else
return finger.fingerID;

// Serial.println(“Invalid User\n”);

}

fingerprint attendance VB.net Application Programming:

fingerprint attendance

This is how the final application looks like. For the Detailed step by step explanation watch Video tutorial available at the end of this article.

Imports System.IO
Imports System.IO.Ports

Public Class Form1

    Dim secs As Integer
    Dim mins As Integer

    ' teacher flag 
    Dim tflag As Integer

    'flags for students 
    Dim sflag1 As Integer ' student1 flag
    Dim sflag2 As Integer 'student2 flag 
    Dim sflag3 As Integer
    Dim sflag4 As Integer
    Dim sflag5 As Integer


    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        tflag = 0
        sflag1 = 0
        sflag2 = 0
        sflag3 = 0
        sflag4 = 0
        sflag5 = 0

        SerialPort1.Close()
        SerialPort1.PortName = "com8"
        SerialPort1.BaudRate = "9600" ‘use same baud rate as used in Arduino
        SerialPort1.DataBits = 8
        SerialPort1.Parity = Parity.None
        SerialPort1.StopBits = StopBits.One
        SerialPort1.Handshake = Handshake.None
        SerialPort1.Encoding = System.Text.Encoding.Default
        SerialPort1.Open()
    End Sub



    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

        ' if the students comes in time, within 2 mints then the students will be marked present. 
        If InStr(TextBox1.Text, "stu1") And (sflag1 = 0) And tflag = 1 And mins <= 2 Then
            chkstu1.Checked = True
            sflag1 = 1
            chkstu1.Text = chkstu1.Text + " Present"
        End If

        If InStr(TextBox1.Text, "stu2") And (sflag2 = 0) And tflag = 1 And mins <= 2 Then
            chkstu2.Checked = True
            sflag2 = 1
            chkstu2.Text = chkstu2.Text + " Present"
        End If

        If InStr(TextBox1.Text, "stu3") And (sflag3 = 0) And tflag = 1 And mins <= 2 Then
            chkstu3.Checked = True
            sflag3 = 1
            chkstu3.Text = chkstu3.Text + " Present"
        End If

        If InStr(TextBox1.Text, "stu4") And (sflag4 = 0) And tflag = 1 And mins <= 2 Then
            chkstu4.Checked = True
            sflag4 = 1
            chkstu4.Text = chkstu4.Text + " Present"
        End If

        If InStr(TextBox1.Text, "stu5") And (sflag5 = 0) And tflag = 1 And mins <= 2 Then
            chkstu5.Checked = True
            sflag5 = 1
            chkstu5.Text = chkstu5.Text + " Present"
        End If


        ' the following conditions will be used to check if the students are late.

        If InStr(TextBox1.Text, "stu1") And (sflag1 = 0) And tflag = 1 And mins > 2 And mins < 5 Then
            chkstu1.Checked = True
            sflag1 = 1
            chkstu1.Text = chkstu1.Text + " is late"
        End If

        If InStr(TextBox1.Text, "stu2") And (sflag2 = 0) And tflag = 1 And mins > 2 And mins < 5 Then
            chkstu2.Checked = True
            sflag2 = 1
            chkstu2.Text = chkstu2.Text + " is late"
        End If

        If InStr(TextBox1.Text, "stu3") And (sflag3 = 0) And tflag = 1 And mins > 2 And mins < 5 Then
            chkstu3.Checked = True
            sflag3 = 1
            chkstu3.Text = chkstu3.Text + " is late"
        End If

        If InStr(TextBox1.Text, "stu4") And (sflag4 = 0) And tflag = 1 And mins > 2 And mins < 5 Then
            chkstu4.Checked = True
            sflag4 = 1
            chkstu4.Text = chkstu4.Text + " is late"
        End If

        If InStr(TextBox1.Text, "stu5") And (sflag5 = 0) And tflag = 1 And mins > 2 And mins < 5 Then
            chkstu5.Checked = True
            sflag5 = 1
            chkstu5.Text = chkstu5.Text + " is late"
        End If

        ' the following conditions will be used to check if the students are absent.

        If (sflag1 = 0) And tflag = 1 And mins >= 5 Then
            chkstu1.Checked = True
            sflag1 = 1
            chkstu1.Text = chkstu1.Text + " is absent"
        End If

        If (sflag2 = 0) And tflag = 1 And mins >= 5 Then
            chkstu2.Checked = True
            sflag2 = 1
            chkstu2.Text = chkstu2.Text + " is absent"
        End If

        If (sflag3 = 0) And tflag = 1 And mins >= 5 Then
            chkstu3.Checked = True
            sflag3 = 1
            chkstu3.Text = chkstu3.Text + " is absent"
        End If

        If (sflag4 = 0) And tflag = 1 And mins >= 5 Then
            chkstu4.Checked = True
            sflag4 = 1
            chkstu4.Text = chkstu4.Text + " is absent"
        End If

        If (sflag5 = 0) And tflag = 1 And mins >= 5 Then
            chkstu5.Checked = True
            sflag5 = 1
            chkstu5.Text = chkstu5.Text + " is absent"
        End If
   
    End Sub

    Private Sub DataReceived(ByVal sender As Object, ByVal e As SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived


        Try

            Dim mydata As String = ""
            mydata = SerialPort1.ReadExisting()

            If TextBox1.InvokeRequired Then
                TextBox1.Invoke(DirectCast(Sub() TextBox1.Text &= mydata, MethodInvoker))
            Else
                TextBox1.Text &= mydata
            End If
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub


    Private Sub Timer2_Tick(sender As System.Object, e As System.EventArgs) Handles Timer2.Tick
        'timer2 will be used to empty the textbox1 for the new data. the timer interval is set to 1 second. 
        TextBox1.Text = ""
    End Sub

    Private Sub Timer3_Tick(sender As System.Object, e As System.EventArgs) Handles Timer3.Tick
        ' timer3 will be used for the elapsed time. and this timer will be activated only when the teacher will check the box.
        secs = secs + 1
        lblsecs.Text = secs
        lblmins.Text = mins
        If secs = 60 Then
            secs = 0
            mins = mins + 1
        End If

    End Sub

    Private Sub chkteacher_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles chkteacher.CheckedChanged
        If chkteacher.Enabled = True Then
            tflag = 1
            Timer3.Enabled = True
        End If
    End Sub
End Class


Watch Video Tutorial:

Engr Fahad

My name is Shahzada Fahad and I am an Electrical Engineer. I have been doing Job in UAE as a site engineer in an Electrical Construction Company. Currently, I am running my own YouTube channel "Electronic Clinic", and managing this Website. My Hobbies are * Watching Movies * Music * Martial Arts * Photography * Travelling * Make Sketches and so on...

3 Comments

  1. Excellent post. I was checking continuously this blog and I’m impressed! Very useful info particularly the last part gdakbbgedefc

Leave a Reply

Your email address will not be published.

Back to top button