Inbound 527261718077491649
Inbound 527261718077491649
RFID Based Attendance System Using NodeMCU with PHP Web App
A Project Presented
BIT 3-C NIGHT COMPTECH Students of
CTU-Moalboal Campus
In Partial Fulfillment
Of the requirements of the Degree
Bachelor of Industrial Technology
Major in Computer Technology
BEJO, JOELAICA
CUEVAS, JESTONI
DOMUGHO, NERISSA
GANTALAO, CHRISTIAN PAUL
HAO, GERALDINE
MAGBANUA, RHEYNARD
PERDIGUEZ, LAURENCE
REQUILME, JOANE MARIE
SAURNIDO, MARIEBETH
JUNE 2022
ii
Acknowledgement
The success and final outcome of this project required a lot of guidance and
assistance from many people and we are extremely privileged to have got this all along
First and foremost, the project's creators would like to thank their Embedded
System instructor, Mr. Marnell L. Escabas, for his guidance and assistance during the
project's development.
In addition, they would like to thank their parents for their understanding and
Above all, they want to express their sincere gratitude to everyone who had
supported them in making it possible and successful and to God, who has been leading
them, giving them wisdom, guidance and clarity of thought and keeping their courage to
ABSTRACT
transfer data from an electronic tag –called an RFID tag or label. The RFID attendance
system is developed with the IoT platform using PHP, CSS, and JavaScript.. We have
used NodeMCU ESP8266 development board with MF-RC522 Module to send the card
UID to the PHP Web app and store data into the website database. Basically, the admin
It can be useful in different places like schools, Colleges, industry and private
monthly/daily working hours automatically. When the person with the correct RFID card
swipes his/her RFID tag, His/hers arrival time will be stored in system Log. Usually,
when the same person swipes his/her RFID tag again, the system will save it as his/her
leaving time.
This project allows the beneficial people to cut down on the time they spend
manually recording attendance on paper and entering it into their computer or on their
student record. The data can be quickly copied and pasted into the appropriate file.
Student will have their individual tags to be used as their personal identification
tags for their attendance. Passive tags is being used to this project.
iv
Table of Contents
Title Page
Title Page---------------------------------------------------------------------------------i
Acknowledgement----------------------------------------------------------------------ii
Abstract----------------------------------------------------------------------------------iii
Table of Contents-----------------------------------------------------------------------iv
List of tables----------------------------------------------------------------------------vii
List of Figures--------------------------------------------------------------------------viii
Chapter I
The Problem
Introduction------------------------------------------------------------1
Theoretical Background----------------------------------------------4
Schematic Diagram----------------------------------------------------6
Statement of Purpose--------------------------------------------------7
Significance of this Project-------------------------------------------8
Scope and Limitations-------------------------------------------------9
Project Components--------------------------------------------------10
Hardware Components--------------------------------------10
Software Components---------------------------------------11
Pin Diagram------------------------------------------------------------12
NodeMCU Pin Configuration-------------------------------12
NodeMCU Pin Description----------------------------------13
RFID RC522 Pin Configuration----------------------------14
RFID RC522 Pin Description-------------------------------15
v
Chapter II
Review of Related Literature -------------------------------------------------16
Chapter III
Project Methodology and Procedure
Method -----------------------------------------------------------------21
Project Procedure------------------------------------------------------22
Flow of the Project-----------------------------------------------------25
Project Processing Chart----------------------------------------------26
Picture presentation of the server------------------------------------27
Programming Code----------------------------------------------------31
Project Environment--------------------------------------------------39
Chapter IV
Summary, Findings, Conclusion, and Recommendation
Summary---------------------------------------------------------------40
Findings----------------------------------------------------------------40
Conclusion-------------------------------------------------------------40
Recommendation------------------------------------------------------41
References---------------------------------------------------------------42
Appendices------------------------------------------------------------------------------44
Activity 1.1----------------------------------------------------------------------45
Activity 1.2----------------------------------------------------------------------46
Activity1.3-----------------------------------------------------------------------58
Activity 1.4----------------------------------------------------------------------77
Activity 1.5-----------------------------------------------------------------------82
Activity 1.6-----------------------------------------------------------------------84
vi
Activity 1.7-----------------------------------------------------------------------86
Activity 1.8------------------------------------------------------------------------88
Activity2.0-------------------------------------------------------------------------90
Activity 2.1-------------------------------------------------------------------------92
Activity 2.2-------------------------------------------------------------------------95
Activity 2.3--------------------------------------------------------------------------97
Activity 2.6--------------------------------------------------------------------------99
Activity 2.7-----------------------------------------------------------------------101
Activity 2.8-------------------------------------------------------------------------103
Activity 2.6-------------------------------------------------------------------------106
Definition of Terms-----------------------------------------------125
Documentation---------------------------------------------------------------137
List of Tables
Table No. Tittle Page
1 Components---------------------------------------------- 9
2 Arduino Uno ---------------------------------------21
3 4x4 Keypad -----------------------------------------------23
4 16x2 LCD -----------------------------------------------------24
5 Definition of Term -------------------------------------125
viii
List of Figures
Figure No. Title Page
1 Schematic Diagram------------------------------------------5
Chapter 1
The Problem
INTRODUCTION
Due to modern globalization and the ease with which practically all information is
Identification (RFID) systems has increased recently.They have been effectively used in a
variety of sectors, including transportation, healthcare, agriculture, and the hotel industry
worldwide and Philippines are start adapting this kind of system. With the use of
appropriate readers and electronic passive and tags, RFID technology enables automatic
wireless identification.
This project is made with the used of RFID technology to address the ongoing
issue of tracking lecture attendance of the students in BIT Computer Technology under
Interaction of lecturer and students are very important, traditional attendance like
roll call the names is one of those. However this strategies is time consuming, stressful
and laborious because the valuable lecture time that could otherwise been used for
deployed in this study is capable of eliminating time wasted during manual collection of
classroom statistics
2
for allocation of appropriate attendance scores and for further managerial decisions.
of all students attendance made in paper in class. Due to this, loss of time for students and
the teachers, lack of knowing exactly the students who attended a particular class for
instant, validation and insertion of data is done manually. There may be chance for
tampering data. Due to large community of students and teachers, it is difficult to manage
manually. It is vital for educational sectors to have solutions that simplify and increase
the speed of data collection and increase the lectures efficiency. To address these
problems, any institution/school must look for a better system such as RFID-based
the attendance sheet every time they attend a class. As common as it seems, such system
lacks automation, where a number of problems may arise. This includes the time
unnecessarily consumed by the students to find and sign their name on the attendance
sheet; some students may mistakenly or purposely sign another student's name. Also the
attendance sheet may get misplaced. Having a system that can automatically capture
student's attendance by flashing their student card at the RFID reader can really save all
the mentioned troubles. This is the main motive of our system and in addition having an
online system accessible anywhere and anytime can greatly help the lecturers to keep
track of their students' attendance. Looking at a bigger picture, deploying the system
throughout the academic faculty will benefit the academic management as students'
attendance to classes is one of the key factor in improving the quality of teaching and
monitoring their students' performance. Besides, this system provides valuable online
3
facilities for easy record maintenance offered not only to lecturers but also to related
academic management staffs especially for the purpose of students' progress monitoring.
4
THEORITICAL BACKGROUND
Dawes A.T. in 2004 said that 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. Bardaki,C., Kourouthanassis, P. and Pramatari,
K., (2012),
According to Zhang Yuru, Chen Delong and Tan Liping in 2013, they illustrated
a system in which hardware nodes based on RFID technology have been proposed. The
designed system significantly improves the productivity and reduces wastage of human
and material resources. The immense potential of RFID based systems has been
identified and explained in literature earlier. It will open the door to applications which
were thought-of a few years ago. Also the evolution of the technology and role of
individual components has been explained in detail. The use of object counters in RFID
based systems has also been shown. Such a system significantly improves the current
5
fully automated approach in monitoring the students in the Campus. The application of
GSM has also been studied to send SMS to a guardian when a student enters the campus.
using RFID technology. A tag is issued to each student at the time of his/her registration
manually. The proposed system is tested only by taking attendance of five students using
RFID to conclude the results. The proposed research does not cover the loopholes of
RFID tag system. The proposed system needs further validation to test in a real time
was provided in the industrial context . The intent of the proposed research was to
identify the commonalities and differences of both technologies. White et al. conducted a
case study in a warehouse to conclude the results where both barcoding and RFID
technologies were already practiced. The parameters used to report the case study were
quantity and type of mistakes associated due to the implementation of barcoding and
RFID technologies. White et al. concluded that RFID technology performed better having
less mistakes and possessed high performance as compared to the bar coding technology
in an operational environment. The reliability of data was low in case of RFID based
practitioners that by amalgamating barcode and RFID technologies could provide better
results by eliminating the limitations of both technologies but it would be expensive and
complex to implement.
6
SCHEMATIC DIAGRAM
Figure1.
Schematic Diagram of RFID Based Attendance System Using NodeMCU with PHP
Web App
7
STATEMENT OF PURPOSE
The project's creator wants to reduce the amount of time they spend
attendance?
The system will help to record, monitor and track the attendance of the students
and employees.
School/University:
since the system will greatly reduce the time of checking the attendance.
If pupils consistently miss class, the institution will quickly notify the
parents.
Students don't have to worry as much about losing their day's attendance
it can also be used to track teachers' and non-teaching staff's attendance and
conduct of teaching and non- teaching employees on the school campus can be
Organization:
Future Researchers:
They can use this as a starting point to modify the system and make it
significantly more advanced.
9
SCOPE:
Compared to the conventional technique of attendance system, this project has offered a
practical approach of attendance marking. The data is better organized using a SQL database.
It is an interface-based system that is user-friendly because it allows for data editing and
organizations and academic institutions. Data retrieval is quite simple. Log in and log out times
The users' indicators for a successful log-in and log-out are the LED and the buzzer.
LIMITATION:
System display the name, arrival and departure time of the user if UID is registered in the
data base, else only UID number will be display and need to register first to see the log in and
PROJECT COMPONENTS
Hardware Components
COMPONENTS DEFINITIONS
Jumper Wires
Jumper wire is an electrical wire, or group of them in a
cable, with a connector or pin at each end, which is
normally used to interconnect the components of
a breadboard or other prototype or test circuit, internally
or with other equipment or components, without
soldering.
Breadboard
A breadboard, or proto-board, is a construction base
for prototyping of electronics. Originally the word
referred to a literal bread board, a polished piece of wood
used when slicing bread.
Table 1.
Components of RFID Based Attendance System Using NodeMCU with PHP Web App
11
Software Components
Arduino IDE
The Arduino integrated development
environment (IDE) is a cross-platform application
(for Microsoft Windows, macOS, and Linux) that is
written in the Java programming language. It originated
from the IDE for the
languages Processing and Wiring.
XAMPP server
XAMPP is a free and open-source cross-platform web
server solution stack package developed by Apache
Friends, consisting mainly of the Apache HTTP Server,
MariaDB database, and interpreters for scripts written
in the PHP and Perl programming languages.
RFID-RC522 Library
The RC522 RFID reader module is designed to create
a 13.56MHz electromagnetic field and communicate
with RFID tags (ISO 14443A standard tags).
Table 2.
Software Components of RFID Based Attendance System Using NodeMCU with PHP Web App
12
PIN DIAGRAM
the contacts, or pins, of an electrical connector or electronic component, and their functions.
Pin Function
Chapter II
with its applications being seen in various fields such as industries, offices, transportation,
often cumbersome and time consuming. However, this problem can be mitigated using the RFID
retrieving from or storing data on to RFID Tags without making any physical contact. The RFID
system comprises an RFID reader, tags, a back end storage system and also an intermittent part
that contains all the electrical elements. This RFID based attendance system has a storage that
stores the unique identification number of the student/employee with the attendance system
being user friendly for commercial purposes. The principal objective is to make a system that
will take the attendance of authorized individuals, record the data along with time and date and
store in an internal SD card file, and finally store the data inside the EEPROM. Both hardware
and software parts have been synchronized in order to serve the aforementioned objective. The
RFID hardware has been relied upon to take the attendance of users. Each user would be
provided with an individual RFID tag and its record will be maintained.
The radio frequency identification (RFID) systems are getting popularity from last
several years due to several reasons such as economical, time saving, resource saving, reduced
effort and easy to implement. It is important to trace inventory for any e-commerce company
because of opening new markets such as Amazon, EBay and Ali Baba. The RFID components
are developed using state-of-the-art technology to create and read tags. The efficiency and
17
accuracy of RFID systems are improved. Wal-Mart, General Electric, USA Department of
Immigration, and USA Department of Defense organizations are already getting the benefits of
RFID based systems. A RFID tag is composed of an antenna, a wireless transducer and an
encapsulating material.
domain to solve the problems of manual attendance method. There is always a requirement for
the instructors to mark attendance of their students in each lecture. Majority of institutions all
over the globe are still using the traditional method to take attendance. The instructors are calling
the name of each student and marking present or absent in from of his/her id and name over a
paper. There are several problems associated with this method to marks attendance such as
students only know their shortage if instructors are willing to inform them before the
examination, time and cost consuming, proxy attendance, insecure, inefficient and inaccurate.
King Abdul-Aziz University (KAU) of Saudi Arabia is one of largest universities in Saudi
Arabia is using an electronic system named Odus Plus to take attendance of students from last
several years but students’ attendance is still taken manually on a paper from taking printout by
faculty. This is because Odus Plus is a web based academic management system running on the
main server of the KAU. An instructor wastes enormous amount of time in each lecture while
connecting to the main server. After login, the instructors call the names of students in order to
mark attendance in electronic system similar to manual attendance method. To avoid such
cumbersome activities, a majority of instructors take print out of attendance sheets from
electronic system and mark attendance of the students manually. There are several problems
associated with both electronic and manual attendance methods such as time and cost consuming,
prone of errors, involvement of human efforts, tedious and inefficient. This research aims to
18
address the main limitations of existing methods of taking attendance in KAU by proposing a
fully automated system using RFID technology. This is achieved by using a customized Scrum
Gatsheni et al. developed a system to automate the attendance of the students using RFID
technology. A tag is issued to each student at the time of his/her registration in the Central
proposed system is tested only by taking attendance of five students using RFID to conclude the
results. The proposed research does not cover the loopholes of RFID tag system. The proposed
system needs further validation to test in a real time environment to check its effectiveness. An
analysis, of barcode and RFID technologies, was provided in the industrial context. The intent of
the proposed research was to identify the commonalities and differences of both technologies.
White et al. conducted a case study in a warehouse to conclude the results where both barcoding
and RFID technologies were already practiced. The parameters used to report the case study
were quantity and type of mistakes associated due to the implementation of barcoding and RFID
technologies. White et al. concluded that RFID technology performed better having less mistakes
and possessed high performance as compared to the bar coding technology in an operational
environment. The reliability of data was low in case of RFID based technology whereas it is high
and RFID technologies could provide better results by eliminating the limitations of both
Schapranow et al. conduct a research to highlight one of the main limitations of RFID
technology that is security. It is illustrated that the security breaches in RFID technology make it
easy for hackers to attack the system. A number of attacks are reported using RFID technology
19
such as man-in-the-middle, RFID cloning and spoofing and replay attacks. Controlled signal
interferences and data encryption systems can control the vulnerability of RFID technology. An
institute [7]. The student attendance management is using the web interface to mark attendance
to replace the paper based traditional style to record present and absent. The main benefits of the
web based attendance management system is that the record of attendance is accessible to the top
management of academic institution in the form of detailed, summary and exception reports.
These reports can be shared to the parents and guardians to take corrective actions. The
information system is developed using model view controller (MVC) architecture. Ajax
technology is used to provide the front end interfaces and MySQL database is used to store the
data. The main limitations of the attendance management system are time, cost, effort and
resources consumptions. The proposed attendance management system is failed to address the
problems of the paper based attendance method. It is recommended as a future work to address
Srindhi and Ramil conduct a research to address the main limitations of manual
biometric technology to take the attendance of the students, faculty and administrative staff. The
proposed system has two versions that are web and mobile. A student is always needed to
register at the time of admission in the institution. A RFID tag is issued with a distinctive code to
each registered student and his/her figure prints are also recorded. All the classes are equipped
with RFID readers and scanners and the campus is also equipped with the hotspots. The RFID
reader will read the tag of each student and scanner will be used to match the figure prints to
avoid the fake attendance. There are several advantages of the proposed web based attendance
20
management system such as automation, detailed, summary and exception reports, time saving,
less errors, alert status of the students to management, parents and guardians through emails and
simple mail message (SMS). The mobile version helps the students about campus events,
crowded area, campus locations using Google map and check the status of attendance in all
classes to avoid fines and disciplinary notices. The proposed research addresses most of the
problems of existing manual attendance taking method but it is costly to implement. The use of
scanner to detect the figure prints of all students is time consuming at the beginning of each
Chapter III
METHODOLOGY
project.
The creator made a through experimenting how the system will run after code is
being uploaded.
The creator analyse how problem being solve and how the project run according
As soon as the code is successfully upload, the project is being test on how the
PROJECT PROCEDURE
PROCEDURE 1:
PROCEDURE 2:
The creator check the availability of the components to be use and gathered all to
be ready for the next step..
Hardware components:
NodeMCU
RFID Module
Jumper Wires
Breadboard
Software components
Arduino IDE
XAMPP server
PHP Source Code
RFID-RC522 Library
PROCEDURE 3:
Wirings:
Connect D2 to SDA/SS
Connect D5 to SCK
Connect D7 to MOSI
Connect D6 to MISO
Connect GND to GND
Connect D1 to RST
23
PROCEDURE 4:
PROCEDURE 5:
We need to add the esp8266 board to our Arduino IDE. Open up your IDE then go
to “File -> Preferences” or simply hit “Ctrl + comma”.
Paste http://arduino.esp8266.com/stable/package_esp8266com_index.json in
additional board manager URLs.
Go to “Tools -> Board -> Boards Manager” search and install esp8266.
Go to Tools -> Port and select the COM Port of your NodeMCU.
If you are not sure what port your NodeMCU is plugged in, go to Device Manager ->
Ports (COM & LPT).
24
Now select NodeMCU 1.0 (ESP-12E Module) by clicking Tools -> Board. Scroll
down until you find it.
Install the MFRC522 library to your Arduino Libraries folder – Download RFID
Library
25
Start
Enrolled the
Students
t
Swipe to Log-in
YES NO
Is student
Enrolled?
Swipe to Log-out
Click UID# edit user info,
add user
End
27
Programming
CODE:
//*******************************libraries********************************
//RFID-----------------------------
#include <SPI.h>
#include <MFRC522.h>
//NodeMCU--------------------------
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
//************************************************************************
//************************************************************************
//************************************************************************
//************************************************************************
//************************************************************************
void setup() {
delay(1000);
Serial.begin(115200);
pinMode(BUZZER, OUTPUT);
33
//---------------------------------------------
connectToWiFi();
//************************************************************************
void loop() {
if(!WiFi.isConnected()){
//---------------------------------------------
previousMillis = millis();
OldCardID="";
delay(50);
//---------------------------------------------
if ( ! mfrc522.PICC_IsNewCardPresent()) {
if ( ! mfrc522.PICC_ReadCardSerial()) {
return;//if read card serial(0) returns 1, the uid struct contians the ID of the read card.
CardID += mfrc522.uid.uidByte[i];
//---------------------------------------------
return;
else{
OldCardID = CardID;
//---------------------------------------------
35
Serial.println(CardID);
SendCardID(CardID);
delay(1000);
if(WiFi.isConnected()){
//GET Data
//GET methode
if (httpCode == 200) {
if (payload.substring(0, 5) == "login") {
Serial.println(user_name);
Serial.println(user_name);
delay(100);
void connectToWiFi(){
delay(1000);
WiFi.mode(WIFI_STA);
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, password);
delay(500);
Serial.print(".");
Serial.println("");
Serial.println("Connected");
delay(1000);
//=================================================================
======
39
PROJECT ENVIRONMENT
Moalboal, Cebu. The campus was located specifically along the National Highway at Poblacion
West, Moalboal Cebu. The University is located some 89K from the Cebu City. The place is
conducive for the conduct of experiment relative to the research. It offers several courses from
both graduate and under graduate department namely: Bachelor of Science and Hospitality
and Fishery (BSFI), Bachelor of Science in Industrial Engineering (BSIE), Bachelor of Arts in
English Language.
Figure 11:
Location Map of the Study
40
Chapter IV
In this chapter, the summary, findings, conclusion and recommendation are presented.
SUMMARY
This project will provide the entire attendance monitoring system for academic
The project shows that upon making this RFID Based Attendance System Using
NodeMCU with PHP Web source, Awareness and Consideration in making this output must be
handling with care in order to avoid circumstances that might ruin the performance of the project.
FINDINGS
This project can be fix near the entrance and exit door for easy access for time in and
time out. In making this project must in full awareness and care in order to complete this product
with no errors.
CONCLUSION
RFID Based Attendance System Using NodeMCU with PHP Web source has been successfully
presented through the means of this paper. The system developed provides an accurate, simple
and cost effective means to register the attendance in educational institutions and effectively
RECOMMENDATION
RFID Based Attendance System Using NodeMCU with PHP Web Source is budding and
because unlike barcode scanners, RFID is bereft of the line of sight paradigm i.e. the tag doesn’t
need to be pointed directly over the reader. Instead, the user can get a scan even from feet away
from the reader. Further, in addition to being cost effective, RFID alleviates the scope of
malpractices and errors. Another point to note here is that this system can further be strengthened
by introducing components like a fingerprint scanner if the need arises. Also the scope of this
RFID based system can be extended to a range of operations like library management, parking
REFERENCES
https://theiotprojects.com/rfid-based-attendance-system-using-
nodemcu/?fbclid=IwAR2N8oaMFDOhZxBb44A_kNUunh9dqNySLEnIH_CPYgIeclnwuRhvnc
Uu93I
system." International Journal of Software Engineering & Applications (IJSEA) 11.3 (2020).
Workshop on Recent Trends in Telecommunications Research (RTTR), 2017, pp. 1-6, doi:
10.1109/RTTR.2017.7887874.
Sulistio, A., R. Ritzkal, and Y. Afrianto. “Student Attendance Information System Using
Web-Based Nodemcu ESP8266”. Jurnal Mantik, vol. 4, no. 3, Nov. 2020, pp. 1597-03,
doi:10.35335/mantik.Vol4.2020.962.pp1597-1603.
] Dawes A.T. (2004),”Is RFID Right for Your Library”, Journal of Access Services, Volume
2(4), pp 7-13.
https://ww.lastminuteengineers.com/how-rfid-works-rc522-arduino-tutorial/
https://www.arduino.cc/en/software
https://github.com/miguelbalboa/rfid
https://www.apachefriends.org/download.html
https://www.github.com/php/php-src
43
https://wwww.github.com/esp8266/Arduino
https://www.lastminuteengineers.com/how-rfid-works-rc522-arduino-tutorial/
APPENDICES
45
COMPONENTS:
1 x LED
1 x BREADBOARD
1 x RESISTOR 1k Ohms
1 x ARDUINO UNO R3
UNI x JUMPING WIRE
PROCEDURE:
CODE:
void loop() }
{
46
delay(1000); // Wait for Time Delay delay(1000); // Wait for Time Delay
millisecond(s) millisecond(s)
digitalWrite(LED1, LOW); digitalWrite(LED1, LOW);
digitalWrite(LED2, LOW); digitalWrite(LED2, LOW);
digitalWrite(LED3, LOW digitalWrite(LED3, LOW
); );
digitalWrite(LED4, LOW); digitalWrite(LED4, LOW);
digitalWrite(LED5, LOW); digitalWrite(LED5, LOW);
digitalWrite(LED6,LOW); digitalWrite(LED6,LOW);
digitalWrite(LED7, HIGH); digitalWrite(LED7, LOW);
digitalWrite(LED8, HIGH); digitalWrite(LED8, LOW);
digitalWrite(LED9, HIGH); digitalWrite(LED9, HIGH);
digitalWrite(LED10, HIGH); digitalWrite(LED10, HIGH);
digitalWrite(LED11, HIGH); digitalWrite(LED11, HIGH);
digitalWrite(LED12, HIGH); digitalWrite(LED12, HIGH);
digitalWrite(LED13, HIGH); digitalWrite(LED13, HIGH);
digitalWrite(LED14, HIGH); digitalWrite(LED14, HIGH);
digitalWrite(LED15, HIGH); digitalWrite(LED15, HIGH);
digitalWrite(LED16, HIGH); digitalWrite(LED16, HIGH);
digitalWrite(LED17, HIGH); digitalWrite(LED17, HIGH);
digitalWrite(LED18, HIGH); digitalWrite(LED18, HIGH);
digitalWrite(LED19, HIGH); digitalWrite(LED19, HIGH);
digitalWrite(LED20, HIGH); digitalWrite(LED20, HIGH);
delay(1000); // Wait for Time Delay delay(1000); // Wait for Time Delay
millisecond(s) millisecond(s)
digitalWrite(LED1, LOW); digitalWrite(LED1, LOW);
digitalWrite(LED2, LOW); digitalWrite(LED2, LOW);
digitalWrite(LED3, LOW digitalWrite(LED3, LOW
); );
digitalWrite(LED4, LOW); digitalWrite(LED4, LOW);
digitalWrite(LED5, LOW); digitalWrite(LED5, LOW);
digitalWrite(LED6,LOW); digitalWrite(LED6,LOW);
digitalWrite(LED7, LOW); digitalWrite(LED7, LOW);
digitalWrite(LED8, HIGH); digitalWrite(LED8, LOW);
digitalWrite(LED9, HIGH); digitalWrite(LED9, LOW);
digitalWrite(LED10, HIGH); digitalWrite(LED10, HIGH);
digitalWrite(LED11, HIGH); digitalWrite(LED11, HIGH);
digitalWrite(LED12, HIGH); digitalWrite(LED12, HIGH);
digitalWrite(LED13, HIGH); digitalWrite(LED13, HIGH);
digitalWrite(LED14, HIGH); digitalWrite(LED14, HIGH);
digitalWrite(LED15, HIGH); digitalWrite(LED15, HIGH);
digitalWrite(LED16, HIGH); digitalWrite(LED16, HIGH);
digitalWrite(LED17, HIGH); digitalWrite(LED17, HIGH);
digitalWrite(LED18, HIGH); digitalWrite(LED18, HIGH);
digitalWrite(LED19, HIGH); digitalWrite(LED19, HIGH);
digitalWrite(LED20, HIGH); digitalWrite(LED20, HIGH);
50
delay(1000); // Wait for Time Delay delay(1000); // Wait for Time Delay
millisecond(s) millisecond(s)
digitalWrite(LED1, LOW); digitalWrite(LED1, LOW);
digitalWrite(LED2, LOW); digitalWrite(LED2, LOW);
digitalWrite(LED3, LOW digitalWrite(LED3, LOW
); );
digitalWrite(LED4, LOW); digitalWrite(LED4, LOW);
digitalWrite(LED5, LOW); digitalWrite(LED5, LOW);
digitalWrite(LED6,LOW); digitalWrite(LED6,LOW);
digitalWrite(LED7, LOW); digitalWrite(LED7, LOW);
digitalWrite(LED8, LOW); digitalWrite(LED8, LOW);
digitalWrite(LED9, LOW); digitalWrite(LED9, LOW);
digitalWrite(LED10, LOW); digitalWrite(LED10, LOW);
digitalWrite(LED11, HIGH); digitalWrite(LED11, LOW);
digitalWrite(LED12, HIGH); digitalWrite(LED12, LOW);
digitalWrite(LED13, HIGH); digitalWrite(LED13, HIGH);
digitalWrite(LED14, HIGH); digitalWrite(LED14, HIGH);
digitalWrite(LED15, HIGH); digitalWrite(LED15, HIGH);
digitalWrite(LED16, HIGH); digitalWrite(LED16, HIGH);
digitalWrite(LED17, HIGH); digitalWrite(LED17, HIGH);
digitalWrite(LED18, HIGH); digitalWrite(LED18, HIGH);
digitalWrite(LED19, HIGH); digitalWrite(LED19, HIGH);
digitalWrite(LED20, HIGH); digitalWrite(LED20, HIGH);
delay(1000); // Wait for Time Delay delay(1000); // Wait for Time Delay
millisecond(s) millisecond(s)
digitalWrite(LED1, LOW); digitalWrite(LED1, LOW);
digitalWrite(LED2, LOW); digitalWrite(LED2, LOW);
digitalWrite(LED3, LOW digitalWrite(LED3, LOW);
); digitalWrite(LED4, LOW);
digitalWrite(LED4, LOW); digitalWrite(LED5, LOW);
digitalWrite(LED5, LOW); digitalWrite(LED6,LOW);
digitalWrite(LED6,LOW); digitalWrite(LED7, LOW);
digitalWrite(LED7, LOW); digitalWrite(LED8, LOW);
digitalWrite(LED8, LOW); digitalWrite(LED9, LOW);
digitalWrite(LED9, LOW); digitalWrite(LED10, LOW);
digitalWrite(LED10, LOW); digitalWrite(LED11, LOW);
digitalWrite(LED11, LOW); digitalWrite(LED12, LOW);
digitalWrite(LED12, HIGH); digitalWrite(LED13, LOW);
digitalWrite(LED13, HIGH); digitalWrite(LED14, HIGH);
digitalWrite(LED14, HIGH); digitalWrite(LED15, HIGH);
digitalWrite(LED15, HIGH); digitalWrite(LED16, HIGH);
digitalWrite(LED16, HIGH); digitalWrite(LED17, HIGH);
digitalWrite(LED17, HIGH); digitalWrite(LED18, HIGH);
digitalWrite(LED18, HIGH); digitalWrite(LED19, HIGH);
digitalWrite(LED19, HIGH); digitalWrite(LED20, HIGH);
digitalWrite(LED20, HIGH);
51
COMPONENTS:
20 x LED’s
20 x Resistor 1k ohms
1 x Push button
1 x Arduino Uno
n x Jumping wires
PROCEDURES:
All negative LED connect to ground
Pin 1A of Pushbutton connect to Resistor terminal 1
1k ohms Resistor connected to the ground
Pin 1A of Pushbutton connect to Arduino A5
Pin 2A of Pushbutton connect to Arduino 3.3v
LED 1 connect to pin 0 LED 14 connect to pin 13
LED 2 connect to pin 1 LED 15 connect to pin A0
LED 3 connect to pin 2 LED 16 connect to pin A1
LED 4 connect to pin 3 LED 17 connect to pin A2
LED 5 connect to pin 4 LED 18 connect to pin A3
LED 6 connect to pin 5 LED 19 connect to pin A4
LED 7 connect to pin 6 LED 20 connect to pin A5
LED 8 connect to pin 7 LED 1 connect to resistor1
LED 9 connect to pin 8 LED 2 connect to resistor2
LED 10 connect to pin 9 LED 3 connect to resistor3
LED 11 connect to pin 10 LED 4 connect to resistor4
LED 12 connect to pin 11 LED 5 connect to resistor 5
LED 13 connect to pin 12 LED 6 connect to resistor 6
59
COMPONENTS:
1x ARDUINO UNO
20x LED
20x resistor 220 ohms
JUMPING WIRES
PROCEDURES
All negative LED connects to ground
LED 1 connect to pin 0 LED 18 connect to pin A3
LED 2 connect to pin 1 LED 19 connect to pin A4
LED 3 connect to pin 2 LED 20 connect to pin A5
LED 4 connect to pin 3 LED 1 connect to resistor1
LED 5 connect to pin 4 LED 2 connect to resistor2
LED 6 connect to pin 5 LED 3 connect to resistor3
LED 7 connect to pin 6 LED 4 connect to resistor4
LED 8 connect to pin 7 LED 5 connect to resistor 5
LED 9 connect to pin 8 LED 6 connect to resistor 6
LED 10 connect to pin 9 LED 7 connect to resistor 7
LED 11 connect to pin 10 LED 8 connect to resistor8
LED 12 connect to pin 11 LED 9 connect to resistor 9
LED 13 connect to pin 12 LED 10 connect to resistor 10
LED 14 connect to pin 13 LED 11 connect to resistor11
LED 15 connect to pin A0 LED 12 connect to resistor12
LED 16 connect to pin A1 LED 13 connect to resistor13
LED 17 connect to pin A2 LED 14 connect to resistor 14
78
CODE:
int LED1 = 0; {
int LED2 = 1; pinMode(LED1, OUTPUT);
int LED3 = 2; pinMode(LED2, OUTPUT);
int LED4 = 3; pinMode(LED3, OUTPUT);
int LED5 = 4; pinMode(LED4, OUTPUT);
int LED6 = 5; pinMode(LED5, OUTPUT);
int LED7 = 6; pinMode(LED6, OUTPUT);
int LED8 = 7; pinMode(LED7, OUTPUT);
int LED9 = 8; pinMode(LED8, OUTPUT);
int LED10 = 9; pinMode(LED9, OUTPUT);
int LED11 = 10; pinMode(LED10, OUTPUT);
int LED12 = 11; pinMode(LED11, OUTPUT);
int LED13 = 12; pinMode(LED12, OUTPUT);
int LED14 = 13; pinMode(LED13, OUTPUT);
int LED15 = A0; pinMode(LED14, OUTPUT);
int LED16 = A1; pinMode(LED15, OUTPUT);
int LED17 = A2; pinMode(LED16, OUTPUT);
int LED18 = A3; pinMode(LED17, OUTPUT);
int LED19 = A4; pinMode(LED18, OUTPUT);
int LED20 = A5; pinMode(LED19, OUTPUT);
pinMode(LED20, OUTPUT);
void setup() }
79
COMPONENTS
Arduino Uno R3
220 Ω Resistor
Red LED
250 k Ω Potentiometer
PROCEDURE
CODE {
ReadValue = analogRead(A0);
int ledValue = 0; }
void setup ()
pinMode (ledPin,OUTPUT);
void loop ()
84
COMPONENTS
Arduino Uno R3
250 kΩ Potentiometer
Micro Servo
PROCEDURE
CODE
Servo myservo; {
{ delay(15);
myservo.attach(9); }
}
86
COMPONENTS
Arduino Uno R3
Piezo
250 kΩ Potentiometer
PROCEDURE
CODE
/*
COMPONENTS:
Arduino Uno R3
220 Ω Resistor
250 kΩ Potentiometer
Piezo
LED
Micro Servo
PROCEDURES
CODE
int ledValue = 0; }
ACTIVITY 2.0
Components
Arduino
LCD1602, or 1602
LCD1602, or 1602
Procedures
Connect the GND pin of the LCD to the GND pin of the Arduino
Connect the Vcc pin of the LCD to the 5v pin of the Arduino
Connect the SDA pin of the LCD to the A4 pin of the Arduino
Connect the SCL pin of the LCD to the A5 pin of the Arduino
Connect Arduino Board to PC via USB Cable
Download the Arduino software and type the codes then verify.
Code
delay( 200);}
// Turn on the blacklight and print a
message. //start of loop Robojax code for LCD with
lcd.backlight(); I2C
// Robojax code for LCD with I2C lcd.clear();
lcd.print("BIT-COMTECH 3C Night");
} lcd.setCursor (0,1); // go to start of 2nd line
lcd.print("Geraldine T. Hao ");
void loop() //lcd.print(millis() / 1000);
{ delay(500);
for (int positionCounter= 0; //end of loopcode Robojax code for LCD
positionCounter<20; positionCounter++){ with I2C
// scroll one position left; }
lcd.scrollDisplayLeft();
//wait a bit;
92
ACTIVITY 2.1
Components
Arduino Uno
2x 16 display with i2C controller
DHT11 Temperature and Humidity Sensor (3pins)
Jumper wire
Procedures
(In LCD)
( LCD to ARDUINO)
( ARDUINO TO DHT11)
After connecting all the components. Connect Arduino Uno to the PC or laptop via USB
cable.
Install Arduino Software.
Copy the above code and open with Arduino IDE.
On Arduino IDE go to Sketch » Include Library» Manage Libraries.
In Library Manager, search " DHT 11", then find the DHT sensor Library by Adafruit.
Click install button to install library.
Search "LCD", then find the Liquid Crystal, and choose version (version 1.0.5).
Click install button to install Library Crystal.
Close the Library Manager.
Go to Tools» Board Arduino» Arduino AVR Boards» Arduino Uno.
Again, Tools» Port COMS ( Arduino Uno) » COMS ( Arduino Uno).
Click upload button on Arduino IDE to upload code to Arduino.
Code
Activity 2.2
Components
LM35 pinout
Arduino Uno
Jumper wire
Breadboard
16x2 LCD display
Procedures
Step 5: Upload the code to your Arduino using the Arduino IDE then run.
Step 6: See the result in LCD.
Code
#include <LiquidCrystal_I2C.h> lcd.createChar(0, Degree);
// Create a new instance of the }
LiquidCrystal_I2C class: void loop()
LiquidCrystal_I2C lcd(0x27, 16, {
2); // Get a reading from the
// Degree symbol: temperature sensor:
byte Degree[] = { int reading =
B00111, analogRead(sensorPin); //
B00101, Convert the reading into voltage:
B00111, float voltage = reading * (5000 /
B00000, 1024.0);
B00000, // Convert the voltage into the
B00000, temperature in degree Celsius:
B00000, float temperature = voltage / 10;
B00000 // Print the temperature on the
}; LCD;
// Define to which pin of the lcd.setCursor(0, 0);
Arduino the output of the LM35 lcd.print("Temperature:");
is connected: lcd.setCursor(0, 1);
#define sensorPin A0 lcd.print(temperature, 1);
void setup() lcd.write(0); // print the custom
{ character
// Start the LCD and turn on the lcd.print("C");
backlight: delay(1000); // wait a second
lcd.begin(); between readings
lcd.backlight(); // Create a }
custom character:
97
Activity 2.3
Arduino Ultrasonic Sensor- LCD
Components
ARDUINO UNO
USB 2.0 CABLE TYPE A/B
ULTRASONIC SENSOR
LCD I2C
JUMPER WIRES
Procedures
STEP 1: Connect all the Components.
CONNECTIONS:
(In LCD)
> Red wire connect to the LCD VCC.
> Black wire connect to the LCD GND.
> Yellow Wire connect to the LCD SDA.
> Green Wire to the LCD SCL.
( LCD to ARDUINO)
> LCD VCC connect to the 5V of Arduino.
> LCD GND connect to GND of Arduino.
> LCD SDA connect to the A0 of arduino.
> LCD SCL connect to the A1 of Arduino.
( ULTRASONIC SENSOR TO ARDUINO)
> Ultrasonic Sensor VCC pin connect to the VCC (5V) of Arduino.
> Ultrasonic Sensor GND pin connect to the Arduino GND.
> Ultrasonic Sensor TRIG pin, this pin receives the control signal (pulse)
from Arduino.
> Ultrasonic Sensor ECHO pin, this pin sends a signal (pulse) to Arduino.
Arduino measures the duration of pulse to calculate distance.
98
Code
#include digitalWrite(trigPin, lcd.print( " M= ");
<LiquidCrystal_I2C.h> LOW); lcd.print(distance_m,1);
LiquidCrystal_I2C delayMicroseconds(2); lcd.setCursor (0,1);
lcd(0x27, 16, 2); // Sets the trigPin on lcd.print ("Inches : ");
const int trigPin = 9; HIGH state for 10 micro lcd.print (distance_inches,
const int echoPin = 10; seconds 1);
// defines variables digitalWrite(trigPin,
long duration, inches; HIGH); delay(500);
long distance; delayMicroseconds(10); }
float duration_us, digitalWrite(trigPin,
distance_cm, distance_m, LOW);
distance_inches; // Reads the echoPin, // Calculating the distance
returns the sound wave //distance = duration *
void setup() { travel time in 0.034 / 2;
pinMode(trigPin, microseconds // Prints the distance on
OUTPUT); // Sets the duration_us = the Serial Monitor
trigPin as an Output pulseIn(echoPin, HIGH); // distance = duration *
pinMode(echoPin, distance_cm = 0.01 * 0.034 / 2;
INPUT); // Sets the duration_us; // Prints the distance on
echoPin as an Input distance_m = the Serial Monitor
Serial.begin(9600); // (distance_cm / 100); // lcd.setCursor(0, 0); //
Starts the serial lcd.clear(); start to print at the first row
communication distance_inches = lcd.print("Distance: ");
lcd.init(); distance_m * 39.37; //lcd.print("Distance: ");
lcd.backlight(); lcd.clear(); //lcd.setCursor (0,1);
} lcd.setCursor(0, 0); // start //lcd.print (distance);
void loop() to print at the first row //Serial.println(distance);
{ lcd.print("Cm=");
// Clears the trigPin lcd.print(distance_cm,1);
99
ACTIVITY 2.6
How 7-Segments Display Works
Components
Arduino UNO
Wires Resistors 1k
Breadboard
1 Digital Tube
Procedures
Arduino UNO pin 1 to 9 connect to Digital Tube
Resistors connect to Digital Tube
Resistors connect to Arduino UNO ground
Code
#include "SevSeg.h" void loop(){
SevSeg sevseg; sevseg.setNumber(0);
void setup(){ delay(1000);
byte numDigits = 1; sevseg.refreshDisplay();
byte digitPins[] = {}; sevseg.setNumber(1);
byte segmentPins[] = {6, 5, 2, 3, 4, 7, 8, delay(1000);
9}; sevseg.refreshDisplay();
bool resistorsOnSegments = true; sevseg.setNumber(2);
byte hardwareConfig = delay(1000);
COMMON_CATHODE; sevseg.refreshDisplay();
sevseg.begin(hardwareConfig, numDigits, sevseg.setNumber(3);
digitPins, segmentPins, delay(1000);
resistorsOnSegments); sevseg.refreshDisplay();
sevseg.setBrightness(90); sevseg.setNumber(4);
} delay(1000);
100
sevseg.refreshDisplay(); sevseg.refreshDisplay();
sevseg.setNumber(5); sevseg.setChars("D");
delay(1000); delay(1000);
sevseg.refreshDisplay(); sevseg.refreshDisplay();
sevseg.setNumber(6); sevseg.setChars("E");
delay(1000); delay(1000);
sevseg.refreshDisplay(); sevseg.refreshDisplay();
sevseg.setNumber(7); sevseg.setChars("F");
delay(1000); delay(1000);
sevseg.refreshDisplay(); sevseg.refreshDisplay();
sevseg.setNumber(8); sevseg.setChars("G");
delay(1000); delay(1000);
sevseg.refreshDisplay(); sevseg.refreshDisplay();
sevseg.setNumber(9); sevseg.setChars("H");
delay(1000); delay(1000);
sevseg.refreshDisplay(); sevseg.refreshDisplay();
sevseg.setChars("A"); sevseg.setChars("I");
delay(1000); delay(1000);
sevseg.refreshDisplay(); sevseg.refreshDisplay();
sevseg.setChars("B"); sevseg.setChars("J");
delay(1000); delay(1000);
sevseg.refreshDisplay(); sevseg.refreshDisplay();
sevseg.setChars("C");
delay(1000);
101
Activity 2.7
4 DIGIT 7-SEGMENT DISPLAYS
Components
Arduino Uno
4 digital tube
Wires
Breadboard
Resistor 1k
Procedures
Arduino uno pin 2 connect to digital tube B
Arduino pin 3 connect to digital tube pin C
Arduino pin 4 connect to digital tube pin DP
Arduino pin 5 connect to digital tube pin D
Arduino pin 6 connect to digital tube pin E
Arduino pin 7 connect to digital tube pin G
Arduino pin 8 connect to digital tube pin F
Arduino pin 9 connect to digital tube pin A
Arduino pins 10 to 13 connect to resistors
Resistor connect to digital tube pin D1
Digital tube pin D2 connect to resistor
Digital tube pin D3 connect to resistor
Digital tube pin D4 connect to resistor
102
Code
Activity 2.8
Interfacing 8×8 LED Matrix with Arduino
Components
Arduino Uno
Matrix tube
IC 74HC595
Resistor
Wire
Breadboard
Procedures
Arduino pin 6 connect to resistor pin C8 of Matrix tube
Arduino pin 7 connect to resistor pin C7 of Matrix tube
Arduino pin 8 connect to resistor pin C6 of Matrix tube
Arduino pin 9 connect to resistor pin C5 of Matrix tube
Arduino pin 10 connect to resistor pin C4 of Matrix tube
Arduino pin 11 connect to resistor pin C3 of Matrix tube
Arduino pin 12 connect to resistor pin C2 of Matrix tube
Arduino pin 13 connect to resistor pin C1 of Matrix tube
IC pin 15 connect to R1 matrix tube
IC pin 1 connect to R2 matrix tube
IC pin 2 connect to R3 matrix tube
IC pin 3 connect to R4 matrix tube
IC pin 4 connect to R5 matrix tube
IC pin 5 connect to R6 matrix tube
IC pin 6 connect to R7 matrix tube
IC pin 7 connect to R8 matrix tube
IC pin 9 connect to IC pin 7
Arduino pin 3 connect to pin 14 of IC 74HC595
104
Code
int latchPin = 4; // pis connected to shift byte O[8]={0x0, 0x3c, 0x42, 0x42, 0x42,
registors 0x42, 0x42, 0x3c};
int clockPin = 5; void setup() {
int dataPin = 3; Serial.begin(9600); // Serial begin
int pins [8] = {6, 7, 8, 9, 10, 11, 12, 13}; // pinMode(latchPin, OUTPUT); // Pin
common cathode pins configuration
byte G[8]={0x0, 0x3c, 0x42, 0x40, 0x4e, pinMode(clockPin, OUTPUT);
0x42, 0x42, 0x3c}; pinMode(dataPin, OUTPUT);
byte E[8] = {0x0, 0x7e, 0x40, 0x40, 0x7c, for (int i = 0; i < 8; i++) { // for loop is used
0x40, 0x40, 0x7e}; to configure common cathodes
byte R[8]={0x0, 0x7c, 0x42, 0x42, 0x7c, pinMode(pins[i], OUTPUT);
0x48, 0x44, 0x42}; digitalWrite(pins[i], HIGH);
byte A[8] = { B00000000, }
B00011000,
B00100100, }
B01000010,
B01111110, void loop() {
B01000010,
B01000010,
B00000000
}; for (int k = 0; k < 100; k++) { // showing
byte L[8]={0x0, 0x40, 0x40, 0x40, 0x40, each letter for 1 second
0x40, 0x40, 0x7c}; display_char(G);
byte D[8] = {0x0, 0x7c, 0x42, 0x42, 0x42,
0x42, 0x42, 0x7c}; }
byte I[8]={0x0, 0x70, 0x20, 0x20, 0x20,
0x20, 0x20, 0x70}; for (int k = 0; k < 100; k++) {
byte N[8]={0x0, 0x42, 0x62, 0x72, 0x5a, display_char(E);
0x4e, 0x46, 0x42}; }
byte blank[8] = { B00000000,
B00000000, for (int k = 0; k < 100; k++) {
B00000000, display_char(R);
B00000000,
B00000000, }
B00000000, for (int k = 0; k < 100; k++) {
B00000000, display_char(A);
B00000000
}; }
byte H[8]={0x0, 0x42, 0x42, 0x42, 0x7e, for (int k = 0; k < 100; k++) {
0x42, 0x42, 0x42}; display_char(L);
105
Activity 2.9
A box with RFID and I2C LCD
Components
Arduino Uno
RFID reader (generic)
SG90 Micro-servo motor
Male/Female Jumper wires
Breadboard
DFRobot 12C 16x2 Arduino LCD Display Module
Procedures
RFID GND connect to Arduino Uno pin GND
RFID pin RST connect to Arduino pin 9
RFID 3.3v connect to Arduino pin 3.3v
RFID MISO connect to Arduino pin 12
RFID MOSI connect to Arduino pin 11
RFID SCK connect to Arduino pin 13
RFID SDA connect to Arduino pin 10
LCD GND connect to Arduino GND
LCD VCC connect to power supply
LCD SDA connect to Arduino pin 4
LCD SCL connect to Arduino pin 5
Servo GND connect to Arduino GND
Servo power supply connect to breadboard power supply
Servo signal connect to Arduino pin 3
Code
#include <deprecated.h> MFRC522 mfrc522(SS_PIN, RST_PIN);
#include <MFRC522.h> Servo myServo;
#include <MFRC522Extended.h>
#include <require_cpp11.h> int *aux;
int card1[4];
#include <MFRC522.h> int flag = 0;
int led = 13;
#include <SPI.h> int cnt = 0;
#include <MFRC522.h>
#include <Wire.h> void setup() {
#include <LiquidCrystal_I2C.h> pinMode(led, OUTPUT);
#include <Servo.h>
LiquidCrystal_I2C lcd(0x27, 16, 2); lcd.begin();
#define SS_PIN 10 lcd.backlight();
#define RST_PIN 9 SPI.begin();
107
mfrc522.PCD_Init();
lcd.print(" Bring the card closer together");
lcd.setCursor(0, 1); for (byte i = 0; i < mfrc522.uid.size; i++)
lcd.print(" For Access "); {
if (aux[i] == card1[i])
myServo.attach(3); cnt++;
myServo.write(0); }
}
if (cnt == mfrc522.uid.size - 1)
void loop() { {
lcd.clear();
if ( ! mfrc522.PICC_IsNewCardPresent()) lcd.print(" ACCESS ");
{ lcd.setCursor(0, 1);
return; lcd.print(" PERMIT ");
} delay(200);
myServo.write(180);
if ( ! mfrc522.PICC_ReadCardSerial()) { delay(5000);
return; myServo.write(0);
} }
else
{
lcd.clear();
for (byte i = 0; i < mfrc522.uid.size; i++) { lcd.print(" ACCESS ");
aux[i] = mfrc522.uid.uidByte[i]; lcd.setCursor(0, 1);
} lcd.print(" FORBIDDEN ");
if (flag == 0) delay(2000);
{ }
lcd.clear();
lcd.print(" Card UID: "); }
lcd.setCursor(0, 1);
for (byte i = 0; i < mfrc522.uid.size; i++) lcd.clear();
{ lcd.print(" Bring the card closer together");
card1[i] = aux[i]; lcd.setCursor(0, 1);
lcd.print( card1[i], DEC); lcd.print(" For Access ");
lcd.print( " "); cnt = 0;
flag = 1; }
}
delay(3000);
lcd.clear();
lcd.print(" Bring the card closer together");
lcd.setCursor(0, 1);
lcd.print(" For Access ");
}
else {
108
CURRICULUM VITAE
109
Curriculum Vitae
Personal Information
Curriculum Vitae
Personal Information
Curriculum Vitae
Personal Information
Curriculum Vitae
Personal Information
Curriculum Vitae
Personal Information
Curriculum Vitae
Personal Information
Curriculum Vitae
Personal Information
Curriculum Vitae
Personal Information
Curriculum Vitae
Personal Information