Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 49

GSM Based RFID Attendance System.

B.Sc. Project
By
ID: 17114
ID: 153
ID: 171

A Project report submitted in partial fulfillment of the requirements for


the degree of Bachelor of Science in Electrical & Electronic Engineering

DEPARTMENT OF ELECTRICAL AND ELECTRONIC ENGINEERING


CITY UNIVERSITY, DHAKA, BANGLADESH
September 2019

1
Certificate
The project titled “GSM Based RFID Attendance System “submitted by

has been accepted as satisfactory in partial fulfillment of the requirement for the
degree of Bachelor of Science in Electrical and Electronic Engineering on August,
2019.

Supervisor

……………….
Md. Ziaul Islam
Lecturer,
Department of Electrical and Electronic Engineering (EEE),
City University, Bangladesh

2
Declaration

This is to certify that the project titled “GSM Based RFID Attendance System” is the
result of our study in partial fulfillment of the B.Sc. Engineering degree under the
supervision of Md. Ziaul Islam, Lecturer, Department of Electrical and
Electronic Engineering (EEE), City University, Bangladesh. It is also hereby declared
that this project or any part of it has not been submitted elsewhere for the award of
any degree.

Signature of the Candidates

……………………………..
Name:
ID No: 171143539
Department of Electrical and Electronic Engineering,
City University, Bangladesh

……………………………
Name:
ID No: 153103305
Department of Electrical and Electronic Engineering,
City University, Bangladesh

……………………………
Name:
ID No: 171143513
Department of Electrical and Electronic Engineering,
City University, Bangladesh

3
Acknowledgement

First, we would like to say thanks to almighty “ALLAH” for giving us the strength to
finish the project as a partial fulfillment for the requirements for the Degree of B. Sc.
In Electrical and Electronic Engineering. We would like to express our gratitude and
appreciation to our supervisor, Md. Ziaul Islam, Lecturer, Department of Electrical
and Electronic Engineering of City University for the guidance and enthusiasm
extended throughout the progress of this work. We would like to say Special thanks to
the acting head of our department Md. Humayun Kabir Khan, Assistant Professor,
Department of Electrical and Electronic Engineering of City University for his
precious advises with fruitful suggestions and coordination. We are also grateful to all
the faculties of the Department of Electrical and Electronic Engineering of City
University, Bangladesh for giving us the opportunity to complete the work and
necessary support during the period. This thesis work would not have been possible
without the encouragement, logical help and advice from our friends. We are grateful
to them. Finally, we must acknowledge with due respect the constant support and
patience of our parents.

4
Abstract
Nowadays, with the advancement of the technologies and the craze of internet in the
present era, students are less motivated to attend the lecture. This project is to simplify
attendance recorder system by using Radio Frequency Identification (RFID)
technology. This will require a product, which has can distinguishing different person.
This can be made possible with the technology of RFID (Radio Frequency
Identification). This report will provide a clear picture of hardware and software used
in the system. It will also provide an overall view of its operation and working.

5
Contents
Name of Contents Page
No.
Title of the Project…………………………………………………………….. I
Certificate …………………… ………………………………………………. II
Declaration …………………………………………………………………… III
Acknowledgement ……………………………………………………………. IV
Abstract ………………………………………………………………………. V
Contents………………………………………………………………………... VI
Figure of contents …………………………………………………………… VIII
Table of contents ……………………………………………………………... IX
Chapter 1: Introduction ……………………………………………………… 1
1.1 Introduction……………………………………………………………….. 1
1.2 What is IoT? ……………… ……………………………………………… 2
1.3 What is GSM? ….………………………………………………………… 2
1.4 What is Gas Detector? ………………………………………………… 3
1.5 What is IoT and GSM Based Gas Detector ……………………………..... 3
1.6 Objective of the project ………... ………………………………………... 4
1.7 Organization of the Project Book …………………………………………. 4

Chapter 2: Hardware description ……………………………………………. 5


2.1 Block diagram ……………………………………………………………. 5
2.2 Required components …………………………………………………….. 5
2.3 Description of the component ……………………………………………. 6
2.3.1.1 MQ2 Sensor …………………………………………………………... 6
2.3.1.2 Features ……………………………………………………………….. 6
2.3.1.3 Pin Configuration ……………………………………………………... 7
2.3.2.1 MQ3 Sensor …………………………………………………………... 7
2.3.2.2. Features ………………………………………………………………. 8
2.3.2.3 Pin Configuration ……………………………………………………... 8
2.3.3.1 MQ4 Sensor …………………………………………………………... 9
2.3.3.2 Features ……………………………………………………………….. 9
2.3.3.3 Pin Configuration ……………………………………………………... 10
2.3.4.1 MQ7 Gas Sensor ……………………………………………………… 11
2.3.4.2 Features ……………………………………………………………….. 11
2.3.4.3 Pin Configuration ……………………………………………………... 12
2.3.5.1 MQ8 Sensor …………………………………………………………... 12
2.3.5.2 Features ……………………………………………………………….. 13
2.3.5.3 Pin Configuration ……………………………………………………... 13
2.3.6.1 Arduino Uno R3 ………………………………………………........... 14
2.3.6.2 Specifications …………………………………………………………. 14
2.3.7.1 NodeMCU ……………………………………………………………. 15
2.3.7.2 Pin Description of NodeMCU …….………………………………….. 16
2.3.7.3 Communication system of Nodemcu …..………………….…………. 17
2.3.7.4 Applications of NodeMCU…………………………………………… 19
2.3.8.1 20*4 LCD with I2C Communication Module……..………………... 19
2.3.8.2 Key Feature of 16*2 LCD …………………………………………… 20

6
2.3.8.3 LCD Display ………………………………………………………….. 20
2.3.8.4 I2C Interface ………………………………………………………….. 21
2.3.8.5 I2C Module Connection……………………………………………….. 21
2.3.9 Connecting Wire …………………………………………………........... 22
2.3.10 Bread Board …………………………………………………………… 22
2.3.11.1 Sim800L GSM Module ……….…………………………………….. 23
2.3.11.2 Features ……………………………………………………………… 23
2.3.12 Power Supply ………………………………………………………….. 24
2.3.13.1 Flame Sensor ………………………………………………………… 25
2.3.13.2 Pins of Flame Sensor ………………………………………………… 25
2.3.13.3 Features & Specifications ………………………………………….... 26
2.3.14 Buzzer …………………………………………………………………. 26

Chapter 3: System design …………………………………………………… 27


3.1 Required software and their set up process ………………………………. 27
3.2 Software …………………………………………………………….......... 27
3.2.1 Installation …………………………………………………… 27
…………
3.2.1.1 Installation and setup of the Arduino software ………………………. 27
3.2.2 Blynk Android App …………………………………………………….. 30
3.3 Programming ………………………………………………………........... 30
3.3.1 Arduino program development ………………………………………… 31
3.4 Hardware implementation …………………………………………........... 31
3.4.1 Hardware Connection ….…………………..…………………………… 31

Chapter 4: Conclusion ………………………………………………………. 32


4.1 Cost analysis ……………………………………………………………… 32
4.2 Conclusions & Future work …………………………………………......... 33
4.3 Limitations ………………………………………………………………... 33
4.4 Advantages ……………………………………………………………….. 33

References.………………………………………………………………........... 34

Appendix ……………………………………………..….……………………. 35
Programming Code for Arduino ……………….………….…………………… 33
Programming Code for NodeMCU ………....……………...…………………… 35

7
Figure of Contents
Figure No. Page No.
Figure 1.1 IoT ………………………………………………………….. 2
Figure 1.2 GSM ………. ………………………………………………. 2
Figure 1.3 Gas Detector ……………………………………………….. 3
Figure 2.1 Block Diagram ……………………………………………... 5
Figure 2.2 MQ2 Sensor ………………………………………………..... 6
Figure 2.3 MQ3 Sensor ………………………………………………..... 8
Figure 2.4 MQ4 Sensor ………………………………………………..... 9
Figure 2.5 MQ7 Sensor ………………………………………………..... 11
Figure 2.6 MQ8 Sensor ………………………………………………..... 12
Figure 2.7 Arduino Uno R3 ……………………………………………. 14
Figure 2.8 NodeMCU ……………….. ………………………………... 16
Figure 2.9 Pins Of NodeMCU ...……………………………………….. 17
Figure 2.10 Communication Pins of NodeMCU ……………………...… 19
Figure 2.11 20*4 LCD With I2C Module…………..…………………… 20
Figure 2.12 LCD And I2C Connection ….……………………………… 21
Figure 2.13 Connecting Wire …... ……………………………………. 22
Figure 2.14 Bread Board ……………………………………………….. 22
Figure 2.15 Sim800L GSM Module ……………………….…………… 23
Figure 2.16 12V Power Supply ………………………………………..... 24
Figure 2.17 5V Power Supply …………… …………………………….. 24
Figure 2.18 Flame Sensor ……………………………………………….. 25
Figure 2.19 Buzzer ……………………………………………………… 26
Figure 3.1 Program installation Process-1 …………………………….... 28
Figure 3.2 Program installation Process-2 …………………………….... 28
Figure 33 Blynk Android App ………………………………………….. 30
Figure 3.4 Flowchart of the compiling process ………………………... 30
Figure 3.5 Circuit Diagram ………………..………….………………... 29

8
Table of Contents
Table No. Page No.
Table 2.1 Pins of MQ2 Sensor …………………………………………... 7
Table 2.2 Pins of MQ3 Sensor …………………………………………... 8
Table 2.3 Pins of MQ4 Sensor …………………………………………... 10
Table 2.4 Pins of MQ7 Sensor …………………………………………... 11
Table 2.5 Pins of MQ8 Sensor …………………………………………... 12
Table 2.6 Specification of Arduino .………….……...………………….. 15
Table 2.7 Pins of NodeMcu ………….………………….………………. 16
Table 2.8 Pins of Flame Sensor ……..…...……………………………… 25
Table 4.1 Cost Analysis of this project …….………….………………… 32

9
Chapter 1: Introduction

1.1 Introduction

The emergence of electronic paradigm for learning compared to traditional method


and availability of almost all information on the information superhighway(Internet),
nowadays have caused students to be less motivated to come to the lecture rooms than
ever before. Laziness on the part of students, nonchalance to school work, extra social
activities that have no importance in aiding the objectives of the institution and a lot
more, may prevent students from attending lectures. Sequel to these, lecturers and
administrators in most developing countries have had to come up with ways to ensure
a healthy participation from students, and make sure that the student-lecturer
interactive relationship is kept intact. This in some cases have come in simple forms
like roll calls, while in more interesting cases, can be formats like surprise quizzes,
extra credit in class, etc. These strategies are however time consuming, stressful and
laborious because the valuable lecture time that could otherwise been used for lectures
is dedicated to student attendance taking and sometimes not accurate. In addition to
all these challenges, the attendances are recorded manually by the tutor and therefore
are prone to personal errors. There arises a need for a more efficient and effective
method of solving this problem. A technology that can solve this problem and even do
more is the RFID technology. RFID is an automated identification and data collection
technology, that ensures more accurate and timely data entry. RFID is not actually a
new technology; it only quickly gained more attention recently because of its current
low cost and advances in other computing fields that open up more application areas.
RFID combines radio frequency and microchip technologies to create a smart system
that can be used to identify, monitor, secure and do object inventory. At their
simplest, RFID systems use tiny chips called ―tags that contain and transmit some
piece of identifying information to an RFID reader, a device that in turn can interface
with computers . The ability of RFID systems to deliver precise and accurate data
about tagged items will improve efficiency and bring other benefits to business
community and consumers alike in the not distant future [11]. In this paper, we
present an intelligent RFID based lecture attendance access control and management
system tailored around Nigerian Universities’ Commission (NUC) policy of ensuring
a 70% course attendance by students for a course before likelihood of writing a
semester examination for any course. The application of RFID Technology to student
course attendance monitoring problem especially in developing countries in our
proposition will lead to elimination or reduction of the quality time wasted during
manual collection of attendance, creation of a student database management system
that is not prone to errors or being manipulated by anyone and above all aids in better
management of classroom statistics for allocation of attendance scores in the final
grading of student performance in a particular course.

1
1.2 What is RFID?

Radio-frequency identification (RFID) uses electromagnetic fields to automatically identify and


track tags attached to objects. An RFID tag consists of a tiny radio transponder; a radio receiver
and transmitter. When triggered by an electromagnetic interrogation pulse from a nearby RFID
reader device, the tag transmits digital data, usually an identifying inventory number, back to the
reader. This number can be used to track inventory goods.
There are two types of RFID tags:

 Passive tags are powered by energy from the RFID reader's interrogating radio waves.
 Active tags are powered by a battery and thus can be read at a greater range from the
RFID reader; up to hundreds of meters. Unlike a barcode, the tag doesn't need to be within the
line of sight of the reader, so it may be embedded in the tracked object. RFID is one method
of automatic identification and data capture (AIDC).[1]
RFID tags are used in many industries. For example, an RFID tag attached to an automobile
during production can be used to track its progress through the assembly line; RFID-tagged
pharmaceuticals can be tracked through warehouses; and implanting RFID microchips in livestock
and pets enables positive identification of animals.
Since RFID tags can be attached to cash, clothing, and possessions, or implanted in animals and
people, the possibility of reading personally-linked information without consent has raised serious
privacy concerns.[2] These concerns resulted in standard specifications development addressing
privacy and security issues. ISO/IEC 18000 and ISO/IEC 29167 use on-
chip cryptography methods for untrace ability, tag and reader authentication, and over-the-air
privacy. ISO/IEC 20248 specifies a digital signature data structure for RFID
and barcodes providing data, source and read method authenticity. This work is done
within ISO/IEC JTC 1/SC 31 Automatic identification and data capture techniques. Tags can also
be used in shops to expedite checkout, and to prevent theft by customers and employees.
In 2014, the world RFID market was worth US$8.89 billion, up from US$7.77 billion in 2013 and
US$6.96 billion in 2012. This figure includes tags, readers, and software/services for RFID cards,
labels, fobs, and all other form factors. The market value is expected to rise from US$12.08 billion
in 2020 to US$16.23 billion by 2029

Figure 1.1: IoT

1.3 What is GSM?

2
GSM is a mobile communication modem; it is stands for global system for mobile
communication (GSM). GSM is an open and digital cellular technology used for
transmitting mobile voice and data services operates at the 850MHz, 900MHz,
1800MHz and 1900MHz frequency bands.

Figure 1.2: GSM

1.4 What is GSM Based RFID Attendance System?


A number of related works exist in literature, application of RFID Technology to
different areas and specifically to the area of academic attendance monitoring
problem. In [6], authors designed and implemented a model of a secured and portable
embedded reader system to read the biometric data from the electronic passport. The
authors attempted to solve problems of reliability, security and privacy
in E-passports by authenticating holder online using Global System of Mobile
Communications (GSM) network. The GSM network is the main interface between
identification centre and the epassport reader. The communication data is protected
between server and e-passport reader by using AES to encrypt data for protection
while transferring through GSM network. Author in reviewed the current research
application of RFID to different areas with emphasis on application for supply chain
management and developed a taxonomic framework to classify literature which
enables swift and easy content analysis to help identify areas for future research.
Authors in reviewed the use of RFID in an integratedcircuit(IC) packaging house to
resolve inventory transaction issues. His study suggests that RFID contributes
significant improvements to the water receiving process and the inventory transaction
process that reduce labour cost and man-made errors. In, an automated attendance
management system was implemented both in electronic and mobile platform using
stationary matrix AR 400 RFID reader with four circulatory polarized antennae and
Symbol MC9000-G handheld RFID reader respectively. In the electronic platform,
the attendance management system depicts a simple client (antennae placed at
classroom entrance) /server (privileged student database) system. Students can
visually see their names as they entered class on the screen and they
are assured that their presence has been entered in the instructor’s database. However,
one important drawback about this system is the RFID tag read rates degrade

3
tremendously as it comes closer to electronic devices. In, an automatic attendance
system using fingerprint verification technique was proposed. The fingerprint
technique verification was achieved using extraction of abnormal point on the ridge of
user’s fingerprint or minutiae technique. The verification confirms the authenticity of
an authorized user by performing one to one comparison of a captured fingerprint
templates against the stored templates in the database. The proposed automatic
attendance system signals either true or false based on logical result of previous one to
one verification of person’s authenticity. Authors in also reviewed and proposed
biometric system using fingerprint identification for attendance automation of
employees in an organization. Consequently, authors in proposed student wolf pack
club tracking system to simplify and speed up the process of student wolf pack club
ticket distribution for athletic event. Our proposition emphasizes a simple, reliable
and cost effective model for face classrooms’ attendance management that uses
existing student ID card chip as the passive tag with additional short message services
to parents as weekly summary.

Figure 1.3: GSM Based RFID Attendance System.

4
1.6 Objective of this Project

This section describes previous work done regarding attendance system. Attendance
records are necessary to conclude and authenticate students as well as employees of
organization. Therefore, many researches have been done research in this area to
improve and replace the traditional system of attendance by RFID technology

[1] describes the integration of mobile device with software for recording
examination attendance is sufficient. In a test, it was found that it reduces time,
manpower, cost (printing and paper), and eases the examination procedures

[2] Tells the establishment of remote monitoring platform based on a GSM short
message mode that can monitor and control the remote communication between the
central monitoring station and remote monitoring stations. The remote monitoring
station can send the short message because GSM network can interconnect and roam
all over the country, and its network ability is very strong; the user will no need
another network.

[3] Proposed a system which utilizes the GSM short message service and
microcontroller to achieve remote real-time data monitoring. The PC server program
written in VB language performs real-time data processing and control and records
monitoring results into database.

[4] Expressed low cost RFID Based Attendance System prototype, the system
provides several advantages over conventional method of taking attendance in class.
The prototype developed in this project is compact and light weight. Besides, it can
run using power adapter or battery power. Therefore, it is very portable and can be
carried to the class for taking the attendance.

[5] Designed a wireless fingerprint-based attendance system to record and obtain the
attendance data using finger prints or known as biometric.

[6] Designed a time management and access monitoring system using microprocessor
card to monitor students‟ or staffs‟ movement with the records that are kept in the
database for administrator reference in campus, office or certain area. All data
captured by this system could be accessed by teachers; headmaster and parents.

1.7 Organization of the Project Book

This book consists of four chapters.

Chapter 1: Gives a brief discussion of the project introduction, project objectives,


project motivation and history.

5
Chapter2: Focuses on hardware we used, their theoretical background and
applications.

Chapter 3: Complete discussion of system designing of proposed “Hand Gesture


Controlled Robot Using Arduino” project.

Chapter 4: Concludes overall discussion of the proposed project and future


recommendation are also presented in this chapter.

6
Chapter 2: Hardware Description

2.1 Block Diagram

Fig. 2.1: Block Diagram of RFID Attendance System.

2.2 Required Components

The required components to complete our project are following:

1. ATMEGA328 PU
2. RFID Receiver
3. RFID Tag
4. SIM800L GSM Module
5. 16 MHz Crystal Oscillator
6. 16*2 LCD
7. Buzzer 
8. LM7805 IC
9. 12V or 5V Power Supply
10. CCB

7
2.3 Description of the Components

2.3.1.1 ATMEGA 328 P

ATMEGA328P is high performance, low power controller from Microchip. ATMEGA328P is an


8-bit microcontroller based on AVR RISC architecture. It is the most popular of all AVR
controllers as it is used in ARDUINO boards.

Fig 2.2: ATMEGA328P

2.3.1.2 ATmega328 Features

ATmega328 Features

No. of Pins 28

CPU RISC 8-Bit AVR

Operating Voltage 1.8 to 5.5 V

8
ATmega328 Features

Program Memory 32KB

Program Memory Type Flash

SRAM 2048 Bytes

EEPROM 1024 Bytes

ADC 10-Bit

Number of ADC Channels 8

PWM Pins 6

Comparator 1

8-pin PDIP32-lead TQFP28-pad


Packages (4)
QFN/MLF32-pad QFN/MLF

Oscillator up to 20 MHz

Timer (3) 8-Bit x 2 & 16-Bit x 1

Enhanced Power on Reset Yes

Power Up Timer Yes

I/O Pins 23

Manufacturer Microchip

SPI Yes

I2C Yes

Watchdog Timer Yes

USI (Universal Serial Interface) Yes

Minimum Operating -40 C to +85 C


Temperature

9
2.3.1.3 Pin Description of ATMEGA 328P

Functions associated with the pins must be known in order to use the device.
Appropriately.ATmega-328 pins are divided into different ports which are given in
detail below.
VCC is a digital voltage supply.AVCC is a supply voltage pin for analog to digital
converter.GND denotes Ground and it has a 0V.Port A consists of the pins
from PA0 to PA7. These pins serve as analog input to analog to digital converters. If
analog to digital converter is not used, port A acts as an eight (8) bit bidirectional
input/output port.Port B consists of the pins from PB0 to PB7. This port is an 8 bit
bidirectional port having an internal pull-up resistor.Port C consists of the pins
from PC0 to PC7. The output buffers of port C has symmetrical drive characteristics
with source capability as well high sink.Port D consists of the pins
from PD0 to PD7. It is also an 8 bit input/output port having an internal pull-up
resistor.

2.3.1.4 ATMEGA 328P as Arduino UNO

Fig 2.3: ATMEGA 328P As Arduino UNO

If you have a new ATmega328P (or ATmega168), you'll need to burn the bootloader
onto it. You can do this using an Arduino board as an in-system program (ISP). If
the microcontroller already has the bootloader on it (e.g. because you took it out of
an Arduino board or ordered an already-bootloaded ATmega), you can skip this
section.

To burn the bootloader, follow these steps:

1. Upload the ArduinoISP sketch onto your Arduino board. (You'll need to
select the board and serial port from the Tools menu that correspond to your

10
board.)
2. Wire up the Arduino board and microcontroller as shown in the diagram to
the right.
3. Select "Arduino Duemilanove or Nano w/ ATmega328" from the Tools >
Board menu. (Or "ATmega328 on a breadboard (8 MHz internal clock)" if
using the minimal configuration described below.)
4. Select "Arduino as ISP" from Tools > Programmer
5. Run Tools > Burn Bootloader

You should only need to burn the bootloader once. After you've done so, you can
remove the jumper wires connected to pins 10, 11, 12, and 13 of the Arduino board.

2.3.1.4.1 Uploading Using an Arduino Board

Once your ATmega328P has the Arduino bootloader on it, you can upload programs
to it using the USB-to-serial convertor (FTDI chip) on an Arduino board. To do, you
remove the microcontroller from the Arduino board so the FTDI chip can talk to the
microcontroller on the breadboard instead. The diagram at right shows how to
connect the RX and TX lines from the Arduino board to the ATmega on the
breadboard. To program the microcontroller, select "Arduino Duemilanove or Nano
w/ ATmega328" from the the Tools > Board menu (or "ATmega328 on a breadboard
(8 MHz internal clock)" if you're using the minimal configuration described below).
Then upload as usual.

Uploading sketches to an ATmega on a breadboard. Remember to remove the


microcontroller from the Arduino board!

Minimal Circuit (Eliminating the External Clock)


If you don't have the extra 16 MHz crystal and 18-22 picofarad capacitors used in
the above examples, you can configure the ATmega328P to use its internal 8 MHz
RC oscillator as a clock source instead. (You don't really need the 10K pullup
resistor on the reset pin either, so we remove it to get a truly minimal configuration.)

You'll need to install support for an additional hardware configuration:

1. Download this hardware configuration archive: breadboard-1-6-


x.zip, Breadboard1-5-x.zip or Breadboard1-0-x.zip depending on which IDE
you use.
2. Create a "hardware" sub-folder in your Arduino sketchbook folder (whose

11
location you can find in the Arduino preferences dialog). If you've previously
installed support for additional hardware configuration, you may already
have a "hardware" folder in your sketchbook.
3. Move the breadboard folder from the zip archive to the "hardware" folder of
your Arduino sketchbook.
4. Restart the Arduino software.
5. You should see "ATmega328 on a breadboard (8 MHz internal clock)" in the
Tools > Board menu.

Once you've done this, you can burn the bootloader and upload programs onto your
ATmega328P as described above. Be sure to select "ATmega328 on a breadboard (8
MHz internal clock)" when burning the bootloader. (If you select the wrong item
and configure the microcontroller to use an external clock, it won't work unless you
connect one.)

2.3.1.5 Communication system of Arduino


There are three types of communications that Node MCU use commonly and they are

UART
UART stands for Universal Asynchronous Reception and Transmission and is a
simple communication protocol that allows the NodeMCU to communicate with serial
devices. The UART system communicates with digital pin 0 (RX), digital pin 1 (TX),
and with another computer via the USB port.

This peripheral, found on all NodeMCU boards, allows the NodeMCU to directly
communicate with a computer thanks to the fact that the Arduino has an onboard
USB-to-Serial converter. Therefore, programs written on a Windows, Mac, or Linux
OS can be used with an NodeMCU connected to a USB port as if it was a serial port
(serial port communication is trivial compared to USB communication).

I2C
I2C, which stands for inter-integrated-circuit, is a serial communications protocol
specially designed for microcontrollers.

While this peripheral is almost never used for PC-device communication, it is


incredibly popular with modules and sensors, making it useful for projects that require
many parts working together. In fact, I2C allows you to potentially connect up to 128
devices to your main board!

When connecting two circuits to one another, think of the main device as the “master”

12
and the connected devices—such as sensors, pin expansions, and drivers—as “slaves”.
I2C makes it possible to connect multiple masters and slaves to your board while
maintaining a clear communication pathway.

Maintaining a clear communication pathway is possible because I2C uses an address


system and a shared bus, meaning many devices can be connected to the exact same
wires. However, the NodeMCU must first select a specific device by transmitting a
unique address before sending data. This provides each slave device with what it
needs while also supporting multiple masters. I2C uses fewer wires and all data is
transmitted on a single wire, keeping your pin count low. The tradeoff for this
simplified wiring is slower speeds than SPI.

SPI

SPI stands for Serial Peripheral Interface. Like I2C, SPI is a different form of serial-
communications protocol specially designed for microcontrollers to talk to each other.
However, it has some key differences from its I2C counterpart.

Fig 2.4: Communication Pins of Node MCU

2.3.2 RFID Receiver

2.3.2.1 What is RFID technology, exactly?

RFID is a method of data collection that involves automatically identifying objects


through low-power radio waves. Data is sent and received with a system consisting
of RFID tags, an antenna, an RFID reader, and a transceiver.
13
Fig 2.5: RFID Receiver

2.3.2.2 How does it work?

Like barcode technology, RFID recognizes locations and identification of tagged


items — but instead of reading laser light reflections from printed barcode labels, it
leverages low-power radio frequencies to collect and store data. In a warehouse or
distribution center, this technology is used to automate data collection. The
transceiver reads radio frequencies and transmits them to an RFID tag. The
identification information is then transmitted from a tiny computer chip embedded in
the tag and broadcasted to the RFID reader.

Here are a few of RFID’s helpful features and functions:

 Tags can trigger alarms when moved

 Communication between readers and tags is not contingent upon orientation

 Data can be automatically read and stored

 Tags can carry unique or standardized product codes

 Items can be individually labeled, but read in mass

 Tag data is compatible with WMS and ERP systems

 Tags are difficult to reproduce/counterfeit

14
2.3.2.3 What is the difference between RFID and barcode technology?

Barcode and RFID share similar functionalities, but they have one distinct difference:
human intervention, or “line of sight.” This refers to the distance between the operator
of the data collection device (barcode scanner or RFID reader) and the labeled or
tagged item — in other words, whether or not they are close enough to the item to see
it.
To get a good barcode read, operators must position their handheld scanner within the
line of sight of the item. To collect data using RFID technology, operators are not as
limited — they simply need to be within the range of the tag. This means that
employees can collect data for any item within the read range without physically
moving from shelf to shelf. This also means that more than one item can be read at
once. For those reasons, many companies are looking to RFID to add even more value
to their operations.

2.3.2.4 What are the benefits of using RFID?

With RFID, supply chain businesses can track the movement of their inventory items
and assets. By eliminating labor-intensive inventory tracking processes that require
human intervention and increasing visibility of your items and assets, RFID can help
businesses cut costs related to manufacturing, distribution, inventory management,
and asset tracking.

RFID automates your data collection process so that your employees can eliminate
time-consuming procedures and spend more time on what’s important: customer
service, shipping, and picking.

An automated data collection system — especially one that does not require human
intervention — improves speed and accuracy so that employees can get more done in
a shorter amount of time (and get it done right the first time). Because of this, RFID
allows businesses to decrease their labor costs. And with improved accuracy,
businesses can also increase their throughput, and therefore reduce their inventory
carrying costs as well.

Not to mention, improved accuracy can yield even more benefits. When shipments
arrive on time and in the right quantities, customers are bound to be more satisfied
with your service.

2.3.3 RFID Tag

15
2.3.3.1 Definition of RFID Tags
RFID tags are a type of tracking system that uses smart barcodes in order to identify
items. RFID is short for “radio frequency identification,” and as such, RFID tags
utilize radio frequency technology. These radio waves transmit data from the tag to a
reader, which then transmits the information to an RFID computer program. RFID
tags are frequently used for merchandise, but they can also be used to track vehicles,
pets, and even patients with Alzheimer’s disease. An RFID tag may also be called an
RFID chip.

Fig 2.6: RFID Tag

2.3.3.2How RFID Tags Work


An RFID tag works by transmitting and receiving information via an antenna and a
microchip — also sometimes called an integrated circuit or IC. The microchip on an
RFID reader is written with whatever information the user wants. There are two
main types of RFID tags: battery-operated and passive. As the name suggests, battery-
operated RFID tags contain an onboard battery as a power supply, whereas a passive
RFID tag does not, instead working by using electromagnetic energy transmitted from
an RFID reader. Battery-operated RFID tags might also be called active RFID tags.
Passive RFID tags use three main frequencies to transmit information: 125 – 134
KHz, also known as Low Frequency (LF), 13.56 MHz, also known as High
Frequency (HF) and Near-Field Communication (NFC), and 865 – 960 MHz, also
known as Ultra High Frequency (UHF). The frequency used affects the tag’s range.
When a passive RFID tag is scanned by a reader, the reader transmits energy to the
tag which powers it enough for the chip and antenna to relay information back to the
reader. The reader then transmits this information back to an RFID computer program
for interpretation. There are two main types of passive RFID tags: inlays and hard
tags. Inlays are typically quite thin and can be stuck on various materials, whereas
hard tags are just as the name suggests, made of a hard, durable material such as

16
plastic or metal. Active RFID tags use one of two main frequencies — either 433
MHz or 915 MHz — to transmit information. They contain three main parts,
including a tag, antenna, and interrogator. The battery in an active RFID tag should
supply enough power to last for 3-5 years. When it dies, the unit will need replaced,
as the batteries are not currently replaceable. There are two main kinds of active RFID
tags: beacons and transponders. Beacons send out an information ping every few
seconds, and their signal is readable from several hundreds of feet away. Because they
are sending out data so frequently, their battery tends to deplete quicker. Like passive
RFID tags, transponders require the use of a reader to transmit information. When
within range of one another, a reader first sends out a signal to the transponder, which
then pings back with the relevant information. Because they only activate when near a
reader, transponders are much more battery-efficient than beacons.

2.3.3.3 Examples of RFID Tags


Since an active RFID is constantly sending out a signal, it makes an excellent choice
for those looking for up-to-the-minute live tracking, such as in tolling and real-time
vehicle tracking applications. They are an expensive product, but they do offer a long
read range, which may be preferred depending on their application. Passive RFID tags
are a much more economical choice than active RFID tags, and cost around 20 cents
each. This makes them a popular choice for supply chain management, race tracking,
file management, and access control applications. While a passive RFID tag does not
require a direct line of sight to the RFID reader, it has a much shorter read range than
an active RFID tag. They are small in size, lightweight, and can potentially las ta
lifetime. Since active RFID tags feature a larger, more rugged design than passive
RFID tags, they are better suited for applications where durability is required. They
are frequently used in toll payment transponder systems, cargo tracking applications,
and even in devices used to track people.

2.3.3.4 Disadvantages of RFID Tags


RFID tags aren’t ideal compared to other tracking labels for a number of reasons.
Some problems with RFID include different security and technological issues.
Because an RFID tag cannot distinguish between readers, the information can be read
by almost anyone once it has left the original supply chain. Because RFID readers are
so portable, and the range of some tags so great, scammers can gather information
they would otherwise not have access to. This means that anyone can collect
potentially sensitive information without a person’s knowledge. Another security
concern for consumers is that RFID tags can be linked to individual credit cards,
creating the potential for financial theft and fraud. Technology-wise, RFID tags are
problematic largely because there are no real global or industry standards. Since they
operate on radio frequency, RFID tags and their systems can also easily become
jammed or disrupted, reducing their usability. This results in longer wait times and
decreased productivity in both retail and warehouse settings. There are also signal
issues that can occur with RFID inventory systems, including collision — when
signals from two or more readers overlap, and interference caused by metal, water, or
other magnetic fields in the surrounding area. An RFID system is also time-
consuming and labor-intensive to set up. Companies need to test various hardware
and tag systems to determine the best fit, which can take months to arrange. In
addition to the cost of the RFID system itself, such as RFID tags and scanners, an

17
increase in time and labor also means an increase in cost. These types of
disadvantages are often avoided with the use of barcodes, which is why they are still a
popular data collection and inventory control choice for many businesses.

2.3.4.1 Sim800L GSM Module

SIM800L is a miniature cellular module which allows for GPRS transmission,


sending and receiving SMS and making and receiving voice calls. Low cost and small
footprint and quad band frequency support make this module perfect solution for any
project that require long range connectivity. After connecting power module boots up,
searches for cellular network and login automatically. On board LED displays
connection state (no network coverage - fast blinking, logged in - slow blinking).
NOTICE: Be prepared to handle huge power consumption with peek up to 2A.
Maximum voltage on UART in this module is 2.8V. Higher voltage will kill the
module.

Fig 2.7: Sim800L GSM Module

2.3.4.2 Specification

 Supply voltage: 3.8V - 4.2V


 Recommended supply voltage: 4V
 Power consumption:
o sleep mode < 2.0mA
o idle mode < 7.0mA
o GSM transmission (avg): 350 mA
o GSM transmission (peek): 2000mA
 Module size: 25 x 23 mm
 Interface: UART (max. 2.8V) and AT commands
 SIM card socket: microSIM (bottom side)

18
 Supported frequencies: Quad Band (850 / 950 / 1800 /1900 MHz)
 Antenna connector: IPX
 Status signaling: LED
 Working temperature range: -40 do + 85 ° C

2.3.5 16MHz Crystal Oscillator


The 16 MHz Crystal Oscillator module is designed to handle off-chip crystals that
have a frequency of 4œ16 MHz. The crystal oscillator's output is fed to the System
PLL as the input reference. The oscillator design generates low frequency and phase
jitter, which is recommended for USB operation.

Fig 2.8: 16MHz Crystal Oscillator.

2.3.6.1 16*2 LCD

19
LCD modules are very commonly used in most embedded projects, the reason being
its cheap price, availability and programmer friendly. Most of us would have come
across these displays in our day to day life, either at PCO’s or calculators. The
appearance and the pinouts have already been visualized above now let us get a bit
technical.
16×2 LCD is named so because; it has 16 Columns and 2 Rows. There are a lot of
combinations available like, 8×1, 8×2, 10×2, 16×1, etc. but the most used one is the
16×2 LCD. So, it will have (16×2=32) 32 characters in total and each character will
be made of 5×8 Pixel Dots. Now, we know that each character has (5×8=40) 40 Pixels
and for 32 Characters we will have (32×40) 1280 Pixels. Further, the LCD should
also be instructed about the Position of the Pixels. Hence it will be a hectic task to
handle everything with the help of MCU, hence an Interface IC like HD44780is used,
which is mounted on the backside of the LCD Module itself. The function of this IC is
to get the Commands and Data from the MCU and process them to display
meaningful information onto our LCD Screen. You can learn how to interface an
LCD using the above mentioned links. If you are an advanced programmer and would
like to create your own library for interfacing your Microcontroller with this LCD
module then you have to understand the HD44780 IC is working and commands
which can be found its datasheet.

Fig 2.9: 16*2 LCD.


.

2.3.6.2 Pin Configuration

Pin Pin Name: Description


No:

1 Vss (Ground) Ground pin connected to system ground

20
2 Vdd (+5 Powers the LCD with +5V (4.7V – 5.3V)
Volt)

3 VE (Contrast Decides the contrast level of display. Grounded to get


V) maximum contrast.

4 Register Connected to Microcontroller to shift between


Select command/data register

5 Read/Write Used to read or write data. Normally grounded to write


data to LCD

6 Enable Connected to Microcontroller Pin and toggled between


1 and 0 for data acknowledgement

7 Data Pin 0  
 
Data pins 0 to 7 forms a 8-bit data line. They can be
connected to Microcontroller to send 8-bit data.
These LCD’s can also operate on 4-bit mode in such
case Data pin 4,5,6 and 7 will be left free.

8 Data Pin 1

9 Data Pin 2

10 Data Pin 3

11 Data Pin 4

12 Data Pin 5

13 Data Pin 6

14 Data Pin 7

15 LED Positive Backlight LED pin positive terminal

21
16 LED Backlight LED pin negative terminal
Negative

Table 2.2: Pins of 16*2 LCD

2.3.6.3 Features of 16×2 LCD module

 Operating Voltage is 4.7V to 5.3V


 Current consumption is 1mA without backlight
 Alphanumeric LCD display module, meaning can display alphabets and
numbers
 Consists of two rows and each row can print 16 characters.
 Each character is built by a 5×8 pixel box
 Can work on both 8-bit and 4-bit mode
 It can also display any custom generated characters
 Available in Green and Blue Backlight

2.3.7 Buzzer

A buzzer or beeper is an audio signaling device, which maybe mechanical, electromechanical,


or piezoelectric (piezo for short). Typical uses of buzzers and beepers include alarm
devices, timers, and confirmation of user input such as a mouse click or keystroke.

Fig 2.10: Buzzer.


2.3.8.1 LM7805

22
LM7805 is a voltage regulator IC. This IC belongs to LM78XX series. This series of
fixed-voltage integrated-circuit voltage regulators is designed for a wide range of
applications. These applications include on-card regulation for elimination of noise
and distribution problems associated with single-point regulation. Each of these
regulators can deliver up to 1.5 A of output current. The internal current-limiting and
thermal-shutdown features of these regulators essentially make them immune to
overload. In addition to use as fixed-voltage regulators, these devices can be used
with external components to obtain adjustable output voltages and currents, and also
can be used as the power-pass element in precision regulators.

Fig 2.11: LM7805 IC.

2.3.8.2 Brief Description on 7805 Voltage Regulator IC


Voltage regulators are very common in electronic circuits. They provide a constant output voltage
for a varied input voltage. In our case the 7805 IC is an iconic regulator IC that finds its
application in most of the projects. The name 7805 signifies two meaning, “78” means that it is a
positive voltage regulator and “05” means that it provides 5V as output. So our 7805 will provide
a +5V output voltage.
The output current of this IC can go up to 1.5A. But, the IC suffers from heavy heat loss hence a
Heat sink is recommended for projects that consume more current. For example if the input
voltage is 12V and you are consuming 1A, then (12-5) * 1 = 7W. This 7 Watts will be dissipated
as heat. 
 

2.3.8.3 7805 as +5V Voltage Regulator


This is a typical application circuit of the 7805 IC. We just need two capacitors of vale 33uf and
0.1uf to get this IC working.

23
The input capacitor 0.33uF is a ceramic capacitor that deals with input inductance problem and the
output capacitor 0.1uF is also a ceramic capacitor that adds to the stability of the circuit. These
capacitors should be placed close to the terminals for them to work effectively. Also they should
be of ceramic type, since ceramic capacitors are faster than electrolytic.
 

2.3.8.4 7805 as adjustable output Regulator


This IC can also act as an adjustable output voltage regulator, meaning you can also control the
output voltage for your desired value using the below circuit.

Here, the input voltage can be anywhere between 9V-25V, and the output voltage can be adjusted
using the value of resistance R1 and R2. The value can be calculated using the below formulae.

Where, Vxx=5, IQ = 5*10-3


 

2.3.8.5 7805 Applications

 Constant +5V output regulator to power microcontrollers and sensors in most of the
projects
 Adjustable Output Regulator
 Current Limiter for certain applications
 Regulated Dual Supply
 Output Polarity-Reversal-Protection Circuit

24
2.3.8.6 Pin Configuration

Pin Number Pin Name Description

1 Input (V+) Unregulated Input Voltage

2 Ground (Gnd) Connected to Ground

3 Output (Vo) Outputs Regulated +5V

Table 2.3: Pins of LM7805 IC

2.3.9 12 Volt Power Supply

12V power supplies (or 12VDC power supplies) are one of the most


common power supplies in use today. In general, a 12VDC output is obtained from a
120VAC or 240VAC input using a combination of transformers, diodes and
transistors.

Fig 2.12: 12Volts Power supply

2.3.10 CCB/L (Copper Clade Board/Laminate)

25
With the development of small, light, thin, multi-functional and high-density
electronic products, the integration and assembly density of components on the boards
are more and more high, as well as power dissipation is more and more large, so the
heat dissipation has a great demand on PCB substrates. There will be overheated for
the components on the board if the substrates have a poor dissipation, which will lead
to the unreliability of whole machine. So the PCB substrate come into being.

Copper clad laminate (CCL), the PCB substrates in PCB manufacturing, which is the

most widely and importantly used to fabricate the boards. And the copper clad

laminate is a kind of material that soak in resin with the electronic glass fiber or other

reinforcing material to make with copper clad on either one side or both sides. what's

more,  it’s widely applied in television, radio, computer, mobile communications and

others electronic products. 

Copper clad laminate (CCL) types


 
There are a lot of kinds of copper clad laminate based on different standard of
classification.

1. Classified by reinforcing material:

1) Paper base CCL ( such as XPC)

26
2) Glass fiber cloth base CCL (such as FR-4, FR-5)
3) Compound CCL ( such as CEM-1, CEM-3)
4) Special material base CCL (such as metal-base CCL, ceramic-base CCL and so on)

2. Classified by applied insulation resin:

1) Phenolic resin CCL (such as XPC, XXXPC, FR-1, FR-2 and so on)
2) Epoxy resin CCL (FR-3)
3) Polyester resin CCL

3. Classified by performance:

1)General performance CCL


2)CCL with high heat resistance
3)CCL with low dielectric constant
4)CCL with low CTE (Coefficient of Thermal Expansion)

4. Classified by mechanical rigidity:


1)Rigid CCL
2)Flexible CCL

27
Chapter 3: System Design

3.1 Required Software and their Setup Process

To complete our project, we need many types of software, most important of them are
following
1. Arduino IDE-1.8.9
3.2 Software
The software that is used to program the microcontroller is open-source-software and
can be downloaded for free on www.arduino.cc. With this “Arduino software” we can
write little programs with the microcontroller. These programs are called “Sketch”.
In the end the sketches are transferred to the microcontroller by USB cable. More on
that later on the subject “programming”.

3.2.1 Arduino IDE Installation


Now one after another the Arduino software and the USB driver for the board have to
be installed.
3.2.1.1 Installation and setup of the Arduino software
1. We have downloaded the Arduino software from www.arduino.cc and installed it
on the computer (This was NOT connected to the PC). After that we opened the
software file and installed the program named arduino.exe.
Two set ups on the program are important and should be considered.
a) The board that we want to connect has to be selected on the arduino software. The
“Arduino Uno” is here known as “Arduino / Genuino Uno and NodeMCU”.
b) We have to choose the right “Serial-Port”, to let the Computer know to which port
the board has been connected. That is only possible if the USB driver has been
installed correctly. It can be checked this way:

28
Fig. 3.1: Program installation process -1

At the moment the Arduino wasn’t connected to the PC. If we now choose “Port”,
under the field “Tool”, we will already see one or more ports here (COM1/ COM2/
COM3…). The quantity of the shown ports doesn't depend on the quantity of the USB
ports on the computer. When the board gets connected to the computer, we will find
one more port.

29
Fig. 3.2: Program installation process -2

30
3.3 Programming

The development cycle is divided into 4 phases:

Edit Compile Upload Run

Fig. 3.3: Flowchart of the compiling process

Compile: Compile means to translate the sketch into machine language, also known
as object.

Code Run: Arduino sketch is executed as soon as terminates the step of uploading on
the board.

3.3.1 Arduino Program Development

• Based on C++ without 80% of the instructions.


• A handful of new commands.
• Programs are called 'sketches'.
• Sketches need two functions:
• void setup ( )
• Void loop ( )
• Setup ( ) runs first and once.
• loop ( ) runs over and over, until power is lost or a new sketch is loaded.

31
3.4 Hardware Implementation

3.4.1 Hardware Connection

Fig 3.4: Circuit Diagram of This Project

1st we programed our circuit and then we connect as like the circuit diagram. Where
LCD is connected to A0-A5 and GSM is connected to D3 and D4 and RFID Receiver
is connected to D9 to D12 and a buzzer is connected to pin D5 through a transistor.

32
Chapter 4: Conclusion

4.1 Cost Analysis


This project is not very costly. The costing of our project is following:

Equipment Price

ATMEGA 328 300

Crystal Oscillator 40

RFID Receiver 430

RFID Tag 150

Buzzer 20

CCB 160

Power supply 150

GSM Module 580

Others 500

Total 2330 Taka

Table 4.1: Cost of This Project

4.2 Future Work

• As it may a possibility that Card might be Lost by Student, to overcome it,


instead of RFID tag Can be Replaced by Compact Size RFID Buttons. That
can Be associated with the Uniform of Student.
• GPS Module may be a good option to enhance its Applicability, By which
students Can be Located in Big Campuses.

33
4.3 Advantages

 Accurate attendance information on every student


 Reduced use of paper
 Lessens administrative stress
 Involvement of few manpower
 Improves student attendance ratios
 Transparency well maintained in the attendance process
 Monitors student whereabouts in campus during school hours
 Send automatic attendance status notifications to parents/guardians of students
.

4.4 Conclusion

Regularity of student attendance is a key concern in schools and universities alike.


Their overall academic performance depends on attendance to a great extent. RFID
based attendance system facilitates auto attendance saving time for both teachers and
students besides also enhancing the school's monitoring system. The fully automated
technology is highly flexible and reliable to use. It gives accurate results and reduces
paper based work, thus reducing environmental impact.

34
References
[1] Chitresh, S and Amit K (2010),”An efficient Automatic Attendance Using
Fingerprint Verification Technique ”,International Journal on Computer Science and
Engineering (IJCSE),Vol. 2 No. 2,pp 264-269.

[2] Henry. S, S. Arivazhagan and L. Ganesan (2003), “Fingerprint Verification Using


Wavelet Transform”, International Conference on Computational Intelligence and
Multimedia Applications, 2003.

[3]Maltoni D, D. Maio, A. K. Jain, S. Prabhaker (2003), “Handbook of Fingerprint


Recognition”, Springer, New York,Pp 13-20.

[4]Victor S, Jonathan M, Reece J, and Lemire J (2003),”Student Wolfpack Club


Tracking System”, North Carolina State University. USA. Retrieved by

[5] Nambiar A.N. (2009),” A supply chain perspective of RFID Systems”, World
Academy of Science, Engineering and Technology Journal, Volume 6,pp1-5.

[6] Mohamed A.B, Abdel-Hamid A and Mohammed K.Y.,(2009), ”Implementation of


an Improved secure system detection for E passport by using EPC RFID tags”, World
Academy of Science, Engineering and Technology Journal, Volume 6,pp1-5.

[7] Dawes A.T. (2004),”Is RFID Right for Your Library”, Journal of Access Services,
Volume 2(4), pp 7-13.

[8] Longe O.O.(2009),”Implementation of Student Attendance System using RFID


Technology”, B. Tech Project Report, Ladoke Aki

35
Appendix

Programming Code

#include <LiquidCrystal.h>
#include <SoftwareSerial.h>
#include <SPI.h>
#include <MFRC522.h>

#define TOTAL_ID 3 // total 3 RFID cards, add: name, number, cardID


#define DAY_OVER_MIN 1 // how much minutes in one day.
#define ABSENT_SMS_DAY 2 // how much days after absent sms are send.
#define DAY_IN_MS (DAY_OVER_MIN * 60000)
#define buzz 5

MFRC522 rfid(10, 9);


LiquidCrystal lcd(A0, A1, A2, A3, A4, A5);
SoftwareSerial gsm(2, 3);

String msgs[] = {
"Dear parents, your child is present in school.",
"Dear parents, your child is absent for last 2days.",
};

// ---------------------------------------------------
String numbers[TOTAL_ID] = {
"01738462211",
"01768077482",
"01773115252",
};

String names[TOTAL_ID] = { // MUST BE in 16 char


"Nazmul Hasan 028",
"MH Rony 033 ",
"Aminur Rahman082",
};

byte cardID[TOTAL_ID][4] = {
{0x73, 0xC1, 0x66, 0x1B,},
{0x73, 0xC1, 0x34, 0x1B,},
{0x72, 0xC1, 0xCE, 0x1F,},
};
// ---------------------------------------------------

byte newCard[4];
byte dayCount;
byte absentCount[TOTAL_ID];
36
bool presentCount[TOTAL_ID];
bool smsFlag[TOTAL_ID];
bool smsFlag2[TOTAL_ID];
long ct;

void setup() {
Serial.begin(9600);
gsm.begin(9600);
SPI.begin();
rfid.PCD_Init();
lcd.begin(16, 2);
pinMode(buzz, OUTPUT);

lcd.clear();
GSMinit();
ct = millis();
}

void loop() {
int ID = checkRFID();

if (ID == -2) {
lcd.setCursor(0, 1);
lcd.print(F("Unauthorised!! "));
delay(1500);
}
else if (ID != -1) {
lcd.setCursor(0, 1);
lcd.print(names[ID]);

if (!presentCount[ID]) {
presentCount[ID] = 1;
if (!smsFlag[ID]) {
sendSMS(numbers[ID], msgs[0]);
smsFlag[ID] = 1;
}
}
else delay(1500);
}
else {
lcd.setCursor(0, 1);
lcd.print(F("Put your ID card"));
}

lcd.setCursor(0, 0);
lcd.print(F("RFID Attandance "));

if (millis() - ct >= DAY_IN_MS) {


Serial.println(F("New Day!"));

37
for (byte i = 0; i < 4; i++) newCard[i] = 0;

Serial.print(F("ABSENT: "));
for (byte i = 0; i < TOTAL_ID; i++) {
if (presentCount[i] == 0) absentCount[i]++;
Serial.print(absentCount[i]);
Serial.print(' ');
if (absentCount[i] == ABSENT_SMS_DAY && !smsFlag2[i]) {
sendSMS(numbers[i], msgs[1]);
smsFlag2[i] = 1;
}
presentCount[i] = 0;
smsFlag[i] = 0;
}
Serial.println();

dayCount++;
if (dayCount == ABSENT_SMS_DAY) {
dayCount = 0;
for (byte i = 0; i < TOTAL_ID; i++) {
absentCount[i] = 0;
smsFlag2[i] = 0;
}
}

ct = millis();
}
}

int checkRFID() {
int found = -1;
if (!rfid.PICC_IsNewCardPresent()) return -1;
if (!rfid.PICC_ReadCardSerial()) return -1;

beep(100);

if (rfid.uid.uidByte[0] != newCard[0] || rfid.uid.uidByte[1] != newCard[1] ||


rfid.uid.uidByte[2] != newCard[2] || rfid.uid.uidByte[3] != newCard[3]) {
for (byte i = 0; i < 4; i++) {
newCard[i] = rfid.uid.uidByte[i];
Serial.print("0x");
Serial.print(newCard[i], HEX);
Serial.print(", ");
}
Serial.println();

// matching IDs
for (byte i = 0; i < TOTAL_ID; i++) {
if (newCard[0] == cardID[i][0] && newCard[1] == cardID[i][1] && newCard[2]
== cardID[i][2] && newCard[3] == cardID[i][3]) {

38
found = i;
break;
}
else found = -2;
}
}
else Serial.println(F("PREVIOUS CARD!"));

rfid.PICC_HaltA();
rfid.PCD_StopCrypto1();
return found;
}

void GSMinit() {
lcd.print("Connecting GSM..");
delay(5000);
gsm.println("AT");
delay(1000);
gsm.println("ATE0");
delay(1000);
gsm.println("AT+CMGF=1");
delay(1000);
gsm.println("AT+CNMI=1,2,0,0,0");
delay(1000);
lcd.clear();
}

void sendSMS(String &number, String &txt) {


lcd.setCursor(0, 0);
lcd.print(F("Sending SMS... "));
Serial.println();
Serial.println(number);
Serial.println(txt);
gsm.print("AT+CMGF=1\r\n");
delay(200);
gsm.print("AT+CMGS=\"");
delay(200);
gsm.print(number);
gsm.print("\"\r\n");
delay(200);
gsm.print(txt);
gsm.write(0x1A);
gsm.print("\r\n");
delay(3000);
Serial.println();
}

void beep(int d) {
digitalWrite(buzz, 1);
delay(d);

39
digitalWrite(buzz, 0);
}

40

You might also like