Automated Classroom Magnetic Door Lock with Attendance Monitoring System using Radio Frequency...
-
Upload
james-paul-bernardo -
Category
Education
-
view
78 -
download
3
Transcript of Automated Classroom Magnetic Door Lock with Attendance Monitoring System using Radio Frequency...
1
CHAPTER I
INTRODUCTION
Background of the Study
This chapter includes the statemetn of the objectives, significance and scope of
the study.
Automated attendance monitoring and security access and control in every
institution is indeed essential. With this, the institutions can keep track on their students
and teachers’ absences and tardiness. This could also benefit the institution in saving
money and paper works, time and effort while at the same time molding students
producing more quality and discipline graduates as well as in monitoring and increasing
teachers’ productivity and performance.
Good attendance record could mean productive performance. However, tardiness
and absenteeism preclude teachers especially students in having complete attendance
resulting into low student grades and unfavorable post performances review. It is
important to keep into note that attendance and its significance should be taught to
students. Attendance is part of a students’ cumulative record. It is essential that good
school attendance habits be established for later years when students seek employment.
Traditionally, the monitoring of attendances is highly relied on the human’s effort
and attention like the school dean assigned checker and the teachers. However, cases like
the loss of checkers copy, human errors, erasures, inaccuracy, considerations and
transparency could vary to the credibility of the record holder and that could also add up
to the administrative stress.
2
There are several institutions all over the world had already adopted and used
attendance monitoring system and classroom security automation to compellingly
improve discipline and provide security. There are in fact several ways on doing
attendance monitoring nowadays. This can be done either writing it in log books, using
Bundy clocks or punch cards, also using computerized systems such as smart cards,
biometrics, barcodes and Radio Frequency Identification (RFID) tags. According to
Hamid, H. (2010), RFID has been used to access control in many different areas, from
asset tracking to limiting access to restricted areas. Although the use of RFID systems in
educational institutions is not new, it is intended to show how the use of it came to solve
daily problems in other educational institutions. RFID is an automatic identification
method, relying on storing and remotely retrieving data using devices called RFID tags or
transponders, thus the RFID is a wireless identification that normally comprises RFID
Reader and RFID Tag. Hence, RFID is another suitable way or remedy that can be used
in developing attendance monitoring system and security access and maintenance in
solving institutional problems.
Tiong Sing, G.C. (2012) described Automatic Access Control System using
Student Identification Card Based on RFID Technology, the system has multiple
functions and objectives. The first function is to provide security to help and support their
university police to keep track of every entry activity in every student’s hostel rooms,
offices, facilities and classrooms that prevents any theft activity and easily identify
students or user who are registered on their system. The system contributed and replaced
their conventional door locking mechanism with simple key interlock automated door
security system controlled by RFID. The second function is it automatically record
3
students’ attendance during class schedule while the teacher could maintain and print out
the students’ attendance record. The system server was able to maintain and monitor both
functions and brought a positive and drastic measure result in obtaining their objectives.
In the Philippines, an institution had also adapted the use of RFID technology in
attendance monitoring with Web- Portal and SMS. The system captures student RFID
upon entrance allowing the parents to monitor their children’s presence inside the campus
everyday. The system also provides a parent-portal web-based system tool to monitor the
rank and grade of their child or children on a specific subject using a web-based system.
Thus, the system could notify the parents if their child needs an immediate action or
follow up together with the school teacher and the guidance counselor, Baltazar, Et. Al.
(2012).
The Attendance Monitoring System using RFID of the Notre Dame of Tacurong
College is a centralized system that monitors and records employee’s daily time record.
The system automates the recording of the time-in and time-out of every employee using
RFID. This method helped save time, paper, effort and the DTR in-charge from hassle in
generating and merging salary reports and the total of late and absences of all employees.
In the College Department of Notre Dame of Tacurong College, an institution
located at the Central Mindanao, is also having similar problems concerning attendance
monitoring, But another particular problem of the school is their administrative overhead
of every college classroom security. As an institution that has modern set-up, fully air-
conditioned classrooms, problems unconsciously arise during every unsupervised student
entry that are using its classrooms, and unit’s which leads into improper electricity
consumption and wastage. This is because there was no present additional security
4
measures installed that could prevent unsupervised entry or worst from a possible theft of
any class room units. The classroom only has normal door knob and door lock keys
which are left open during class hours that is why students can freely spend their free
time inside open classrooms charging up their gadgets or refreshing themselves from the
city’s unfavorable hot climate.
The College of Arts and Sciences and Education (CAS-ED) assigned working
students to check the attendance of every teachers evey period. This repetetive task of the
working students is a hassle and tiresome for them to regularly perform the room-to-room
routine. The dean entrusted the checker to keep the attendance record, and then later
summarized to check the performance of every teachers in terms of attendance. However,
the process is time consuming for the office to prepare. Sometimes it led to inconsistency.
The teachers are using the conventional way of recording student attendance in
paper or logbook manually while doing the traditional process of roll-calling names
which is basically time consuming and is indeed troublesome for the teachers. This
affects both teachers and students as time is spent on roll-calling, checking and verifying
students’ names that is supposedly intended for lesson. The student attendance record of
the teacher is kept. After every semester, the teacher summarizes and prepares a report
that will be submitted to the dean. It is a slow and stressful process that could sometimes
trigger human errors and could possibly result’s into inaccuracy and misplacement of
record which leads to inconsistency.
Along with this, the proponents conducted a study on Automated Classroom
Magnetic Door Lock with Attendance Monitoring System using Radio Frequency
Identification. The study could lower the stated problems based on this research
5
hypothesis by implementing the research in using a fail-safe type of electromagnetic door
lock controlled by microcontroller and radio frequency identification technology.
Objectives
General Objective
This study aimed’s to develop an Automated Classroom Magnetic Door Lock
with Attendance Monitoring System using Radio Frequency Identification for Notre
Dame of Tacurong College.
Specific Objectives
Specifically, the study aims to:
1. Design an algorithm to facilitate the attendance automation and classroom
security entry access.
2. Design and implement a database structure for data storage which will hold all
the data and information.
3. Design a miniature prototype model to simulate the attendance monitoring
system and classroom magnetic door lock security feature.
6
Significance of the Study
The result of this study on Automated Classroom Magnetic Door Lock with
Attendance Monitoring System using Radio Frequency Identification is beneficial to the
following stakeholders.
To the Notre Dame of Tacurong College, The research could benefit the
institution in maintenaining classrooms in providing security which will limit student
entry as well as usage of every college classroom facilities which could impose
observation in the consumption of energy during class days operation, hence, decreasing
the school’s electricity bill.
To the College Dean’s Office, the office may no longer require working students
to manually deal the room-to-room attendance checking and consolidation of records just
to create necessary reports needed by the school for evaluation. Hence, the system may
help save time, loads of paper works, man power and energy. In using the attendance
monitoring system, the dean could easily track and monitor the performance and the
attendance records of every teacher using the Reports Form in the system. Through this
Reports Form, the system allows the Dean to view and print records.
To the School Physical Plant and Logistics Office, the electromagnetic door lock
security feature may aid the janitorial personnel to improve the condition of classroom
maintenance. This may also help school security personnel which are under the
maintenance office in carrying out their duty from manually checking the college Smith
Building’s classrooms that have valuable units.
7
To the College Teachers, They won’t need any log-books to do the manual
attendance recording. They can easily keep track, monitor and record students’ tardiness
and absences allowing them to monitor their students’ performances. The system can
automatically count, summarize and print the attendance percentage of every student at
the end of every semester providing them with ease during the production of reports
instead of creating it manually. Furthermore, it could help the teachers to refrain from
manual writing and calling student’s name individually that consumes valuable time
during a class session.
To the College Students, the students could easily tap their RFID’s during class
schedules while the system automatically captures their RFID’s and count it as part of
their tardiness and absences’ record. These data are directly counted inside the system
that is stored inside the database. Through the system’s attendance monitoring and
classroom security feature it may assist in molding and in embedding discipline
especially to the students of Bachelor of Computer Science of the College Department to
avoid rule deviation, tardiness, cutting of classes and other unethical misconduct patterns
which students commonly do before or every after class sessions. Hence, it helps the
students to adopt and practice punctuality, professionalism and adhere to proper school
ethics and conduct.
To the Parents and Student Guardians, they could be easily informed about their
childrens' school performance through the reports taken from the system given by the
school teacher or the school administrator. The report contains the student’s attendance
records in which the school could use it as a basis for a student referral to the guidance
office to undergo a counseling in preventing any further cause and effect detrimental to
8
career and reputation of both student and parents or guardians inside and outside the
campus.
To the Bachelor of Science in Computer Science Program, this research may also
contribute to the Bachelor of Science in Computer Science Program in providing them
new ideas and insights in more advanced and effective algorithm formulation in the field
of software development.
To the Future Researchers, this may be considered as their basis for their future
studies, explorations developments in the fields of security and attendance monitoring
system and for new or other purpose and possibilities using the RFID technology. The
results and findings of this study may give them some necessary information which they
need for their study related to the proposed.
Scope of the Study
This chapter presents the scope and the capabilities of the proposed research
system.
The study focused mainly in the development of Automated Classroom Magnetic
Door Lock with Attendance Monitoring System using Radio Frequency Identification
Technology. The study was implemented in every College classroom of Smith Building
of Notre Dame of Tacurong College, City of Tacurong. The system was made to record
teachers’ and students’ attendances, classroom entry and exit logs, calculation of
tardiness and absences.
9
The system had the capability to retain current and previous records which could
be used for future educational reference, entry log history or for security references. Only
the system administrator was authorized to create and update subjects and schedules and
assign teachers and students to it. Also, the system administrator had the authority to
create system users, enroll student and teachers’ basic details that was then linked to their
every RFID’s.
The College Dean had limited access to the system. The dean can only view
teachers’ and students’ attendance records and their statuses. The teachers were limited
only to viewing students’ attendance records, students’ status. Both the Dean and
Teachers can access the system using their assigned passwords. They were also allowed
to print reports based on summary of the records of their main variables.
Furthermore, in order to achieve the researcher’s objectives, the proponents will
created two (2) miniature classroom doors which will served as the prototype model for
the simulation of the system and its operation in order to showcase and attest its features
and capabilities. The proponents could achieve the following goals by combining
hardware and software. The system will used Microsoft Visual Studio 2015 Community
Edition and its MSsql Local Database as its application software. Its hardware
components included Gizduino v.5 for RFID Reader and RFID Card Communication,
Arduino Uno to control Electromagnetic lock devices providing security and restriction
on every classroom doors, 4x4 Keypad buttons for security override and 16x2 LCD for
entry and attendance log status display. All hardware, aside from electromagnetic lock
were placed into a 14 inches single wood board to hold every device. The wood board
was covered by a glass frame according to its size securing all the wirings and devices.
10
The proposed system did not have a backup battery to operate and assist the system
operation during power interruptions.
Definition of Terms
To firmly understand the study, the following terms are contextually and
operationally defined:
Administrator refers to the person who is in-charge of the system and
maintenance and the person responsible for the encoding of the teacher and student
details to the local database server.
Attendance Monitoring refers to the recording of time in and out of teachers and
students using the system.
Algorithm refers to the set of rules used in the system which specifies in solving
and handling virtual and hardware task and operation.
Database refers to the software installed in the centralized computer server that
holds and stores all the user information for attendance monitoring and door access and
control.
Centralized Computer Server refers to the computer which contains the
application software and the local database. This also serves as the main brain of the
attendance monitoring that receives data, transmits, and commands to the hardware
devices.
11
Electromagnetic Lock refers to the door security device installed on every
classroom door that operates using electric current passing through electromagnet which
creates a locking action securing a door.
Magnetize / De-magnetized refers to the state of the electromagnetic door lock
either the device is supplied of power or not.
Notre Dame of Tacurong College refers to the institution where the proposed
system is to be applied.
Passive RFID Card refers to one of the main components that carries the user’s
information with authentic serial codes that is linked to the information of every end user
of the system being detected using an RFID reader.
Pin Code refers to the four (4) set of characters used in keypad inputto manually
open the classroom door.
RFID tag refers to the microchip an inside the RFID card that holds authentic
serial codes.
RFID Reader refers to the device that detects and reads information from the
RFID tag.
System User refers to the teacher, dean and working student who use the proposed
system for viewing and printing records.
12
CHAPTER 2
REVIEW OF RELATED LITERATURES ANS STUDIES
This chapter presents the relevant literature and studies related to the proposed
system from different authors and books that may help in the development of the
proposed study.
According to Chow, H. et, al. (2012), RFID is a perfect solution which had
a problem in security and monitoring the attendance. In recent years, there has
been considerable interest in employing radio frequency identification (RFID)
technology to support supply chain management for various industries and in
institution, according to Chi-Kong Chan, The RFID technology system provides a
cost-effective solution to some pragmatic requirements and technical challenges.
A study in radio frequency identification based attendance system has also been
developed in Bharti Vidhyapeeth College, Pune,India. The system is intended to
automate the recording of student attendances by simply tapping the given student RFID
to the reader during class entry. Also, their other objective is to eliminate human errors
made by teachers during and to prevent students from their tardiness and absenteeism, et,
al. Tapasvee, M. (2014).
Another type of automatic attendance system using fingerprint verification
technique was proposed by Chitresh, S. and Amit K. (2010). The fingerprint technique
verification was achieved using extraction of abnormal point on the ridge of user’s
fingerprint or minutiae technique. The verification confirms the authenticity of an
13
authorized user by performing one to one comparison of a captured fingerprint template
against the stored templates in the database. The proposed automatic attendance system
signals either true or false based on logical result of previous one to one verification of
person’s authenticity.
Moreover, RFID based Attendance Management System has been developed by
Shashank Shukla, Shailee Shah, Pooja Save from the Department of Information
Technology, Thakur College of Engineering & Technology in Mumbai University, India.
Their attendance monitoring system can automatically capture student's attendance by
flashing their student card at the RFID reader, thus solving the problems in unnecessary
consumption of class time by the students to find and sign their name on the attendance
sheet, mistakenly or purposely sign another student's name and misplacement of
attendance sheet.This is the main motive of their 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 was is one of the key factors in improving the quality of teaching and monitoring
their students' performance. Besides, this system provided valuable online 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.
Furthermore, another study relating to security access has been made by Nor
Amiyana Binti, M.A. (2011) from Universiti Teknikal Malaysia Melaka which is entitled
Attendance and Access Control System Using RFID System designed specially for
Companies that lack in controlling employees and outsiders entry flow. People
14
(employees or outsiders) can go in and out of the company’s premises with minimal
supervision. Manual log booking and attendance system for employees and visitors has
the absolute potential of wasting valuable time since the outsiders apecially employees
needs to line up and wait their turn to tally up hand-written punch clock cards manually
while entering the company gate. The proposed system resolves the stated problems by
the use of RFID. Important records such as picture and time of entry or exit are added and
managed. The attendance system monitors and implements an access control based on the
presence of employees and visitors. The system also recorded and calculated working
hours of employees in order to pay their wages and evaluate the jobs accurately.
15
CHAPTER 3
TECHNICAL BACKGROND
In this chapter discuss the technicality of the research study by which it describes
the type of the project to be developed, parts and its functionality.
The primary purpose of an RFID system in this application area is to detect the
presence and absence of the teacher and student data to be transmitted through wiring
connection, called tag, which is read by an RFID reader and processed according to the
programmed instructions on the personal computer (PC). The proposed system provides
solution to lecture attendance problem through coordinated hardware and software design
handshaking data communications between RFID tag and RFID reader serially interfaced
to the digital computer system.
Figure 1.
Network and System Architecture.
16
Figure 1 represents the network and system architecture which comprises the
hardware and software connection of the system as a whole. In order for the system to be
fully functional, the first operation starts in registering student and teachers’ details which
is handled by the system administrator. The system administrator gathers the teachers and
students details and the serial code of their given RFID’s which will be registered in the
Teachers and Students Form for their accounts. Assuming that the subject and schedules
are already created, the admin will assign teachers and students to the schedules to the
system using MsSql Local Database system and Visual Studio 2015 application software
inside the centralized computer server.
In order for anyone to have an access to every classroom, the teachers will use
their assigned RFID’s containing their information tapping it to RFID reader. RFID
reader will convert the analog signal into digital and pass the converted data to the
GizDuino v.5 microcontroller sending it to the computer server. The system application
inside the centralized computer server will verify the received data and compares it to the
stored data inside the data base management system for user validation or filtration.
Successful log-in and log-out will be counted and stored in the database for the
attendance recording. Whether the result of a transaction either successful or not, the
programming application software with the help of the centralized computer server will
send back a signal to the GizDuino and decide whether to command or not the
electromagnetic lock to change its status and projecting message to the 16x2 LCD
successful or not. School security or maintenance personnel classroom entry will be
possible using the 4x4 universal keypad. The passcode that is being typed by any
personnel will be processed and compared inside the Arduino Uno microcontroller and its
17
pre-defined logic. Right combination of entered pic code in the Arduino Uno will will
trigger the Gizduino microcontroller to operate the relay switch that controls and cut the
power supply of the electromagnetic lock. Teachers and students attendance records
summary can be produced using the printer which is connected to the computer server.
In order to use the attendance monitoring system, Hardware and software
components of the system are required to be fully functional:
Figure 2. Passive RFID Tag (125 KHzMango).
Radio-frequency identification (RFID) contains and electronic tag or transponder
microcontroller which can hold RFID serial data, RFID uses radio waves signal to
transfer data. Tags can be read at once as long as they are passed within close enough
proximity to an RFID reader. RFID contains serial codes and which is then processed and
compared in the system using a host computer to identify the user’s information. There
are many variety of RFID that is being used in the industry but the most common types of
RFID are Passive and Active RFID. Passive RFID do not use any battery to operate
instead it leeches power from the RFID reader to become active and detectable. The
18
passive RFID operates in a low frequency, it works on 125 kHz and it has approximately
from within 4 inches up to a half meter reading range and mostly used for short reading
range applications. Kamran Ahsan, (2010). In this research, Passive RFID is used in the
operation of attendance monitoring and in classroom security access with and through
RFID Reader device.
Figure 3. GizDuino 5.0 RFID Reader.
RFID reader works as a central place for the RFID system. It reads tags data
through the RFID antennas at a certain frequency. Basically, the reader is an electronic
apparatus which produce and accept a radio signalsm. The antennas contains an attached
reader, the reader translates the tags’ radio signals through antenna which acts as a
Transceiver depending on the tags capacity. The reader consist a build-in anti-collision
schemes and a single reader can operate on multiple frequencies. As a result, these
readers are expected to collect or write data onto tag and pass it to computer systems
using USB cables to serial ports through a Gizduino or Arduino microcontroller.
19
Figure 4. GizDuino Version 5 w/ATmega328P.
In order for the centralized computer system to capture RFID card, the system
will use Gizduino to control the classroom entry and access. This device sends a signal to
the electromagnetic lock to control and change the magnetic lock’s status.
Gizduino is another version product of E-Gizmo Company similar to Arduino or
Arduino Uno. It is an open-source and programmable microcontroller development
board. You can use the Gizduino to read sensors and control things like motors and
lights. This allows you to upload programs to this board which can then interact with
things in the real world. With this, you can make devices which respond and react to the
world at large. Basically, if there is something that is in any way controlled by electricity,
the Gizduino can interface with it in some manner and even if it is not controlled by
electricity, you can probably still use things which are (like motors and electromagnets),
to interface with it.
20
Figure 5. 4x4 Universal Keypad
Universal keypad buttons is an input device that has a set of buttons arranged in a
block or "pad", these buttons are labelled with digits (numerals), symbols and
alphabetical letters. Keypad is used in the system for manual override of classroom
security for the security and maintenance personnel use. The entered pin code will be
processed to the Arduino Uno R3 microcontroller.
Figure 6. Arduino Uno Microcontroller R3.
21
Arduino Uno is an open-source electronics prototyping platform based on
flexible, easy-to-use hardware and software. Arduino can sense the environment by
receiving input from a variety of sensors and can affect its surroundings by controlling
lights, motors, and other actuators. The microcontroller on the board is programmed
using the Arduino programming language (based on Wiring). In the system, this is used
to receive data from the 4x4 universal keypad which processes and compares it to the
pre-defined programmed logic codes and transmits a signal from its digital PIN 0 to
Gizduino microcontroller Pin 11. Result of the activity will be projected to the 16x2
Liquid Crystal Display.
Figure 7. 16x2 Liquid Crystal Display 1602A.
Liquid it is a controller circuit integrated device display terminal that could be
connected to GizDuino. It could display digital output message response relay in order to
provide an interaction between the system and the user. LCD responds and displays the
characters or codes entered by school personnel that enable them to interact with the
computer server when accessing a. The LCD displays a message of teacher’s entry status
as well as a message in recording student’s attendance process if it’s granted or not.
22
Figure 8. Centralized Computer Server (PC).
In order for the system to become operational, a centralized computer server
(CCS) is needed. The computer server will serve as the front-end of the system that
provides an interface between the RFID hardware and application based system, which is
the “main brain” of the system. It is used to network multiple RFID interrogators and
GizDuino and Arduino Uno microcontrolles to centrally process input and output
information using USB wires and Serial Ports. The data that flows to computer enters
through computer serial ports. Serial ports are detected in the computer as ComPort or
Communication Ports. Personal Computer (PC) consist a running attendance monitoring
application software using Visual Studio 2015.
23
Figure 9. Visual Studio.net 2015.
VS.net (Visual Studio.NET) is an object-oriented programming language from
Microsoft. It is the .NET version of the Visual Basic (VB) programming language. Like
all .NET languages, VB.NET uses the Common Language Runtime (CLR) for program
execution. Visual Studio is used to program the attendance monitoring system that allows
the admin and user to create, read, update and delete teacher, student, subjects and
schedule details as well as in creating user and setting the user limitation and system
access to the application. Furthermore, it is also used for DTR function feature. Visual
Studio only allows and limits registered teachers, working students and dean as a user
only in previewing and printing records and reports. The information that are created and
projected or viewed in the attendance monitoring system are stored and retrieved inside
its Local Database called MsSql Local Database 2015 which is part of the package of
Visual Studio application installer.
24
Figure 10. MsSql Local Database 2015.
Database Technology is used for large scale of data. In this study, the researchers
will be dealing with data. A database is needed to store and organize information in an
easy and convenient way.
Database is a part of the centralized computer server or personal computer (PC)
that handles the storage, retrieval, and updating of data in a computer system. The
Database system contains an SQL server in which all the data will be stored. All the
information loaded to the GUI will come from the system’s Database server. This will
basically hold the entire user’s (Students and Teachers) data, class schedules, time and
other necessary information needed for attendance automation and in accessing
classroom magnetic locks. Pronounced either "Microsoft S-Q-L" or "MS Sequel," It is an
open source relational database management system. It is based on the structure query
language (SQL), which is used for adding, removing, and modifying information in the
database. Successful or failure classroom attendance and door access will vary or depend
based on the registered data inside specially for controlling door access in changing
electromagnetic lock state or statues.
25
Figure 11. Ebelco 300/600 – LED Electro Magnetic Lock (Fail-Safe).
To establish and maintain classroom security and restriction, a device called
Electro Magnetic Door lock will be the suitable component for the problem. The
Magnetic Door lock device is a simple locking device that consists of a magnetic lock
and armature plate with no moving parts and it purely works due to the magnetic field.
Therefore the magnetic lock is truly fail-safe (Power to lock). Magnetic lock or mag lock
uses an electrical current to produce a magnetic force. When a current is passed through
the coil, the magnet lock becomes magnetized. The door will be securely bonded when
the electromagnet is energized holding against the armature plate. Access control systems
are operated by peripheral device (ie.Numeric Keypads, RFID Tag and RFID Reader) to
identify the user whether access is permitted or not. Controlling multiple electromagnetic
lock in this study, it requires a printed circuit board in which transistors, resistors,
Gizduino and Arduino Uno microcontroller are all being connected to a customized
Printed Circuit Board. Using PCB, the computer server manipulate or control the flow of
electric current which supplies the electromagnetic lock’s power through
microcontrollers.
26
Figure 12. Customized Printed Circuit Board (PCB).
PCB is an electronic circuit consisting of thin strips of a conducting material such
as copper, which have been etched from a layer fixed to a flat insulating sheet called a
printed circuit board, and to which integrated circuits and other components are attached.
the board base for physically supporting and wiring the surface-mounted and socketed
components in most electronics. This customized printed circuit board holds the
microcontroller pins and other electronic devices such as 12 Volts replay, Transistor
2n2222, Resistor 4.7kohm and the Cannon M-838S power supply.
Figure 13. Self-Lock Channel 12 volts Relay.
Relay is an electromagnetic device which is used to isolate two circuits
electrically and connect them magnetically. They are very useful devices and allow one
circuit to switch another one while they are completely separate. They are often used to
interface an electronic circuit (working at a low voltage) to an electrical circuit which
works at very high voltage. For example, a relay can make a 5V DC battery circuit to
switch a 230V AC mains circuit. Thus a small sensor circuit can drive, say, a fan or an
27
electric bulb.
A relay switch can be divided into two parts: input and output. The input section
has a coil which generates magnetic field when a small voltage from an electronic circuit
is applied to it. This voltage is called the operating voltage. Commonly used relays are
available in different configuration of operating voltages like 6V, 9V, 12V, 24V etc. The
output section consists of contactors which connect or disconnect mechanically. In a
basic relay there are three contactors: normally open (NO), normally closed (NC) and
common (COM). At no input state, the COM is connected to NC. When the operating
voltage is applied the relay coil gets energized and the COM changes contact to NO. In
this study, relay is trigger by the Gizduino and Arduino Uno microcontroller. Both
microcontroller runs on 5-9 Volts, thus, the power of both microcontrollers are not
enough to trigger the 12 Volts electromagnetic lock. With the help of the transistor and a
resistor, power can be controlled and increase which is enough voltage for the relay.
Through transistor and a resistor, the 5-9 volts power from the microcontrollers will be
converted. Thus, allowing it to either change the connection status of the 12 volts relay in
controlling the flow of the current supply powering the electromagnetic lock. To further
define, The 2N2222 transistor is a common NPN bipolar junction transistor (BJT) used
for general purpose low-power amplifying or switching applications. It is designed for
low to medium current, low power, medium voltage, and can operate at moderately high
speeds. It was originally made in the TO-18 metal can as shown in the picture. A 4.7kΩ
resistor has yellow, purple, and red stripes in that order. The last stripe represents the
tolerance. Gold means ±5%.
28
Figure 14. Potentiometer 10kOhm.
Figure 14 is the measuring instrument called a potentiometer is essentially a
voltage divider used for measuring electric potential (voltage); the component is an
implementation of the same principle, hence its name. Potentiometers are commonly used
to control electrical devices such as volume controls on audio equipment. This is used as
a peripheral device or the Liquid Crystal Display (LCD), it controls the intensity by
adjusting the potentiometer which affects the voltage flow or supply.
Figure 15. Gizduino v.5 and Arduino Uno microcontroller programming
languages.
29
In order to control software and hardware devices, microcontroller must be
prgrammed using Arduino 1.0.1 and Adruino 1.6.7. it is needed for Gizduino v.5 and
Arduino Uno in order to establish, communicate with other devices and to the computer.
Arduino 1.0.1 and Adruino 1.6.7. are version types of programming languages that
contains libraries, syntax and includes presets of codes for deferent devices such as for
displaying and controlling.
Figure 16. Printer.
A printer is a piece of hardware that is connected to the computer server. It
accepts text and graphic output from centralized computer server (computer) and prints
the information to paper. Using this device, it will allow the system administrator, teacher
especially the College Dean to print attendance records on paper. To do its work, a
printer must be connected to a computer.
30
CHAPTER IV
METHODOLOGY
This chapter highlights the techniques and tools used in the proposed study. It
includes the Operational Diagram, Context and Physical Data Flow Diagram, Entity
Relationship Diagram, the Developmental Approach, Schedule and Timeline of activities,
and the Budgetary Outlay and Cost Management.
Operational Diagram:
31
Figure 17. Operational Diagram of Automated Classroom Magnetic Door Lock
with Attendance Monitoring System using Radio Frequency Identification.
Figure 17 shows how the Automated Classroom Magnetic Door Lock with
Attendance Monitoring System using Radio Frequency Identification works. The system
operation starts during the Users Tapping of their RFID’s assuming that the teachers’ and
students’ information of the current school year has been registered in the Centralized
Computer Server in its Database by the system administrator.
In order to access and use a classroom, the Teacher must be the first user to tap-in
using his or her assigned RFID to the RFID Reader device. The system will compare,
validate and record the teacher’s RFID and log-in information to the Database
Management System. The result of the teacher’s access transaction will then trigger the
Centralized Computer Server to send a signal to operate the Gizduino microcontroller
activating the Electromagnetic Door Lock’s status to its de-magnetized mode.
Changing the electromagnetic lock status, the system then activates the attendance
recording feature for the teachers and students in a particular class schedule. The students
can now tap their RFID’s to the RFID reader for recording students’ log-in. both teacher
and student entry access and attendance recording are prompted by the 16x2 Liquid
Crystal Display whether for or failed successful transaction. When leaving the classroom
after the class session, the students are obliged to re-tap their RFID’s for their log-out
information. To close a classroom and to magnetize the magnetic lock, the teachers must
32
also re-tap their RFID’s. This action will record teachers and students log-in and log-out
while the system calculates and summarizes both users’ attendance records to the
system’s database and count as one record entry for the day.
Instances such as emergency or classroom maintenance and security, school
personnel without having or any issued RFID with them can access the classrooms using
the universal keypad by typing the personnel or classroom access code. When De-
magnetizing the lock status, the system allocates five (5) seconds to return to its
magnetized status. The teacher and students can open the door from the inside using the
push button exit device. Monitoring System Using Radio Frequency Identification is
divided into three (3) sub parts that explains more about the system.
Figure 18. Accessing Classroom and Attendance Monitoring using Radio
Frequency Identification.
33
Figure 18 shows that using the teacher RFID tag serves as the key to trigger the
system to de-magnetize the electromagnetic lock which opens the classroom door and
activates the system’s attendance monitoring.
To start the process, the teacher will first tap his/her RFID card to the RFID
reader. Using his or her RFID card, this allows the teacher to communicate with the
centralized computer server and its system application through RFID reader and
Gizduino microcontroller. The RFID reader will capture the analog signal from the
teacher’s RFID and sends the information to the Gizduino microcontroller converting it
into digital data in a way for a computer could understand. Relaying this digital data to
the centralized computer server allows the system to analyze and compare if the detected
RFID card information is from a teacher or not, this is made possible using the records
inside its Local Database system. This process allows the system logic to decide and
trigger whether to suspend the power supply de-magnetizing the electromagnetic lock.
After the teacher logs-in, the student can now tap their RFID card for their
individual log-in attendances. After the class session has ended, all students must be the
first to tap out before their teacher in order for the system to record it as a student log-out.
This process is followed by the teacher tapping out his or her RFID card telling the
system that the class session has already ended. This will stop the attendance monitoring
and recording system on a particular subject schedule and signals the system to trigger
the gizduino microcontroller to magnetize the electromagnetic lock closing the door.
Finally, the system will count and summarize the attendance records of both teachers and
students whether it’s a tardy late or an absent.
34
Instances like students tapping their RFID card first will only limit them from
opening the classroom door. Also, for the students who failed to log-out before their
teacher will be counted as absent. Students and teachers who failed to log-in before the
allocated time of a class schedule will be counted as late.
Figure 19. Using Push Button inside the Classroom.
In this figure, the push button will be used inside the classroom. Either students or
the teacher can use the push button for their personal necessities, emergencies and/or
evacuation. The push button is connected to the Printed Circuit Board (PCB) through PIN
35
4 triggering the 12 volts (V) Relay Direct Current (DC) cutting the power supply to
unlock the Electromagnetic Lock State.
Figure 20. Overriding the System Using 4x4 Universal Keypad.
In the figure shown above, the security or maintenance personnel can access
every classroom using the given passcode to override the classroom door lock security
system for classroom maintenance purposes. Using keypad, the security personnel can
also access the classroom for monitoring, security or emergency situation purposes.
The Electromagnetic lock status is lock and powered by default as well as the
16x2 LCD message displaying “Welcome, Pin Code:”. If the personnel would like to
access any classroom, the personnel will type his or her passcode using the universal
keypad located outside the classroom. Upon typing his or her four (4) digit passcode
enter by pressing “hashtag” (#), the Arduino Uno microcontroller will then compare the
entered passcode to the data programmed inside Arduino Uno. If the passcode is correct,
the Arduino Uno microcontroller will display “Pin Code Correct!, Door is Open.” and at
36
the same time it will throw a data through its PIN 0 to the PIN 12 of Gizduino
microcontroller disabling the power supply of the Electromagnetic Lock through PIN 13.
After disabling the magnetic locks power supply, there will be 5 seconds delay in order
for the Arduino Uno microcontroller to reactivate the 12 volts (V) Relay resupplying the
12 volts(V) power supply to re-magnetizing the electromagnetic lock. Else, if the given
password by the personnel is incorrect, the Arduino Uno microcontroller will send a
digital data to the 16x2 LCD displaying a message “Wrong Pin Code, Please try again”
and the Electromagnetic Lock won’t be unlocked.
37
System Analysis
Figure 21. Context Data Flow Diagram (Level 0)
38
Figure 22. Data Flow Diagram (Level 1)
39
Figure 23. Entity Relationship Diagram (ERD).
40
Developmental Approach
This section discusses the steps or procedures that the researchers made in making
the study, Automated Classroom Magnetic Door Lock with Attendance Monitoring
System using Radio Frequency Identification.
Procedures
The attainment of the objectives was the main concern of this study and the
following processes were made in order to produce a successful project. The researchers
used the Waterfall Approach where different phases of the process and sequences were
determined, followed and stated in order to complete the research project:
1. The researchers determined the problems of the study, formulated the objectives,
identified the scope of the proposed study and formulated a solution to the problems
determined.
2. The researchers planned to create an Automated Classroom Magnetic Door Lock
with Attendance Monitoring System using Radio Frequency Identification.
3. The researchers determined the different devices needed and checked its availability
to materialize the proposed project.
4. The researchers determined Middleware and Programming Languages to be used
was identified and chosen for the study with the supervision of the thesis adviser.
41
5. After identifying the hardware and software needed for the development, the
researchers started developing the system to determine the functionality and
compatibility of the devices.
6. The researchers compiled, simulated and tested the program together with the
devices after the system development was done.
7. Changes were made for better improvement after testing the compatibility of the
devices and the software, the researchers found out the problems that occurred
during the test then later debugged the system.
8. The researchers checked the system’s stability to know if the objectives were
obtained.
9. Since the testing was proved successful, the presentation of project documentation
and the entire system was presented.
Table 1. Hardware and Software Requirements
Particular Specification
HARDWARE
Desktop Computer(Computer Server)
Windows 7 Home Premium, Professional, or UltimateCore i5 Processor, 4 GB RAM, 500 GB or higher, 512 MB Video Memory or higher.
e-Gizmo RFID Card Reader
Operating Voltage: 7.5 to 9V DCOn-board IC: MCU ATmega168Address Bit Amount: 7 bitsMaximum Cards Registered: 100 (from internal memory alone) Radio Frequency: 125KHzRFID Card Type: 64bitPCB Dimensions: 46mm x 64mm
gizDuino Version 5 Power Input External: 8V-12V USB:5VMicrocontroller : ATmega 328/328P
42
w/ATmega328P Debubger Port: ICSPI/O port: 20 I/Os (14 Digital I/O & 6 Analog InDC Power Output: 3.3VOn-board Crystal: 16MHzPCB Dimensions: 2.7 x 2.1 inch
Arduino Uno R3ATmega328 microcontrollerInput voltage: 7-12V14 Digital I/O Pins (6 PWM outputs)6 Analog Inputs,32k Flash Memory, 16Mhz Clock Speed.
16x2 LCD 1602ADisplay Mode: STN, BLUBDisplay Format: 16 Character x 2 Line,Viewing Direction: 6 O’Clock,Input Data: 4-Bits or 8-Bits interface available,Display Font: 5 x 8 Dots,Power Supply: Single Power Supply (5V±10%),Driving Scheme: 1/16Duty,1/5Bias,Backlight: SideLED: WHITE
(Ebelco) Electro Magnetic Lock
EM-300LED:Voltage Input : 12 VDC / 24 VDC,Current Draw: 12V / 320mA; 24V / 160mA (±5%)Holding Force: Up to 300 lbs (136 kg)Hall Effect Contact: SPDT rated 2A at 24 VDCAnti-Rust Surface Treatment : Blue Zinc PlatingOperating Temperature: 0~55° C ( 32~131° F)Operating Humidity: 0~95% ( non-condensing)Weight (Magnet): 0.7 kg (±1%)Dimensions : Magnet: (L)210x(W)35x(T)21 mmArmature: (L)130x(W)33x(T)11 mm
EM-600LED:Voltage Input : 12 VDC / 24 VDCCurrent Draw: 12V / 500mA; 24V / 250mA (±5%)Holding Force: Up to 600 lbs (272 kg)Hall Effect Contact: SPDT rated 2A at 24 VDCAnti-Rust Surface Treatment: Blue Zinc PlatingOperating Temperature: 0~55° C ( 32~131° F)
43
Operating Humidity: 0~95% ( non-condensing)Weight (Magnet): 1.1 kg (±1%)Dimensions: Magnet: (L)250x(W)42x(T)25 mmArmature: (L)180x(W)38x(T)11 mm
4x4 Matrix Universal Keypad
Ultra-thin design, Adhesive backing, BASIC Stamp 2 and Propeller P8X32A microcontrollersMaximum Rating: 24 VDC, 30 mAInterface: 8-pin access to 4x4 matrix Operating Temperature: 32 to 122 °F (0 to 50°C)Dimensions: Keypad, 2.7 x 3.0 in (6.9 x 7.6 cm)Cable: 0.78 x 3.5 in (2.0 x 8.8 cm)
12v RelayRated voltage: 12VDCRated current: 33.3 mACoil resistance: 360 ΩPower consumption: Approx. 400 mW
PotentiometerType: Surface mount chipTolerance: ±25%Operating voltage: 20VDC or AC RMS, max.Resolution: essentially infinitePower rating: .1W @ 70°C max.Weight: 0.11gmValues: 10K
Transistor 2n2222Collector Emitter Voltage: 30Collector Base Voltage: 60Emitter Base Voltage: 5Collector Current Continuous: 800Operating & Storage Junction Temperature Range: -65 to +200
Radio Frequency Identification (RFID) Card
TAG:Type: PassiveRF Frequency: 125KHzRange: 4 inches
44
Chip: UniqueMemory: 64bit read only memoryPHYSICAL:Size: 85.6mm x 53.98mm,Material: PVC
SOFTWARES
Visual Studio Community 2015
Windows 7 Service Pack 1, Windows 10, Windows 8.1, or Windows 81.6 GHz or faster processor1 GB of RAM (1.5 GB if running on a virtual machine)4 GB of available hard disk space5400 RPM hard disk driveDirectX 9-capable video card that runs at 1024 x 768 or higher display resolution
MsSQL Local Database Server 2015
MsSQL Server 2015 requires Super-VGA (800x600) or higher resolution monitorMinimum of 6 GB of available hard-disk space, x86 Processor: 1.0 GHz, x64 Processor: 1.4 GHz, Recommended: 2.0 GHz or fasterx64 Processor: AMD Opteron, AMD Athlon 64, Intel Xeon with Intel EM64T support, Intel Pentium IV with EM64T supportx86 Processor: Pentium III-compatible processoror faster
Arduino Software Integrated Development Environment (IDE)*ARDUINO 1.0.1*ARDUINO UNO 1.6.7
512 MB of RAMOS Platform: x86/x64 bit Operating System, Windows Operating System, Mac OS X, Linux.
45
Schedule and Timeline
This section shows the calendar of activities done to accomplish the study, Automated Classroom Magnetic Door Lock
with Attendance Monitoring System using Radio Frequency Identification. It shows all events scheduled for particular weeks
of the month, for S.Y. 2015-2016.
Table 2. Schedule and Timeline
46
Budgetary Outlay
Budget and proper cost management including the available resources and the
cost of the device and software tools needed for the system must be considered. The
Table below shows the budgetary outlay which includes the list of all items and the total
cost needed to accomplish the project.
Table 3. List of Hardware and Software Tools and Equipment
PARTICULAR QUANTIY UNIT PRICE TOTAL
HARDWARE
Desktop Computer 1 17,000.00 17,000.00
RFID Reader 2 690.00 1, 380.00
Gizduino v.5.0 2 662.00 1, 324.00
Arduino Uno R3 2 750.00 1, 500.00
16x2 LCD 1602A 2 250.00 500.00
Power Supply: Cannon M-838S 2 200.00 400.00
600-LED Fail Safe Electro-Magnetic
Lock1 2, 390.00 2, 390.00
300-LED Fail Safe Electro-Magnetic
Lock1 1, 990.00 1, 990.00
40-Pin 2.54mm (Male-Female Socket
Row)2 50.00 100.00
47
4x4 Universal Matrix Array Keypad 2 150.00 300.00
12v Relay 2 75.00 150.00
10K Potentiometer 2 30.00 60.00
Printed Circuit Board 1 50.00 50.00
Connecting Wires/Solid Wires 2 80.00 160.00
Transistor 2n2222 2 50.00 100.00
Resistor 4.7kOhm 2 1.00 2.00
Gigabyte Multi-USB Port 1 150.00 150.00
Push Button 2 25.00 50.00
Glass Cover and Frame 1 180.00 180.00
2-Swing Doors (Prototype Model) 1 620.00 620.00
SOFTWARE
Microsoft Visual Studio 2015
Community Edition (Free)1 0.00 0.00
MsSql 2015 Local Database (Free) 1 0.00 0.00
Arduino 1.0.1 (Free) 1 0.00 0.00
Arduino Uno (Free) 1 0.00 0.00
PL-2303 CheckChipVersion Tool
Program v1.0.0.61 0.00 0.00
TOTAL: 28,406.00
48
CHAPTER 5
RESULTS AND DISCUSSION
Figure 24. Automated Classroom Magnetic Door Lock with Attendance Monitoring
System using Radio Frequency Identification frequency.
Figure 24 is the whole structure and conceptual model of the entire system.
Administrator, Student, Teacher, and Personnel are the main users of the system. Thus,
the Admin will facilitate or control the system inside the desktop computer, the student
and teacher will tap their RFID tag in order for them to register their personal information
and login or logout between classes. The RFID Reader that connects to Gizduino will
serve as bridge between RFID tags and desktop computer. The data that comes from
RFID tags and student and teacher personal information will be saved into database that
was pre-installed in the desktop computer using the visual studio. The personnel will
enter his/her four (4) digit passcode in universal keypad, the Arduino Uno will evaluate
the passcode entered to its own secret passcode. If the passcode is correct, the Arduino
Uno will send a data to the LCD that will display a message, the Arduino Uno will send a
49
signal to Gizduino that controls the Printed Circuit Board (PCB) to trigger the
electromagnetic lock to open. Else if the passcode entered in Arduino Uno is wrong, the
Arduino Uno will not send a signal Gizduino, the electromagnetic locked will remain
lock until the correct passcode will be entered.
Specific Objective 1. Design an algorithm to facilitate the attendance automation
and classroom security entry access.
50
Figure 25. Algorithm flowchart for teacher attendance monitoring and classroom security
access and entry.
Figure 25. shows the process flow for teachers in using the system. The User
(teacher) would tap his or her RFID card to the RFID Reader then the data will pass
through Gizduino to the Computer. This is the first security level of the system in
controlling the door lock status. After the data has entered the system, the application will
compare and check the RFID tag data to the MsSql 2015 Local Database and verifies if
the user’s RFID card is a teacher’s RFID or not, otherwise, the system will deny access
and prompts the user as unregistered displaying the second message as door status as
locked maintaining it as closed. If the tapped RFID of the user is identified as teacher’s
RFID, the system will activate its second level of security function. The system will
checked if the detected teacher’s RFID has a class schedule on a specific time. If there
was, the system will automatically record it as attendance and treats it as teachers log-in
inside the Local Database Server displaying a message while at the same time changing
de-magnetizing electromagnetic lock opening the door allowing the teacher and student
to enter the classroom.
During this state, the system’s attendance monitoring for student is activated
allowing students to tap their RFID’s for their log-in. Before or during the end of the
class session, the students are required to tap again their RFID’s for student attendance
log-out. The second time the teacher taps his or her RFID, this activates the
electromagnetic lock into magnetize state securing the door and displaying a message.
This also treats the teacher’s second tap as log-out and records it to the database.
51
Figure 26. Algorithm flowchart for student attendance monitoring.
Figure 26 shows the process flow for student attendance monitoring and
recording. After the teacher tapped in and activated the attendance recording system for
the students, the students would tap their individual RFID’s to the RFID reader in order
for the system to compare it to the local database. If the students’ RFID tag data matches
the record inside the local database, it will then verify if the student is enrolled on the
class schedule in order to treat it as log-in in the system and displays Log-in success
52
message, otherwise it prompts the student an access denied message which is a failure in
recording attendance log-in.
In order for the system to consider a counted student attendance, the system must
consider a pair or a complete set of student log-in and log-out logical condition. This
logical condition programmed inside the system will determine if a student will be
counted as absent or not. Students who failed in tapping their RFID for log-out will be
considered by the system as absent. This is to prevent student cutting classes.
Figure 27. Algorithm flowchart for security and maintenance personnel classroom
access.
53
Figure 27 shows the process flow in accessing classroom security by overriding it
using set of programmed codes. Security and maintenance personnel of the school will
type the access codes which is a combination of four numbers and pressing “#” special
character. By pressing “#” special character, the entered pin code will be processed and
validated by the microcontroller. Correct pin code sets the electromagnetic status to de-
magnetized mode and releases its lock while displaying a “Welcome, Door is Open”
message projected to the 16x2 liquid crystal display (LCD) allowing any school
personnel to enter the room. Otherwise, the door will remain closed and the
electromagnetic lock stays on its magnetized state maintaining its lock mode.
Specific Objective 2. Design and implement a database structure for data storage
which will hold all the data and information.
54
Figure 28. Database Structure of Automated Classroom Magnetic Door Lock with
Attendance Monitoring System using Radio Frequency Identification.
Figure 28 illustrates that the system administrator is the only person who is
authorized to register student and teacher RFID and basic information details to the
system in MsSql 2015 Local Database inside Visual Studio 2015. To do this, the
administrator will log-in as a user that has full access on the Main Form of the system
using the Authentication Form. The admin will use the Teacher and Student Registration
Forms to add their individual information to the system. The administrator will also
register their every RFID’s using a separate RFID Reader. These students and teachers
RFID’s are linked to their individual registered accounts in order for the teachers and
students to use and connect the attendance monitoring system.
Specific Objective 3. Design a miniature prototype model to simulate the
attendance monitoring system and classroom magnetic door lock security feature.
55
Figure 29. Miniature prototype simulation model.
Fig. 29. shows how the actual simulation of accessing the door using the RFID
and recording of attendance, Push Button and Universal Keypad. The teacher’s RFID will
be used to manipulate the electromagnetic state to open and close the classroom door and
also for teachers’ attendance time in and out. Students will use their RFID cards to
register their attendances. Students’ attendance monitoring activity is made during or in
between class hours. By doing this, the system will use RFID reader to capture RFID tag
information. RFID attendance monitoring process is handled by the Gizduino
microcontroller and forwarded to the computer server. Recording attendances and
opening classroom is handled by the Visual Studio 2015. Data comparison and record
storing are processed using MsSql Local Database.
Security and maintenance personnel can access the classroom without using
RFID. It is done using keypad, 16x2 LCD and Arduino Uno. Personnel will only type a
set of pin codes using the keypad. After the entering of pin code, the 16x2 LCD will
display a message for either successful or unsuccessful activity. To control the magnetic
lock state using keypad, the command will vary on the logic programmed inside the
Arduino Uno microcontroller.
56
CHAPTER 6
CONCLUSIONS AND RECOMMENDATIONS
Conclusion
After developing the research project, the results showed the Automated
Classroom Magnetic Door Lock with Attendance Monitoring System Using Radio
Frequency Identification system satisfied the entire objectives. When it was tested, it
showed that through the attendance monitoring, the accuracy, reliability, convenience and
security satisfied the needs of the teachers and students. It only proved that proposed
study was a manageable system that is capable of recording attendance accurately and
securely in lesser time. It was consistent in terms of providing correct information and
updating of student’s and teacher’s attendance; it can be easily accessed by the school
dean. The system was specifically developed for attendance monitoring, security access
and maintenance which used a technology that is being used nowadays. The research
implied that the system was designed as user-friendly and easy to access.
Therefore, the researchers say that Automated Classroom Magnetic Door Lock
with Attendance Monitoring System using RFID system is ideal for attendance
monitoring.
57
Recommendations
After thorough study, the researchers strongly recommended the following:
1. The system should have a centralized monitoring system control capable to
network all Automated Classroom Magnetic Door Lock with Attendance
Monitoring System.
2. The system should not be limited to Microsoft Operating System (O.S.) and
Visual Studio.net platforms but should also in other platforms (i.e. Linux, Mac
O.S., iOS, Java programming software).
3. The system should also provide access to students in viewing their attendance
in the web browser or in a mobile application using the Internet.
4. The system should use two database platforms to back up all files.
5. The system should have a power backup device called Uninterruptible Power
Supply or (UPS) in case of power failure.
58
REFERENCES
Hanisah Binti Hamid (25th Nov. 2010). “RFID Based Systematic Student’s Attendance Management System”.
Geoffrey Chua Tiong Sing (5th JULY 2012).“Automatic Access Control System Using Student Identification Card Based On RFID Technology”.
Carlo V. Baltazar and Ferick John B. Ragojos (2012). “The Parent Portal and Attendance Monitoring System with SMS”.
Chi-Kong Chan, Harry K. H. Chow, Alex K. S. Ng, Henry C. B. Chan, and Vincent T. Y. Ng; (July 2012). “An RFID Case Study for Air Cargo Supply Chain Management”.
Proceedings of the International MultiConference of Engineers &; 2012, Vol. 1, p201
Tapasvee, M. Et. Al. (2014). “ Performance analysis of multi-carrier RFID systems” Bharti Vidhyapeeth College, Pune,India
Chitresh, S and Amit K. (2010), “An efficient Automatic Attendance Using Fingerprint Verification Technique”,International Journal on Computer Science and Engineering (IJCSE),Vol. 2 No. 2,pp 264-269.
Shashank Shukla, Shailee Shah, Pooja Save (No. 6, December 2013). “RFID Based Attendance Management System”. International Journal of Electricaland Computer Engineering (IJECE) Vol. 3, No. 6, December 2013, pp. 784~790 ISSN: 2088-8708
Nor Amiyana Biti Mohd Alias (2011). “Attendance and Access Control System Using RFID System”. Universiti Teknikal Malaysia Melaka, Fakulti Kejuruteraan Elektronik Dan Kejuruteraan Komputer. Borang Pengesahan Status Laporan Project Sarjana Muda II
Jun Wu Li Zhou Zhenting Xiang (2010) “The Research of RFID-Based Indoor Signal Block Positioning System Optimum Interval of Placing Tags”. ICCEA '10 Proceedings of the 2010 Second International Conference on Computer Engineering and Applications - Volume 01
59
APPENDIX A
User’s Manual
How to Log-in using User authentication?
For a user can access and use the system and its features, the user must either supply the
fields in the Authentication form by entering the User Name and Password and click
the Authenticate Button or by tapping their RFID tag, the same process goes to the
system administrator.
.For successful login, you will be directed to the main form.
60
Main Form
The system has three (3) levels of security access, first is the administrator level, which
all Forms are accessible, second is the School Dean level, which allows him or her to
access all Forms but limited to Settings Form. Lastly, the Teacher access level, which
only allow any teacher to manipulate students, subject and schedule Forms and its details.
61
How to add User/s? (Administrator Level)
The administrator can manage users using the Manage Users Account in the settings
menu. FormUserList Form will pop-up, it is where the list of user accounts are displayed
and the administrator can add edit and delete Users(Teachers and School Dean).
By clicking the Add Button or by double clicking a user record on the list, a
FormUserDetail will appear. To delete a user account, right click on the user and click
delete to remove user account including its data fields.
62
This form allows you to add or edit user details and menu form access. supply the
necessary fields and click the Save Button. Save button automatically updates the user
details.
How to add Teacher/s? (Administrator Level)
In the Main Form, click the Teacher Menu tab and choose View Teachers. This will
open the teacher’s registration form.
63
Tap in the Teacher’s RFID Tag to the RFID Reader to register its RFID data. In this
form, it also displays the list of teachers that are already registered in the system.
Clicking on the Refresh Button updates the list.
The RFID Tag data of the teacher is displayed in the Teacher RFID. Fill in the First,
Middle and the Last name textbox fields and click Save Button. To remove the name
details, click the Clear Button.
64
How to add Student/s? (Aministrator Level)
65
In the main form just click the Student menu tab and then choose View Student, the
FormStudentRegistration will show up.
After choosing the View Student menu, tap the Student’s RFID tag to register it to the
system using RFID Reader. This also displays the list of the registered students. Click
refresh to activate updates on the student list. To edit the Student details, double click on
the target student on the list to call the FormStudentDetail.
66
Supply the necessary information in the Student Detail Fields and click Save. Clear the
text fields using the Clear Button. The list of students can be seen and managed on the
schedule menu.
How to add Subject?
67
In the main form just click the Subject menu tab and then choose View
Subjects. The FormSubjectResgistration will show up.
68
The registered subjects are displayed in this form. To create another subject, click Add
Button. To delete a subject in the list, just simply right click on the selected and choose
delete. Double clicking on a subject in the list brings up the FormSubjectCreate, this
will allow you to edit the subject details or its data fields and save it using Save Button
to update it.
Fill in the subject code and subject description textboxes. Click the Save Button to
save the data. Clear Button to clear out the text fields.
69
How to add Schedule?
Go to main form just click the Schedule and then you will see the View Schedule on the
menu, and then select it.
70
FormSchedule displays the list of class schedules in the system. To add another subject,
click on the Add Button to open up the ScheduleDetails Form. Refresh Button to
update the list in case nothing appears in the list or the newly created subject.
NOTE: The schedule contains subject I.D., teachers full name, day and time.
To create a new schedule, select any registered Subject, Teacher and Day from the
respective individual dropdown combobox lists. Also, you have to define the time and
click Save Button.
71
To delete and edit in the FormSchedule form, just simply right click and choose Delete
to remove a schedule and Edit to re-open the ScheduleDetails form make do updates.
Click Manage students to open FormShowStudents.
NOTE: You can’t delete any of the schedule in the list from FormSchedule if they have
still student in the subject.
How to manage Students inside a Schedule?
By choosing the Manage Students in the FormShedule, the FormShowStudent will
appear. Select students that you want to enroll or include in a schedule.
72
To delete a student enrolled in a schedule, right click and choose delete. The Edit option
edits the number of students enrolled in a subject.
How to use the Daily Time Record or DTR? (Administrator Level)
To use the Daily Time Record (DTR) form, click the DTR Menu and choose Open DTR.
This will show the FormDTR form
.
73
During the class, the administrator enables the DTR system for in order to record the
teachers’ and students’ attendances. To open the door and to activate the electro-magnetic
lock, first, the teacher must first tap its RFID tag to the RFID Reader, this will signal the
system that the class has been started and the teacher’s attendance is automatically
recorded. Next, the students must tap their RFID tags to register their time in and time
out. Lastly, on a range of a pre-defined time in a class, the teacher must tap their RFID
tag again to signal the system that the class is finished. This process ends the recording of
any attendances and activates the electro-magnetic device to close the door.
How to manage and print Reports?
74
Choose Reports in the Menu and select either Teacher, Student and Schedule Master
Liss or Teachers nad Student Absences. This will open Report Forms based on what you
have selected.
FormTeacherPrint displays the Teachers Master List registered in the system. You
can either Print or Save the list as a text file the Teacher’s Master List.
75
In this FormStudentList, all the registered students are displayed and can be Print or
Save by clicking the Print and Save icons.
76
To view reports of student enrolled per subject, just go to Reports and choose
Schedules Master List. Here, you can use the Filter Button to either filter and view it
per subjects or per students that has similar subjects.
77
To View the total absences of teacher/s per subject, go to Reports tab menu
and choose Teachers Absences. Use the Filter Button to view the list per
Name, Sched. I.D., per day or per Total of absences.
78
To View the total absences of student/s per subject, go to Reports tab menu
and choose Students Absences. Use the Filter Button to view the list per Name
or per Total of absences.
79
APPENDIX B
Letter of Invitation for Thesis AdviserNOTRE DAME OF TACURONG COLLEGE
City of TacurongJuly 6, 2015ENGR. LOUIE ANGELO G. VILLEGAS College InstructorNotre Dame of Tacurong College
Dear Sir:
Part of the BS in Computer Science curriculum is to accomplish at least one (1) Thesis Study with software implementation for one whole year. The said study will help the students show their potentials in research writing and creating innovative software program that will contribute much to the development of BSCS department and its curriculum.
Currently, the group is conducting a research study on Automated Classroom Magnetic Door Lock with Attendance Monitoring System using Radio Frequency Identification.
In this regard, may we ask you to be our Adviser/Consultant for the above mentioned study. We believe that your expertise can be a great help throughout the group’s research work.
Thank you very much for your favorable merit to this request.
Truly yours,
BERNARDO, JAMES PAUL S. PAGMANOJA III, FEDERICO J.Researcher Researcher
GARCIA, CHRISTOPHER KING D. ROQUE, MICHEAL F.
Researcher Researcher
Noted by:(SGD) ANALIZA S. HENODIA, MIT ENGR. ACEL S. MONARES, MSITThesis Coordinator Program Head, BSCS/BSCPE
Approved by:ENGR. LOUIE ANGELO G. VILLEGAS, MSIT Thesis Adviser
80
APPENDIX C
Letter of Invitation for Thesis ReaderNOTRE DAME OF TACURONG COLLEGE
City of TacurongJuly 6, 2015MARY JANE B. TUBALADOCollege FacultyNotre Dame of Tacurong College
Dear Ma’am:
Part of the BS in Computer Science curriculum is to accomplish at least one (1) Thesis Study with software implementation for one whole year. The said study will help the students show their potentials in research writing and creating innovative software program that will contribute much to the development of BSCS department and its curriculum.
Currently, the group is conducting a research study on Automated Classroom Magnetic Door Lock with Attendance Monitoring System using Radio Frequency Identification.
In this regard, may we ask you to be our Grammarian for the above mentioned study. We believe that your expertise can be a great help throughout the group’s research work.
Thank you very much for your favorable merit to this request.
Truly yours,
BERNARDO, JAMES PAUL S. PAGMANOJA III, FEDERICO J.Researcher Researcher
GARCIA, CHRISTOPHER KING D. ROQUE, MICHEAL F.
Researcher Researcher
Noted by:(SGD) ANALIZA S. HENODIA, MIT ENGR. ACEL S. MONARES, MSITThesis Coordinator Program Head, BSCS/BSCPE
Approved by:MARY JANE B. TUBALADOThesis Grammarian
81
APPENDIX D
Application Letter for Preliminary Defense
NOTRE DAME OF TACURONG COLLEGECity of Tacurong
First Semester, S.Y. 2015-2016
July 10, 2015ANALIZA S. HENODIA, MITBSCS Thesis InstructressNotre Dame of Tacurong College
Dear Ma’am:
The group has already accomplished the three (3) Chapters of the research study and its 50-75% program output. Hence, to know the reliability and accuracy of our paper and software program, please allow us to present them on October 15, 2015 at exactly 9:00-12:00 in the AVR.
Our research study is Automated Classroom Magnetic Door Lock with Attendance Monitoring System using Radio Frequency Identification. We hope that with your approval we will be able to show the contents of our Thesis study.
Thank you very much.
Truly yours,
BERNARDO, JAMES PAUL S. PAGMANOJA III, FEDERICO J.Researcher Researcher
GARCIA, CHRISTOPHER KING D. ROQUE, MICHEAL F.
Researcher Researcher
Approved by:
(SGD) ANALIZA S. HENODIA, MIT BSCS Thesis Instructress
82
APPENDIX E
Application Letter for Chapters Defense
NOTRE DAME OF TACURONG COLLEGECity of Tacurong
Second Semester, S.Y. 2015-2016April 8, 2015
Dear Sir/Ma’am:
The group has already accomplished the five (5) Chapters of the research study,
Software, and Hardware of the system. Hence, to know the reliability and accuracy of our
paper, please allow us to present them on Monday, April 11, 2016 at exactly 9:00 a.m in
the morning.
Thank you very much.
Truly yours,
BERNARDO, JAMES PAUL S. PAGMANOJA III, FEDERICO J.Researcher Researcher
GARCIA, CHRISTOPHER KING D. ROQUE, MICHEAL F.Researcher Researcher
Approved by:
(SGD) ANALIZA S. HENODIA, MIT BSCS Thesis Instructress
Noted By:
ENGR. LOUIE ANGELO G. VILLEGASThesis Adviser
83
APPENDIX F
Application Letter for Final Defense
NOTRE DAME OF TACURONG COLLEGECity of Tacurong
Second Semester, S.Y. 2015-2016April 14, 2015
ANALIZA S. HENODIA, MIT
BSCS Thesis Instructress
Notre Dame of Tacurong College
Dear Ma’am:
The group is happy to inform you that we had already accomplished one greatest achievement in Academic life – our Thesis study which is entitled Automated Classroom Magnetic Door Lock with Attendance Monitoring System using Radio Frequency Identification.
In connection with this, we would like to apply for a Final Defense this coming April 21, 2016, at exactly 5:00 p.m., at AVR.
With your approval, we will be able to show the results and contributions of the said study to the community it covers.
Thank you very much.
Truly yours,
BERNARDO, JAMES PAUL S. PAGMANOJA III, FEDERICO J.Researcher Researcher
GARCIA, CHRISTOPHER KING D. ROQUE, MICHEAL F.Researcher Researcher Approved by:
(SGD) ANALIZA S. HENODIA, MITBSCS Thesis Instructress
84
APPENDIX G
Proponents’ Profile
JAMES PAUL S. BERNARDO2nd Block Purok 9, Tacurong CitySultan Kudarat+63-909-426-7622
PERSONAL DATA:Date of Birth : February 23, 1989 Age : 27 Place of Birth : 2nd Block Purok 9, Tacurong City, Sultan Kudarat
Nationality : Filipino Gender : Male Civil Status : Single
Person to be contacted in case of emergency: Mrs. Pilgriminda S. BernardoAddress : 2nd Block Purok 9, Tacurong City, Sultan KudaratContact Number : +63-906-719-5925
EDUCATIONAL BACKGROUND:
Elementary : Tacurong Pilot Elementary School High School : St. John Learning CenterCollege : Notre Dame of Tacurong College
AFFILIATIONS:
Philippine Society of Information Technology Students (PSITS), Member - 2014-2016JEM - 2013-2016Rotaract Club of Koronadal Community-Based, Member, Secretary, Past President, Past Assistant District Rotaract Representative. - 2010-2016
85
CHRISTOPHER KING D. GARCIABrgy. Katiku, Pres. Quirino,Sultan Kudarat+63-917-784-7850
PERSONAL DATA:Date of Birth : June 05, 1993 Age : 22 Place of Birth : Isulan, Sultan KudaratNationality : FilipinoGender : MaleCivil Status : SinglePerson to be contacted in case of emergency: Mrs. Winefreda D. GarciaAddress : Brgy. Katiku, Pres. Quirino, Sultan KudaratContact Number: +63-910-354-8868
EDUCATIONAL BACKGROUND:
Elementary : Katiku Central Elementary School High School : Notre Dame of Katiku, INC.College : Notre Dame of Dadiangas University Notre Dame of Tacurong College
AFFILIATIONS:
Philippine Society of Information Technology Students (PSITS), President -2012-2016KARATE-DO -2013-2016
86
FEDERICO J. PAGMANOJA, III60 Bonifacio Street, Tacurong City, Sultan Kudarat+63-930-065-0909
PERSONAL DATA:Date of Birth : March 25, 1993 Age : 22 Place of Birth : 60 Bonifacio Street, Tacurong City, Sultan KudaratNationality : FilipinoGender : MaleCivil Status : SinglePerson to be contacted in case of emergency: Mrs. Jocelyn J. PagmanojaAddress : 60 Bonifacio Street, Tacurong City, Sultan KudaratContact Number: +63-936-367-6840
EDUCATIONAL BACKGROUND:
Elementary : Tacurong Pilot Elementary School High School : Sultan Kudarat State University (SKSU)College : Notre Dame of Tacurong College
AFFILIATIONS:
ACES - 2012-2014Philippine Society of Information Technology Students (PSITS), Member - 2014-2016Peer Counselor - 2013-2016
87
MICHAEL F. ROQUEAurora Extension, Digos City+63-921-248-4010
PERSONAL DATA:Date of Birth : September 30, 1988 Age : 27 Place of Birth : Aurora Extension, Digos CityNationality : FilipinoGender : MaleCivil Status : SinglePerson to be contacted in case of emergency: Dr. Marlene G. FerolinoAddress : 2nd Block New Rosario, Tacurong City, Sultan KudaratContact Number: +200-3141
EDUCATIONAL BACKGROUND:
Elementary : San Miguel Elementary School High School : Aloran Trade High SchoolCollege : Notre Dame of Tacurong College
AFFILIATIONS:
Philippine Society of Information Technology Students (PSITS), Member - 2012-2016KARATE – DO - 2012-2013Peer Counselor, Member - 2013-2016
88
APPENDIX H
Source Code
FormAuthentication
Imports Encryption.AESMethod
Public Class FormAuthentication Property Message As String Private Sub btnlogin_Click(sender As Object, e As EventArgs) Handles btnlogin.Click If Auth(tbusername.Text, tbpassword.Text) Then
With Form1 sprfid.Dispose() .UserCode = tbusername.Text ClearData() .ShowDialog()
End With ElseIf tbusername.Text = "admin" And tbpassword.Text = "admin" FormUserList.Show() Else MsgBox(Message) ClearData() End If End Sub Function Auth(ByVal u As String, ByVal p As String) As Boolean Using jb As New JBContext Dim guser = (From x In jb.Users Where x.UserCode = u Select x)
If guser.Count > 0 Then If guser.First.UserPassword = Encrypt(tbpassword.Text, "s3cr3t") Then Return True Else Message = "Incorrect PAssword" Return False End If Else Message = "User does not exists!" Return False End If End Using End Function Sub ClearData() tbpassword.Clear() tbusername.Clear() End Sub End Sub
89
Private Sub PictureBox1_Click(sender As Object, e As EventArgs) Handles PictureBox1.Click End SubEnd Class
FormMain
Public Class Form1 Property UserCode As String Private Sub ViewTeachersToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ViewTeachersToolStripMenuItem.Click FormTeacherRegistration.ShowDialog() End Sub
Private Sub ViewStudentToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ViewStudentToolStripMenuItem.Click FormStudentRegistration.ShowDialog() End Sub
Private Sub ViewSubjectsToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ViewSubjectsToolStripMenuItem.Click FormSubjectRegistration.ShowDialog() End Sub
Private Sub ViewSchedulesToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ViewSchedulesToolStripMenuItem.Click FormSchedule.ShowDialog() End Sub
Private Sub OpenDTRToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles OpenDTRToolStripMenuItem.Click FormDTR.ShowDialog() End Sub
Private Sub LogoutToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles LogoutToolStripMenuItem.Click Close() End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Using jb As New JBContext Dim g_user = (From u In jb.Users Where u.UserCode = UserCode Select u).First
With g_user SettingsToolStripMenuItem.Enabled = .HasSettings StudentToolStripMenuItem.Enabled = .HasStudent TeacherToolStripMenuItem.Enabled = .HasTeacher SubjectToolStripMenuItem.Enabled = .HasSubject DTRToolStripMenuItem.Enabled = .HasDTR ReportsToolStripMenuItem.Enabled = .HasReports
90
ScheduleToolStripMenuItem.Enabled = .HasSchedule End With
End Using End Sub
Private Sub TeacherMasterListToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles TeacherMasterListToolStripMenuItem.Click FormTeacherList.ShowDialog()
End Sub
Private Sub StudentMasterListToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles StudentMasterListToolStripMenuItem.Click FormStudentList.ShowDialog()
End Sub
Private Sub SchedulesToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles SchedulesToolStripMenuItem.Click FormScheduleList.ShowDialog() End Sub
Private Sub TeachersAbsencesToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles TeachersAbsencesToolStripMenuItem.Click FormTeacherAbsences.ShowDialog() End SubEnd Class
Formexec
Public Class Formexec Property port As String Private Sub Formexec_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing SerialPort1.Dispose() End Sub
Private Sub Formexec_Load(sender As Object, e As EventArgs) Handles MyBase.Load SerialPort1.PortName = port SerialPort1.Open() SerialPort1.Write("C") Close() End SubEnd Class
FormDTR
91
Imports System.IO.Ports
Public Class FormDTR Delegate Sub settextcallback(ByVal [text] As String) Property Status As Boolean Property AttendanceId As Integer Property ScheduleId As Integer Property port As String
Sub RefreshData(ByVal attid As Integer)
Using jb As New JBContext Dim getstuds = (From ad In jb.AttendanceDetail Join s In jb.Students On ad.ADtlStd.StdId Equals s.StdId Where ad.ADtlAtt.AttId = attid Select ad.ADtlId, s.StdFName, s.StdLName, ad.ADtlDate, ad.ADtlTimeIn, ad.ADtlTimeOut).ToList With dgv .DataSource = Nothing .DataSource = getstuds End With
End Using End Sub
Private Sub tbrfid_TextChanged(sender As Object, e As EventArgs) Handles tbrfid.TextChanged
If tbrfid.Text.Length = 104 Then If isTeacher(tbrfid.Text) Then 'GetSchedule(tbrfid.Text, Now)
If sprfid1.PortName = "COM5" Then GetSchedule(tbrfid.Text, Now) sprfid1.Write("O")
End If
Else Using jb As New JBContext Dim gatt = (From a In jb.Attendance Where a.AttSchedule.ScdId = ScheduleId And a.AttStat = True Select a ) If gatt.Count > 0 Then LogAttendance(tbrfid.Text, gatt.First.AttId) tbrfid.Clear() tbrfid.Focus() Else MsgBox("No onging class.") tbrfid.Clear() tbrfid.Focus() End If
92
End Using
End If
End If 'sprfid1.Close() End Sub
Function CheckIfSched(ByVal attid As String, ByVal rfid As String) As Boolean Using jb As New JBContext Dim getatt = (From a In jb.Attendance Join s In jb.ScheduleDetails On a.AttSchedule.ScdId Equals s.DtlScd.ScdId Where a.AttId = attid And s.DtlStdId.StdRFID = rfid Select a)
If getatt.Count > 0 Then Return True Else Return False End If
End Using
End Function
Sub LogAttendance(ByVal rfid As String, ByVal attid As Integer) If CheckIfSched(attid, rfid) Then Using jb As New JBContext Dim att = (From a In jb.Attendance Where a.AttId = attid Select a).First
Dim stud = (From s In jb.Students Where s.StdRFID = rfid Select s).First
Dim c_stud = (From d In jb.AttendanceDetail Where d.ADtlAtt.AttId = attid And d.ADtlStd.StdRFID = rfid Select d)
If c_stud.Count > 0 Then
With c_stud.First .ADtlTimeOut = Now.TimeOfDay End With With jb .SaveChanges() End With
Else
Dim dtl As New AttendanceDetail With { .ADtlAtt = att,
93
.ADtlDate = Today, .ADtlTimeIn = Now.TimeOfDay, .ADtlStd = stud}
With jb .AttendanceDetail.Add(dtl) .SaveChanges() End With End If RefreshData(attid) End Using Else MsgBox("Not enrolled in this subject") End If
End Sub Private Sub ReceivedText(ByVal [text] As String) If tbrfid.InvokeRequired Then Dim x As New settextcallback(AddressOf ReceivedText) Me.BeginInvoke(x, New Object() {(text)}) Else tbrfid.Text &= [text] End If End Sub
Private Sub sprfid_DataReceived(sender As Object, e As SerialDataReceivedEventArgs) Handles sprfid1.DataReceived ReceivedText(sprfid1.ReadExisting()) port = "COM5" End Sub
Private Sub sprfid_DataReceived2(sender As Object, e As SerialDataReceivedEventArgs) Handles sprfid2.DataReceived ReceivedText(sprfid2.ReadExisting()) port = "COM6" End Sub
Sub CreateAttendance(ByVal stat As Boolean, ByVal d As Date, ByVal id As Integer) Using jb As New JBContext Dim sched = (From s In jb.Schedule Where s.ScdId = id Select s).First
dgv.DataSource = Nothing Dim att As New Attendance With { .AttDate = Today, .AttStat = stat, .AttSchedule = sched, .AttTimeOpen = Now.TimeOfDay}
With jb .Attendance.Add(att) .SaveChanges() tbstat.Text = "Ongoing" Status = True
94
tbrfid.Clear()
End With
''Insert Arduino Code to open door here
End Using End Sub
Sub UpdateAttendance(ByVal stat As Boolean, ByVal d As Date, ByVal id As Integer, ByVal attid As Integer)
'If sprfid1.PortName = "COM5" Then
Using jb As New JBContext Dim sched = (From s In jb.Schedule Where s.ScdId = id Select s).First
Dim att = (From a In jb.Attendance Where a.AttId = attid Select a).First
With att .AttStat = stat .AttTimeClose = Now.TimeOfDay End With tbstat.Text = "Finished" Status = False With jb .SaveChanges() tbrfid.Clear()
End With
'Insert arduino code to close door here
'Close() 'Formexec.port = port 'Formexec.ShowDialog() 'If sprfid1.PortName = "COM5" Then ' sprfid1.Write("C") 'End If
End Using Call closesprfid1() End Sub
Function CheckAttendance(ByVal scdid As Integer) As Boolean Using jb As New JBContext Dim getsched = (From s In jb.Attendance Where s.AttSchedule.ScdId = scdid And s.AttStat = True Select s) If getsched.Count > 0 Then
95
UpdateAttendance(False, Now, scdid, getsched.First.AttId) Else CreateAttendance(True, Now, scdid) End If End Using Return True End Function
Sub GetSchedule(ByVal rfid As String, ByVal dte As Date) Dim tme As TimeSpan = dte.TimeOfDay Dim d As String = dte.DayOfWeek Dim s As String
If d = 1 Or d = 3 Or d = 5 Then s = "MWF" Else s = "TTH" End If
Using jb As New JBContext Try Dim getsched = (From x In jb.Schedule Join t In jb.Teachers On t.ThrId Equals x.ScdThr.ThrId Join b In jb.Subjects On b.SubId Equals x.ScdSub.SubId Where x.ScdDay = s And x.ScdThr.ThrRFID = rfid And x.ScdFrmTime <= tme And x.ScdToTime >= tme Select t.ThrFName, t.ThrLName, x.ScdDay, x.ScdFrmTime, x.ScdToTime, b.SubDesc, x.ScdId, x.ScdFrmTimestr, x.ScdToTimestr)
If getsched.Count > 0 Then
With getsched.First tbteacher.Text = .ThrFName & " " & .ThrLName tbdesc.Text = .SubDesc tbsched.Text = .ScdDay & "" & .ScdFrmTime.ToString & " - " & .ScdToTime.ToString CheckAttendance(.ScdId) ScheduleId = .ScdId End With Else 'MsgBox("No schedule for today or Teacher has not opened the class yet.") End If Catch ex As Exception MsgBox(ex.Message) End Try
tbrfid.Clear()
End Using
96
End Sub
Private Sub FormDTR_Load(sender As Object, e As EventArgs) Handles MyBase.Load tbrfid.Focus()
Try
With sprfid1 .PortName = "COM5" .BaudRate = "9600" .Parity = IO.Ports.Parity.None .StopBits = IO.Ports.StopBits.One .DataBits = 8
End With '''''''sprfid1.Open() If Not sprfid1.IsOpen Then sprfid1.Open() End If
With sprfid2 .Close() .PortName = "COM6" .BaudRate = "9600" .Parity = IO.Ports.Parity.None .StopBits = IO.Ports.StopBits.One .DataBits = 8
End With ''''''' sprfid2.Open() If Not sprfid2.IsOpen Then sprfid2.Open() End If Catch ex As Exception MsgBox(ex.Message) End Try End Sub
Function isTeacher(ByVal rfid As String) As Boolean Using jb As New JBContext Dim getteacher = (From t In jb.Teachers Where t.ThrRFID = rfid Select t)
If getteacher.Count > 0 Then Return True Else Return False End If End Using End Function Private Sub FormDTR_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
97
sprfid1.Dispose() sprfid2.Dispose() End Sub
Sub closesprfid1() If sprfid1.PortName = "COM5" Then sprfid1.Close() sprfid1.Open() sprfid1.Write("C") End If End SubEnd ClassformschedDetail
Public Class FormSchedDetail Private Sub FormSchedDetail_Load(sender As Object, e As EventArgs) Handles MyBase.Load Using jb As New JBContext Dim getsubj = (From s In jb.Subjects Select s).ToList
Dim getteacher = (From t In jb.Teachers Select New With {.Id = t.ThrId, .FullName = t.ThrFName & " " & t.ThrLName}).ToList
With cmbsubj .DataSource = Nothing .DataSource = getsubj .ValueMember = "SubId" .DisplayMember = "SubDesc" End With
With cmbteacher .DataSource = Nothing .DataSource = getteacher .ValueMember = "Id" .DisplayMember = "FullName" End With End Using End Sub Function ToAMPM(ByVal t As TimeSpan) As String Dim tp As New TimeSpan(12, 00, 00) If tp > t Then Return t.ToString.Substring(0, 5) & " AM" Else Return t.Subtract(tp).ToString.Substring(0, 5) & " PM" End If
End Function Private Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click Using jb As New JBContext Dim subid As Integer = cmbsubj.SelectedValue Dim thrid As Integer = cmbteacher.SelectedValue
Dim subj = (From s In jb.Subjects Where s.SubId = subid
98
Select s).First
Dim teacher = (From t In jb.Teachers Where t.ThrId = thrid Select t).First
Dim sched As New Schedule With { .ScdDay = cmbday.Text, .ScdFrmTime = dtpfrom.Value.TimeOfDay, .ScdToTime = dtpto.Value.TimeOfDay, .ScdFrmTimestr = ToAMPM(dtpfrom.Value.TimeOfDay), .ScdToTimestr = ToAMPM(dtpto.Value.TimeOfDay), .ScdSub = subj, .ScdThr = teacher}
With jb .Schedule.Add(sched) If .SaveChanges Then MsgBox("Added") Close() End If End With End Using End SubEnd Class
FormSchedStudents
Public Class FormSchedStudents Property SchedId As Integer
Private Sub FormSchedStudents_Load(sender As Object, e As EventArgs) Handles Me.Load RefreshData() End Sub
Sub RefreshData() Using jb As New JBContext Dim getdet = (From d In jb.ScheduleDetails Where d.DtlScd.ScdId = SchedId Select d.DtlId, d.DtlScd.ScdId, d.DtlStdId.StdFName, d.DtlStdId.StdLName).ToList
With dgv .DataSource = Nothing .DataSource = getdet End With End Using End Sub
99
Private Sub btnadd_Click(sender As Object, e As EventArgs) Handles btnadd.Click With FormShowStudent .SchedId = SchedId .ShowDialog() RefreshData() End With End Sub
Private Sub DeleteToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles DeleteToolStripMenuItem.Click If dgv.SelectedRows.Count > 0 Then Dim id As Integer = dgv.SelectedRows(0).Cells(0).Value
'Try Using jb As New JBContext Dim RemoveStud = (From s In jb.ScheduleDetails Where s.DtlId = id Select s).First With jb .ScheduleDetails.Remove(RemoveStud) If .SaveChanges Then MsgBox("removed") RefreshData() End If End With End Using 'Catch ex As Exception ' MsgBox(ex.InnerException.Message) 'End Try End If End Sub
End Class
FormShowStudent
Public Class FormShowStudent Property SchedId As Integer Private Sub FormShowStudent_Load(sender As Object, e As EventArgs) Handles MyBase.Load Using jb As New JBContext Dim getstud = (From s In jb.Students Select s).ToList
With dgv .DataSource = Nothing .DataSource = getstud End With End Using End Sub
Private Sub btnSelect_Click(sender As Object, e As EventArgs) Handles btnSelect.Click If dgv.SelectedRows.Count > 0 Then Using jb As New JBContext Dim schd = (From s In jb.Schedule
100
Where s.ScdId = SchedId Select s).First
For Each row As DataGridViewRow In dgv.SelectedRows Dim studid As Integer = row.Cells(0).Value Dim stud = (From s In jb.Students Where s.StdId = studid Select s).First
Dim schedstd As New ScheduleDetail With { .DtlScd = schd, .DtlStdId = stud }
With jb .ScheduleDetails.Add(schedstd) .SaveChanges() End With Next MsgBox("Success") Close() End Using End If End SubEnd Class
FormStudentDetail
Public Class FormStudentDetail Property RFID As String Property Stat As Boolean
Private Sub FormStudentDetail_Load(sender As Object, e As EventArgs) Handles MyBase.Load Stat = Check() End Sub
Private Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click If Stat = False Then Using JB As New JBContext Dim srecord As New Student With { .StdRFID = RFID, .StdFName = tbfname.Text, .StdLName = tblname.Text, .StdMName = tbmname.Text, .StdContact = tbcontact.Text, .Address = tbaddress.Text }
With JB
101
.Students.Add(srecord) If .SaveChanges Then Clear() MsgBox("Added") Close() End If End With End Using Else Using JB As New JBContext Dim getstudent = (From s In JB.Students Where s.StdRFID = RFID Select s).First
With getstudent .StdRFID = RFID .StdFName = tbfname.Text .StdLName = tblname.Text .StdMName = tbmname.Text .StdContact = tbcontact.Text .Address = tbaddress.Text End With With JB .SaveChanges() End With Clear() MsgBox("Updated") Close()
End Using End If
End Sub
Sub Clear() tbaddress.Clear() tbcontact.Clear() tbfname.Clear() tblname.Clear() tbmname.Clear() End Sub
Private Sub btnclear_Click(sender As Object, e As EventArgs) Handles btnclear.Click Clear() End Sub
Function Check() As Boolean Using JB As New JBContext Dim getstudent = (From s In JB.Students Where s.StdRFID = RFID Select s) If getstudent.ToList.Count > 0 Then MsgBox("There is an existing record. Press OK to edit.") With getstudent.First tbrfid.Text = .StdRFID tbfname.Text = .StdFName
102
tblname.Text = .StdLName tbmname.Text = .StdMName tbaddress.Text = .Address tbcontact.Text = .StdContact End With Return True Else Clear() tbrfid.Text = RFID Return False End If End Using End FunctionEnd Class
FormStudentRegistration
Imports System.IO.Ports
Public Class FormStudentRegistration Delegate Sub settextcallback(ByVal [text] As String) Private Sub StudentIn_OutSerialPort_DataReceived(ByVal sender As System.Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles sprfid.DataReceived ReceivedText(sprfid.ReadExisting()) End Sub
Private Sub ReceivedText(ByVal [text] As String) If tbrfid.InvokeRequired Then Dim x As New settextcallback(AddressOf ReceivedText) Me.BeginInvoke(x, New Object() {(text)}) Else tbrfid.Text &= [text] End If End Sub
Private Sub tbrfid_TextChanged(sender As Object, e As EventArgs) Handles tbrfid.TextChanged If tbrfid.Text.Length = 104 Then With FormStudentDetail .RFID = tbrfid.Text.Trim .ShowDialog() RefreshData() tbrfid.Clear() End With End If End Sub
Private Sub FormStudentRegistration_Load(sender As Object, e As EventArgs) Handles MyBase.Load Try RefreshData()
103
With sprfid .PortName = "COM5" .BaudRate = "9600" .Parity = IO.Ports.Parity.None .StopBits = IO.Ports.StopBits.One .DataBits = 8
End With
If Not sprfid.IsOpen Then sprfid.Open() End If Catch ex As Exception MsgBox(ex.Message) End Try
End Sub
Sub RefreshData() Using JB As New JBContext Dim getrecords = (From s In JB.Students Select s).ToList
With dgv .DataSource = Nothing .DataSource = getrecords End With
End Using End Sub
Private Sub btnRefresh_Click(sender As Object, e As EventArgs) Handles btnRefresh.Click RefreshData() End Sub
Private Sub DeleteToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles DeleteToolStripMenuItem.Click If dgv.SelectedRows.Count > 0 Then Dim sid As Integer = dgv.SelectedRows(0).Cells(0).Value Try Using JB As New JBContext Dim getstudent = (From s In JB.Students Where s.StdId = sid).First
With JB .Students.Remove(getstudent) If .SaveChanges Then MsgBox("Removed") RefreshData() End If End With
End Using Catch ex As Exception MsgBox(ex.InnerException.Message) End Try
104
End If End Sub
Private Sub FormStudentRegistration_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing sprfid.Dispose() End Sub
Private Sub EditToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles EditToolStripMenuItem.Click If dgv.SelectedRows.Count > 0 Then With FormStudentDetail .RFID = dgv.SelectedRows(0).Cells(1).Value .ShowDialog() RefreshData()
End With End If End SubEnd Class
FormSubjectCreate
Public Class FormSubjectCreate Property SubjID As Integer Property Stat As Boolean Private Sub btnsave_Click(sender As Object, e As EventArgs) Handles btnsave.Click If Stat = True Then
Using jb As New JBContext Dim subj As New Subject With { .SubCode = tbcode.Text, .SubDesc = tbdesc.Text}
With jb .Subjects.Add(subj) If .SaveChanges Then MsgBox("Added") clear() Close() End If End With End Using Else Using jb As New JBContext Dim subj = (From s In jb.Subjects Where s.SubId = SubjID Select s).First With subj .SubCode = tbcode.Text
105
.SubDesc = tbdesc.Text End With
With jb If .SaveChanges Then MsgBox("Updated") clear() Close() End If End With End Using End If
End Sub
Sub clear() tbcode.Clear() tbdesc.Clear() End Sub
Private Sub FormSubjectCreate_Load(sender As Object, e As EventArgs) Handles Me.Load tbcode.Clear() tbdesc.Clear() If Stat = False Then Using jb As New JBContext Dim subj = (From s In jb.Subjects Where s.SubId = SubjID Select s).First With subj tbcode.Text = .SubCode tbdesc.Text = .SubDesc End With End Using End If
End Sub
Private Sub btnclear_Click(sender As Object, e As EventArgs) Handles btnclear.Click clear()
End Sub
End Class
FormSubjectRegistration
Public Class FormSubjectRegistration
106
Private Sub btnAdd_Click(sender As Object, e As EventArgs) Handles btnAdd.Click
With FormSubjectCreate .Stat = True .ShowDialog() RefreshData() End With
End Sub
Sub RefreshData() Using jb As New JBContext Dim getrecord = (From subj In jb.Subjects Select subj).ToList
With dgv .DataSource = Nothing .DataSource = getrecord End With End Using End Sub
Private Sub FormSubjectRegistration_Load(sender As Object, e As EventArgs) Handles Me.Load RefreshData() End Sub
Private Sub btnRefresh_Click(sender As Object, e As EventArgs) Handles btnRefresh.Click RefreshData() End Sub
Private Sub EditToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles EditToolStripMenuItem.Click If dgv.SelectedRows.Count > 0 Then With FormSubjectCreate .SubjID = dgv.SelectedRows(0).Cells(0).Value .Stat = False .ShowDialog() RefreshData() End With End If End Sub
Private Sub DeleteToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles DeleteToolStripMenuItem.Click If dgv.SelectedRows.Count > 0 Then Dim id As Integer = dgv.SelectedRows(0).Cells(0).Value
Try Using jb As New JBContext Dim subj = (From s In jb.Subjects Where s.SubId = id Select s).First With jb
107
.Subjects.Remove(subj) If .SaveChanges Then MsgBox("removed") RefreshData() End If End With End Using Catch ex As Exception MsgBox(ex.InnerException.Message) End Try End If End SubEnd Class
FormTeacherDetail
Public Class FormTeacherDetail
Property RFID As String Property Stat As Boolean Private Sub FormTeacherDetail_Load(sender As Object, e As EventArgs) Handles Me.Load Stat = Check() End Sub
Function Check() As Boolean Using JB As New JBContext Dim getTeacher = (From s In JB.Teachers Where s.ThrRFID = RFID Select s) If getTeacher.ToList.Count > 0 Then MsgBox("There is an existing record. Press OK to edit.") With getTeacher.First tbrfid.Text = .ThrRFID tbfname.Text = .ThrFName tblname.Text = .ThrLName tbmname.Text = .ThrMName
End With Return True Else Clear() tbrfid.Text = RFID Return False End If End Using End Function
Sub Clear()
tbfname.Clear() tblname.Clear() tbmname.Clear()
108
End Sub
Private Sub btnclear_Click(sender As Object, e As EventArgs) Handles btnclear.Click Clear()
End Sub
Private Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click If Stat = False Then Using JB As New JBContext Dim srecord As New Teacher With { .ThrRFID = RFID, .ThrFName = tbfname.Text, .ThrLName = tblname.Text, .ThrMName = tbmname.Text }
With JB .Teachers.Add(srecord) If .SaveChanges Then Clear() MsgBox("Added") Close() End If End With End Using Else Using JB As New JBContext Dim getTeacher = (From s In JB.Teachers Where s.ThrRFID = RFID Select s).First
With getTeacher .ThrRFID = RFID .ThrFName = tbfname.Text .ThrLName = tblname.Text .ThrMName = tbmname.Text
End With With JB .SaveChanges() End With Clear() MsgBox("Updated") Close()
End Using End If End SubEnd ClassFormUserDetail
Imports Encryption.AESMethod
109
Public Class FormUserDetail Property Stat As Boolean Property UID As Integer Private Sub btnsave_Click(sender As Object, e As EventArgs) Handles btnsave.Click If Stat = True Then Using jb As New JBContext Dim nuser As New User With { .UserCode = tbusername.Text, .UserPassword = Encrypt(tbpassword.Text, "s3cr3t"), .HasDTR = cbdtr.Checked, .HasReports = cbreports.Checked, .HasSchedule = cbreports.Checked, .HasSettings = cbsettings.Checked, .HasStudent = cbstudents.Checked, .HasSubject = cbsubjects.Checked, .HasTeacher = cbteachers.Checked, .UserFullName = tbfullname.Text}
With jb .Users.Add(nuser) If .SaveChanges Then MsgBox("Added") Close() End If End With End Using Else Using jb As New JBContext Dim guser = (From u In jb.Users Where u.UserId = UID Select u).First
With guser .UserFullName = tbfullname.Text .UserPassword = Encrypt(tbpassword.Text, "s3cr3t") .UserFullName = tbfullname.Text .HasReports = cbreports.Checked .HasSchedule = cbreports.Checked .HasSettings = cbsettings.Checked .HasStudent = cbstudents.Checked .HasSubject = cbsubjects.Checked .HasTeacher = cbteachers.Checked .HasDTR = cbdtr.Checked End With
With jb If .SaveChanges() Then MsgBox("Updated") End If
End With Close() End Using End If
110
End Sub
Sub ClearData() tbfullname.Clear() tbpassword.Clear() tbusername.Clear() End Sub
Private Sub FormUserDetail_Load(sender As Object, e As EventArgs) Handles MyBase.Load If Stat = False Then Using jb As New JBContext Dim guser = (From u In jb.Users Where u.UserId = UID Select u).First
With guser tbfullname.Text = .UserFullName tbpassword.Text = Decrypt(.UserPassword, "s3cr3t") tbusername.Text = .UserCode cbreports.Checked = .HasReports cbschedules.Checked = .HasSchedule cbsettings.Checked = .HasSettings cbstudents.Checked = .HasStudent cbsubjects.Checked = .HasSubject cbteachers.Checked = .HasTeacher cbdtr.Checked = .HasDTR End With End Using End If End Sub
Private Sub CheckBox7_CheckedChanged(sender As Object, e As EventArgs) Handles cbdtr.CheckedChanged End SubEnd Class
FormUserList
Public Class FormUserList Private Sub FormUserList_Load(sender As Object, e As EventArgs) Handles MyBase.Load RefreshData() End Sub
Private Sub btnAdd_Click(sender As Object, e As EventArgs) Handles btnAdd.Click FormUserDetail.Stat = True FormUserDetail.ShowDialog() RefreshData() End Sub
Sub RefreshData() Using jb As New JBContext
111
Dim listUser = (From u In jb.Users Select u.UserId, u.UserCode, u.HasSettings, u.HasDTR, u.HasReports, u.HasSchedule, u.HasStudent, u.HasSubject, u.HasTeacher).ToList
With dgv .DataSource = Nothing .DataSource = listUser End With End Using End Sub
Private Sub DeleteToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles DeleteToolStripMenuItem.Click If dgv.SelectedRows.Count > 0 Then Dim id As Integer = dgv.SelectedRows(0).Cells(0).Value
Using jb As New JBContext Dim guser = (From u In jb.Users Where u.UserId = id Select u).First
With jb .Users.Remove(guser) If .SaveChanges Then MsgBox("Removed") End If End With RefreshData() End Using End If End Sub
Private Sub EditToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles EditToolStripMenuItem.Click If dgv.SelectedRows.Count > 0 Then With FormUserDetail .Stat = False .UID = dgv.SelectedRows(0).Cells(0).Value .ShowDialog() End With RefreshData() End If
End SubEnd Class
FromSchedule
Public Class FormSchedule
112
Private Sub btnadd_Click(sender As Object, e As EventArgs) Handles btnadd.Click With FormSchedDetail .ShowDialog() RefreshData() End With End Sub
Sub RefreshData() Using jb As New JBContext Dim getrecords = (From schd In jb.Schedule Select New With { .ScdId = schd.ScdId, .SubCode = schd.ScdSub.SubCode, .ThrFullName = schd.ScdThr.ThrFName & " " & schd.ScdThr.ThrLName, .ScdDay = schd.ScdDay, .ScdFrmTime = schd.ScdFrmTimestr, .ScdToTime = schd.ScdToTimestr}).ToList
With dgv .DataSource = Nothing .DataSource = getrecords End With End Using End Sub
Private Sub FormSchedule_Load(sender As Object, e As EventArgs) Handles Me.Load RefreshData() End Sub
Private Sub DeleteToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles DeleteToolStripMenuItem.Click If dgv.SelectedRows.Count > 0 Then Try Dim sid As Integer = dgv.SelectedRows(0).Cells(0).Value Using jb As New JBContext Dim schd = (From s In jb.Schedule Where s.ScdId = sid Select s).First With jb .Schedule.Remove(schd) If .SaveChanges() Then MsgBox("Removed") RefreshData() End If End With
End Using Catch ex As Exception MsgBox(ex.Message) End Try
End If
113
End Sub
Private Sub btnrefresh_Click(sender As Object, e As EventArgs) Handles btnrefresh.Click RefreshData() End Sub
Private Sub ManageStudentsToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ManageStudentsToolStripMenuItem.Click If dgv.SelectedRows.Count > 0 Then With FormSchedStudents .SchedId = dgv.SelectedRows(0).Cells(0).Value .ShowDialog() End With End If
End SubEnd Class
TeacherRegistration
Imports System.IO.Ports
Public Class FormTeacherRegistration
Delegate Sub settextcallback(ByVal [text] As String) Private Sub StudentIn_OutSerialPort_DataReceived(ByVal sender As System.Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles sprfid.DataReceived ReceivedText(sprfid.ReadExisting()) End Sub
Private Sub ReceivedText(ByVal [text] As String) If tbrfid.InvokeRequired Then Dim x As New settextcallback(AddressOf ReceivedText) Me.Invoke(x, New Object() {(text)}) Else tbrfid.Text &= [text] End If End Sub
Private Sub tbrfid_TextChanged(sender As Object, e As EventArgs) Handles tbrfid.TextChanged If tbrfid.Text.Length = 104 Then With FormTeacherDetail .RFID = tbrfid.Text.Trim .ShowDialog() RefreshData() tbrfid.Clear() End With End If End Sub
114
Sub RefreshData() Using JB As New JBContext Dim getrecords = (From s In JB.Teachers Select s).ToList
With dgv .DataSource = Nothing .DataSource = getrecords End With
End Using End Sub
Private Sub FormTeacherRegistration_Load(sender As Object, e As EventArgs) Handles MyBase.Load Try RefreshData()
With sprfid .PortName = "COM5" .BaudRate = "9600" .Parity = IO.Ports.Parity.None .StopBits = IO.Ports.StopBits.One .DataBits = 8
End With
If Not sprfid.IsOpen Then sprfid.Open() End If Catch ex As Exception MsgBox(ex.Message) End Try
End Sub
Private Sub btnRefresh_Click(sender As Object, e As EventArgs) Handles btnRefresh.Click RefreshData() End Sub
Private Sub DeleteToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles DeleteToolStripMenuItem.Click If dgv.SelectedRows.Count > 0 Then Dim sid As Integer = dgv.SelectedRows(0).Cells(0).Value Try Using JB As New JBContext Dim getstudent = (From s In JB.Teachers Where s.ThrId = sid).First
With JB .Teachers.Remove(getstudent) If .SaveChanges Then MsgBox("Removed") RefreshData() End If End With
115
End Using Catch ex As Exception MsgBox(ex.InnerException.ToString) End Try
End If End Sub
Private Sub EditToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles EditToolStripMenuItem.Click If dgv.SelectedRows.Count > 0 Then With FormTeacherDetail .RFID = dgv.SelectedRows(0).Cells(1).Value .ShowDialog() RefreshData()
End With End If End SubEnd Class
Button and Door Lock Code (Arduino Sourcecode)
#include <SoftwareSerial.h>
SoftwareSerial RFIDReader (2,3); //(RX,TX);
const int MagneticLock = 13; //conneted to the relayint setByte;const int SW1 = 12; //variable for switch pin EMERGENCY BUTTONint switchState; //variable for switch state - PRESSED OR NOT PRESSEDconst int fromPINCode = 11; //data reciver from arduino UNO (LCD and Keypad)int isOpen;int dataReceived;
void setup() {
116
Serial.begin(9600); RFIDReader.begin(9600); pinMode(MagneticLock, OUTPUT); pinMode(SW1, INPUT); pinMode(fromPINCode, INPUT); digitalWrite(MagneticLock, HIGH);}
void loop()
{
switchState = digitalRead(SW1); isOpen = digitalRead(fromPINCode);
if (RFIDReader.available() > 0) { dataReceived = RFIDReader.read(); Serial.print(dataReceived); //Serial.print("S202"); //change everytime you upload and assign COM number } if (Serial.available() > 0) { setByte = Serial.read();
if (setByte == 'O') { digitalWrite(MagneticLock, LOW); // Serial.println("DOOR OPEN."); } if (setByte == 'C') { digitalWrite(MagneticLock, HIGH); // Serial.println("DOOR CLOSED.");
117
} }
if (switchState == LOW) { digitalWrite(MagneticLock, LOW); // Serial.println("DOOR OPEN."); delay(5000); digitalWrite(MagneticLock, HIGH); // Serial.println("DOOR CLOSED."); }
if (isOpen == LOW) { digitalWrite(MagneticLock, LOW); // Serial.println("DOOR OPEN."); delay(5000); digitalWrite(MagneticLock, HIGH); // Serial.println("DOOR CLOSED."); } }