Академический Документы
Профессиональный Документы
Культура Документы
Sponsor:
ArcelorMittal
Sponsor
Liaison:
Cliff
Barnett
Facilitator:
Nihar
Mahapatra
4/29/2015
ECE
480
–
Design
Team
7
Executive Summary
ArcelorMittal requested a new entry gate that will aid traffic flow, improve security, and
reinforce safety on their Indiana Harbor Long Carbon (IHLC) Plant. During the visit to
ArcelorMittal the team noticed the current plant entrance was very outdated and not secure. The
current system consists of only two guards that monitor the incoming and outgoing traffic flow.
Employees were granted access simply by waving their badge to the guards. This method was
deemed inadequate because with this system an unauthorized person could easily wave a false
card to the guard and gain entrance to the facilities. To improve the security of the front entrance
employees will utilize the RFID tags currently installed in their employee IDs to grant them
access through our “smart” gate. The hardware used to complete the small scale design, was an
Arduino Yun microcontroller, serving as the processing unit. A servo motor and a Parallax RFID
Card Reader were attached to the Arduino Yun as Input and Output devices. The required
software for this project is Arduino Software, which makes it easy to write and upload code to
the microcontroller through a serial port connection. After the hardware and software were
configured and uploaded, two cards with RFID tags were used to test the functionality of the
design. Only one tag was embedded in the microcontroller code as “having access.” While the
RFID reader acknowledged both cards, only the card with the tag embedded in the system would
initiate the servo motor. This is what ArcelorMittal is looking to implement as a solution at their
plant.
1
Smart
Gate
Security
ECE
480
–
Design
Team
7
Acknowledgments
Cliff Barnett: Sponsor, for providing us with insight to what ArcelorMittal was looking for. As a
result of our countless emails and meetings the team was able to jump into the project with a
clear understanding and game plan. This made it easy to adjust the design as needed.
Dr. Nihar Mahapatra: Facilitator, for his help and mentoring through the various stages of the
project. His advice and feedback contributed greatly to our project and helped us come together
as a team.
Dr. Timothy Grotjohn and Dr. Latlia Udpa: ECE 480 professors, for their help and insight
throughout the semester.
Gregory Racich: ArcelorMittal Contact, for providing us with in depth knowledge of some of the
infrastructure resources and policies at ArcelorMittal. This helped us jump into a designing a
cost effective large scale budget.
Mechanical Engineering Team: Partners, for providing us with layouts of the new entrance
designs and mounting points for our hardware.
2
Smart
Gate
Security
ECE
480
–
Design
Team
7
3
Smart
Gate
Security
ECE
480
–
Design
Team
7
4
Smart
Gate
Security
ECE
480
–
Design
Team
7
1.1
Introduction
ArcelorMittal is in need of a new updated electrical and mechanical design for the front gate
entrance at the Indiana Harbor Long Carbon plant. According to many of the ArcelorMittal
personnel, safety and security are two major concerns on and off the job. The current gate
entrance is very outdated with little to no security. This means that anyone wanting to gain
entrance has a significantly high chance of being able to do so with the current design. The goal
is to modify the current entrance to ensure all personnel entering the facilities is supposed to be
there. This is very important in meeting the objectives that ArcelorMittal has set in creating a
safer and secure entrance. In order to create a solution to their problem we will need to design an
entrance with the following: a Radio Frequency Identification card reader, and security cameras
at the entrance. Due to the nature of the project there is both a small scale and large scale model.
The small scale model will be what is presented on design day and will simulate aspects of the
large scale model. The small scale model will also be connected to the Mechanical Engineering
team’s prototype, giving the prototype life like characteristics. The large scale model however
will consist of a mechanical model and a budget for ArcelorMittal to implement or contract out
to another company.
1.2
Background
Cliff Barnett, Environmental Engineering Manager, Project Sponsor, and receiving customer of
the finished product provided the team with a tour and technical information on the card readers
used currently throughout the ArcelorMittal IHLC Plant during our site visit. From this visit
design specifications were established. The plant currently used the Matrix Systems card readers
to assist in access control to their buildings. The Matrix systems had been proven to be efficient,
familiar, and effective for the customer in the past. Since the card reader use Power over Ethernet
(PoE), the customer will have a streamlined and easy installation process. The Matrix System
card reader that was chosen for this project is the MXProx2. This card reader is capable of
controlling a gate entrance using a built in microcontroller; as well as being capable of reading
cards from 3 to 4 inches away, providing a secure entrance from the business standpoint. The
next step consists of making sure that everyone entering the facility is doing so with their own
credentials. This can be accomplished with the use of a security camera. The security camera
aspect of the project was left open ended for the group to explore. After speaking with Greg
Racich, Manager of Emergency & Security Services, the ArcelorMittal security infrastructure
technology stack was more understood. The technology stack consisted of a ExacqVision video
server which was used to record security cameras at different ArcelorMittal Plants. These servers
are configured to record up to the 80 gigabyte capacity and then overwrite the oldest files. The
compatible Internet Protocol (IP) cameras that ArcelorMittal uses with the ExacqVision server
5
Smart
Gate
Security
ECE
480
–
Design
Team
7
are Axis, Samsung, and Arecont. After careful consideration, it was decided to go with is an Axis
Q1604-E, an outdoor IP camera that utilizes PoE. Several requirements are met with this model
including day and night functionality, a proven and reliable product that has been implemented
before in ArcelorMittal’s security infrastructure, and capable of surviving the harsh weather
changes in the midwest region. The camera itself has a very small footprint in the grand scheme
of the overall design, as seen in figure 1 below.
Gate security designs in today’s society fall into two categories. Those that are manually
controlled, which are typically toll based, and those that are automatic which are automatic. The
latter has started to slowly grow and become a standard within the industry instead of the use of
tags that hang from employee’s mirrors. The limits in today’s society are typically the cost to
upgrade to this new standards. There are many companies that do not have problems with their
current method and do not have the capital readily available to upgrade parking lot entrances,
exits, or technology infrastructure. The companies that have accepted and implemented this new
business model are typically using only RFID readers at the entrances. Therefore, we are
proposing the new idea of recording the traffic flow, using security cameras, for each lane of
traffic. This will provide a new and successful method of entrance because in the case of
emergency, an emergency/security employee can look at the entrance footage and see what the
person was wearing on that given day. This does not only protect the company but improves
employee safety under extreme circumstances. Overall, this new technique will provide peace of
mind not only for the business as a whole, but employees alike.
Response code or have to register with the guards. After these steps have been completed, the
respective individual will be given the grant or deny access message. Upon exiting the plant,
each individual will scan their identification card, quick response code, or make contact with the
guard so they can be removed from the onsite table. Given the circumstances, removing them
from the table will provide a very accurate list of who is on site during an emergency. If there is
an incident, like theft or unauthorized entry, the emergency and security team will have time
stamps to narrow down who they should question. This can be seen in the fast diagram, and is
important in the successful implementation at the ArcelorMittal Indiana Harbor Long Carbon
plant.
7
Smart
Gate
Security
ECE
480
–
Design
Team
7
a. The overall efficiency will be both for employees and visitors. Instead of a truck
driver, contractor, or visitor having to get out of there car and check in with the
guards, they can scan the quick response code, sent prior to their arrival, and be
granted access fast.
Operational 30 This system will work very well This system will not work as well since
Functional: A since it will use many devices that the Raspberry Pi and Bus Camera are
description of how are used widely in today’s society more limited in overall operation.
the proposed device by both home and business owners. This system would not be accepted
will benefit the The system will be user friendly very well since the user experience
company and how since it will be able to be accessed would be challenging for a person with
well it would remotely and the camera will be average technical skills.
interface. more robust. Score: 26
Acceptance: A Score: 30
validation for how
well the solution
would be received
by the company,
user, and the
public's’
perspective.
Technical 30 The technology used in this design The technology used in this design is
Technology: The would be considered “state of the older since the camera is recorded off
amount of art” currently. The Arduino is very the bus. When the camera is connected
technology and robust in customization and to the bus there is no opening for other
support needed. The accessibility. While the IP camera devices to be interfaced. Making the
practical use of the has an infrared interface allowing design not only limited, but will be
proposed for better night vision. much larger to accomplish the task.
technology within
the company The expertise that will be needed The expertise to fix a problem with this
Knowledge: will be very minute. Many of the design will be much more technical
Evaluation of the small problems that could be faced because the manager will need to track
8
Smart
Gate
Security
ECE
480
–
Design
Team
7
needed expertise for will be able to be fixed with a quick down which microcontroller is
each step of the reboot. experiencing the problem in order to fix
project, as well as it
maintenance. Score: 20
Score: 26
This solution is very unique in that it is a very small replica compared to the current solutions
used in society. Many of the current gate security solutions utilize PoE for powering the device
and connecting it to a network. Unlike these commonly used technologies, the new prototype
will process almost everything on board except a USB connection for power and serial
monitoring. There are a few reasons that the Arduino Yun was ideal for this application.
Compared to the Raspberry Pi, the Arduino Yun was more robust and business oriented
compared to the Raspberry Pi that was more homeowner oriented. Secondly, the Arduino Yun
has an onboard wireless card which allows it to be connected to a network without sacrificing a
USB port for a wireless adapter.
Additionally, the design was chosen due to the use of a wireless camera. A wireless camera uses
the IP protocols instead of the typical USB connection. This allows for the camera to be
configured to write data to a central server. This enables videos to be stored centrally instead of a
limited amount locally, leading to more storage availability. One of the benefits of this solution
9
Smart
Gate
Security
ECE
480
–
Design
Team
7
architecture is the end user can choose how much storage to use and have the option to expand
the storage volumes as needed.
The next part of the solution is to receive an input to us for authentication. The Parallax RFID
reader will be connected to the Arduino Yun. The RFID reader will read the code embedded in
the identification card and will be fed into the overall program uploaded to the microcontroller.
Depending on the user’s access restrictions, they will either be allowed to drive onto the premise
or they will be unauthorized and not allowed to enter. As stated before, the serial viewer will also
show the string that is tied to the RFID card for any logistics that need to be analyzed for the
addition of users to the authentication list.
After an individual is authorized to access the premise, it is important that the motor works
effectively so one can get onsite efficiently. This aspect of the prototype will control the
movement of the gate. This action is built into the code, if the card is in the database, the pin is
activated and rotates the motor to an open position, wait and then close it to its starting position.
A program will be written to combine all aspects of the design and provide an effective solution.
The program will be developed on a Windows 7 laptop and the Arduino Yun software which is
readily available on the manufacturer’s website. In order to obtain a string to use for
authentication, the program will take the read value and store it in a temporary variable. The
program will also have the desired pins set for controlling each hardware device. Once the value
has been obtained it will check to see if it is valid. If it is valid, the motor will then activate and
the car would be able to drive through. However, if it is not valid the RFID reader LED will flash
and nothing will happen symbolizing an unauthorized card. The final working code can be seen
in Appendix 3.
Though the solution is very effective in the way it operates, there are some downsides when
addressing it for use in industry. Many of today’s gate designs are not managed locally at the
gate. The devices are networked using PoE and access off site information. After accessing this
information the gate then can open or close depending on the received information.
Unfortunately the constraints limited us our design prototype however, for this reason, an
industry budget was created.
10
Smart
Gate
Security
ECE
480
–
Design
Team
7
cost, and reason for purchase. These costs are those associated to MSU and not to mass produce
the design. Since it cannot be directly implemented, there is no budget for mass production of
this prototype.
Total: $167.06
Table 2 - Estimated Cost (Small Scale)
For the planned design, the team will be within the five hundred dollar budget that was
previously set forth by the MSU ECE department.
11
Smart
Gate
Security
ECE
480
–
Design
Team
7
Many challenges were faced during the course of the semester which hindered the teams desired
prototype. First, when trying to implement the python database, many errors were encountered.
Initial troubleshooting was done but was unsuccessful. This could be due to newer versions of
python with different libraries. The team decided that it would be more advantageous, for the
sake of time, to create a local database within the program. This was part of the RFID code
development to recognize which RFID card was valid. Once the RFID code was recognized the
program would call the servomotor program to activate the servo motor. In the eyes of the team,
this was a large success considering the frustration that was faced during the initial coding with
an online database. Since the database for ArcelorMittal would be the Matrix Security Server
which manages permissions and card readers, this was an acceptable solution for a design
prototype. Under the given time constraints the team was unable to order and implement a
security webcam to simulate the security aspect of the project. With the different business
projects and struggles faced with getting the RFID and motor to work, it was not feasible to get
the security camera to work. There however was research put into finding how the camera should
operate. It would be a continuous stream of video and then capture snapshots, similar to the
computer software LoJack, when motion was detected. The revised GANTT chart can be seen
below in figure 4. This is the most recent and relevant GANTT chart for the teams efforts in
designing the prototype.
12
Smart
Gate
Security
ECE
480
–
Design
Team
7
on a separate laptop. Unfortunately due to the circumstances stated above, an alternative solution
had to be sought. The new design used the Input and Output pins, along with the micro USB port.
Each piece of the prototype would be assigned a pin which corresponded with the commands in
the software. Similar to the input and output pins, the Arduino Yun has onboard ground, 3.3V
and 5V connections to power the additional hardware implemented in the prototype. These pins
can be seen in the image below on both sides of the board.
13
Smart
Gate
Security
ECE
480
–
Design
Team
7
14
Smart
Gate
Security
ECE
480
–
Design
Team
7
development environment (IDE) allowing programmers to have a vast majority of tools. The
built in tools include a source code editor, automation tools, and a debugger. Having these
resources available makes it easy to write a code and upload it to the microcontroller board.
During the course of developing a working prototype, the team utilized the source code editor
and debugger. The goal was to use the python library with the python database server, but was
unsuccessful during implementation. Therefore, the libraries that were available from Arduino
were not widely used. The software was very intuitive in aiding in the successful design of the
working Gate Security prototype.
15
Smart
Gate
Security
ECE
480
–
Design
Team
7
if(strcmp(rfid,"02006E218CC") == 0 || strcmp(rfid,"02006E2C311") == 0 );
The declared variable “rfid” holds the 10-digit character string of a scanned tag. The string
“strcmp(a, b) == 0” is a comparison command that compares the a and b strings. For
demonstration purposes, the logic and layout of the example above is valid for two strings which
were put into the built-in database. However, one strcmp directive serves only one tag string.
Foreseeably, the code could go extremely wrong if the tag information of all the employees and
visitors were to be included.
16
Smart
Gate
Security
ECE
480
–
Design
Team
7
miniscule percentage and will not cause concern. Therefore, the brute force attack protection
strategy is one that will work not only effectively but will enhance the working devices security.
The assembly of the prototype was one of the most important tasks of the design process. It not
only determined if the design was working but also aided in ensuring the success of the software.
The first step was to connect the Arduino Yun to the computer. This can be done through a USB
to microUSB cable which is not included when purchasing the microcontroller. Once recognized
by the Arduino Yun software we will need to upload the software to it. Once the software has
verified that the software was compiled and uploaded, the components can be connected. In
order to power the rfid reader we will want to connect the ground and voltage pins to the pins
stated earlier in section 3.1.2. Next, the microcontroller pins can be connected to the enable and
data transfer pins of the RFID reader. These pins are 2 and 8 respectively. Now that the RFID
reader is connected, the motor can now be connected. The motor can be powered using the
17
Smart
Gate
Security
ECE
480
–
Design
Team
7
onboard ground and power pins that were discussed in section 3.1.3 above. Once these are
connected, the last wire can be connected to pin 9 on board the microcontroller. This will control
when the motor turns on and operates the gate. The design will look similar to the schematic
below.
During the course of the semester, the team worked with the mechanical engineering team who
were responsible for redesigning the entrance of the plant. Once the electrical engineering
prototype had been complete, it was integrated into the 3D model created by the mechanical
team. This design consisted of two gates, one for entry and one for exit, which would function to
the specifications set forth by ArcelorMittal. The gate itself would have incremented latches that
function as a belt. The gate would then cycle open and close using a gear attached to the motor,
and the notches built into the gate. The gate setup can be seen in figure 10 below:
Figure 10: The motor attached and integrated with the gate
18
Smart
Gate
Security
ECE
480
–
Design
Team
7
19
Smart
Gate
Security
ECE
480
–
Design
Team
7
success rate, without any errors. This provided the team with a very confident feeling that the
prototype would serve the purpose for ArcelorMittal’s gate security.
Overall the project was a success due to the expectations of ArcelorMittal. The team expects no
failures with the execution of the deliverables that the team had produced. Besides the prototype,
ArcelorMittal was looking for a budget to be created in order to implement a large scale model.
Designing the prototype provided the insight to learn about how RFID and gate security systems
work. Besides this background information, we also gained a vast majority of information about
corporate infrastructure, safety and security. This not only enabled us to create a prototype and
budget, but a very rewarding out of classroom experience.
20
Smart
Gate
Security
ECE
480
–
Design
Team
7
Total: $274.02
Table 3 - Small Scale Costs
21
Smart
Gate
Security
ECE
480
–
Design
Team
7
Code 1 $0 $0
Total: $136.02
Table 4 - Small Scale Budget
Total: $3736.29
Table 5 - ArcelorMittal Budget
The above table does not include the hardware that they already have at ArcelorMittal’s central
office in Chicago, Illinois. This office houses the infrastructure and information technology
operations. The table below lists everything that would be utilized but not cost any additional
money.
22
Smart
Gate
Security
ECE
480
–
Design
Team
7
Product Function
Brainstorm Gate Interface to work with Arduino Yun, 4 days Mon 2/9/15 Thu 2/12/15
RFID Reader, servo motor
Order All Parts (Microcontroller, Motor, Camera) 1 day Fri 2/13/15 Fri 2/13/15
Interface RFID and Motor with microcontroller 3 days Wed 2/25/15 Fri 2/27/15
Debug User Interface and simplification of apps 5 days Thu 3/12/15 Wed 3/18/15
23
Smart
Gate
Security
ECE
480
–
Design
Team
7
Lauren
Poole
Due to the nature of our project and the limited amount of technical work that went into
completing this project my technical involvement was primarily a supportive role. My portion of
the overall project, as defined by the lab coordinator, was to research the various components
needed to configure the solution; RFID reader, RFID tag, microcontroller, and motor and
research, which would be best for our design and most cost efficient. The purpose of the
microcontroller was to serve as the link between the database, the RFID reader, and motor. After
doing our own individual research on various microcontrollers we came together to discuss our
finding. Trevor had found the Arduino Yun. Not only was the Arduino Yun cost efficient, but
also came with a code that did exactly what we wanted our program to do. Unfortunately, the
code did not work initially, after researching all day trying to detect the problems Bingyang took
the code home to do further work, we had downloaded the program to his computer only. When
looking for a RFID reader and tag it was from my research on the RFID system that we knew we
wanted a passive RFID tag with an active RFID reader. Passive tags required no battery and had
a longer lifespan. We then simply chose the RFID reader that was recommended for that specific
tag.
Although not involved heavily in the direct coding of our gate system it was through my
supportive role I was able to get a thorough understanding of our system and how it compared to
our initial goals. My understanding assisted me greatly in constructing all documents (proposal,
24
Smart
Gate
Security
ECE
480
–
Design
Team
7
fast diagram, design issue, poster, etc.), ensuring that they not only met all requirements, but also
were clear and easy to interpret.
Trevor
Emerick
I had a very involved technical role in the design and implementation of our gate security
solution. As a manager, I felt it was crucial to have a complete understanding of every technical
aspect of the project. As well as the technical design roles, I also had a large role in writing, and
presenting technical documentation throughout the semester. I also was responsible for leading
meetings with our sponsor, facilitator, and professors. In the early stages, I did a vast amount of
research to understand the capabilities of the microcontroller, servo motor, and RFID reader.
After the first few weeks of class, I had found a desired solution for the problem at hand.
Unfortunately, this had to be scrapped later in the semester because of some database
communication problems. The next step I took was to go back to the drawing board and research
different solutions that were currently out there, whether they were with the same or different
microcontrollers. I then checked to see how we could model our solution off one of these models.
We found a program that we could model, which involved a user to control the entry after an
RFID scan. The work flow was then analyzed and built by the team for our design, which was to
be automatic. I worked with Bingyang to implement this solution with the servo motor and RFID
reader. Once it was working we could incorporate it with the ME team’s design.
The next role I played was a liaison between our team and other personnel at
ArcelorMittal. ArcelorMittal wanted a budget for the overall cost to implement an industrial
model of our design. Therefore, I contacted the Manager of the Security and Emergencies
services team, Greg Racich. Greg was able to provide me with information on the current
security infrastructure in place at ArcelorMittal in Chicago, IL. This allowed me to narrow down
what brands we could use for cameras, RFID readers, and the peripherals. I was able to lower the
budget and use servers that were already implemented throughout the company. This budget will
be highly useful for ArcelorMittal when they receive bids to build an industrial size gate security
system.
Jazmine Gaymon
Our project was a bit different from typical ECE capstone projects. We were asked by
ArcelorMittal to partner with the Mechanical Engineering Senior Design Team to come up with
a security gate system and provide research for how much an entirely new system would cost.
Therefore, our project did not require an abundance of technical work to implement our design
project.
25
Smart
Gate
Security
ECE
480
–
Design
Team
7
I had an active role throughout the entire designing process of our security gate system.
My primary technical role was research. I helped with researching the proper microcontroller to
use for our design. We were originally looking at the Raspberry Pi microcontroller but opted for
the Arduino Yun microcontroller because it was more robust and was easier to create and upload
scripts using the Arduino 1.6.2 software.
As the presentation coordinator, it was vital that I researched every aspect of the
hardware we decided to use in order to understand critical points in our project. This was
important for the sake of constructing PowerPoint presentations and making sure concepts were
clear and concise for the audience. In the engineering industry, it is extremely important to know
what you are talking about and be able to communicate through technical writing when
proposing a new design.
I aided in troubleshooting as well. When we first began to assemble our design, I helped
wire the hardware components to produce a prototype. The prototype did not work. After
debugging and looking for problems in the code, we looked back at our prototype and found that
the wires were not connected correctly. The original schematic that we decided to use was
incorrect due to the fact that we had a different microcontroller made by the same company.
I also helped Lauren with technical writing, making sure all our documents flowed
accordingly for audience comprehension.
Bingyang
Wu
I was responsible for most works done to create the prototype. The prototype consists of a
servomotor, an Arduino Yun microcontroller. The design had not been working as expected at
the first time it was tested. I initially thought that it must be the problem of the code and spent
roughly a week to finally find out that the pins were not correctly wired. Then I got the wiring
problems fixed so that the reader could then be able to properly read the tags. One of the lessons
I can take out of it is to be extra careful while looking for errors and never ignore the simplest
possible issues. For the next few days, Trevor and I tried to get the servomotor to work. However,
one of the issues we encountered was that the motor would keep running for whatever speed and
angle values assigned once it was attached on the specific pin. After conducting some research
on the Internet, Trevor and I realized that the only way to stop the servomotor in Arduino is to
detach it from the pin temporarily. Therefore, we managed to write the proper code that turns on
the motor and allows the motor to spin at desired speed, in specified direction, and for allocated
time duration.
Next, I worked with Trevor to put all elements together and adjusted the code that
enables the servomotor to respond correctly to different tags being swiped. This goal was
26
Smart
Gate
Security
ECE
480
–
Design
Team
7
achieved simply by a string comparison of the tag strings with the preset allowed strings. The
last step was to add up more functions, such as display the name of the tag holder; count the
number of people entered or exit the plant, to the system.
As the web designer, I was responsible for creating the team project website. The website
was built using Adobe Muse CC 2014. It is a user-friendly tool that meets the needs of both
amateur and advanced users. There are basically two ways to publish the website. What I did is
to export all the files from Muse and uploaded them to the specified server hosting all the
websites from ECE 480 course. The team website I am building is of a simple and
straightforward navigation style without any fancy effects. The visitors can easily get an idea of
what our project is about from a glance of it.
27
Smart
Gate
Security
ECE
480
–
Design
Team
7
Appendix 2 – References
"AXIS Q16 Network Camera Series For Demanding Lighting Conditions." Web. 27 Apr. 2015.
<http://classic.www.axis.com/en/files/datasheet/ds_q16_59000_en_150223_lo.pdf>.
28
Smart
Gate
Security
ECE
480
–
Design
Team
7
// RFID Settings
#include <SoftwareSerial.h>
// NewSoftSerial needs pin in and out, but RFID Reader only has IN
int pinUnused = 12;
int pinRfidEnable = 2;
int pinRfidSerialIn = 8;
int baudRateRfid = 2400;
SoftwareSerial rfidSerial(pinRfidSerialIn, pinUnused);
// Servo settings
#include <Servo.h>
Servo servo;
int pinServoStart = 9;
int pinServoStop = 7;
int servoLockedRotation = 150;
int servoUnlockedRotation = 30;
int unlockTime = 1500;
void emptySerialBuffers()
{
// This empties the serial buffers to prevent repeat reads
while(rfidSerial.available() > 0) {
rfidSerial.read();
}
while(Serial.available() > 0) {
Serial.read();
}
29
Smart
Gate
Security
ECE
480
–
Design
Team
7
void setup()
{
// Serial to computer
Serial.begin(9600);
// Set up servo
servo.attach(pinServoStop);
void loop()
{
// Read serial from RFID reader
if(rfidSerial.available() > 0)
{
val = rfidSerial.read();
30
Smart
Gate
Security
ECE
480
–
Design
Team
7
if(bytesRead == 10)
{
// Send RFID tag to computer
//Serial.println(rfid);
digitalWrite(pinRfidEnable, HIGH);
31
Smart
Gate
Security
ECE
480
–
Design
Team
7
Serial.println("Access Denied");
digitalWrite(pinRfidEnable, HIGH);
// Wait a moment so we can't brute force crack
delay(300);
digitalWrite(pinRfidEnable, LOW);
}
}
//bytesRead = 0;
}
}
// Reactivate RFID antenna
digitalWrite(pinRfidEnable, LOW);
}
32
Smart
Gate
Security
ECE
480
–
Design
Team
7
// RFID Settings
#include <SoftwareSerial.h>
// NewSoftSerial needs pin in and out, but RFID Reader only has IN
int pinUnused = 12;
int pinRfidEnable = 2;
int pinRfidSerialIn = 8;
int baudRateRfid = 2400;
SoftwareSerial rfidSerial(pinRfidSerialIn, pinUnused);
// Servo settings
#include <Servo.h>
Servo servo;
int pinServoStart = 9;
int pinServoStop = 7;
int servoLockedRotation = 30;
int servoUnlockedRotation = 150;
int unlockTime = 1400;
void emptySerialBuffers()
{
// This empties the serial buffers to prevent repeat reads
while(rfidSerial.available() > 0) {
rfidSerial.read();
}
while(Serial.available() > 0) {
Serial.read();
}
}
33
Smart
Gate
Security
ECE
480
–
Design
Team
7
void setup()
{
// Serial to computer
Serial.begin(9600);
// Set up servo
servo.attach(pinServoStop);
void loop()
{
// Read serial from RFID reader
if(rfidSerial.available() > 0)
{
val = rfidSerial.read();
34
Smart
Gate
Security
ECE
480
–
Design
Team
7
bytesRead++;
}
}
if(bytesRead == 10)
{
// Send RFID tag to computer
//Serial.println(rfid);
digitalWrite(pinRfidEnable, HIGH);
35
Smart
Gate
Security
ECE
480
–
Design
Team
7
}
else
{
// Acess Denied
// Keep the reader from reading repeatedly
Serial.println("Access Denied");
digitalWrite(pinRfidEnable, HIGH);
// Wait a moment so we can't brute force crack
delay(300);
digitalWrite(pinRfidEnable, LOW);
}
}
//bytesRead = 0;
}
}
// Reactivate RFID antenna
digitalWrite(pinRfidEnable, LOW);
}
36
Smart
Gate
Security