Minor Project Final
Minor Project Final
Minor Project Final
ON
DUAL SECURITY SMART SYSTEM
Submitted in partial fulfillment of the requirements
For the award of the degree of
BACHELOR OF TECHNOLOGY
IN
ELECTRONICS AND COMMUNICATION ENGINEERING
Submitted By
NEHA SHARIKACHAUHAN
(01315607322) (01115607322)
SAKSHI SINGH
(01915607322)
Under the guidance of
Miss NEHA JAIN, ECE department
We hereby certify that the work that is being presented in the project report entitled DUAL
SECURITY SMART SYSTEM to the partial fulfilment of the requirements for the award
of the degree of Bachelor of Technology in Electronics & Communication Engineering from
Dr Akhilesh Das Gupta Institute of Professional Studies, New Delhi. This is an authentic
record of our own work carried out during a period from Aug, 2024 to Nov, 2024 under the
guidance of Miss NEHA JAIN , Assistant Professor in ECE department.
The matter presented in this project has not been submitted by us for the award of any other
degree elsewhere.
SAKSHI SINGH
(01915607322)
This is to certify that the above statement made by the candidates is correct to the best of our
knowledge.
ACKNOWLEDGEMENT
i
We would like to acknowledge the contributions of the following persons, without whose
help and guidance this report would not have been completed.
We acknowledge the counsel and support of our project guide Miss NEHA JAIN , ECE
department, with respect and gratitude, whose expertise, guidance, support, encouragement,
and enthusiasm has made this report possible. Their feedback vastly improved the quality of
this report and provided an enthralling experience. We are indeed proud and fortunate to be
supervised by him.
We are thankful to Prof. (Dr) Surender Dhiman, H.O.D. ECE department, Dr. Akhilesh
Das Gupta Institute of Professional Studies, New Delhi for his constant encouragement,
valuable suggestions and moral support and blessings.
We are immensely thankful to our esteemed, Prof. (Dr.) Niranjan Bhattacharya, Director,
Dr. Akhilesh Das Gupta Institute of Professional Studies, New Delhi for his never-ending
motivation and support.
We shall always remain indebted to Mr. Devraj Gautam, the project in charge of the ECE
department, and faculty and staff members of Dr Akhilesh Das Gupta Institute of
Professional Studies, New Delhi.
Finally, yet importantly, I/We would like to express our heartfelt thanks to God, our beloved
parents for their blessings, our friends/classmates for their help and wishes for the successful
completion of this project.
SAKSHI SINGH
(01915607322.)
ABSTRACT
iii
The "Fingerprint and Face Recognition Attendance System using Raspberry Pi"
project aims to develop a biometric-based attendance management system
utilizing both fingerprint and facial recognition technologies. This system
leverages the processing capabilities of the Raspberry Pi, a cost-effective and
energy-efficient computing platform, to enable real-time attendance tracking in
academic institutions, workplaces, and secured premises.
The proposed system integrates a fingerprint sensor and a camera module with
the Raspberry Pi to capture biometric data. For fingerprint recognition, a
compatible sensor module is employed to scan and match fingerprints against
stored templates. Facial recognition is achieved through the camera module,
which captures images of individuals and processes them using OpenCV and a
pre-trained deep learning model. Both recognition methods are validated against
pre-registered biometric data to ensure accurate identification.
Overall, this project offers an efficient, automated, and scalable solution for
attendance management, catering to various use cases where traditional
attendance systems may fall short in terms of security and eff\
TABLE OF CONTENTS
Title Page
iv
Certificate i
Acknowledgement ii
Vision Mission iii
Abstract iv
Table of Contents v
List of Figure vi
List of Tables vii
1.1. Introduction
1.2. Basic terms of project
1.3. Literature Overview
1.4. Motivation
1.5. Organization of Project Report
2.1 Objectives
2.2 Tool used
2.3 Work Flow diagram of proposed work
4.1 Merits
4.2 Demerits
4.3 Applications
5.1 Conclusion
5.2 Future Scope
List of Figures
v
2. Block Diagram 17
3. Attendance system 32
List of Tables
vi
1 Specification Table of All Components 22
vii
CHAPTER 1: INTRODUCTION AND LITERATURE REVIEW
1.1 INTRODUCTION
1
1.2 BASIC TERMS OF THE PROJECT
1. Biometrics
Biometrics refers to the identification and authentication of individuals based on
physical or behavioral characteristics, such as fingerprints, facial features, iris patterns,
and voice. Biometric systems are designed to be highly accurate, secure, and resistant
to forgery, making them suitable for applications requiring reliable identification, such
as attendance systems.
2. Fingerprint Recognition
Fingerprint recognition is a biometric technique that involves scanning and
analyzing unique patterns of ridges and valleys on an individual’s finger. Each
person’s fingerprint is distinct, making it a reliable means of identification. In this
project, a fingerprint sensor captures and matches fingerprints to validate attendance.
3. Face Recognition
Face recognition is a biometric method that identifies or verifies an individual by
analyzing facial features. The system captures an image of the face and compares it to
stored data to authenticate identity. The technology uses algorithms to analyze
landmarks on the face, such as the distance between the eyes and the shape of the
jawline.
4. Raspberry Pi
The Raspberry Pi is a small, affordable, single-board computer developed by the
Raspberry Pi Foundation. It is widely used for various projects due to its compact size,
low power consumption, and ability to run a full Linux operating system. In this
project, the Raspberry Pi serves as the central processing unit, handling fingerprint and
facial recognition, data storage, and attendance management.
2
5. Open CV
OpenCV (Open Source Computer Vision Library) is an open-source software library
that contains programming functions for real-time computer vision. It is commonly
used for face detection and recognition tasks due to its extensive support for image and
video processing. This project uses OpenCV to process and identify facial images
captured by the camera module.
6. Database
A database is an organized collection of data that is easily accessible, manageable,
and updateable. In this project, the database stores attendance records, fingerprint
templates, and facial recognition data, allowing for quick retrieval and analysis. The
database provides a structured way to log and manage attendance data efficiently.
7. Real-time Processing
Real-time processing refers to the immediate or near-instantaneous processing of
data as it is captured, which is essential for biometric systems that need to verify
identity quickly. In this project, real-time processing enables the system to instantly
match fingerprints and facial images to authenticate users and mark attendance without
delays.
8. Dual-Authentication
Dual-authentication, also known as multi-factor authentication (MFA), involves
using two or more verification methods to confirm an individual's identity. In this
project, both fingerprint and face recognition are used together to enhance security,
ensuring that only authorized individuals are granted attendance logging.
These terms provide a foundation for understanding the technology and functionality
behind the Fingerprint and Face Recognition Attendance System developed in this
project.
1.3LITERATURE REVIEW
The field of biometric attendance systems has seen considerable research and
development, with fingerprint and face recognition technologies becoming widely
adopted in attendance management and access control. This literature review examines
prior studies, methodologies, and technological advancements that contribute to the
design of the "Fingerprint and Face Recognition Attendance System using Raspberry Pi."
4
2. Fingerprint Recognition
Fingerprint recognition is one of the most widely researched biometric techniques due
to its high accuracy and uniqueness. Ratha et al. (2002) highlight that fingerprint-based
systems are popular for attendance and access control because each individual’s
fingerprint pattern is unique and difficult to replicate. A study by Malik et al. (2018)
explored the implementation of fingerprint-based attendance systems and found that the
use of fingerprint sensors, combined with template-matching algorithms, achieved fast
and accurate identification. These systems, however, may face challenges in
environments where fingerprint quality is affected by external conditions, such as dust or
humidity.
making it ideal for low-cost, small-scale biometric systems. Research by Tan and Lee
(2020) also explored the use of Raspberry Pi in educational environments, finding it to be
a practical option for automating attendance due to its compatibility with Python-based
libraries such as OpenCV for facial recognition.
6
1.4 MOTIVATION
The increasing demand for reliable and automated attendance management systems in
educational institutions, workplaces, and secure facilities has highlighted the need for
advanced, efficient, and secure methods for identity verification. Traditional attendance
systems, including manual roll-calling or ID card swiping, are often labor-intensive, prone to
human error, and susceptible to fraudulent activities such as proxy attendance. These
shortcomings not only impact productivity but also compromise the accuracy of attendance
Biometric technology offers a promising solution to these issues, with fingerprint and face
recognition emerging as two of the most accurate and user-friendly biometric methods
available. By leveraging these technologies in a single system, dual-authentication can
significantly enhance the security and reliability of attendance management, minimizing the
chances of unauthorized access and attendance manipulation. Fingerprint recognition is
highly unique and reliable, while face recognition provides a non-intrusive, contactless
method, making them complementary in enhancing both security and convenience.
The choice of the Raspberry Pi platform adds further motivation to this project. As a cost-
effective, compact, and energy-efficient computing device, the Raspberry Pi enables the
creation of a low-cost biometric attendance system that is accessible for small to medium-
scale deployments. It also offers extensive support for open-source libraries, such as
OpenCV, that facilitate image processing and machine learning tasks. The versatility and
affordability of the Raspberry Pi make it an ideal platform for prototyping and deploying
real-time biometric solutions.
with real-time processing and database storage can offer immediate benefits in terms of both
time savings and data accuracy. By implementing this project, we aim to create a scalable
attendance solution that addresses the limitations of traditional systems and aligns with the
growing adoption of biometric technology for secure and efficient identity verification.
Chapter 1: Introduction
This chapter introduces the motivation, objectives, and scope of the project. It also includes
key concepts, a literature review of relevant research, and an outline of the significance of
biometric attendance systems in modern settings. The chapter sets the context for the project
and outlines its intended contributions.
8
This chapter details the design and architecture of the attendance system. It includes the
system requirements, hardware components (such as the Raspberry Pi, fingerprint sensor,
and camera module), and software libraries (such as OpenCV). The architecture diagram and
data
flow are presented to explain the interaction between different modules within the system.
Chapter 4: Implementation
This chapter describes the step-by-step implementation of the project. It covers the
configuration of the Raspberry Pi, integration of the fingerprint and camera modules, setup
of the software environment, and the development of the attendance registration and
authentication processes. Code snippets, algorithms, and explanations of key functions are
included to clarify the implementation details.
2.1 OBJECTIVES
The methodology for developing the "Fingerprint and Face Recognition Attendance System
using Raspberry Pi" involves a structured approach that ensures efficient design, integration,
and testing of the system components. The methodology adopted includes the following
phases:
1. Requirement Analysis
- Objective Definition: Clearly define the objectives, such as creating a dual-authentication
attendance system using fingerprint and face recognition technologies.
- Scope Identification: Identify the scope of the project, including the hardware and
software requirements for implementing a real-time attendance system.
- Feasibility Study: Assess the feasibility of using a Raspberry Pi as the primary processing
unit along with compatible biometric sensors.
2. System Design
- Architecture Design: Develop the architecture of the system, detailing the components
and their interactions. This includes the fingerprint sensor, camera module, Raspberry Pi, and
database integration for storing attendance data.
- Data Flow Design: Outline the flow of data from biometric capture (fingerprint or facial
image) to authentication, logging, and database storage.
10
- User Interface Design: Design a simple, intuitive interface for user registration,
attendance tracking, and management.
3. Hardware Setup
- Raspberry Pi Configuration: Set up and configure the Raspberry Pi, installing the required
operating system, libraries, and dependencies.
- Integration of Fingerprint Sensor : Connect and configure a fingerprint sensor compatible
with the Raspberry Pi, ensuring proper communication and data transfer between the sensor
and the Raspberry Pi.
- Camera Module Setup: Attach a camera module for facial recognition, calibrate its
resolution, and ensure it is capable of capturing high-quality images under various lighting
conditions.
4. Software Development
- Biometric Data Processing: Develop code for processing fingerprint data and facial
images. Use appropriate libraries (e.g., OpenCV for face recognition) and algorithms to
capture, preprocess, and extract features from the biometrics.
- Authentication Algorithms: Implement algorithms for matching fingerprints and facial
features with registered templates to ensure reliable and accurate identification.
5. Dual-Authentication Workflow
- Fingerprint Recognition: Program the system to initiate fingerprint scanning, capture the
fingerprint template, and match it with registered data.
- Face Recognition: Implement facial recognition by capturing a live image, processing it
using OpenCV, and matching it with stored templates.
- Attendance Logging: If both fingerprint and face recognition are successful, log the user’s
attendance in the database with a timestamp, marking their presence.
7. Performance Evaluation
- Accuracy Testing: Evaluate the accuracy of fingerprint and face recognition by testing
with multiple users and under various conditions.
- Speed and Efficiency: Measure the time taken for biometric capture, processing, and
attendance logging to ensure real-time functionality.
- Reliability Testing: Assess the system's reliability in consistent identification and
attendance logging over extended periods.
12
SOFTWARE USED:
Python programming language: Utilized for data manipulation, analysis, and model
development.
Pandas: Used for data manipulation and analysis, particularly for importing and
handling tabular data.
NumPy: Employed for numerical computing, providing support for arrays and
matrices operations.
OpenCV: OpenCV (Open Source Computer Vision Library) is a powerful library for
real-time image processing and computer vision applications. It provides functions for
face detection, image manipulation, and video stream processing, which are essential for
building the face detection module of the system.
Dlib: Dlib is a popular machine learning library that includes a robust face recognition
module. Dlib’s face recognition model is based on deep learning and provides high
accuracy in feature extraction and face matching, enabling reliable identification
within the system.
FingerPrint Sensor Library (e.g., Adafruit Fingerprint Library)
This library provides functions to interact with fingerprint sensors in Python. It
supports functions for fingerprint enrollment, image capture, and matching, facilitating
seamless integration of the fingerprint sensor with the Raspberry Pi.
HARDWARE USED
RaspberryPi
The Raspberry Pi serves as the central processing unit for the system. It is a small,
affordable, and powerful single-board computer capable of handling biometric data
processing, real-time operations, and database management.
FingerprintSensorModule
A fingerprint sensor module (such as the R305) is used to capture and verify
fingerprints. This sensor communicates with the Raspberry Pi via GPIO (General
Purpose Input/Output) pins and provides fingerprint templates for matching.
13
CameraModule
A camera module, compatible with the Raspberry Pi (such as the Raspberry Pi Camera
Module V2), is used for capturing images of individuals for face recognition. The
camera captures high-quality images, even in varying lighting conditions, which is
essential for accurate facial identification.
SDCard
A microSD card is used for storage and acts as the primary storage medium for the
Raspberry Pi’s operating system, software, and attendance data.
GSM Module
GSM (Global System for Mobile communication) is a digital mobile network that is
widely used by mobile phone users in Europe and other parts of the world.
LCD
LCD (Liquid Crystal Display) is a type of flat panel display which uses liquid crystals
in its primary form of operation. LEDs have a large and varying set of use cases for
consumers and businesses, as they can be commonly found in smartphones,
televisions, computer monitors and instrument panels.
Power
A reliable power supply for the Raspberry Pi is necessary to ensure stable operation,
particularly for long periods of real-time processing.
14
2.2.1 Specification Table of All Components
15
2.3 WORK FLOW DIAGRAM
16
This workflow ensures a seamless transition from face detection and recognition to real-
time attendance logging and web-based viewing for administrators. The system can be
designed as a flowchart diagram showing arrows connecting each step, illustrating how
data moves and decisions are made at each stage.
To build an efficient fingerprint and face recognition attendance system, each phase of
the design process must be carefully planned and executed. Here’s a step-by-step
breakdown of the system design:
power for real-time processing and outline constraints like limited storage and power
requirements.
18
Step 2: System Architecture Design
- System Overview: Create a high-level architecture diagram to define the interaction
between components, including the Raspberry Pi, biometric sensors, and the database.
- Module Breakdown:
- Biometric Capture Module: Manages fingerprint and face capture.
- Authentication Module: Matches captured biometrics with stored templates.
- Database Module: Stores and retrieves attendance data and user biometrics.
- User Interface Module: Manages user interactions for registration and attendance tracking.
- Data Flow: Design the data flow from biometric capture to authentication, logging, and
storage.
- Authentication Algorithm:
- Implement algorithms to match captured fingerprints and facial images with
19
registered data, establishing dual-authentication for accuracy.
- Deploy System: Set up the system in the intended environment and perform final testing
under real-world conditions.
20
- Maintenance and Upgrades:
- Establish a routine for regular data backups, hardware checks, and software updates.
- Plan for potential system expansions, such as integrating additional biometric modalities
or remote data access.
21
4.1 MERITS
The Face Recognition Based Attendance System offers numerous advantages that make
it a valuable and efficient solution for automated attendance management. Below are the
key merits of this system:
2. Time Efficiency
By automating the attendance process, the system saves time for both users and
administrators. It eliminates the need for manual sign-ins, streamlining the process and
reducing the time required to log attendance for large groups.
3. Increased Accuracy
The face recognition algorithm accurately identifies individuals, reducing the chances
of errors associated with traditional attendance methods, such as proxy attendance or
missed logs. This ensures reliable and consistent attendance records.
4. Enhanced Security
The system securely stores facial data and attendance records, preventing unauthorized
access and manipulation of records. Only registered users are recognized and logged,
adding a layer of security to attendance management.
The system processes facial data and logs attendance in real time, providing immediate
updates to the database. This feature enables administrators to access current attendance
22
information whenever needed, without delays.
23
4.2 DEMERITS:
1. Privacy Concerns
The collection and storage of facial data may raise privacy concerns among users, as
some may feel uncomfortable with their biometric data being stored in a database.
Ensuring data security and compliance with privacy laws is essential but may still not
alleviate all user concerns.
5. Dependency on Technology
The system relies heavily on technology, such as cameras, stable internet, and
electricity. Any technical failures, such as network issues, power outages, or camera
malfunctions, can disrupt the system’s functionality, leading to downtime or gaps in
attendance logging.
4.3 APPLICATIONS
25
1. Educational Institutions
Schools, colleges, and universities can use face recognition attendance systems to
streamline student attendance tracking, saving time and reducing manual errors. It also
helps in maintaining an accurate record of student attendance, improving administrative
efficiency, and ensuring timely monitoring of student presence.
2. Corporate Offices
In workplaces, this system can be used to automate employee attendance, eliminating
the need for manual punch-in systems or biometric fingerprint scanners. It also helps
track in-and-out times, supports remote work attendance, and integrates with payroll
systems, making HR management more efficient.
3. Healthcare Facilities
Hospitals and clinics can use face recognition attendance systems to track the
attendance of medical staff and ensure that shifts are adequately covered. Additionally, it
can help in maintaining hygienic conditions by offering a contactless attendance solution
in environments where health and safety are paramount.
26
tracking shift timings, ensuring that only authorized personnel are present in restricted
areas, and enhancing workplace safety.
6. Event Management
For large events, conferences, and gatherings, a face recognition attendance system can
be used to streamline entry and exit, prevent unauthorized access, and accurately log
attendance. It helps organizers manage crowd control and provides valuable data on
attendee presence and engagement.
The system can be used by companies offering remote and hybrid work options to track
27
attendance for virtual meetings, team collaborations, and work sessions. This makes it
easier to log and manage employee attendance and productivity in remote work
scenarios.
28
CHAPTER 5: CONCLUSIONS AND FUTURE SCOPE
This project, "Fingerprint and Face Recognition Attendance System using Raspberry Pi,"
successfully demonstrates a secure, efficient, and automated approach to attendance
management. By combining fingerprint and face recognition, the system provides dual-
authentication, enhancing both accuracy and security. The system operates with a high
degree of reliability and speed, leveraging Raspberry Pi’s capabilities and utilizing
OpenCV, dlib, and SQLite for real-time biometric data processing and storage.
The proposed paper suggests a system for monitoring attendance without human
intervention hence avoiding mistakes and malpractices. It is mainly based on biometrics
implemented using Raspberry Pi with GSM module . Traditionally, taking attendance is a
pen-paper task. By the use of this system, it eliminates the use of paper making it
environmentally responsible..
29
3. Multi-Factor Authentication
Adding multi-factor authentication, such as combining face recognition with PIN codes
or mobile app notifications, can enhance security. This feature would be particularly
valuable in high-security environments and ensure that attendance records are both
accurate and secure.
30
8. Offline Mode for Remote Locations
An offline mode would allow the system to function without internet connectivity in
remote or rural locations, storing attendance data locally and syncing with the central
database when connectivity is restored.
31
REFERENCES
[1] Ayush Kakkar and Ashwin Pajankar, Rasberry Pi by Example. Packt Publishing, CA:
2016.
[2] Kiran Kumar.R and Mekala.S, “Face recognition attendance system using Raspberry
Pi,” International Journal of Pure and Applied Mathematics, 2018, Volume 118, 3061-
3065.
[3] Rajan Datt, Utsav Shah and Dharmin Shah, “Student attendance management system
using fingerprint scanner,” International Journal of Pure and Applied Mathematics, 2018,
Volume 119, 2273-2278.
[4] Michael Kofler, the Definitive Guide to MySQL 5, 3rd Edition. Apress, CA: 2005.
[5] Marco Schwartz, Arduino for Secret Agents. Packt Publishing, CA: 2015.
[6] Sunila Gollapudi, Learn Computer Vision Using OpenCV. Apress , CA: 2019.
[7] Robin Nixon, Learning PHP, MySQL & JavaScript, 5th Edition. O’Reilly, CA: 2018.
[8] Omkar Biradar, Anurag bhave, “Face Recognition Based Attendance Monitoring
System using Raspberry-pi and OpenCV”, International Research Journal of Engineering
and Technology, Volume: 06 Issue: 01 Jan 2019
32
APPENDICES :
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
PyFingerprint
Copyright (C) 2015 Bastian Raschke <[email protected]>
All rights reserved.
"""
import time
from pyfingerprint.pyfingerprint import PyFingerprint
if ( f.verifyPassword() == False ):
raise ValueError('The given fingerprint sensor password is wrong!')
except Exception as e:
print('The fingerprint sensor could not be initialized!')
print('Exception message: ' + str(e))
exit(1)
34
if ( positionNumber >= 0 ):
print('Template already exists at position #' + str(positionNumber))
exit(0)
print('Remove finger...')
time.sleep(2)
## Creates a template
f.createTemplate()
except Exception as e:
print('Operation failed!')
print('Exception message: ' + str(e))
exit(1)
import face_recognition
import cv2
import numpy as np
import os
import xlwt
from xlwt import Workbook
from datetime import date
import xlrd, xlwt
from xlutils.copy import copy as xl_copy
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BOARD)
GPIO.setwarnings(False)
'''
define pin for lcd
'''
# Timing constants
E_PULSE = 0.0005
E_DELAY = 0.0005
delay = 1
GPIO.setup(LCD_E, GPIO.OUT) # E
GPIO.setup(LCD_RS, GPIO.OUT) # RS
GPIO.setup(LCD_D4, GPIO.OUT) # DB4
GPIO.setup(LCD_D5, GPIO.OUT) # DB5
GPIO.setup(LCD_D6, GPIO.OUT) # DB6
GPIO.setup(LCD_D7, GPIO.OUT) # DB7
GPIO.setup(Buzzer, GPIO.OUT) # DB7
'''
Function Name :lcd_init()
Function Description : this function is used to initialized lcd by sending the different commands
'''
def lcd_init():
# Initialise display
lcd_byte(0x33,LCD_CMD) # 110011 Initialise
lcd_byte(0x32,LCD_CMD) # 110010 Initialise
lcd_byte(0x06,LCD_CMD) # 000110 Cursor move direction
lcd_byte(0x0C,LCD_CMD) # 001100 Display On,Cursor Off, Blink Off
lcd_byte(0x28,LCD_CMD) # 101000 Data length, number of lines, font size
lcd_byte(0x01,LCD_CMD) # 000001 Clear display
time.sleep(E_DELAY)
'''
Function Name :lcd_byte(bits ,mode)
Fuction Name :the main purpose of this function to convert the byte data into bit and send to lcd port
'''
def lcd_byte(bits, mode):
# Send byte to data pins
# bits = data
# mode = True for character
# False for command
GPIO.output(LCD_RS, mode) # RS
36
# High bits
GPIO.output(LCD_D4, False)
GPIO.output(LCD_D5, False)
GPIO.output(LCD_D6, False)
GPIO.output(LCD_D7, False)
if bits&0x10==0x10:
GPIO.output(LCD_D4, True)
if bits&0x20==0x20:
GPIO.output(LCD_D5, True)
if bits&0x40==0x40:
GPIO.output(LCD_D6, True)
if bits&0x80==0x80:
GPIO.output(LCD_D7, True)
# Low bits
GPIO.output(LCD_D4, False)
GPIO.output(LCD_D5, False)
GPIO.output(LCD_D6, False)
GPIO.output(LCD_D7, False)
if bits&0x01==0x01:
GPIO.output(LCD_D4, True)
if bits&0x02==0x02:
GPIO.output(LCD_D5, True)
if bits&0x04==0x04:
GPIO.output(LCD_D6, True)
if bits&0x08==0x08:
GPIO.output(LCD_D7, True)
37
message = message.ljust(LCD_WIDTH," ")
lcd_byte(line, LCD_CMD)
for i in range(LCD_WIDTH):
lcd_byte(ord(message[i]),LCD_CHR)
# This is a demo of running face recognition on live video from your webcam. It's a little more complicated than
the
# other example, but it includes some basic performance tweaks to make things run a lot faster:
# 1. Process each video frame at 1/4 resolution (though still display it at full resolution)
# 2. Only detect faces in every other frame of video.
# PLEASE NOTE: This example requires OpenCV (the `cv2` library) to be installed only to read from your
webcam.
# OpenCV is not required to use the face_recognition library. It's only required if you want to run this
# specific demo. If you have trouble installing it, try any of the other demos that don't require it instead.
GPIO.output(Buzzer, False)
38
time.sleep(E_DELAY)
lcd_init()
lcd_byte(0x01,LCD_CMD) # 000001 Clear display
time.sleep(E_DELAY)
lcd_string("Smart Attendence ",LCD_LINE_1)
lcd_string(" System ",LCD_LINE_2)
time.sleep(2)
rb = xlrd.open_workbook('attendence_excel.xls', formatting_info=True)
wb = xl_copy(rb)
lcd_byte(0x01,LCD_CMD) # 000001 Clear display
time.sleep(E_DELAY)
lcd_string("Please Enter ",LCD_LINE_1)
lcd_string("lecture Name",LCD_LINE_2)
time.sleep(E_DELAY)
inp = input('Please give current subject lecture name')
lcd_byte(0x01,LCD_CMD) # 000001 Clear display
time.sleep(E_DELAY)
lcd_string("Lecture Name ",LCD_LINE_1)
lcd_string(inp,LCD_LINE_2)
time.sleep(2)
sheet1 = wb.add_sheet(inp)
sheet1.write(0, 0, 'Name/Date')
sheet1.write(0, 1, str(date.today()))
row=1
col=0
already_attendence_taken = ""
lcd_byte(0x01,LCD_CMD) # 000001 Clear display
time.sleep(E_DELAY)
lcd_string("Please Scan",LCD_LINE_1)
lcd_string("Your Face",LCD_LINE_2)
time.sleep(E_DELAY)
while True:
# Grab a single frame of video
ret, frame = video_capture.read()
# Resize frame of video to 1/4 size for faster face recognition processing
small_frame = cv2.resize(frame, (0, 0), fx=0.25, fy=0.25)
# Convert the image from BGR color (which OpenCV uses) to RGB color (which face_recognition uses)
rgb_small_frame = small_frame[:, :, ::-1]
face_names = []
for face_encoding in face_encodings:
# See if the face is a match for the known face(s)
matches = face_recognition.compare_faces(known_face_encodings, face_encoding)
39
name = "Unknown"
face_names.append(name)
if((already_attendence_taken != name) and (name != "Unknown")):
sheet1.write(row, col, name )
col =col+1
sheet1.write(row, col, "Present" )
row = row+1
col = 0
print("attendence taken")
wb.save('attendence_excel.xls')
already_attendence_taken = name
lcd_byte(0x01,LCD_CMD) # 000001 Clear display
time.sleep(E_DELAY)
lcd_string("Your Attendence",LCD_LINE_1)
lcd_string("Taken "+name,LCD_LINE_2)
time.sleep(2)
GPIO.output(Buzzer, True)
time.sleep(1)
GPIO.output(Buzzer, False)
time.sleep(1)
else:
print("next student")
lcd_byte(0x01,LCD_CMD) # 000001 Clear display
time.sleep(E_DELAY)
lcd_string("Please Scan Next",LCD_LINE_1)
lcd_string("Student Face",LCD_LINE_2)
time.sleep(E_DELAY)
40
# Display the resulting image
cv2.imshow('Video', frame)
41