0% found this document useful (0 votes)
27 views63 pages

3 Jaswanthdoc

Uploaded by

Samsani Anil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views63 pages

3 Jaswanthdoc

Uploaded by

Samsani Anil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 63

RFID BASED SMART ATTENDANCE SYSTEM

A Project Report
Submitted in partial fulfilment of the Requirements for
the Award of Degree
of

BACHELOR OF TECHNOLOGY
in
ELECTRICAL AND ELECTRONICS ENGINEERING
By
A. MURALIKRISHNA 18B91A0212
B. CHIHINITHA 18B91A0219
B. JASWANTH 18B91A0223
G. BHAVYA DEEPIKA 18B91A0266
A. SUBRAHMANYA ADITYA 18B91A0209
D. SAI PAVAN 18B91A0245

Under the esteemed guidance of


Dr. B.R.K. Varma M.E., Ph.D.
Professor

DEPARTMENT OF ELECTRICAL & ELECTRONICS ENGINEERING


S.R.K.R. ENGINEERINGCOLLEGE (A)
(AFFILIATED TO JNTU, KAKINADA) (RECOGNISED BY A.I.C.T.E., NEW DELHI)
(Accredited by N.B.A., NEW DELHI), BHIMAVARAM
534204(2018-2022)

1
S.R.K.R. ENGINEERING COLLEGE (A)
(AFFILIATED TO JNTU, KAKINADA) (RECOGNISED BY A.I.C.T.E., NEW DELHI)
(Accredited by N.B.A., NEW DELHI)

BHIMAVARAM-534204
DEPARTMENT OF ELECTRICAL AND ELECTRONICS
ENGINEERING

Certificate
This is to certify that this project work entitled
RFID BASED SMART ATTENDANCE SYSTEM
is the bona fide work of
Mr./Miss B. JASWANTH Regd. no 18B91A0223
of final year B.E. along with his batch mates submitted in partial
fulfilment of the requirements for the award of Degree in Bachelor of
Engineering in Electrical and Electronics Engineering during the
academic year 2021-2022.

GUIDE: HEAD OF THE DEPARTMENT:


Dr. B.R.K. Varma M.E., Ph.D. Dr. B.R.K. Varma M.E., Ph.D.
Professor HOD
Department of E.E.E Department of E.E.E
CERTIFICATE OF EXAMINATION

This is to verify that we had examined the project report and hereby

according to our approval of it as a study carried out and presented in a manner

required for its acceptance in a partial fulfilment for the award of degree of

Bachelor of engineering in Electrical and Electronics engineering for which

it has been submitted.

This approval doesn't necessarily endorse or accept every statement made,

opinion expressed or conclusion drawn as in the report. It only signifies the

acceptance of report for the purpose for which it is submitted.

EXTERNALEXAMINER I NTERN ALEX AMI NER


ACKNOWLEDGEMENT

Our most sincere and graceful acknowledgement is due to this sanctum, SAGI

RAMA KRISHNAM RAJU ENGINEERING COLLEGE, for giving us opportunity

to fulfil our aspiration to become an engineer.

In the first place. We would like to convey our heartfelt gratitude to Dr. B.R.K.

Varma, Professor, Department of EEE, who offered this project to us. We owe him a

great debt of gratitude for his insightful discussions, capable direction, and unwavering

support throughout the project, without whom this project would not have been a success.

We would like to convey our heartfelt gratitude to Dr. B.R.K. Varma, Head of

The Department of EEE, S.R.K.R. Engineering College, Bhimavaram, for his constant

support and timely advice that helped me complete my project successfully.

We gratefully acknowledge M. JAGAPATHI RAJU, incharge, Principal, SRKR

Engineering College, Bhimavaram, for providing me with this opportunity to complete

my degree.

We also thank other teaching and non-teaching staff for their assistance and help

extended. We thank everyone who has contributed directly or indirectly to my project.

We are grateful to my family for being a part of my vision and teaching me the

values that really count in life.

-Project associates
18B91A0212- A. Murali Krishna
18B91A0219- B. Chihinitha
18B91A0223- B. Jaswanth
18B91A0266- G. Bhavya Deepika
18B91A0209- A. Subrahmanya Aditya
18B91A0245- D. Sai Pavan
DECLARATION

This project titled “RFID BASED SMART ATTENDANCE SYSTEM” has been

carried out by me in the partial fulfilment of the requirements for the award of the degree

of Bachelor of Technology in the Department of Electrical and Electronics

Engineering, Sagi Rama Krishnam Raju Engineering College, (Affiliated to JNTUK),

Bhimavaram.

I hereby declare that this thesis has not been submitted to any other university/institute

for the award of any other degree/diploma.

A. MURALIKRISHNA 18B91A0212
B. CHIHINITHA 18B91A0219
B. JASWANTH 18B91A0223
G. BHAVYA DEEPIKA 18B91A0266
A. SUBRAHMANYA ADITYA 18B91A0209
D. SAI PAVAN 18B91A0245
Table of Contents

Contents Page No

List of Figures iii

List of Tables iv

List of Abbreviations iv

Abstract v
CHAPTER 1: INTRODUCTION
1.1 Introduction 6
1.2 Literature Survey 7
1.3 Overview of project 8
1.4 Block Diagram 9
1.5 Description 9
CHAPTER 2: HARDWARE REQURIMENTS
2.1.1 Radio frequency identification 10

2.1.2 What are RFID tags and smart labels 13


2.1.3 What are the types of RFID systems 13
2.1.4 RFID vs BARCODES 15
2.1.5 RFID vs NFC 16
2.1.6 RFID Challenges 16
2.1.7 RFID security and privacy 17
2.1.8 Next generation RFID use 18
2.1.9 Key features of RFID 18
2.2.1 NODEMCU 20
2.2.2 NODEMCU pinout 21
2.2.3 ESP-12E module 23
2.2.4 ESP-12E pinout 24
2.2.4 Features 26
2.2.5 Peripherals of NODEMCU 27
2.3 Jumping Wires 29
2.4 Buzzer 29
2.5 LED 30

i
CHAPTER 3: SOFTWARE REQUIREMENTS
3.1.1 Arduino IDE 31
3.2.1 Testing the Arduino RFID library 35
3.2.2 Info dump test from RFID tag 37
3.2.3 Customizing RFID tags in Arduino 39
3.2.4 Writing data to RFID tags 40
CHAPTER 4: METHODOLOGY AND IMPLEMENTATION
4.1.1 Interfacing NODEMCU and RFID 44
4.1.2 Interfacing LED and BUZZER with circuit 46
4.2.1 Code for entering name in card 47
4.2.2 APP Script code in Google sheets 49
4.2.3 Code for Attendance 50
CHAPTER 5: RESULTS AND CONCLUSION
5.1 Entering name in the card 55
5.2 Recording Attendance 55
5.3 Conclusion 56
5.4 Future Scope 57
REFERENCES 58

ii
LIST OF FIGURES

Figures Titles

Fig 1.1 Block Diagram


Fig 2.1.1 RFID-RC522 Pin Diagram
Fig 2.1.2 Antenna
Fig 2.1.3 Transmitter
Fig 2.1.4 Transponder
Fig 2.2.1 ESP8266
Fig 2.2.2 Node MCU Pinout
Fig 2.2.3 ESP-12E Module
Fig 2.2.4 ESP-12E PINOUT
Fig 2.3 Jumping Wires
Fig 2.4 Buzzer
Fig 2.5 LED
Fig 3.1.1 Download the Arduino IDE
Fig 3.1.2 Introducing ESP8266 to Arduino IDE
Fig 3.1.3 Installing ESP8266 library
Fig 3.1.4 Selecting ESP8266 Board
Fig 3.1.5 Arduino COM Port
Fig 3.2.1 Installing MFRC522 library
Fig 3.2.2 Examples of RFID
Fig 3.2.3 Sector details of RFID Tag
Fig 3.2.4 Display of Card UID
Fig 3.2.5 Data stored in card
Fig 3.2.6 Hexadecimal representation of name
Fig 4.1.1 Interfacing NODEMCU and RFID reader
Fig 4.1.2 Interfacing with Node MCU, RFID, LED and Buzzer
Fig 5.1 Stored card name displayed in Serial monitor
Fig 5.2 Excel Sheet display

iii
LIST OF TABLES

Tables Title

Table 2.1.1 RFID vs BARCODES


Table 2.1.2 RFID vs NFC
Table 2.2.1 NodeMCU Pin Description
Table 2.2.2 ESP-12E Module Pin function
Table 2.2.3 NodeMCU Specifications
Table 4.1.1 Interfacing NODEMCU and RFID reader

LIST OF ABBREVIATIONS

RFID Radio Frequency Identification


NODEMCU Node Microcontroller Unit
ESP Espressif modules
UID Unique Identification
GND Ground
MISO Master In Slave Out
MOSI Master Out Slave In
SCK Serial Clock
SDA Serial Data
SPI Serial Peripheral Interface
UART Universal Asynchronous Reception and Transmission
I2C Inter-Integrated Circuit
UTF Unicode Transformation Format
ADC Analog to Digital Converter

iv
ABSTRACT

Taking traditional pen-and-paper attendance is time-consuming, unsecure,


and often leads to human errors and misconduct since important time and effort
is wasted arranging and structuring attendance data in registers. To address this
major hectic, we used a real-time relational database management system with
proper security measures to access, manipulate, and represent data based on
unique RFID tags that can be scanned quickly and easily on an RFID reader. This
system uses RFID technology in combination with Node MCU firmware to take
attendance. The main objective of this proposed system is to make the effective
and efficient computerized attendance on an institute website in excel sheet
format with a particular date. RFID utilization in education is student attendance
monitoring system, by using cloud technology.

With this monitoring system, if there are students who are not present can
be immediately discovered and can be taken immediate action and the learning
process can run smoothly.

v
CHAPTER 1

INTRODUCTION

1.1 INTRODUCTION

Attendance plays a very important role in any organization. Attendance in


many organizations, college and schools are paper-based. When paper-based
attendance is considered, the chances of error are high. Using technology this
issue can be solved and the papers can be avoided in this process. There are many
technologies that support to solve this issue. But best among them is RFID (Radio
Frequency Identification) as the names suggest it uses the radio waves to identify
and track the object or individual. The communication with respect to RFID is
wireless using an electromagnetic and electrostatic coupling, where a radio
frequency of spectrum is used to communicate. For demonstrating the results, the
system is built using RFID card reader module of the model RC522 RFID card
reader and RFID cards/tags. The RFID system consists of RFID tag (or card) and
RFID reader. The tag (or card) has a unique ID which is initially stored in the
database before assigning it to the user. The user has to place the tag at a specific
distance from the RFID reader so as to log the attendance. The tag consists of a
microchip that helps to store unique sequence number that is useful in identifying
objects. The microchip includes micro circuitry and an embedded silicon chip.
The tag has a rewritable and permanent memory which can be repeatedly
programmed by multiple times. The RFID reader is the most fundamental part of
the RFID system. The RFID reader used in detection has a maximum range of
around 5cm above the reader and operates at frequency of 125 kHz and 12V
power supply. RFID tag (or card) is used to exchange data with the RFID reader
using the radio waves where the tag is made up of the antenna which receives the
radio waves and the other component is an integrated circuit which is mainly to
process and store the data. It reads the raw data from the tag and transmits it to

Page | 6
the middle-ware for processing. Tags at varying frequencies are interrogated by
the reader. The reader is further connected to the computer for processing the data
this can be done via a USB connector or any wireless connection. This type of
simple system where scanning of the tag towards the reader makes the work quite
easier and improves the rate of error. Also, the long procedure of attendance is
cut short to a single move/step. The smart attendance management system
removes the traditional way of registering the attendance. It also provides a
secure, error-free method of attendance management. The administrators can be
at ease by employing such a smart attendance system. The system is best suited
for managing attendance of employees. It can also be used to record attendance
for students at their hostels.

1.2 LITERATURE SURVEY

The use of Radio-frequency identification (RFID) technology in automated


electronic environment and for tracking objects has been widely researched upon
by researchers and deployed by various organizations as part of their automation
systems. Zhang Yuru, Chen Delong and Tan Liping, April, 2013, suggested, The
Research and Application of College Student Attendance System based on RFID
Technology. Combined with the actual situation of college students class
attendance system, the design of student attendance system nodes based on RFID
has be proposed. In this paper, the hardware node of system and the develop
processes of related application have been detailed presentation. The designed
system not only can improve the work efficiency, but also can save human and
material resources [2]. SumitaNainan, Romin Parekh and Tanvi Shah, January
2013, suggested that ―RFID

Technology Based Attendance Management System. The proposed framework


can give another, precise, and less bulky method for taking understudy
participation in school and switch the worldview of understudy's address
participation checking in classroom. An ease and cheap RFID Based
Page | 7
Authentication System model have effectively created. The model of the
framework can give a few advantages over the customary strategy for taking
participation.

This framework will help in programmed capacity of participation and


guardians will be informed in instance of non-attendance. In this framework
utilizing the AVR controller, guarantees quick operation, cost viability and low
power utilization [3]. Ankita Agrawal and Ashish Bansal, ―Online Attendance
Management System Using RFID with Object Counter says that, The Student
Attendance System using Radio Frequency Identification technology with object
counter will significantly improve the current manual process of student
attendance recording and tracking system, especially in a university environment.
The system promotes a fully-automated approach in capturing the student
attendance and monitoring the student in the university campus. The attendance
taken is secure and accurate.

The system is user-friendly with easily accessible switches and communication


ports. Attendance can be stored and retrieved [4].

1.3 OVERVIEW OF PROJECT

Manually taking attendance might be time consuming. We wanted it to be


automatic so that students and lecturers could take attendance without having to
do anything. We designed a plan to automate the attendance system as a result.
To begin, we are constructing an automatic attendance monitoring system for
staff, so that when they enter the department and scan the RFID tag, they are
automatically logged.

Page | 8
1.4 BLOCK DIAGRAM

RFID READER
Operating Voltage:
3.3V

NODE MCU
Input Voltage ESP8566
LED
(5V) (5V-10V)
Operating
voltage: 3.3V

BUZZER

Fig 1.1: BLOCK DIAGRAM

1.5 DESCRIPTION

The adaptor's input voltage is 5V, while the NODEMCU's operational


voltage is 3.3V. NODEMCU will operate between 5 and 10 volts, depending on
the application. The working voltage for RFID is 3.3V. The led will glow and the
buzzer will sound when the RFID tag is scanned against the RFID reader,
signalling that attendance has been registered.

Page | 9
CHAPTER 2

HADWARE REQUIREMENTS

2.1.1 RADIO FREQUENCY IDENTIFICATION (RFID)

RFID offers a unique combination of features. It is an efficient way to


identify individual items electronically, and the ID can be linked with software
and databases to form an integrated relationship between physical objects and
computer systems.

Unlike barcodes, RFID does not require a direct line of sight between the
reader and the tag and it can operate effectively in hostile environments where
the tag may be contaminated with dirt and grease.

These features make RFID an ideal choice for many applications including
manufacturing, warehousing, distribution, maintenance and repair.

Every RFID system consists a scanning antenna, a transceiver and


transponder. When the scanning antenna and transceiver are combined, they are
referred to as an RFID reader or interrogator. There are two types of RFID readers
-- fixed readers and mobile readers. The RFID reader is a network-connected
device that can be portable or permanently attached. It uses radio waves to
transmit signals that activate the tag. Once activated, the tag sends a wave back
to the antenna, where it is translated into data.

The transponder is in the RFID tag itself. The read range for RFID tags
varies based on factors including the type of tag, type of reader, RFID frequency
and interference in the surrounding environment or from other RFID tags and
readers. Tags that have a stronger power source also have a longer read range.

Page | 10
Fig 2.1.1: RFID-RC522 Pin Diagram

EVERY RFID SYSTEM CONSISTS OF THREE COMPONENTS:

-a scanning antenna

-a transmitter

-a receiver

-a transponder

• Antenna:

In short, RFID Antennas take energy from an RFID reader and transmit
it in the form of RF waves to RFID tags in the vicinity. If RFID Readers
are the “brains” of an RFID system, RFID antennas are the arms because
they actually transmit RF waves to the tags.

Fig 2.1.2: Antenna


Page | 11
• Transmitter:

Transmitter transmits the radio frequency waves out of the RFID, which
are received by the tags and gets active and sends a signal to the reader
again.

Fig 2.1.3: Transmitter

• Receiver:

The transmitted data from card is received by the RFID reader through the
receiver.

• Transponder:

Transponders incorporate a receiver and transmitter. These devices


communicate with radio frequency identification readers and are designed
to work at the specific frequencies associated with radio frequency
identification.

Fig 2.1.4: Transponder

Page | 12
2.1.2 WHAT ARE RFID TAGS AND SMART LABELS?

Low-power, embedded non-volatile memory plays an important role in


every RFID system. RFID tags typically hold less than 2,000 KB of data,
including a unique identifier/serial number. Tags can be read-only or read-write,
where data can be added by the reader or existing data overwritten.

The read range for RFID tags varies based on factors including type of tag,
type of reader, RFID frequency, and interference in the surrounding environment
or from other RFID tags and readers. Active RFID tags have a longer read range
than passive RFID tags due to the stronger power source.

Smart labels are simple RFID tags. These labels have an RFID tag
embedded into an adhesive label and feature a barcode. They can also be used by
both RFID and barcode readers. Smart labels can be printed on-demand using
desktop printers, where RFID tags require more advanced equipment.

2.1.3 WHAT ARE THE TYPES OF RFID SYSTEMS?

There are three main types of RFID systems: low frequency (LF), high frequency
(HF) and ultra-high frequency (UHF). Microwave RFID is also available.
Frequencies vary greatly by country and region.

• Low-frequency RFID systems. These range from 30 KHz. to 500 KHz,


though the typical frequency is 125 KHz. LF RFID has short transmission
ranges, generally anywhere from a few inches to less than six feet.

• High-frequency RFID system These range from 3 MHz to 30 MHz, with


the typical HF frequency being 13.56 MHz. The standard range is
anywhere from a few inches to several feet.

Page | 13
• UHF RFID systems. These range from 300 MHz to 960 MHz, with the
typical frequency of 433 MHz and can generally be read from 25-plus feet
away.

• Microwave RFID systems. These run at 2.45 GHz and can be read from
30-plus feet away.

The frequency used will depend on the RFID application, with actual obtained
distances sometimes varying from what is expected. For example, when the U.S.
State Department announced it would issue electronic passports enabled with an
RFID chip, it said the chips would only be able to be read from approximately 4
inches away. However, the State Department soon received evidence that RFID
readers could skim the information from the RFID tags from much farther than 4
inches -- sometimes upward of 33 feet away.

If longer read ranges are needed, using tags with additional power can boost read
ranges to 300-plus feet.

RFID applications and use cases

RFID dates back to the 1940s; however, it was used more frequently in the 1970s.
For a long time, the high cost of the tags and readers prohibited widespread
commercial use. As hardware costs have decreased, RFID adoption has also
increased.

Some common uses for RFID applications include:

• pet and livestock tracking


• inventory management
• asset tracking and equipment tracking
• inventory control
• cargo and supply chain logistics
• vehicle tracking

Page | 14
• customer service and loss control
• improved visibility and distribution in the supply chain
• access control in security situations
• shipping
• healthcare
• manufacturing
• retail sales
• tap-and-go credit card payments

2.1.4 RFID vs BARCODES

Using RFID as an alternative for barcodes is increasing in use. RFID


and barcode technologies are used in similar ways to track inventory, but there
are some important differences between them.

RFID TAGS BARCODES

Can identify individual objects without Direct line of sight required for
direct line of sight. scanning.

Can scan items from inches to feet away, Require closer proximity for
depending on type of tag and reader. scanning.

Data can be updated in real time. Data is read-only and can't be


changed.

Require a power source. No power source needed.

Read time is less than 100 milliseconds Read time is half a second or more per
per tag. tag.

Contain a sensor attached to an antenna, Printed on the outside of an object and


often contained in a plastic cover and more subject to wear.
more costly than barcodes.

Table 2.1.1: RFID vs BARCODES


Page | 15
2.1.5 RFID vs. NFC

Near-field communication (NFC) enables data to be exchanged between devices


by using short-range, high-frequency wireless communication technology. NFC
combines the interface of a smart card and reader into a single device.

RADIO FREQUENCY NEAR-FIELD


IDENTIFICATION COMMUNICATION
Uni-directional Bi-directional
Range up to 100 m Range less than 0.2 m
LF/HF/UHF/Microwave 13.56 MHz
Continuous sampling No continuous sampling
Bit rate varies with frequency Up to 424 Kbps
Power rate varies with frequency <15 milliamperes

Table 2.1.2: RFID vs NFC

2.1.6 RFID challenges

RFID is prone to two main issues:

• Reader collision. Reader collision, when a signal from one RFID reader
interferes with a second reader, can be prevented by using an anti-collision
protocol to make RFID tags take turns transmitting to their appropriate
reader.

• Tag collision. Tag collision occurs when too many tags confuse an RFID
reader by transmitting data at the same time. Choosing a reader that gathers
tag info one at a time will prevent this issue.

Page | 16
2.1.7 RFID SECURITY AND PRIVACY

A common RFID security or privacy concern is that RFID tag data can be
read by anyone with a compatible reader. Tags can often be read after an item
leaves a store or supply chain. They can also be read without a user's knowledge
using unauthorized readers, and if a tag has a unique serial number, it can be
associated to a consumer. While a privacy concern for individuals, in military or
medical settings this can be a national security concern or life-or-death matter.

Because RFID tags do not have a lot of compute power, they are unable to
accommodate encryption, such as might be used in a challenge-response
authentication system. One exception to this, however, is specific to RFID tags
used in passports -- basic access control (BAC). Here, the chip has sufficient
compute power to decode an encrypted token from the reader, thus proving the
validity of the reader.

At the reader, information printed on the passport is machine-scanned and


used to derive a key for the passport. There are three pieces of information used
-- the passport number, the passport holder's birth date and the passport's
expiration date -- along with a checksum digit for each of the three.

Researchers say this means passports are protected by a password with


considerably less entropy than is normally used in e-commerce. They key is also
static for the life of the passport, so once an entity has had one-time access to the
printed key information, the passport is readable with or without the consent of
the passport bearer until the passport expires.

The U.S. State Department, which adopted the BAC system in 2007, has
added an anti-skimming material to electronic passports to mitigate the threat of
undetected attempts to steal users' personal information.

Page | 17
2.1.8 NEXT-GENERATION RFID USE

Sensor data such as temperature, movement, and location can be wirelessly


transmitted by combining the technology with smart sensors and/or GSP
technology. RFID systems are increasingly being used to support IoT
deployments.

2.1.9 KEY FEATURES OF RFID:

1. A unique ID

As automation and artificial intelligence become increasingly prevalent in


business; there needs to be a closer relationship between computers and the
physical environment. RFID provides the means to accurately identify individual
components, batches of materials, construction equipment, retail goods or other
items. The computer systems can then use the ID to automatically update the
records with a combination of data such as location, temperature, date and time.

2. Automatic recognition

Tags are attached to items and transmit the stored ID to readers. The
readers may be positioned at fixed points such as ‘goods out’ or ‘goods in’ or at
specific locations within a chemical processing plant, As each item passes by, the
reader will automatically scan the ID. Alternatively the readers can be built into
tables or mobile phones, enabling the tags to be scanned wherever the entity
happens to be.

3. No need for batteries

Passive RFID tags – the most common type – are activated by the reader’s
power source so they do not require batteries. This means that tags can be very
small – tiny enough for them to be embedded in miniature devices.

Page | 18
They also have a very long life and some can survive outdoors in all
conditions for ten years and beyond. Typically, passive tags are used for items
that need to be read within a range from 1mm up to about 10m.

For longer distances or more specialist applications, active tags with their
own power source may be used. Even so, these can remain active for up to five
years depending on use and environmental conditions.

4. Can detect ‘hidden’ objects

Unlike bar codes, with RFID the object being scanned does not necessarily
have to be within the direct line of sight. Files in racks or items moving on a
conveyor belt, can be detected simply by positioning the reader correctly.

However, the ability to read a tag will depend on a combination of factors


such as the type of tag and reader, the surface material and the environment. With
any system, it is important to take the appropriate technical advice and to carry
out trials. Core RFID have many years’ experience of successful RFID projects
and can advise on the right equipment and conduct feasibility studies and trials.

5. Multiple tags can be read at once

Similarly, one RFID reader can collect data from a large number of tags
simultaneously – unlike barcodes where each item has to be scanned separately.
This makes it possible to collect data en masse which can save a huge amount of
time. The contents of an entire pallet can be scanned as it leaves the warehouse,
or a stock check of the contents of a shelving rack can be carried out without
removing each item. Again, there are many factors to be considered when
selecting the correct RFID technology so take professional advice.

6. Rugged and weatherproof

RFID tags can be more robust than barcodes or other print labels and can
be used even in the most demanding environments. There is a huge range of tag

Page | 19
types available designed for everything from underwater applications to
contaminated or hazardous environments, high-vibration areas or where there is
a risk of explosions (ATEX compliant). Contact one of our engineers for an initial
discussion to advise on the best way forward.

2.2.1 NODEMCU

Even though the concept of Internet of Things (IoT) has been there for
several years, it really took off once the DIY community started investing in it.
To aid low-cost and easy to implement IoT systems, you need both the supporting
hardware as well as good software. This is where Espressif Systems came into
picture with a bang. The ESP8266 SoC, released back in 2014, has been the go-
to chip for IoT related projects in the DIY community.

Several third-party manufacturers took the ESP8266 SoC and started developing
small modules and boards, that can be easily integrated into our existing hobbyist
setup consisting mainly of Arduino. One of the popular ESP8266 based module
is the ESP-01, developed by Ai-Thinker. This is a simple board with the ESP8266
SoC, a flash memory and few pins to connect to other devices like Arduino.

This is a great board to start with ESP8266 but there are a few limitations like the
pins are not breadboard friendly, only two GPIO pins, need for an USB to UART
converter module to program etc. So, what manufacturers started doing is instead
of using the vanilla version of the ESP8266 Module, which is the ESP-01, they
started using a slightly advanced version called the ESP-12E, which is also from
Ai-Thinker.

The good thing about ESP-12E is it has more GPIO Pins and the PCB comes with
castellated edges so that you can easily solder this board on to your own design.

Page | 20
Fig 2.2.1: ESP8266

2.2.2 NODEMCU PINOUT

The following image shows the pinout for NodeMCU board. A typical
NodeMCU board (if it is based on the original NodeMCU Devkit design) has 30
pins. In this, 8 pins are related to power and 2 are reserved. The remaining 20
pins are associated with pins of ESP-12E Module.

Fig2.2.2: NodeMCU Pinout

Page | 21
A brief description of the pins is given in the following table.

Alternate Default
Pin Description
Functions
ADC0 Analog Input ADC0
Reserved
Reserved
SDD3 SDIO Data 3 GPIO10 SDD3
SDD2 SDIO Data 2 GPIO9 SDD2
SDD1 SDIO Data 1 GPIO8 SDD1
SDDCMD SDIO CMD GPIO11 SDDCMD
SDD0 SDIO Data 0 GPIO7 SDD0
SDCLK SDIO CLK GPIO6 SDCLK
GND Ground
3.3V 3.3V Output
EN Chip Enable
(Active HIGH)
RST Reset (Active
LOW)
GND Ground
VIN 5V Input 3.3V
Regulator
3.3V 3.3V Output
GND Ground
TXD0 UART0 TXD GPIO1 TXD0
RXD0 USRTO RXD GPIO3 RXD0
GPIO15 GPIO15 HSPI_CS/RTS0 GPIO15
GPIO13 GPIO13 HSPI_MOSI/CTS0 GPIO13
GPIO12 GPIO12 HSPI_MISO GPIO12
GPIO14 GPIO14 HSPI_SCK GPIO14
GND Ground
3.3V 3.3V Output
GPIO2 GPIO2 UART1 TXD GPIO2
Flash Flash GPIO0
GPIO4 GPIO4 Software SDA GPIO4
(12C)
GPIO5 GPIO5 Software SCL GPIO5
(12C)
GPIO16 GPIO16 Wake (deep sleep) GPIO16
Table 2.2.1: NodeMCU Pin Description

Page | 22
2.2.3 ESP-12E MODULE

Ai-Thinker’s ESP-12E is a Wi-Fi Module based on ESP8266EX SoC. The


ESP8266EX SoC is a Wi-Fi chip based on Tensilica’s L106 Diamond 32-bit
Processor and an integrated Wi-Fi MAC, with support for full TCP/IP Stack.

Since it has a Microcontroller (in the form of Tensilica’s L106 Diamond),


the ESP-12E can be used as either a stand-alone device with its Wi-Fi
connectivity and GPIO Pins or it can be used as a Wi-Fi adapter for other
microcontrollers like Arduino, for example, through UART interface.

The ESP-12E Module consists of ESP8266 SoC, 4MB of SPI Flash, 26


MHz Crystal, PCB antenna and some RF related components. As you can see
from the image, the ESP-12E has a lot more pins than ESP-01 Module and all the
pins on the PCB are edge castellated.

Fig 2.2.3: ESP-12E Module

Page | 23
2.2.4 ESP-12E PINOUT
If you are interested in designing your own breakout board for ESP-12E
Module, then the following ESP-12E Pinout image will be very useful for you.
As you can see, there are 22 pins on the ESP-12E Module.

Fig 2.2.4: ESP-12E PINOUT

Page | 24
The following table describes the pins of ESP-12E Module.

PIN Function
RST Reset the Module
ADC0 ADC Pin with 10-bit resolution
EN Chip Enable Pin (active HIGH)
GPIO16 GPIO16 pin (wake pin from deep
sleep mode)
GPIO14 GPIO14 pin (HSPI_CLK)
GPIO12 GPIO12 pin (HSPI_MISO)
GPIO13 GPIO13 pin (HSPI_MOSI)
VCC 3.3V Power Supply (max 3.6V)
SDCMD SDIO CMD (GPIO11)
SDD0 SDIO Data 0 (GPIO7)
SDD2 SDIO Data 2 (GPIO9)
SDD3 SDIO Data 3 (GPIO10)
SDD1 SDIO Data 1 (GPIO8)
SCCLK SDIO CLK (GPIO6)
GND Ground Pin
GPIO15 GPIO15 pin (HSPI_CS)
GPIO2 GPIO2 pin (TXD1)
Flash Flash Pin (GPIO0)
GPIO4 GPIO4 pin (SDA – software I2C)
GPIO5 GPIO5 pin (SCL – software I2C)
RXD0 UART0 RXD pin (GPIO3)
TXD0 UART0 TXD (GPIO1)

Table 2.2.2: ESP-12E Module Pin function

Page | 25
Specifications:

Voltage: 3.3V
Wi-Fi Direct (P2P), soft-AP
Current consumption: 10uA~170mA
Flash memory attachable: 16MB max (512K normal)
Integrated TCP/IP protocol stack
Processor: Tensilica L106 32-bit
Processor speed: 80~160MHz
RAM: 32K + 80K
GPIOs: 17 (multiplexed with other functions)
Analog to Digital: 1 input with 1024 step resolution.
+19.5dBm output power in 802.11b
mode 802.11 support: b/g/n
Maximum concurrent TCP connections: 5

Table 2.2.3: NodeMCU Specifications

2.2.4 FEATURES

• Processor: L106 32-bit RISC microprocessor core based on


the Tensilica Xtensa Diamond Standard 106Micro running at
80 MHz[5]
• Memory:
o 32 KiB instruction RAM
o 32 KiB instruction cache RAM
o 80 KiB user-data RAM

Page | 26
o 16 KiB ETS system-data RAM
• External QSPI flash: up to 16 MiB is supported (512 KB to 4 MB
typically included)
• IEEE 802.11 b/g/n Wi-Fi
o Integrated TR switch, balun, LNA, power
amplifier and matching network
o WEP or WPA/WPA2 authentication, or open networks
• 17 GPIO pins[6]
• Serial Peripheral Interface Bus (SPI)
• I²C (software implementation)[7]
• I²S interfaces with DMA (sharing pins with GPIO)
• UART on dedicated pins, plus a transmit-only UART can be enabled
on GPIO2
• 10-bit ADC (successive approximation ADC)

POWER
There are two ways to power the NodeMCU board. One is through the
micro-USB port and the other is through VIN pin. Note that ESP8266EX SoC is
compatible with only 3.3V. So, the NodeMCU board has 3.3V Regulator IC
(AMS1117 – 3.3).
If you have regulated 5V power, then you can apply this to the VIN pin. There
are three 3.3V pins, which are connected to the 3.3V output of the regulator.

2.2.5 WHAT PERIPHERALS ARE AVAILABLE ON


NODEMCU?

Strictly speaking, this is related to the ESP8266EX SoC. Keeping that in mind,
let us see all the peripherals that are available on the NodeMCU.

Page | 27
GPIO
The ESP8266EX has 17 GPIO pins. But not all them available for the
user as some of these are used for their alternative functions (like UART, SDIO,
SPI etc.) in NodeMCU (ESP-12E Module). We will see the available GPIO Pins
on NodeMCU after looking at all the other peripherals.

SPI
There are two SPI Interfaces on ESP8266EX SoC (SPI and HSPI). Both
support Master and Slave Operations. Master mode clock can be configured to
80 MHz while slave mode clock is up to 20 MHz.

• SCLK – GPIO6 (Not Available)


• MISO – GPIO7 (Not Available)
• MOSI – GPIO8 (Not Available)
• CS – GPIO11 (Not Available)
• HSPI_CLK – GPIO14
• HSPI_MISO – GPIO12
• HSPI_MOSI – GPIO13
• HSPI_CS – GPIO15
GPIO pins for SPI are multiplexed with some SDIO pins. Also, there is a 4MB
SPI Flash on the ESP-12E Module connected through SPI Pins. So, you do not
have access to SPI pins. You can only use HSPI pins for SPI communication.

I2C
Hardware I2C is not available in ESP8266 but is can implemented through
software. GPIO4 and GPIO5 can be used as SDA and SCL as they do not have
any other alternative functions.

Page | 28
UART
ESP8266EX has two hardware UARTs (UART0 and UART1) with baud
rates up to 115200. In this, UART0 can be used for communication and it has
data flow control as well. UART1 has only TX pin (its RX pin is used by
SDD1) so, it can used for data logging.

• UART0 TX – GPIO3
• UART0 RX – GPIO1
• UART0 RTS – GPIO15
• UART0 CTS – GPIO13
• UART1 TX – GPIO2
• UART1 RX – GPIO8 (Not Available)

2.3 JUMPPING WIRES


Jumper wires are simply wires that have connector pins at each end, allowing
them to be used to connect two points to each other without soldering. Jumper
wires are typically used with breadboard and other prototyping tools in order to
make it easy to change a circuit as needed. Use the jumper wire to bypass a
portion of the circuit or to otherwise establish a connection between two points.

Fig 2.3: Jumping Wires

2.4 BUZZER

The buzzer is a sounding device that can convert audio signals into sound signals.
It is usually powered by DC voltage. It is widely used in alarms, computers,
printers and other electronic products as sound devices.

Page | 29
This system works on radio frequency identification that is RFID. Whenever
someone uses a card, whose information is registered in the memory of the
buzzer starts beeping.

Fig2.4: Buzzer

2.5 LEDs

LED stands for light emitting diode. LED lighting products produce light
up to 90% more efficiently than incandescent light bulbs. How do they work? An
electrical current pass through a microchip, which illuminates the tiny light
sources we call LEDs and the result is visible light.

This system works on radio frequency identification that is RFID. Whenever


someone uses a card, whose information is registered in the memory of the system
the red LED will glow.

Fig 2.5: LED

Page | 30
CHAPTER 3

SOFTWARE REQUIRMENTS

3.1.1 ARDUINO IDE

To get started with Arduino microcontroller boards. We’ll cover software


installation, as well as connecting and configuring the Arduino IDE.

You Will Need

• Arduino HYPERLINK:

"https://www.digikey.in/productdetail/en/arduino/A000073/1050-1041-
ND/3476357" Uno

• USB Cable

• Windows 10, Windows 8, Windows 7, Mac, or Linux OS

• Arduino IDE

• About 15 minutes

Step 1: Download and Install the IDE

You can download the IDE from the official Arduino website. Since the Arduino
uses a USB to serial converter (which allow it to communicate with the host
computer), the Arduino board is compatible with most computers that have a
USB port. Of course, you will need the IDE first. Luckily, the Arduino designers
have released multiple versions of the IDE for different operating systems,
including Windows, Mac, and Linux. In this tutorial, we will use Window 10,
so ensure that you download the correct version of the IDE if you do not have
Windows 10.

Page | 31
Fig 3.1.1: Download the Arduino IDE

Once downloaded, install the IDE and ensure that you enable most (if not all)
of the options, INCLUDING the drivers.

Step 2: To use Arduino IDE to program the NodeMCU

In order to use Arduino IDE to program the NodeMCU, you have to introduce
it to the software at first.

To do this copy the following code and follow the steps below:

http://arduino.esp8266.com/stable/package_esp8266com_index.json

Step 2.1: Choose Preferences in the File menu and enter the copied code
in Additional Board Manager URLs part. Then press OK.

Fig 3.1.2: Introducing ESP8266 to Arduino IDE

Page | 32
Step 2.2: Search the word ESP8266 in Boards>boards manager from Tools
menu. Then install ESP8266 boards. After complete installation, you will
see the INSTALLED label on ESP8266 boards.

Fig 3.1.3: Installing ESP8266 library

After these two steps, you can see ESP8266 based boards such as NodeMCU
in your Arduino IDE boards list, and you can choose your desired board to
upload the code.

Fig 3.1.4: Selecting ESP8266 Board


Page | 33
Step 3: Get the Arduino COM Port Number

Next, you’ll need to connect the Arduino Uno board to the computer. This is
done via a USB B connection. Thanks to the wonderful world of USB, we do
not need to provide power to the

In the window that appears, click “Search automatically”.

Fig 3.1.5: Arduino COM Port

Windows can be a real pain sometimes with COM ports, as it can magically
change their numbers between connections. In other words, one day, your
Arduino may be on port 7 (as shown here), but then on other days, Windows
may shift it to a different port number. As I understand it, this happens when
you connect other COM ports to your system (which I do frequently).

So, if you can’t find your Arduino on the port that you usually use, just go to
your Device Manager and check what port it’s actually on and, if necessary,
update your driver.

Step 4: Loading a Basic Example


For the sake of simplicity, we will load an example project that the Arduino IDE
comes with. This example will make the onboard LED blink for a second
continuously. To load this example, click File > Examples > 01. Basics > Blink.

Page | 34
Load the blink example.
With the example loaded, it’s time to verify and upload the code. The verify
stage checks the code for errors, then compiles the ready-for-uploading code to
the Arduino. The upload stage actually takes the binary data, which was created
from the code, and uploads it to the Arduino via the serial port.
To verify and compile the code, press the check mark button in the upper left
window.
The “Verify” button will compile the Arduino code.
If the compilation stage was successful, you should see the following message
in the output window at the bottom of the IDE. You might also see a similar
message—just it’s one that does not have words like “ERROR” and
“WARNING”.
This is a successful compilation.

With the code compiled, you must now upload it the Arduino Uno. To do this,
click the arrow next to the check mark.
The “Upload” button will program the Arduino with your code.

3.2.1 TESTING THE ARDUINO RFID LIBRARY

The Arduino IDE’s Library Manager has a widely used RFID library that
is compatible with the MFRC522 chip. The library, conveniently titled
MFRC522, can be downloaded directly from the library manager and the user
can get started right away with the many example scripts available to the
Arduino platform. Below is a short sequence that outlines the procedure for
downloading the MFRC522 library:

Navigate to the Library Manager


In the toolbar: Sketch -> Include Library -> Manage Libraries…
Search for the MFRC522 Library

Page | 35
Install the MFRC522 library

Fig 3.2.1: Installing MFRC522 library

Observe the Examples Available to the Selected Arduino Board (Uno in this
case)

Navigate to File -> Examples -> MFRC522

Fig 3.2.2: Examples of RFID


Page | 36
We will be using these examples to read and write various information onto
and from RFID cards with unique identifiers (UIDs).

3.2.2 Info Dump Test from RFID Tag:

The first checks we can do for verification of wiring, the Arduino library,
and the validity of the RFID tags is to upload the “Dump Info” code from the
examples list. Upon uploading, assuming the wiring is correct and there are no
errors, the user should place a tag within 4 inches of the MFRC522 scan area
(the wave-like drawing on the MFRC522 board) and look for a print out on the
Arduino serial port that looks similar to the following:
Info Dump from RFID Tag
Notice the terminology of sectors and blocks. These will be discussed
below.
We can see from the info dumpy that the tag we are using is a MIFARE 1KB
tag, which we can quantify by the multiplication of 64 blocks x 16 bytes per
block = 1024 = 1KB. This is a standard classic MIFARE tag, which are used in
low-security systems such as public transportation, schools and universities,
and employee office access.

Below is a great MIFARE Classic Resource:

"MIFARE Classic 1K-Mainstream contactless smart card IC for fast and easy
solution development." Rev. 3.2 — 23 May 2018, by NXP.
We can see from the info dumpy that the tag we are using is a MIFARE 1KB
tag, which we can quantify by the multiplication of 64 blocks x 16 bytes per
block = 1024 = 1KB. This is a standard classic MIFARE tag, which are used in
low-security systems such as public transportation, schools and universities,
and employee office access.

Page | 37
In order to identify the terms printed above, we have compiled an explanation
for each term based on the MIFARE document published by NXP:

PICC - Proximity Integrated Circuit Card (Contactless Card). This is the


tag/card being used as the ‘access device.’

UID - Unique Identifier. This is the 4-byte (32-bit) ID given to each PICC (tag).
Over 4.2 billion IDs are available with the 4-byte ID system. The UID is usually
stored in Sector 0, block 0 in the first four bytes.

SAK - Select Acknowledge. This is used for compliance checking under


international standards.

Sector - A sector is partitioned into 4-blocks. There are a total of 16 sectors in


each 1K MIFARE tag.

Block - A block is comprised of 16-bytes of data.

Access Bits - These control the read/write permissions for each block

Fig 3.2.3: Sector details of RFID Tag


Page | 38
There are a few more pieces of information contained in the chart above that
we can use to comprehend the output from the Arduino serial monitor. From
our serial printout, the Key B for our tag sectors are FF FF FF FF FF FF, which
is somewhat of a manufacturer default for classic MIFARE tags. Additionally,
the NXP document goes into the details of the relationship between keys and
access bits, however, we will not spend time on that as it can get quite complex.
One final note on the info dump - we can identify crucial information about
each card based on the zeroth block of the zeroth sector, known as the
manufacturer data. In our card printed above, we can see that the first four bytes
of block 0 contains the UID of the card.

Using the table provided by NXP and the definitions above, we can identify a
few key parameters for our specific tag (from the Arduino printout above):

• UID - CE 5B F4 3C

• SAK - 08

• Key B - FF FF FF FF FF FF

In the next section, we will explore a few routines for altering th ese default
values and seeing just how far we can push the customization of these RFID
tags using the MFRC522 module.
3.2.3 Customizing RFID Tags in Arduino
We are going to attempt to change the Unique Identifier (UID) of each tag being
placed in front of the MFRC522 active area. The MFRC522 example code
‘ChangeUID’ allows us to do this by giving the user the power to change the
UID to a custom 4-byte address. We’re going to change the address of the tag
printed out in the previous section, to a completely random address of “F3 45

Page | 39
1B 0C” for testing. If we place the same tag in front of the MFRC522 scan area,
we get the following output, which we can compare with the previous output.

We can see that the only information that changed was the first five bytes of the
zeroth block of sector 0. The first four bytes have been changed to the desired
UID, while the fifth byte appears to be either random or specified by the write
action (we have not identified this byte designation in the library).
We tried several times to write new UIDs to our black tags, but we were unable.
This was expected, due to the specification of read-only, however, we figured
an attempt wouldn’t hurt!

3.2.4 Writing Data to RFID Tags

Next, we’ll attempt to write specific data to each tag to see what
information we can store. Each sector (except sector 0) has three available
blocks for storing data (4-blocks per sector, minus 1 for keying). Thus, we can
store up to 48 bytes of data in each sector. This can lead to the storing of names,
dates, location information, product information - the possibilities are
expansive. We can start with the example in the Arduino MFRC522 library
called ‘rfid_write_personal_data’ which will ask the user to input a first and
last name for storing in the Electrically Erasable Programmable Read-Only
Memory (EERPROM), also known as the 16-sectors of data.

Upon opening the serial monitor after uploading ‘rfid_write_personal_data’ the


user should place their RFID tag in front of the MFRC522 active area. The
serial monitor will ask for two inputs:

1. Type Family name, ending with #

2. Type First name, ending with #

The user must input a name followed by the # symbol. For example:

Page | 40
• Smith#

• John#

The resulting inputs will be saved in memory and should output the following
if successful:

Successful Saving of First and Last Name to RFID Tag

In our case, we inputted Smith# and John#, which should output John Smith as
the first and last name.

If we now upload the ‘RFID read personal data’ we can see how the personal
data is returned to us based on our inputs above:

Fig 3.2.4: Display of Card UID

Output of all 16 Sectors after saving first and last name

We can see that block 1,2 and 4,5 have changed, which is where the example
code saved the personal data.

Page | 41
Fig 3.2.5: Data stored in card

If we were to copy sector 1 and convert it from hex to UTF-8 characters, we


get the following output:

Fig 3.2.6: Hexadecimal representation of name

Page | 42
The same can be done for the first name as well (contained in sectors 4), though
sector four contains carriage return and newline characters as the first two
bytes. These two characters are due to the setting on our serial monitor (Both
NL & CR). If we change the line setting to "No line ending” this disappears
and we just get “John” and “Smith” as outputs for sectors 1 and 4. Users can
also verify the hex to UTF-8 values by inserting the hex output to a hex
conversion website.

Page | 43
CHAPTER 4

METHODLOGY AND IMPLEMENTATION

4.1.1 INTERFACING NODEMCU AND RFID

Fig 4.1.1: Interfacing NODEMCU and RFID reader

The MFRC522 IC supports a wide variety of RFID Tags like MIFARE 1K,
MIFARE 4K, MIFARE Mini and other ISO / IEC 14443 protocol-based cards
and tags.

Page | 44
It operates at 13.46 MHz frequency and the operating range is up to 50 mm. The
MFRC522 IC supports three types of serial communication with the host
(Microcontroller like Arduino). They are:

• SPI
• UART
• I2C

CONTENTS OF THE KIT

The RC522 RFID Reader kit consists of the RC522 RFID Reader Module,
RFID card, RFID Key Fob and couple of male headers to solder. Both the RFID
Tags i.e., RFID Card and RDIF key fob in the kit are compatible with MIFARE
1K tags (they both have 1 KB of memory).

The RC522 RFID Reader Module consists of the MFRC522 IC, a 27.12 MHz
Crystal Oscillator, an Antenna embedded on the PCB and supporting passive
components to emit 13.56 MHz electromagnetic field.

An important thing to remember is that the MFRC522 IC operates at a supply


voltage of 2.5V to 3.3V but the communication pins are tolerant to 5V. So, the
power supply voltage should be 3.3V, but you can connect the data pins to
Arduino directly.

NODE MCU RFID-RC522


3V 3.3V
GND GND
D3(GPIO 0) Reset
D6(GPIO 12) MISO
D7(GPIO 13) MOSI
D5(GPIO 14) SCK
D4(GPIO 2) SDA

Table 4.1.1: Interfacing NODEMCU and RFID reader

Page | 45
4.1.2 INTERFACING LED AND BUZZER WITH CIRCUIT

Fig 4.1.2: Interfacing led and buzzer with circuit

The LED and BUZZER are added to the system in the circuit diagram
above. Buzzer and LED will glow when the card is presented to the RFID reader,
indicating that attendance has been recorded and uploaded to google sheets.

Page | 46
4.2 PROJECT CODE
4.2.1 CODE FOR ENTERING NAME IN CARD
#include <SPI.h> //include the SPI bus library
#include <MFRC522.h> //include the RFID reader library

#define SS_PIN D4 //slave select pin


#define RST_PIN D3 //reset pin

MFRC522 mfrc522(SS_PIN, RST_PIN); // instatiate a MFRC522 reader object.


MFRC522::MIFARE_Key key; //create a MIFARE_Key struct named 'key', which will hold the
card information

//this is the block number we will write into and then read.
int block=4;

byte blockcontent[64] = {"XXXXXXX"}; //an array with 16 bytes to be written into one of the 64
card blocks is defined
//byte blockcontent[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; //all zeros. This can be used to delete a
block.

//This array is used for reading out a block.


byte readbackblock[18];

void setup()
{
Serial.begin(9600); // Initialize serial communications with the PC
SPI.begin(); // Init SPI bus
mfrc522.PCD_Init(); // Init MFRC522 card (in case you wonder what PCD means: proximity
coupling device)
Serial.println("Scan your Tag");

// Prepare the security key for the read and write functions.
for (byte i = 0; i < 6; i++) {
key.keyByte[i] = 0xFF; //keyByte is defined in the "MIFARE_Key" 'struct' definition in the .h file
of the library
}
}

void loop()
{
// Look for new cards
if ( ! mfrc522.PICC_IsNewCardPresent()) {
return;
}

// Select one of the cards

Page | 47
if ( ! mfrc522.PICC_ReadCardSerial())
{
return;
}
Serial.println("card selected");

//the blockcontent array is written into the card block


writeBlock(block, blockcontent);

//read the block back


readBlock(block, readbackblock);
//uncomment below line if you want to see the entire 1k memory with the block written into it.
//mfrc522.PICC_DumpToSerial(&(mfrc522.uid));

//print the block contents


Serial.print("read block: ");
for (int j=0 ; j<16 ; j++)
{
Serial.write (readbackblock[j]);
//printf("%d",j);
}
Serial.println("");
}

//Write specific block


int writeBlock(int blockNumber, byte arrayAddress[])
{
//Serial.println(blockNumber);
//this makes sure that we only write into data blocks. Every 4th block is a trailer block for the
access/security info.
int largestModulo4Number=blockNumber/4*4;
//Serial.print(largestModulo4Number);
int trailerBlock=largestModulo4Number+3;//determine trailer block for the sector
if (blockNumber > 2 && (blockNumber+1)%4 == 0){Serial.print(blockNumber);Serial.println(" is a
trailer block:");return 2;}
Serial.println(blockNumber);
Serial.println(" is a data block:");
//authentication of the desired block for access
byte status = mfrc522.PCD_Authenticate(MFRC522::PICC_CMD_MF_AUTH_KEY_A,
trailerBlock, &key, &(mfrc522.uid));
if (status != MFRC522::STATUS_OK) {
Serial.print("PCD_Authenticate() failed: ");
Serial.println(MFRC522::GetStatusCodeName(MFRC522::StatusCode()));
return 3;//return "3" as error message
}

//writing the block


status = mfrc522.MIFARE_Write(blockNumber, arrayAddress, 16);

Page | 48
//status = mfrc522.MIFARE_Write(9, value1Block, 16);
if (status != MFRC522::STATUS_OK) {
Serial.print("MIFARE_Write() failed: ");
Serial.println(MFRC522::GetStatusCodeName(MFRC522::StatusCode()));
return 4;//return "4" as error message
}
Serial.println("block was written");
}

//Read specific block


int readBlock(int blockNumber, byte arrayAddress[])
{
int largestModulo4Number=blockNumber/4*4;
int trailerBlock=largestModulo4Number+3;//determine trailer block for the sector

//authentication of the desired block for access


byte status = mfrc522.PCD_Authenticate(MFRC522::PICC_CMD_MF_AUTH_KEY_A,
trailerBlock, &key, &(mfrc522.uid));

if (status != MFRC522::STATUS_OK) {
Serial.print("PCD_Authenticate() failed (read): ");
Serial.println(MFRC522::GetStatusCodeName(MFRC522::StatusCode()));
return 3;//return "3" as error message
}

//reading a block
byte buffersize = 18;//we need to define a variable with the read buffer size, since the MIFARE_Read
method below needs a pointer to the variable that contains the size...
status = mfrc522.MIFARE_Read(blockNumber, arrayAddress, &buffersize);//&buffersize is a pointer
to the buffersize variable; MIFARE_Read requires a pointer instead of just a number
if (status != MFRC522::STATUS_OK) {
Serial.print("MIFARE_read() failed: ");
Serial.println(MFRC522::GetStatusCodeName(MFRC522::StatusCode()));
return 4;//return "4" as error message
}
Serial.println("block was read");
}

4.2.2 APP SCRIPT CODE IN GOOGLE SHEETS

var ss = SpreadsheetApp.openById('1njbfVkR7AV6h1H8SXsayICg3-ATvuSv5buTnBiI4q9w');
var sheet = ss.getSheetByName('Sheet1');
var timezone = "Asia/Kolkata"

//.........................................................................................
function doGet(e){
Logger.log( JSON.stringify(e) );

Page | 49
//----------------------------------------------------------------------------------
//write_google_sheet() function in esp32 sketch, is send data to this code block
//----------------------------------------------------------------------------------
//get gps data from ESP32
if (e.parameter == 'undefined') {
return ContentService.createTextOutput("Received data is undefined");
}
//----------------------------------------------------------------------------------
var Curr_Date = new Date();
var Curr_Time = Utilities.formatDate(Curr_Date, timezone, 'HH:mm:ss');
var name = stripQuotes(e.parameters.name);
//Logger.log('name=' + name);
//----------------------------------------------------------------------------------
var nextRow = sheet.getLastRow() + 1;
sheet.getRange("A" + nextRow).setValue(Curr_Date);
sheet.getRange("B" + nextRow).setValue(Curr_Time);
sheet.getRange("C" + nextRow).setValue(name);
//-------------------------------------
//returns response back to ESP32
return ContentService.createTextOutput("Card holder name is stored in column C");
//----------------------------------------------------------------------------------
}
//......................................................................................
function stripQuotes( value ) {
return value.toString().replace(/^["']|['"]$/g, "");
}

4.2.3 CODE FOR ATTENDANCE


#include <SPI.h>
#include <MFRC522.h>
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#include <WiFiClient.h>
#include <WiFiClientSecureBearSSL.h>
//-----------------------------------------------------------
String CardholderName;
const String web_app_url =
"https://script.google.com/macros/s/AKfycbx9Cl3Hvt1NsI7xM0ZuBgAIjK9i4RW89Uaal__8ncy7zB
LfgpFKXM6qCbD0iPrFVjc/exec?name=";
//-----------------------------------------------------------
#define WIFI_SSID "Mr.MK"
#define WIFI_PASSWORD "muralikrishna"
//-----------------------------------------------------------
int blocks[] = {4,5,6,8,9,10};
#define blocks_len (sizeof(blocks) / sizeof(blocks[0]))
//-----------------------------------------------------------
//GPIO 0 --> D3
//GPIO 2 --> D4

Page | 50
//GPIO 4 --> D2
#define RST_PIN D3
#define SS_PIN D4
#define BUZZER D2
#define LED D1
//-----------------------------------------
MFRC522 mfrc522(SS_PIN, RST_PIN);
MFRC522::MIFARE_Key key;
MFRC522::StatusCode status;
//-----------------------------------------
/* Be aware of Sector Trailer Blocks */
int blockNum = 4;
/* Create another array to read data from Block */
/* Legthn of buffer should be 2 Bytes more than the size of Block (16 Bytes) */
byte bufferLen = 64;
byte readBlockData[64];
/**********************************
* setup() function
**********************************/
void setup()
{
/* Initialize serial communications with the PC */
Serial.begin(9600);
//--------------------------------------------------
//WiFi Connectivity
Serial.println();
Serial.print("Connecting to WIFI");
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
while (WiFi.status() != WL_CONNECTED){
Serial.print(".");
delay(20);
}
Serial.println("");
Serial.println("WiFi connected.");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
Serial.println();
/* Set BUZZER, LED as OUTPUT */
pinMode(BUZZER, OUTPUT);
pinMode(LED, OUTPUT);
/* Initialize SPI bus */
SPI.begin();
//--------------------------------------------------
}
/**********************************
* loop() function
**********************************/
void loop()

Page | 51
{
//------------------------------------------------------------------------
/* Initialize MFRC522 Module */
mfrc522.PCD_Init();
/* Look for new cards */
/* Reset the loop if no new card is present on RC522 Reader */
if ( ! mfrc522.PICC_IsNewCardPresent()) {return;}
/* Select one of the cards */
if ( ! mfrc522.PICC_ReadCardSerial()) {return;}
/* Read data from the same block */
Serial.println();
Serial.println(F("Reading last data from RFID..."));
//------------------------------------------------------------------------
String fullURL = "", temp;
for (byte i = 0; i < blocks_len; i++) {
ReadDataFromBlock(blocks[i], readBlockData);
if(i == 0){
temp = String((char*)readBlockData);
temp.trim();

//fullURL = "data" + String(i) + "=" + temp;


fullURL = temp;
}
else{
temp = String((char*)readBlockData);

temp.trim();
//fullURL += "&data" + String(i) + "=" + temp;
fullURL += temp;
}
}
fullURL.trim();
fullURL = web_app_url+ fullURL;
fullURL.trim();
Serial.println(fullURL);
//------------------------------------------------------------------------
digitalWrite(BUZZER, HIGH);
digitalWrite(LED, HIGH);
delay(200);
digitalWrite(BUZZER, LOW);
digitalWrite(LED, LOW);
delay(200);
digitalWrite(BUZZER, HIGH);
digitalWrite(LED, HIGH);
delay(200);
digitalWrite(BUZZER, LOW);
digitalWrite(LED, LOW);
delay(3000);

Page | 52
//.................................................................................
if (WiFi.status() == WL_CONNECTED) {
//-------------------------------------------------------------------------------
std::unique_ptr<BearSSL::WiFiClientSecure>client(new BearSSL::WiFiClientSecure);
//-------------------------------------------------------------------------------
client->setInsecure();
//-------------------------------------------------------------------------------
HTTPClient https;
Serial.print(F("[HTTPS] begin...\n"));
//.................................................................................
if (https.begin(*client, (String)fullURL)){
//-----------------------------------------------------------------
Serial.print(F("[HTTPS] GET...\n"));
// start connection and send HTTP header
int httpCode = https.GET();
//-----------------------------------------------------------------
// httpCode will be negative on error
if (httpCode > 0) {
// HTTP header has been send and Server response header has been handled
Serial.printf("[HTTPS] GET... code: %d\n", httpCode);
// file found at server
}
//-----------------------------------------------------------------
else
{Serial.printf("[HTTPS] GET... failed, error: %s\n", https.errorToString(httpCode).c_str());}
//-----------------------------------------------------------------
https.end();
delay(10);
}
//.............................................................................................
else {
Serial.printf("[HTTPS} Unable to connect\n");
}
}
}
/* ReadDataFromBlock() function
**********************************/
void ReadDataFromBlock(int blockNum, byte readBlockData[])
{
/* Prepare the ksy for authentication */
/* All keys are set to FFFFFFFFFFFFh at chip delivery from the factory */
for (byte i = 0; i < 6; i++) {
key.keyByte[i] = 0xFF;
}
/* Authenticating the desired data block for Read access using Key A */
status = mfrc522.PCD_Authenticate(MFRC522::PICC_CMD_MF_AUTH_KEY_A, blockNum,
&key, &(mfrc522.uid));
//----------------------------------------------------------------------------

Page | 53
if (status != MFRC522::STATUS_OK){
Serial.print("Authentication failed for Read: ");
Serial.println(mfrc522.GetStatusCodeName(status));
return;
}
//----------------------------------------------------------------------------
else {
Serial.println("Authentication success");
}
//----------------------------------------------------------------------------
/* Reading data from the Block */
status = mfrc522.MIFARE_Read(blockNum, readBlockData, &bufferLen);
if (status != MFRC522::STATUS_OK) {
Serial.print("Reading failed: ");
Serial.println(mfrc522.GetStatusCodeName(status));
return;
}
//----------------------------------------------------------------------------
else {
readBlockData[16] = ' ';
readBlockData[17] = ' ';
Serial.println("Block was read successfully");
}
}

Page | 54
CHAPTER 5

RESULTS AND CONCLUSION

5.1 ENTERING NAME IN THE CARD

To get register with your name, one should enter their name in the card. To
enter their name in the card on should dump the code mentioned in chapter 7 into
the NODEMCU.

When the code is dumped into the NODEMCU, now show the tag that is
to be registered to the RFID reader, then the name mentioned in the code will be
uploaded in the card. Output will be displayed in the serial monitor.

Fig 5.1: Stored card name displayed in Serial monitor

5.2 RECORDING OF ATTENDANCE

To register for attendance, one must scan their card against the RFID
reader. Once scanned, the recorded data, i.e., name, is sent to an excel sheet along
with the date and time.

When an unregistered card is scanned, nothing is displayed in the excel


page, and the cell is left blank.

Page | 55
Fig 5.2: Excel sheet display

→ The output when the registered card is scanned is shown in the red-
coloured box in the excel sheet.
→ The output when the unregistered card is scanned is shown in the green-
coloured box in the excel sheet.

5.3 CONCLUSION

Through the proposed IoT based smart attendance system using RFID the
existing manual system of registering the attendance can be transformed into an
efficient and error-free attendance management system. By employing this
system information can be conveyed without a hitch. The proposed system will

Page | 56
be of great help in schools, colleges and any organizations to monitor their
students or employees. Although there are different methods of managing the
student’s or employee’s attendance, the proposed system is easy to handle and
very convenient for any organization. The proposed system is time-saving, user-
friendly and reliable to use.

5.4 FUTURE SCOPE

A hex key pad keypad can be interfaced to micro controller board by which
user can enter his password then only the lock can be opened. This ensures even
if someone has card then also without the password, he can't get access.

Every good engineering design innovation has limitation. The passive RFID
based lecture attendance monitoring system is not without limitation as a data
collection technology with accurate and timely data entry. Hence, the limitation
of this design would be improved upon in future by considering the following
salient recommendations:

→ By incorporating a facial recognition application that would serve to


further increase the biometric security of the system against impersonation
by erring students.
→ Usage of High frequency (HF) active RFID tags against passive Low
frequency RFID tags for better performance and flexibility of users.
→ Performance evaluation of combination of thumbprint, facial recognition
and RAID technology to student’s attendance monitoring system.

Page | 57
REFERENCES

[1]. Fingerprint Attendance System for classroom needs, Mohamed Basheer K P


Dept. of Electronics and Communications Engineering, National Institute of
Technology Calicut, Kerala, India, Raghu C V Dept. of Electronics and
Communications Engineering, National Institute of Technology Calicut, Kerala,
India.

[2]. Zhang Yuru, Chen Delong and Tan Liping, The Research and Application of
College Student Attendance System based on RFID Technology International
Journal of Control and Automation Vol. 6, No. 2, April, 2013.

[3]. Sumita Nainan, Romin Parekh and Tanvi Shah, RFID Technology Based
Attendance Management System IJCSI International Journal of Computer
Science Issues, Vol. 10, Issue 1, No 1, January 2013.

[4]. Ankita Agrawal and Ashish Bansal, Online Attendance Management System
Using RFID with Object Counter International Journal of Information and
Computation Technology, ISSN 0974-2239 Volume 3, ©International Research
Publications House, Number 3 (2013), pp. 131-138.

[5]. Student Attendance System in Classroom Using Face Recognition Technique


Samuel Lukas1, Aditya Rama Mitra2, Ririn Ikana Desanti3, Dion Krisnadi4
1,4Informatics Department, 2 Computer System Department, 3 Information
System Department Universitas Pelita Harapan Karawaci, Indonesia

Page | 58

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy