• Ankita Sharma

Fingerprint Sensor-based attendance system using Raspberry Pi

Updated: Dec 31, 2020

In every institution/organization, #attendance is an aspect of major importance, which can be used to monitor the individual's overall performance. Currently, in many institutions, attendance is taken by manually calling out the names of students or by simply using a sheet of paper in which students sign in front of their names.


The major drawback of this system is that it cannot prevent proxy attendance and is very time-consuming which affects the education quality directly or indirectly. With the growing technologies, educational institutions need more efficient and cost-effective systems to keep a check on students/employees. This is why the #biometric attendance systems came into existence.


In this article, we will see how to build a Fingerprint Sensor-based attendance system using Raspberry Pi and a fingerprint sensor module.


Hardware Requirements :


The hardware components required for the proposed design are as follows -


Components Required
Components Required


Raspberry Pi :

Raspberry Pi
Raspberry Pi

Raspberry Pi ( #Rpi ) is a low-cost, credit card-sized computer that runs on Linux Operating System. It provides a set of GPIO ( General Purpose Input / Output Pins ) which allows the interfacing of hardware components. It has inbuilt WiFi and Bluetooth capabilities making it a better candidate for IoT projects and Developments. To know more about Raspberry Pi, refer to this article - What is Raspberry Pi?


Buy Raspberry Pi 3B+ board from here.


R307 Fingerprint Sensor :

R307 Fingerprint module
R307 Fingerprint module

A #sensor that detects the fingerprint of an individual. The fingerprint module is connected to the microcontroller via TTL serial to get and observe pictures of fingerprints. The enrollment of new fingers can be stored directly within the flash memory of the board. #R307 has the capability to capture prints up to 500 dpi resolution. It consists of pins that are connected through different colored connecting wires, where each color indicates each pin of the sensor.

  • DNC pin is connected through white wire.

  • VCC pin is connected through red wire.

  • TX pin is connected through blue wire.

  • RX pin is connected through green wire.

  • GND pin is connected through black wire.

Buy the R307 Fingerprint Sensor module from here.


USB Cable :

USB Cable
USB Cable

USB ( Universal Serial Bus ) Cable is used to connect Raspberry Pi to the system ( For eg: Laptops ).


Buy USB Cable from here.


Micro SD card :

16 GB Micro SD Card
16 GB Micro SD Card

Micro SD card acts as a hard drive for Raspberry Pi and stores information. SD is an abbreviation for Secure Digital. The faster you read data from the micro SD card, the faster will be the booting and loading of programs to Raspberry Pi. That is why it is always recommended to use Class 10 micro SD cards.


Buy 16 GB Micro SD card from here.


Jumper Wires :


Jumper Wires
Jumper Wires

Jumper wires are connecting wires having connector pins at each end, allowing them to connect two points without soldering. They typically come in three versions - male-to-male, female-to-female, and male-to-female. Here, we will need some female-to-female and male-to-female jumper wires for #interfacing the hardware components.


Buy Jumper Wires from here.


CP 2102 USB to TTL converter :


CP 2102 USB to TTL converter
CP 2102 USB to TTL converter

It is used to establish connectivity between USB and Serial UART interfaces. UART stands for Universal Asynchronous Receiver/Transmitter and its main purpose is to transmit and receive serial data.


Buy CP 2102 USB to TTL converter from here.


I2C Module :


I2C Module
I2C Module

It has an inbuilt chip that converts I2C serial data to parallel data for an LCD. Directly interfacing LCD takes a lot of pins on #Raspberry Pi which makes the circuit more complicated. That is why interfacing of LCD and Raspberry Pi is done via the I2C module. It consists of four pins - VCC ( Power Supply ), GND ( Ground ), SDA ( Serial Data pin), SCL ( Serial Clock pin ).


Buy I2C Module with LCD from here.


4 x 4 Keypad :

4 x 4 Keypad
4 x 4 Keypad

It is a 4 x 4 matrix keypad which are used to take input values from the user. It has a total of 8 terminals which are driven out from 16 input keys present in the module.


Buy 4 X 4 Keypad Module from here.


LCD :

LCD
LCD

LCD ( Liquid Crystal Display ) are mainly preferred for multi-segment light-emitting diodes and seven segments.


Buy LCD from here.


Softwares :


Raspberry Pi Imager :


Raspberry Pi Imager
Raspberry Pi Imager

Raspberry Pi imager is a quick and easy to install RPi Operating System which allows the interfacing of hardware devices with Softwares. It needs to be installed into the system for making the Raspberry Pi board recognizable. It can be installed with the help of an SD Card Reader.


Python IDLE IDE :

Python IDLE IDE
Python IDLE IDE

Python IDLE ( Integrated Development Learning Environment ) is an integrated development environment for Python, used to execute Python scripts.


Hardware Connections :


The circuit connections for this design are as follows -


Fingerprint Sensor based attendance system using Raspberry Pi
Circuit Connections

Since the circuit connections are quite complicated here, let us understand the interfacing of each component separately.


Interfacing fingerprint sensor module to Raspberry Pi :


A fingerprint sensor module is connected to Raspberry Pi via #CP2102 USB to TTL converter that enables serial communication between them.

  1. GND of the fingerprint module is connected to the GND of CP2102.

  2. RX of the fingerprint module is connected to TX of CP2102.

  3. TX of the fingerprint module is connected to RX of CP2102.

  4. VCC of the fingerprint module is connected to the VCCIO of CP2102.

CP2102 is then connected to the Raspberry Pi board.


Interfacing LCD to Raspberry Pi :


Firstly LCD is connected to the #I2C module which is further interfaced with the RPi board.

  1. VCC pin of I2C is connected to +5V of RPi board.

  2. GND pin of I2C is connected to GND of RPi board.

  3. The SDA of I2C is connected to the SDA of the RPi board.

  4. SCL pin of I2C is connected to the SDA of the RPi board.


Interfacing 4 X 4 keypad module to Raspberry Pi :


Any 8 GPIO pins of the RPi board is connected to the 8 terminals of 4 X 4 Keypad ( first four-terminal for rows and next four-terminal for columns ).


Code:


The code for this design are as follows -


To get complete code, download the following documents -

Main Code file
.txt
TXT • 19KB

Driver files:

  • Fingerprint sensor driver file

pyfingerprint (driver file)
.txt
TXT • 45KB
  • I2C - LCD Driver file

I2C_LCD_driver file
.txt
TXT • 5KB

Note: Do not forget to change the file format to .py(python file) format before you upload the code to the Raspberry Pi.


Installations :


Run the following commands in your system's terminal window -


Installing RPi imager

sudo apt install rpi-imager 

Installing Python IDLE

sudo apt-get install idle3 

Installing Fingerprint library for Raspberry Pi

sudo apt-get install python-fingerprint

Working:


Powered, Circuit Connections
Powered, Circuit Connections

Once the hardware connections are completed and the code is written in the #IDE, connect the hardware device to the system ( Laptop ) and upload the code to the hardware.


SSH Terminal
SSH Terminal

After saving the code file under the above-mentioned extension ( i.e .py ), open the SSH (Secure Socket Shell ) terminal. Now, RUN the code file by writing <filename>.py on the SSH terminal window.



Menu
Menu

After Running the code, you will see two options in the LCD Display ( 1. Attendance 2. Registration ). Now, select the desired option using the Keypad module.



Registration completed
Registration completed

For registration, place your right thumb on the fingerprint #sensor screen. The sensor module will take some time to scan and record your fingerprint in the database. After that, the #LCD will display a message " Finger enrolled Successfully " as shown in the above image.



Attendance Recorded
Attendance Recorded

For attendance, place your right thumb on the fingerprint module screen. The #fingerprint sensor will automatically recognize your identity based on your fingerprint and your attendance will be recorded to the database.


This is how the fingerprint-based attendance system works!


Do watch the video to get a better understanding through practical implementation.


Video By - Sai Parimal


Conclusion :


An #IoT based biometric attendance system proves to be of great value to educational institutions due to its capability of taking attendance and recording it on the database in real-time. The fingerprint scanner ensures the reliability of the system while using a database to store the attendance records makes the data easy to access and retrieve when required.


See Also :