Вы находитесь на странице: 1из 37

MICHIGAN

 STATE  UNIVERSITY  COLLEGE  OF  ENGINEERING  

Smart  Gate  Security  


ECE  480  Senior  Design  Project  Final  Report  
Team  7    

Trevor  Emerick    |Lauren  Poole  |  Jazmine  Gaymon  |  Bingyang  Wu  


 

 
 
 
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  

Table  of  Contents  

Executive  Summary ...................................................................................................................... 1  


Acknowledgements ...................................................................................................................... 2  
Chapter  1  -­‐  Introduction  &  Background ....................................................................................... 5  
1.1  Introduction  .......................................................................................................................................  5  
1.2  Background  .......................................................................................................................................  5  
Chapter  2  -­‐  Finding  a  Solution ...................................................................................................... 6  
2.1  FAST  Diagram   ...................................................................................................................................  6  
2.2  House  of  Quality  .................................................................................................................................  7  
2.3  Conceptual  Design  Matrix  .................................................................................................................  8  
2.4  Chosen  Solution  .................................................................................................................................  9  
2.5  Estimated  Cost  .................................................................................................................................  10  
2.6  GANTT  Chart  ....................................................................................................................................  11  
Chapter  3  -­‐  Final  Design ............................................................................................................. 12  
3.1  Hardware  Setup  ...............................................................................................................................  12  
3.1.1  Setup  Arduino  Yun  ....................................................................................................................  12  
3.1.2  Setup  RFID  Reader  ....................................................................................................................  13  
3.1.3  Setup  Servo  Motor  ....................................................................................................................  14  
3.2  Software  Setup  .................................................................................................................................  14  
3.2.1  Arduino  Software  ......................................................................................................................  14  
3.3  Software  Design  ...........................................................................................................................  15  
3.3.1  Built-­‐in  Database  ......................................................................................................................  16  
3.3.2  Checking  Database  for  Access  ..................................................................................................  16  
3.3.3  Brute  Force  Attack  Protection  ..................................................................................................  16  
3.4  Design  Issues  and  Solutions  .............................................................................................................  17  
Chapter  4  -­‐  Assembling  &  Testing .............................................................................................. 17  
4.1  Assembling  the  Prototype  ................................................................................................................  17  
4.2  Testing  &  Proof  of  Functionality  .....................................................................................................  19  
Chapter  5  -­‐  Summary  and  Conclusion ........................................................................................ 20  
5.1  Summary  and  Conclusions  ..............................................................................................................  20  
5.2  Success  and  Failures  ........................................................................................................................  20  

3
Smart  Gate  Security    
    ECE  480  –  Design  Team  7  

5.3  Suggestions  for  the  Future  ..............................................................................................................  21  


5.4  Small  Scale  Final  Costs  ....................................................................................................................  21  
5.5  Final  Budget  .....................................................................................................................................  22  
5.5.1  Small  Scale  (Team  7  Design)  ....................................................................................................  22  
5.5.2  ArcelorMittal  Budget  ................................................................................................................  22  
5.6  Final  Schedule  ..................................................................................................................................  23  
Appendix  1  -­‐  Individual  Contributions ....................................................................................... 24  
Lauren  Poole  ..........................................................................................................................................  24  
Trevor  Emerick  ......................................................................................................................................  25  
Jazmine  Gaymon  ....................................................................................................................................  25  
Bingyang  Wu  .........................................................................................................................................  26  
Appendix  2  –  References ............................................................................................................. 28  
Appendix  3  -­‐  Technical  Documents ............................................................................................ 29  
Final  Code  (Entering  Gate)  ...................................................................................................................  29  
Final  Code  (Exit  Gate)  ...........................................................................................................................  33  

4
Smart  Gate  Security    
    ECE  480  –  Design  Team  7  

Chapter  1  -­‐  Introduction  &  Background  

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.

Figure 1: Specification Design of the Axis Q1604-e camera.

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.

Chapter  2  -­‐  Finding  a  Solution  

2.1  FAST  Diagram  


The overall goal of the project, as shown in the fast diagram, was to create a gate entrance that
was “smart”. The fast diagram below is for the theoretical small scale model. However there are
many similarities to the large scale model, which would be simpler and can be broken down into
two main tasks. A RFID tag needs to be read, compared to an active database, and cause a visual
of the individual to be recorded. This can be accomplished by using an Matrix System MXProx2
card reader, which will obtain the tag code from the employees identification card. This will be
sent over the PoE connection that is used also to provide power to the card reader. During this
time the IP camera will record the employee so there is a visual representation of every employee
on site for that day. However if a visitor, contractor or trucker arrives to the plant, they will go
through a similar process except instead of a RFID card being read, they will receive a Quick
6
Smart  Gate  Security    
    ECE  480  –  Design  Team  7  

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.

Figure 2: FAST Diagram

2.2  House  of  Quality  


In order to determine the most critical customer requirements the house of quality approach was
used. These requirements are as follows:
1. Improvement of Entrance Security
a. The use of the RFID reader will provide additional security to the plant entrance.
This will replace the waving of identification cards to the guards without contact.
Now there will be a virtual contact point between the employee and the matrix
server, which will verify the employee's identification.
2. Improve Employee Safety
a. With the ability to track when employees are entering and leaving the plant,
employees will be working in a safer environment. If anything were to happen,
security would be able to compile a list of personnel still on the premises very
quickly.
3. Increase Entrance Efficiency

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.

2.3  Conceptual  Design  Matrix  


The below table was used to determine which method should be pursued for designing a small
scale prototype.

Criteria Weight Arduino/Wireless IP Camera Raspberry Pi/Bus Camera


(%)

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

Economic 30 300+ 350+


The overall cost for
the proposed design
and the amount the
business will Score: 25 Score: 23
recoup.

Timeline 10 5 to 7 weeks 6-8 weeks


Amount of time to
deliver the proposed
solution effectively. Score: 10 Score: 9

Rank 100 x> 91 x> 78

Table 1 - Design Feasibility Matrix

2.4  Chosen  Solution  


The team decided that the best solution was to use an Arduino Yun microcontroller as the
processing unit for the gate controller and an IP Camera. This will then be connected to the input
and output hardware. The computer will be used for code development and serial command
window to track when RFID card is scanned.

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.

2.5  Estimated  Cost  


During the building of this prototype there were limited costs to the MSU ECE department.
Some of the resources used during the design process had no associated cost. These consisted of
a dell laptop computer and the Arduino Yun Software. With these two systems coupled together,
the team had the means to develop a working program. Since all of the team members are
students, the additional man hours needed for development are not billable. However, there were
some costs in designing the prototype which are listed in the table below with the product name,

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.

Product Cost Reasoning

Arduino Yun $75.95 Processing Unit

Servo Motor $13.99 Gate Motor

Logitech HD Webcam C310 $32.12 Safety Monitoring

RFID Reader $44.99 Input Device

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.

2.6  GANTT  Chart  


The GANTT Chart below, in Figure 3, is what the team was aiming to meet in the final design.
This included a database, RFID reader, servo motor, webcam, and Arduino Yun microcontroller.
Each aspect of the overall prototype would have been met from security to safety. The path in
red is the immediate path for the success in designing a prototype. Unfortunately the first project
plan was not met due to some design constraints that we could not address with the timespan
given.

Figure 3: GANTT Chart

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.

Figure 4: Revised GANTT Chart

Chapter  3  -­‐  Final  Design  

3.1  Hardware  Setup  


3.1.1  Setup  Arduino  Yun  
The Arduino Yun is a microcontroller board that has not only Input and Output pins but is also
capable of being networked wirelessly or through an ethernet port. Initially the plan was to
incorporate and use the networking capabilities to communicate with a python database hosted

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.

Figure 5: Arduino Yun

3.1.2  Setup  RFID  Reader  


The RFID reader must be powered and connected to the Arduino Yun microcontroller in order to
pass through a RFID tag number. This tag number is extremely important to the success of the
prototype. The Parallax RFID reader has four wires that that are used for power and passing data.
The card reader schematic can be seen in figure 6 below. The Vcc is connected to the 5V on
board supply and GND to ground. Connecting the wires as stated will provide the reader with
power to work. Next the Enable pin and Sout pin can be connected to two different pins on the
microcontroller board. These will be set to input pins. Setting the enable pin will allow for the
reader remain active and in standby for a card to be swiped. The Sout pin is then used to
transport the received tag into the program. From here the program is responsible for
manipulating this string of characters to verify whether or not it is authenticated to activate the
gate motor.

13
Smart  Gate  Security    
    ECE  480  –  Design  Team  7  

Figure 6: Parallax RFID Card Reader

3.1.3  Setup  Servo  Motor  


Once the RFID card has been read and verified, the next step is to activate the motor if
authorized to do so. This can be done on the same board using the same program. The servo
motor has three pins for connection to the microcontroller. Similar to the RFID reader two of
these are power and ground. The power pin will be connected from the motor power pin (Red
Wire) to the 3.3V on the microcontroller. Next the GND connection (Black Wire) will be
connected to another GND connection on the microcontroller. The last pin that is on the servo
motor is one that is thought of as an enable pin (White Wire). When the pin is set to active, the
motor will be operational. If it is not active then the motor will not work. These constraints will
be addressed in the next section which deals with writing the software and then assembling the
working device.

Figure 7: Servo Motor

3.2  Software  Setup  

3.2.1  Arduino  Software    


Arduino has software that works across all operating system, for developing and implementing
code, while being very simple to install. The software is open source with an integrated

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.

3.3  Software  Design  


Below if a workflow of how the software was designed. The first thing it does is enable to RFID
reader so a card can be read immediately if presented. The next step is to read the tag
information off the card and check whether the person is valid or not. If they are valid, the
program will cycle the motor up, wait and then down. Once completed there is a built in time
delay to protect against brute force hacks and multiple access attempts. If someone tries to cycle
different RFID cards, it will become very time consuming and obvious to the on duty security
personnel. However, if it is not in the database, the program cycles through the wait time and
then the RFID reader goes back to the ready and waiting state.

Figure 8: Program Workflow

15
Smart  Gate  Security    
    ECE  480  –  Design  Team  7  

3.3.1  Built-­‐in  Database  


The security gate system is expected to be capable of storing all the personal information of the
individuals possessing an RFID tag or card. Thus, a database is needed. The team tried to
establish an external database. We attempted to implement a database using an online server but
technical issues were raised and the team was unable to pull it off within the given time frame.
Instead of using an online database, the alternative solution was to have all the tag information
built into the main program. The method of how to implement the built-in database and its
drawbacks will be discussed in detail in the following session.

3.3.2  Checking  Database  for  Access  


Each of the RFID tags have been pre-programmed with a unique 10-digit character string. Once
a tag is scanned, the unique character string is read and compared with the information stored in
the database. If the tag’s string matches one of the valid strings in the database, access will be
granted and the servo motor will be activated. Similarly, access is denied if the scanned tag has a
character string that cannot be found in the database and the servo motor will not activate.
Specifically, this is achieved by an if statement that executes string comparison as the following:

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.

3.3.3  Brute  Force  Attack  Protection  


One of the hot topics with any network or communication device is security. If there is a lack in
security, the device may not serve its intended purpose. In security devices that use
authentication, a hacker can use multiple devices to attempt to gain entry. With the gate security
device, hackers can try a stack of predefined RFID cards, or a program that cycles RFID
possibilities. In both of these cases the more options they have, the more vulnerable the system
becomes. The team has decided to remediate this problem by adding a time delay that occurs
once the motor is deactivated or the card is denied, which can be seen in figure 8 above. This
delay creates a waiting time for any person trying to hack the system. The benefit of this waiting
tactic is that the on duty guard will notice the strange activity and approach the unauthorized
individual. The time the individual starts swiping cards and is notice will be very short. They will
likely only be able to try three to four cards. With the number of RFID tag possibilities this is a

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.

3.4  Design  Issues  and  Solutions  


The designed program was written to check if an incoming RFID scan is listed within the
“Access Granted” list. This program works well and is efficient in operation, but it would be
more beneficial to have a networked database. This flaw could be corrected in a future design. It
would not be able to be created within the program that the group developed. In order to do so,
the current program would have to be scratched, and a new one created. In addition to writing a
new program, we would also have to approach the problem from a different angle. Since there
are many different database alternatives (e.g. Access or SQL), there are many different
approaches. Unfortunately, the team was scarce on time and was unable to pursue one of these
alternatives from scratch. The solution to the database problem was using the built in “Access
Granted” list in the program. This list would be comprised of all the RFID tag codes that are
allowed access into the premises. The current solution is very bulky and not streamlined.
Therefore, with every additional RFID tag the code gets longer. However, with a new program
that utilizes a networked database, similar to the matrix system ArcelorMittal uses, the code
becomes much simpler. The database can also have more demographics about who is entering,
their position, time entered, etc. These demographics would help in creating a stronger report for
the Emergency & Security Services team at ArcelorMittal.

Chapter  4  -­‐  Assembling  &  Testing  

4.1  Assembling  the  Prototype  


The design consisted of both hardware and software components. It was assumed that all the
hardware parts were in working order from the manufacturer. These products were the Arduino
Yun microcontroller, Servo Motor, and Parallax RFID Reader.

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.

Figure 9: Prototype Wiring Schematic

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  

Figure 11: Final combined EE and ME prototype

4.2  Testing  &  Proof  of  Functionality  


Testing of the designed software was repetitive, but crucial to the overall success of the project.
It was also important to ensure that the prototype was assembled and working correctly. Once the
code is uploaded and power is connected to the microcontroller, testing can be performed. The
three tests performed will be a card that is an employee with access, an employee without access,
and an unauthorized individual. In order to test both the functionality and the integrity of the
program, the first card to test is an authorized employee. This will help ensure all the pins are
connected correctly, since it will function correctly, and that an employee with access can get
into the plant. If the prototype did not work, the program would have to be debugged and the pin
diagram rechecked. The next step is to verify that an unauthorized employee cannot
inadvertently gain access to the plant. The same steps will be taken as testing the authorized
employee, except this time the motor should not begin to open the gate. It also needs to be
verified that there is a time gap between when the card is denied, the reader LED going from
green to red, and the time a new card can be presented. This was also completed with an
unauthorized card that was also not an employee. These card swipes were then mixed up and
tested with the same results and no errors. During these testing stages the prototype functioned as
it should. The code was also set to constantly be running during this time to verify there were no
time outs reached when waiting for a card to be scanned. Since we don't have a device that can
simulate an rfid code generator, we were unable to test that aspect. However, we had a very high

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.

Chapter  5  -­‐  Summary  and  Conclusion  

5.1  Summary  and  Conclusions  


Overall, with the given constraints and changes, the project was successful and performed well.
The prototype was able to read a RFID card, process it through the microcontroller, and then
control a servo motor without error. The RFID reader constantly read new cards presented after
being idle with excellent accuracy. It can be concluded that the prototype works on a small scale
and the design can be successfully implemented into a large scale model.

5.2  Success  and  Failures  


The team goal was to provide a precise and efficient “smart” gate that secured the plant. The goal
was to provide a device that not only secured the plant based on authentication but visually as
well. The team had experienced both successes and failures during the course of the semester.
The team was successful in producing a device that provides access to only authorized
individuals and not to unauthorized ones. This part of the design was very successful. The
software allows for the addition of RFID tags, and the ability to add additional devices. The
smart function of the gate eliminates the guessing the guard has to do when one waves a card as
they pass by the current guard building. On the other hand there were a few things that did not
turn out as planned. The camera security system was unable to be implemented under the given
time constraints, as well as learning ArcelorMittal’s security system was IP based and a separate
entity. Therefore, the team would need to have implemented a second solution that would record
all the activities and then overwrite them as space became full on the drive. One way to have
fixed this would be to purchase a cheaper IP camera similar to the Foscam FI8919W which
would have allowed for the recording to a network drive. Another alternative solution would be
to use a laptop webcam paired with software similar to LoJack. When a model car would
approach, a picture would be triggered and saved. Both of these would have been viable
solutions to fix the failure of implementing the security camera.

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  

5.3  Suggestions  for  the  Future  


There are many improvements that can be made in future models of the design. Instead of using
only an rfid reader and microcontroller, a sensor could be added to the device. This sensor would
be responsible for checking if a car is present under the gate. Since safety is a big concern, it
would only improve the overall design. This was something that was overlooked by the team
early and was unable to be implemented into the design. Another suggestion would be to fix the
teams failure and incorporate a camera, which could be a smartphone that could interface with a
computer to demonstrate the security footage capture. Since the team found out late that the
RFID gate opening module is separate from the security footage recording module within the
ArcelorMittal technology stack we were unable to implement this goal. Lastly, more research
could also be done using different databases. The database could be locally connected via USB,
or networked and would serve as an industrial purpose. The database would be able to store more
users, track them, and provide additional information about each user. An additional field in the
database could be a mobile phone number. The user would then be able to call a designated
hotline that communicates with the server. The server would then trigger the gate and log the
user’s entry. With the newer cars on the market, this could be hands free and streamlined way
employees could enter the plant. Not all of these are applicable to be addressed in a semester, but
would become in high demand in future designs.

5.4  Small  Scale  Final  Costs  


The final costs were analyzed once the prototype was completely assembled and working. As it
can be seen in the table below, the team was well within the five hundred dollar constraint that
was set forth by the MSU ECE department. All elements were purchased through vendors that
the university typically orders from; therefore shipping was very minimal and amounted to
$31.52. This is minimal but was not factored into the final costs of the small scale design.

Product Quantity Cost Total Per Unit

Arduino Yun Microcontroller 2 $74.04 $148.08

5V Servo Motor 2 $16.99 $33.98

Parallax RFID Reader 2 $44.99 $89.98

Parallax RFID Tag 2 $.99 $1.98

Total: $274.02
Table 3 - Small Scale Costs

21
Smart  Gate  Security    
    ECE  480  –  Design  Team  7  

5.5  Final  Budget  

5.5.1  Small  Scale  (Team  7  Design)  


The budget below is what a company would need to purchase in order to implement the RFID
reader and servo motor prototype. This is relatively inexpensive comparatively. Since the code
was developed by students and is relatively available, it would be free of charge as long as the
company purchases the other components.

Product Quantity Cost Total Per Unit

Arduino Yun Microcontroller 1 $74.04 $74.04

5V Servo Motor 1 $16.99 $16.99

Parallax RFID Reader 1 $44.99 $44.99

Code 1 $0 $0

Total: $136.02
Table 4 - Small Scale Budget

5.5.2  ArcelorMittal  Budget  


The budget below is what ArcelorMittal would need to purchase to implement a life size design
solution for their current problem. This includes all hardware that needs to be purchased for each
traffic lane.

Product Quantity Price Total

Axis Q1604-e camera 3 $1,240 $3,270

MXProx2 Card Reader 3 $120 $360

Cat 6 Ethernet Cable (~1000 ft.) 1 $106.29 $106.29

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

ExacqVision Server Record Security Footage

80 GB Hard Drive Storage for Security Footage

Matrix System Server Manage & Authenticate RFID Readers


Table 6 - ArcelorMittal Resources

5.6  Final  Schedule  


Task # of Days Start Date End Date

Gate Security 71 days Fri 1/23/15 Fri 5/1/15

Initial Meeting With Sponsor 1 day Fri 1/30/15 Fri 1/30/15

PreProposal 5 days Mon 2/2/15 Fri 2/6/15

Website Creation 2 days Mon 2/2/15 Tue 2/3/15

ArcelorMittal Site Visit 1 day Fri 2/6/15 Fri 2/6/15

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

RFID Input Program 4 days Mon 2/16/15 Thu 2/19/15

Setup Motor Program 4 days Thu 2/19/15 Tue 2/24/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

Complete Working Prototype design 20 days Thu 3/19/15 Wed 4/15/15

Work On Design Day presentation 20 days Thu 3/19/15 Wed 4/15/15

Miscellaneous Tasks and Fixes 12 days Thu 4/16/15 Fri 5/1/15


Table 7 - Prototype Schedule

23
Smart  Gate  Security    
    ECE  480  –  Design  Team  7  

Appendix  1  -­‐  Individual  Contributions  

Figure12: Design Team 7 (From left to right)

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

"Arduino - ArduinoYun." Arduino - ArduinoYun. Arduino, n.d. Web. 27 Apr. 2015.


<http://www.arduino.cc/en/Guide/ArduinoYun>.

"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>.

"Matrix Card Readers: MX ICLASS, MX2, MXProx2." Web. 27 Apr. 2015.


<http://www.matrixsys.com/PDF_DATASHEETS/Matrix_Frontier_CardReader_DS.pdf>.

28
Smart  Gate  Security    
    ECE  480  –  Design  Team  7  

Appendix  3  -­‐  Technical  Documents

Final  Code  (Entering  Gate)  

// 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);

// These are used for serial communication


int val = 0;
double count = 0;
char rfid[10];
int bytesRead = 0;
char Granted = '02006E218C';
char Denied = '02006E2C31';

// Servo settings
#include <Servo.h>
Servo servo;
int pinServoStart = 9;
int pinServoStop = 7;
int servoLockedRotation = 150;
int servoUnlockedRotation = 30;
int unlockTime = 1500;

int pinLed = 13;

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 RFID Reader


rfidSerial.begin(baudRateRfid);
pinMode(pinRfidEnable, OUTPUT);
digitalWrite(pinRfidEnable, LOW);

// Set up servo
servo.attach(pinServoStop);

// Set up indication LED


pinMode(pinLed, OUTPUT);
digitalWrite(pinLed, LOW);
}

void loop()
{
// Read serial from RFID reader
if(rfidSerial.available() > 0)
{
val = rfidSerial.read();

// Got signal from RFID Reader


if(val == 10)
{
bytesRead = 0;
while(bytesRead < 10)
{
if(rfidSerial.available() > 0)
{
val = rfidSerial.read();
// Line endings mean end of message
if(val == 10 || val == 13)
{
break;
}
rfid[bytesRead] = val;
bytesRead++;
}

30
Smart  Gate  Security    
    ECE  480  –  Design  Team  7  

if(bytesRead == 10)
{
// Send RFID tag to computer
//Serial.println(rfid);
digitalWrite(pinRfidEnable, HIGH);

// Read serial from computer


/*if(Serial.available() > 0)
{
// Got signal from computer
// Disable RFID reader so we don't get repeats
digitalWrite(pinRfidEnable, HIGH);
val = Serial.read();
//emptySerialBuffers();
}*/

if( (strcmp(rfid, "02006E218C") == 0) )


{
// Access Granted
count++;
Serial.println("Access Granted");
Serial.println("Visitor: Trevor Emerick");
Serial.print("Total number of people entered: ");
Serial.println(count);
digitalWrite(pinLed, HIGH);
servo.attach(pinServoStart);
servo.write(servoUnlockedRotation);
delay(unlockTime);
servo.attach(pinServoStop);
delay(3500);
servo.attach(pinServoStart);
servo.write(servoLockedRotation);
delay(unlockTime);
servo.attach(pinServoStop);
digitalWrite(pinLed, LOW);
}
else
{
// Acess Denied
// Keep the reader from reading repeatedly

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  

Final  Code  (Exit  Gate)  

// 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);

// These are used for serial communication


int val = 0;
double count = 0;
char rfid[10];
int bytesRead = 0;
char Granted = '02006E218C';
char Denied = '02006E2C31';

// Servo settings
#include <Servo.h>
Servo servo;
int pinServoStart = 9;
int pinServoStop = 7;
int servoLockedRotation = 30;
int servoUnlockedRotation = 150;
int unlockTime = 1400;

int pinLed = 13;

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 RFID Reader


rfidSerial.begin(baudRateRfid);
pinMode(pinRfidEnable, OUTPUT);
digitalWrite(pinRfidEnable, LOW);

// Set up servo
servo.attach(pinServoStop);

// Set up indication LED


pinMode(pinLed, OUTPUT);
digitalWrite(pinLed, LOW);
}

void loop()
{
// Read serial from RFID reader
if(rfidSerial.available() > 0)
{
val = rfidSerial.read();

// Got signal from RFID Reader


if(val == 10)
{
bytesRead = 0;
while(bytesRead < 10)
{
if(rfidSerial.available() > 0)
{
val = rfidSerial.read();
// Line endings mean end of message
if(val == 10 || val == 13)
{
break;
}
rfid[bytesRead] = val;

34
Smart  Gate  Security    
    ECE  480  –  Design  Team  7  

bytesRead++;
}
}

if(bytesRead == 10)
{
// Send RFID tag to computer
//Serial.println(rfid);
digitalWrite(pinRfidEnable, HIGH);

// Read serial from computer


/*if(Serial.available() > 0)
{
// Got signal from computer
// Disable RFID reader so we don't get repeats
digitalWrite(pinRfidEnable, HIGH);
val = Serial.read();
//emptySerialBuffers();
}*/

if( (strcmp(rfid, "02006E218C") == 0) )


{
// Access Granted
count++;
Serial.println("Granted");
Serial.println("Visitor: Trevor Emerick");
Serial.print("Total number of people exited: ");
Serial.println(count);
digitalWrite(pinLed, HIGH);
servo.attach(pinServoStart);
servo.write(servoUnlockedRotation);
delay(unlockTime);
servo.attach(pinServoStop);
delay(3500);
servo.attach(pinServoStart);
servo.write(servoLockedRotation);
delay(unlockTime);
servo.attach(pinServoStop);
digitalWrite(pinLed, LOW);

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    

Вам также может понравиться