Upload
others
View
2
Download
0
Embed Size (px)
Citation preview
RFID Security System by Alkhadashi, Kaminski, and Puninske 1
GROUP 1:
Mohamed Alkhadashi
Mike Kaminski
Benjamin Puninske
NETWORK CONNECTED RFID SECURITY SYSTEM
ECE 4600 CAPSTONE PROJECT, FALL 2016
DECEMBER 9, 2016
CAPSTONE ADVISOR: DR. SYED MAHMUD
RFID Security System by Alkhadashi, Kaminski, and Puninske 2
Contents TABLE OF FIGURES ................................................................................................................................................ 3
ABSTRACT ............................................................................................................................................................. 4
EXECUTIVE SUMMARY .......................................................................................................................................... 5
INTRODUCTION ..................................................................................................................................................... 6
BACKGROUND/PATENTS ....................................................................................................................................... 8
Passive RFID ...................................................................................................................................................... 8
Active RFID ........................................................................................................................................................ 9
ALTERNATE DESIGN IDEAS .................................................................................................................................. 13
DETAILED DESCRIPTION OF PROJECT .................................................................................................................. 16
RFID READER ................................................................................................................................................... 16
LCD SCREEN ..................................................................................................................................................... 17
TTL CAMERA .................................................................................................................................................... 18
W5100 ETHERNET SHIELD & SD CARD SLOT ................................................................................................... 19
ARDUINO MEGA 2560 ..................................................................................................................................... 20
5V TO 12V RELAY ............................................................................................................................................ 21
SOLENOID LOCK SYSTEM ................................................................................................................................ 21
HOW IT ALL WORKS ............................................................................................................................................ 22
ACCEPTED CARD ............................................................................................................................................. 22
REJECTED CARD (LESS THAN 3 ATTEMPTS) ..................................................................................................... 23
REJECTED CARD (3 OR MORE ATTEMPTS) ...................................................................................................... 24
OVERCOMING CHALLENGES ............................................................................................................................... 26
OPERATIONAL PROCEDURE ................................................................................................................................ 27
ANALYSIS/DISCUSSION ....................................................................................................................................... 29
RELEVANT OSHA/FCC REGULATIONS .................................................................................................................. 31
CONCLUSION ....................................................................................................................................................... 32
REFERENCES ........................................................................................................................................................ 33
APPENDIX I: PARTS LIST ...................................................................................................................................... 34
APPENDIX II: COST ANALYSIS .............................................................................................................................. 35
APPENDIX III: SCHEMATICS ................................................................................................................................. 36
APPENDIX IV: PROJECT CODE.............................................................................................................................. 37
APPENDIX V: PARTNER CONTRIBUTION ............................................................................................................. 52
APPENDIX VI: DATASHEETS ................................................................................................................................. 53
RFID Security System by Alkhadashi, Kaminski, and Puninske 3
TABLE OF FIGURES
Fig. 1 Overview of typical RFID passive tag system ........................................................................ 8
Fig. 2 (Left) Image of an enabled RFID reader. (Right) Image of a disabled RFID reader ............. 16
Fig. 3 Example of a typical RFID passive tag ID data feed ............................................................. 17
Fig. 4 Image of the LCD screen displaying an ACK message ......................................................... 17
Fig. 5 Image of the TTL Camera with wires connected to 4 pins .................................................. 18
Fig. 6 Sample image of the W5100 Ethernet Card. Note the micro SD card slot in the lower right
corner of the shield ....................................................................................................................... 19
Fig. 7 Image of the Arduino MEGA 2560 ...................................................................................... 20
Fig. 8 Image of the 5V to 12V relay ............................................................................................... 21
Fig. 9 Image of the solenoid used in the project .......................................................................... 21
Fig. 10 ACK confirmation to user .................................................................................................. 23
Fig. 11 NAK message seen if rejected card ID is scanned less than three times .......................... 24
Fig. 12 NAK message seen when a card ID is rejected 3 times ..................................................... 25
Fig. 13 Ethernet cable and USB cable connected to Arduino board ............................................ 27
Fig. 14 Example of system boot up messages to the user ............................................................ 28
Fig. 15 Example of process feedback on the serial monitor. Pictured is feedback for the picture,
storage, hosting, and email programs. ......................................................................................... 28
RFID Security System by Alkhadashi, Kaminski, and Puninske 4
ABSTRACT
For years, security has been one of the most critical aspects when it comes to protecting
valuable goods. Whether it’s from hacking a system or intruders entering an area without
permit, security comes in many different ways. One of the most widely used security systems
when it comes to controlling entry to a confined space is the Radio Frequency Identification
(RFID) system. The RFID system uses electromagnetic field to indication or retrieve information
from another tag or card when they are brought closely to a certain range. Each tag comes with
its own unique identification and be used to reference any type of information on it such as
person’s full information. Thus nothing can be written to the tag nor can the identification can
be altered. The identification retrieved by the RFID reader determines if an individual is granted
access when attempting to access and enter a confined area. Since the market for the RFID
security system is very competitive, this paper is proposing a unique system that will make it
challenging for other security systems to provide such feature. This system will perform the
normal functionality of an RFID but with the added feature that makes it outstanding. It will
have the ability to capture an image of an individual for certain cases. When an individual
attempts to enter a build that is equipped with this RFID system, a photographic device will
capture the personnel’s image if access is denied three times. The captured image will be sent
to a data base for future reference. During the process of sending the image to the database, a
pseudo timestamp will be included to be able to keep record of occurring event. This system is
cost effective and is easy to install and use. It will consist of Arduino ATMEGA2560, a
photographic device and an internet shield.
RFID Security System by Alkhadashi, Kaminski, and Puninske 5
EXECUTIVE SUMMARY
In considering the implementation of the RFID security system, we felt that a new, novel,
approach needed to be taken regarding security systems. Starting from the beginning of the
semester, we have strived to create such a novel approach.
The most important development for the security system was the implementation of the
security camera. Our research indicated that most commercial and private RFID security
systems did not implement any method of image capture. Our focus was to not only capture
the image but to have the ability to pass this image to an outside user. This lead us to
implementing Ethernet access for our project.
With the implementation of both image capture and Ethernet connectivity, we feel that our
RFID security system not only closely approximates commercial systems, but exceeds the
functionality of many private systems. Which, based on our research, is where the majority of
the growth is occurring in regards to any such system.
With the possibility of Power over Ethernet, our system meets the requirements for
commercial applications. Using an Arduino for processing is the limiting factor, however this
can be mitigated by using a faster processor (i.e. raspberry pi or similar). This project can be
easily scaled to almost any size, due to the simplicity of the underlying code. No scaling or
modification is necessary; it can be immediately installed in a home for use.
RFID Security System by Alkhadashi, Kaminski, and Puninske 6
INTRODUCTION
In today’s modern world, security systems are widely used in homes, industries, automobile
and small businesses. One of the most common security systems used for protecting against an
intruder is the Radio Frequency Identification (RFID). The RFID was developed with the
advantage that allow them to be read wirelessly and without any physical hardware
connection. They have the ability to carry more information than barcode and are more
vigorous [1]. The RFID is not just strictly used for securing a subject area but it's also used in
many industries for other purposes such as maintaining inventory of goods and high value
products. Although RFID is a bit more expensive than the traditional barcode and printed
symbols, but it is becoming more affordable in large scale because the ratio of the prices is
almost equivalent [2]. The way the RFID work is that each tag carries its own unique internal
memory with its own identification that can be retrieved when scanned by an RFID reader. The
memory is of two types, either a read-only memory or a re-write memory. The read-only
memory also known as passive is used only for retrieving information stored in the memory, as
for the re-write, also known as active, it can be used for encrypting other information to it
when it is scanned. To be able to write to an active tag, it must contain a form of power source
to enable it to interact with an RFID reader.
In this project, a passive tag is being used. In the case of this project the passive is being used
because it’s convenient for the applications within the scope for this level of research and its
less expensive. The identification on the tag is well secured for a passive. In other word the
person using it will not be able to alter the information in the tag when scanning the tag, that is
because there is no power source in the tag. Each tag has its unique identification value
assigned to it. Typically, the RFID reader generates an electromagnetic field that allows it to
capture a tag within its range and identify it [3]. When this event occurs, the high frequency
electromagnetic energy and signal from the tag reader prompts the tag to reply to the signal by
a form of frequency which will result in communication between the tag and the reader and
therefore the reader retrieves the requested information inside the tag [4]. That is how a
typical RFID works. As for the RFID used in this paper it has a unique feature to it. It includes a
photographic device that is utilized to capture an images and send it to the database. The way
this system is setup is that when the user attempts to access a confined space using the RFID,
and is denied three consecutive times, the photographic device will be triggered to capture an
instantaneous image, which is typically the face image or the upper half of the body and sends
it to the desired database for later reference. This system is efficient, cost effective and robust.
It can be installed on a frame wall indoor or outdoor. The RFID and tag are both waterproof
when completely installed. Therefore, this makes the system weatherproof with minor
RFID Security System by Alkhadashi, Kaminski, and Puninske 7
limitations to harsh temperatures. The RFID reader can be wired to a typical 120V outlet with
voltage being regulated to accommodate certain components being used. Voltage can be
regulated and still is able to comply with OSHA standards and regulations.
RFID Security System by Alkhadashi, Kaminski, and Puninske 8
BACKGROUND/PATENTS
Passive RFID
Generally speaking, three main parts make up in a passive RFID system – an RFID reader or
interrogator, an RFID antenna, and RFID tags. Passive RFID tags only have two main
components – the tag’s coil that induces power and the microchip that alters the reader’s RF
wave.
Fig. 1 Overview of typical RFID passive tag system
Passive tags wait for a signal from an RFID reader. The interrogator (reader) produces a RF wave that is sent into the field of interrogation (read zone). Once a tag is read within the “read” zone, the RFID tag’s internal antenna draws in energy from the RF waves. The energy moves from the tag’s antenna to the IC and powers the chip which generates a signal back to the RF system. This is called backscatter. The backscatter, or change in the electromagnetic or RF wave, is detected by the reader, which interprets the information. Passive RFID tags have no internal power source, and relies on using the energy from the RF wave transmitted by the reader.
Passive RFID tags do not all operate at the same frequency. There are three main frequencies within which passive RFID tags operate. The frequencies effective range determines how far the tags can be read which in turn predicates application options.
http://www.atlasrfidstore.com/rfid-readers/http://www.atlasrfidstore.com/rfid-antennas/http://www.atlasrfidstore.com/rfid-tags/http://www.atlasrfidstore.com/rfid-tags/
RFID Security System by Alkhadashi, Kaminski, and Puninske 9
125 – 134 KHz – Low Frequency (LF) – An extremely long wavelength with usually a short read range of about 1 – 10 centimeters.
13.56 MHz – High Frequency (HF) & Near-Field Communication (NFC) – A medium wavelength with a typical read range of about 1 centimeter up to 1 meter.
865 – 960 MHz – Ultra High Frequency (UHF) – A short, high-energy wavelength of about a one meter which translates to long read range. Passive UHF tags can be read from an average distance of about 5 – 6 meters, but larger UHF tags can achieve up to 30+ meters of read range in ideal conditions.
As a general rule, higher frequencies will have shorter, higher-energy wavelengths and, in turn, longer read ranges. Moreover, the higher the frequency, generally speaking, the more issues an RFID system will have around non-RFID-friendly materials like water and metal.
Pros of Passive RFID:
Smaller tags Much cheaper tags Thinner/more flexible tags Higher range of tag options Tags can last a lifetime without a battery
Active RFID
Active RFID systems have three essential parts – a reader or interrogator, antenna, and a tag. Active RFID tags possess their own power source – an internal battery that enables them to have extremely long read ranges as well as large memory banks.
All these additional features translate to increased costs for the customer, but the return on investment of a system may far outweigh the initial costs. The prices of active RFID tags range anywhere from $20 to $100+ depending on the tag’s ability to withstand harsh conditions and other key functional features of the tag. Given the required investment of an active RFID system, active tags are usually reserved for tracking high worth assets or for items where accurate location tracking is necessary to the success of the system.
Pros of Active RFID Tags:
Extremely Long Read Range
http://www.atlasrfidstore.com/active-rfid/http://www.atlasrfidstore.com/omni-id-power-400-active-rfid-development-kit/http://www.atlasrfidstore.com/omni-id-power-400-active-rfid-development-kit/
RFID Security System by Alkhadashi, Kaminski, and Puninske 10
Increased tag abilities with partnered technologies (GPS, sensors, etc.) Extremely Rugged tag options
While both active and passive RFID technologies use radio frequencies to communicate information, each is very different, and likewise, possess different qualities well suited for varying applications.
Active RFID Passive RFID
Power Battery Operated No Internal Power
Signal Strength Required Low High
Communication Range Long (100m+) Short Range (3m+)
Range Data Storage Large Read/Write(128kb) Small Read/Write (128b)
Cost Tag Per $15 - $100 $0.15 - $5
Fixed Infrastructure Costs Lower – cheaper interrogators Higher – fixed readers
RFID based security system US 6888459 B2
Inventors: Louis A. Stilp
Assignee: Louis A. Stilp
Appl. No: US 10/356,512
Filed: Feb 3, 2003
https://www.google.com/search?tbo=p&tbm=pts&hl=en&q=ininventor:%22Louis+A.+Stilp%22https://www.google.com/search?tbo=p&tbm=pts&hl=en&q=ininventor:%22Louis+A.+Stilp%22
RFID Security System by Alkhadashi, Kaminski, and Puninske 11
Abstract: A system and method for constructing a security system for a building using at least one RFID reader to communicate with at least one RFID transponder to provide the radio link between each of a number of openings and a controller capable of causing an alert in the event of an intrusion. The RFID transponder is connected to an intrusion sensor. The controller preferably communicates with the RFID reader using a power line communications protocol. The RFID transponder can contain a battery. The RFID reader contains means for transferring power to an RFID transponder for the purpose of charging any battery. The security system can contain more than one controller, whereby the RFID reader can communicate with more than one controller.
This patent details a baseline passive RFID security system where all the main components (keypad, system controller, and various intrusion sensors) are wired to each other. It also describes the basis of which additional sensors such as smoke and motion detectors can be used in the system. The networked connected RFID security system detailed in this paper uses this base infrastructure.
RFID-based asset security and tracking system, apparatus and method US 8334775 B2
Inventors: Hollis M. Tapp, Joseph C. McAlexander, James Olivier, William C. Slemmer
Assignee: Guardian Technologies
Appl. No: US 12/470,709
Abstract Systems and methods are disclosed for tracking an item using a RFID surveillance system. In some embodiments, a security controller is connected to a point of sale system with at least one RFID tag reader. In these embodiments, the RFID tag reader is associated with an area that is observable through a video camera. If the tag reader does not recognize information obtained from a RFID tag, the tag reader may activate the video camera. When the video camera is activated, the video camera may capture images and send them to a recording device.
This RFID tracker detailed in this paper uses a video camera in which the tag reader is able to activate and observe the unrecognized tag through a video camera. The camera may take photos of the unrecognized tag. The networked connected RFID security system detailed in this paper uses a camera in a similar fashion.
https://www.google.com/search?tbo=p&tbm=pts&hl=en&q=ininventor:%22Hollis+M.+Tapp%22https://www.google.com/search?tbo=p&tbm=pts&hl=en&q=ininventor:%22Joseph+C.+McAlexander%22https://www.google.com/search?tbo=p&tbm=pts&hl=en&q=ininventor:%22James+Olivier%22https://www.google.com/search?tbo=p&tbm=pts&hl=en&q=ininventor:%22William+C.+Slemmer%22https://www.google.com/search?tbo=p&tbm=pts&hl=en&q=inassignee:%22Guardian+Technologies%22
RFID Security System by Alkhadashi, Kaminski, and Puninske 12
RFID reader for a security network US 7023341 B2
Inventors: Louis A. Stilp
Assignee: Ingrid, Inc.
Appl. No: US 10/602,854
Filed: Jun 25, 2003
Abstract: An RFID reader for use in a security network based upon RFID techniques. The RFID reader can use wireless communications to communicate with RFID transponders and other devices in the security network. The RFID reader of the security network can be provided with multiple modulation techniques, multiple antennas, and the capability to vary its power level and carrier frequency. The RFID reader can transmit RF energy useful for detecting motion or for charging the batteries in RFID transponders. The RFID reader can contain an audio transducer, a camera, or various environmental sensors to detect parameters such as smoke, temperature, and water, among others. The program code of the RFID reader can be updated. A master controller within the security network can control operations within the RFID reader.
This patent outlines a RFID reader that can contain a variety of different peripherals in it, including a camera. Included in this paper is a RFID system that utilizes a camera module.
https://www.google.com/search?tbo=p&tbm=pts&hl=en&q=ininventor:%22Louis+A.+Stilp%22https://www.google.com/search?tbo=p&tbm=pts&hl=en&q=inassignee:%22Ingrid,+Inc.%22
RFID Security System by Alkhadashi, Kaminski, and Puninske 13
ALTERNATE DESIGN IDEAS
After examining two other alternative design ideas, our group eventually chose the
implementation outlined in this report. The table below details the choices made for each part
of the project.
Item Final Choice and Reasoning
RFID Detector TTL Camera
Options --13.56 MHz RFID Reader --125 kHz I2C RFID Reader --125 kHz SPI RFID Reader Final Decision --125 kHz SPI RFID Reader Reasoning --We decided to go with the 125 kHz RFID reader for a few reasons. First, the 13.56 MHz RFID reader was cost prohibitive for us (approximately 75$). The increased resistance to EM interference was not worth the price. The 125 kHz RFID reader is more resistant to physical interference (weather, etc.), this makes it ideal for an outdoor reader, which is the idea behind our project. We decided to use the 125 kHz SPI RFID reader as the other devices used in our project also communicated using the SPI bus. Options --OmniVision OV7670 CMOS --Adafruit TTL Serial Camera Final Decision --Adafruit TTL Serial Camera Reasoning --We first tried to implement the OmniVision camera. However, after a detailed analysis of the user manual, we discovered that the camera would need to be connected to a dedicated oscillator circuit. This circuit would need to pass trains of square pulses to “tune” the camera. We felt that this was an unnecessary and unrealistic burden for the system. The Adafruit TTL Serial Camera does not need any external oscillation and communicated on the SPI bus.
RFID Security System by Alkhadashi, Kaminski, and Puninske 14
LCD Screen Network Connection Main Processor
Options --Parallax Serial LCD --Adafruit Standard LCD Final Decision --Parallax Serial LCD Reasoning --When researching LCD screens, we came across two which we evaluated. The Adafruit Standard LCD needs the standard 6 pins to communicate with the Arduino as well as a pin which needs to be connected to a potentiometer, for dimming the device. The Parallax LCD screen only needs 3 pins to communicate, via the SPI bus. This predicated our decision to use the Parallax LCD screen. Options --Xbee Wireless Module --W5100 Ethernet Shield Final Decision --W5100 Ethernet Shield Reasoning --When evaluating the options for network connectivity, we had to consider signal strength, ease of implementation, and reliability. When we examined the Xbee Wireless Module, we noticed that the signal strength varied significantly with distance to the source as well as with the presence of barriers. This lead us to test the Ethernet shield. Not only did the Ethernet shield have much better data transfer rates, it also had constant signal strength, as well as a built in SD card slot, which was another component we needed. Options --Arduino Mega 2560 --Raspberry Pi 3 Final Decision --Arduino Mega 2560
RFID Security System by Alkhadashi, Kaminski, and Puninske 15
SD Card Slot 5V to 12V Relay Solenoid Lock
Reasoning --While the Raspberry Pi 3 is a much more powerful board with image processing capabilities, the cost for the board made us ultimately decide to use the Arduino. Options --W5100 Ethernet Shield Final Decision --W5100 Ethernet Shield Reasoning --As the SD card slot was included on the Ethernet Shield we selected, we did not consider any other options. Options --Standard Songle 5V relay Final Decision --Standard Songle 5V relay Reasoning --As 5V relays are fairly standardized in terms of power consumption and effectiveness, we did not consider any other options. Options --Standard Adafruit Solenoid Lock Final Decision --Standard Adafruit Solenoid Lock Reasoning --As most solenoid locks work off of similar precepts, we felt that the only differentiable quality we needed to look for was the size of the lock. This did not lead us to consider multiple locking systems.
RFID Security System by Alkhadashi, Kaminski, and Puninske 16
DETAILED DESCRIPTION OF PROJECT
Our project consisted of several sections. Each section is detailed below, which is followed by a
detailed description of how each section operates.
RFID READER
The RFID reader used for the project was purchased from Parallax Inc. The reader
communicates over the SPI bus at a rate of 2400 bps. The reader has four pins: 5V, GND,
Enable, SOUT. The Enable pin on the RFID reader is set as an active LOW. This means that in
order to function properly, the ENABLE pin must have a LOW signal (approximately 0V). When
an active low is present, a red LED on the board will illuminate. When a HIGH signal is sent to
the ENABLE pin, the RFID reader becomes disabled and cannot read any data, the reader will
also illuminate a green LED.
Fig. 2 (Left) Image of an enabled RFID reader. (Right) Image of a disabled RFID reader
When the RFID reader is enabled and a compatible passive tag is brought into actionable
distance (for this type of system, that distance is approximately 10 cm or less), the RFID reader
RFID Security System by Alkhadashi, Kaminski, and Puninske 17
will read the modulated magnetic field from the card and obtain the card’s ID and any pertinent
data stored on the card.
All communication is 8 bits, no parity (error check), with the lead significant bit being read first.
The data is read from the card, it is read as a unique 12-byte ID which is originally read as hex,
but transmitted to the host as a printable ASCII string. The start byte is always 0x0A and the
stop byte is always 0x0D. These bytes correlate with the line feed and carriage return
characters, respectively.
Fig. 3 Example of a typical RFID passive tag ID data feed
LCD SCREEN
The LCD screen used for this project was also purchased from Parallax Inc. The LCD screen also
communicates over the SPI bus utilizing a single, RX, pin. The LCD screen supports a maximum
of 2 rows by 16 columns of characters with back lighting. The LCD screen can also support three
different baud rates for communication: 2400 bps, 9600 bps, and 19200 bps. This is achieved by
manipulation of two dip switches on the back of the unit. The main purpose of the LCD in this
project is to relay information to a user. The LCD screen will both show the user a message and
play a tone for auditory recognition. To use the LCD screen, a LCD object must be instantiated
using the SoftwareSerial class. Once the LCD object has been created, commands can be
written to the LCD screen in either decimal or hexadecimal. These commands can be reference
in the documentation from Parallax Inc.
Fig. 4 Image of the LCD screen displaying an ACK message
RFID Security System by Alkhadashi, Kaminski, and Puninske 18
TTL CAMERA
The camera used in this project was purchased from Adafruit. The camera was originally
manufactured for surveillance purposes, which made it a perfect fit for our project. It has the
capability to take continuous video or take snapshots.
The camera communicates serially over the SPI bus at a default baud rate of 38400 bps. While
different rates of communication are possible, the documentation for the camera warned that
forcing the camera to a different baud rate may damage the device. With this information, we
chose to communicate with the camera using the default baud rate.
Fig. 5 Image of the TTL Camera with wires connected to 4 pins
As seen in the figure above, the TTL camera has 6 pins for communication:
CVBS (RCA Video)
GND (GND for RCA Video)
TX
RX
GND
5V
The camera is powered by a 5V HIGH pin, however, the RX pin must be sent a 2.5V signal from
the Arduino. To achieve this, we constructed a voltage divider utilizing two 10kΩ resistors. This
ensured that the RX pin on the camera received the proper voltage and current.
RFID Security System by Alkhadashi, Kaminski, and Puninske 19
The screw seen at the top of the aperture in the figure above is for manual focus of the image.
Fortunately, during testing, we confirmed that the images taken by the camera were tuned
correctly, so there was no need to manually tune the camera.
Similar to the LCD screen, the camera can only by used by instantiating it using the
SoftwareSerial class. Once the camera object is created, a resolution must be defined. For the
purposes of our project, we used the best resolution (640x480). Once that is done, it is a matter
of taking the snapshot, and saving the data to a storage device. For our project, we used an SD
card slot to save the data to.
W5100 ETHERNET SHIELD & SD CARD SLOT
The W5100 Ethernet shield for the Arduino is based on the Wiznet W5100 chipset. It supports
full duplex network communication at speeds up to 100Mbps. The shield also supports up to
four simultaneous socket connections, each of which support TCP or UDP protocols. For this
project, we decided to use the UDP protocol, which would give us the best performance for the
application needed (hosting an image in real time).
The Ethernet shield sits on top of a large portion of the Arduino Mega 2560. It connects to the
majority of the analog and (low numbered) digital pins. However, each pin the Ethernet shield
connects to also acts as a pass through, so there is no actual board real estate taken by the
shield.
Fig. 6 Sample image of the W5100 Ethernet Card. Note the micro SD card slot in the lower right corner of the shield
RFID Security System by Alkhadashi, Kaminski, and Puninske 20
The Ethernet shield, like most other modules for this project, also communicates on the SPI
bus. This is carried out over the ISCP pins. These pins can be located on the Arduino board itself
as a group of six pins in the middle of the board. The Ethernet shield has a standard SS (Slave
Select) pin of PIN 10. This pin needed to be kept open so that the board can function properly.
The SD card slot embedded on the board is a standard SD card slot for the Arduino board. It is
supported by 3.3V. This voltage is supplied automatically by the Ethernet shield. The main
purpose for the SD card is to save the image and usage data from the rest of the system and
host it on the Arduino’s local IP address.
The SD card slot communicates via the Ethernet shield, which means that it also communicates
via the ISCP pins (SPI bus). The SS (Slave Select) for the SD card slot is defaulted to 4. This meant
that when we were constructing our project, we had to make sure that this slot was clear to
ensure proper communication to the card. The SD card slot supports a default baud rate of
9600 bps; however, the card slot can support communication at different rates as well. For the
purposes of our project, we felt 9600 bps was sufficient.
ARDUINO MEGA 2560
The Arduino Mega 2560 is the central part of our project. It handles all of the processing of all
inputs and operation of all modules. The board we used was purchased from SparkFun and is a
genuine Arduino (manufactured in Italy). It features the traditional, open-soured, board design
for a Mega 2560. It supports 54 digital I/O pins (15 PWM) as well as 16 analog pins. The Mega
can also support up to four simultaneous serial connections, which was of use for this project.
The Mega communicates with the LCD Screen, RFID Reader, and the TTL Camera, the Ethernet
Shield, and the SD Card Slot, all serially. The Mega has a max clock speed of 17 MHz. This was of
particular interest when we considered image processing. This, as well as cost analysis, made
the Arduino Mega 2560 the choice for this project.
Fig. 7 Image of the Arduino MEGA 2560
RFID Security System by Alkhadashi, Kaminski, and Puninske 21
5V TO 12V RELAY
As the solenoid lock we chose for this project needed a 12V signal to engage, we needed a way
to translate the 5V HIGH signal from the Arduino to a 12V signal to activate the solenoid. After
some research into voltage amplification circuits, we decided on using a 5V to 12V relay. Relays
act as a magnetic switch which use a small voltage signal to connect a larger voltage signal to a
circuit. The magnetic switch is created by running a current through a system of coupled
inductors, the current generates a magnetic field. This magnetic activates a ferromagnetic
switch which then allows the larger voltage to enter a circuit. The relay is rated at 360-mW,
which means that, for a 5V signal (the signal from the Arduino), the current needed to activate
the relay is 72mA, fortunately, the Arduino is capable of generating such a current.
Fig. 8 Image of the 5V to 12V relay
SOLENOID LOCK SYSTEM
The solenoid lock system used is a standard solenoid lock with a 9-12VDC activating voltage.
Solenoid locks in general are no more than electromagnetics with a slug (the lock) connected.
When a sufficient voltage, driven by the minimum current, is passed to the solenoid, the
electromagnet charges and pulls the slug back, thereby unlocking the door. Taking the power
requirements into consideration, we choose a portable 12VDC battery pack. Testing showed
that it met the minimum current requirements.
Fig. 9 Image of the solenoid used in the project
RFID Security System by Alkhadashi, Kaminski, and Puninske 22
HOW IT ALL WORKS
As the previous sections have explained, in detail, the operation of each separate module of the
RFID security system. This section will detail how each module operates together during
operation.
The system always starts from the default state, enabled and ready to RFID tags. Once a tag has
been scanned, the unique tag ID is sent from the RFID reader (SOUT) to the Arduino (RX1). Once
the data is read in the by Arduino, the value is checked against an array of accepted values. If
the tag ID is not in that array, it is then checked against an array of “bad” or non-accepted
values. From here, the system will perform different tasks based on the number of attempts
from any single tag ID value. The sections below describe the response of the system to the
following scenarios:
Accepted Card
Unknown Card (less than three attempts)
Unknown Card (three or more attempts)
ACCEPTED CARD
When the system is ready to accept a card and an accepted card is scanned. If the tag ID value
is in the accepted array, the follow events occur:
The Arduino sends an active HIGH signal over PIN 7 to the RFID reader (ENABLE pin), this
disables the RFID reader. This protects against system overload in the event of multiple
scans.
A text file is created on the SD card and a success is written to it with the tag ID number.
The text file is then closed for further appending.
The Arduino sends a decimal command (17) to the LCD (RX pin) from PIN 6, this
command turns on the backlight. The system then delays for 20ms to allow for the
command to run.
The Arduino prints the message “Welcome” to the LCD.
The Arduino sends a decimal command (224) to the LCD, this command prompts the
LCD screen to play a C# note.
The Arduino sends a 5V HIGH signal from PIN 9 to the 5V relay, which in turn switches
the 12VDC battery pack to the solenoid lock. The system then delays for 5 seconds to
allow the user to enter the door.
RFID Security System by Alkhadashi, Kaminski, and Puninske 23
The Arduino then sends a decimal command (12) to the LCD, this command clears the
display and sets the cursor to the origin (0,0). The system then delays for 5ms for the
command to run.
The Arduino then sends a LOW signal on PIN 7 to the RFID reader ENABLE pin. This
enables the RFID reader to start reading cards again.
The Arduino then sends a LOW signal on PIN 9 to the 5V relay, this will open the switch,
locking the door again.
Fig. 10 ACK confirmation to user
REJECTED CARD (LESS THAN 3 ATTEMPTS)
The unique tag ID number is transmitted from the RFID reader (SOUT PIN) to the Arduino (RX1
pin). Once the ID data is transferred to the Arduino, the Arduino performs a check against an
array of accepted card values. If there is no match to any of the existing accepted values, the
tag ID is checked against another array of previously scanned, rejected, cards. If the card value
does not exist in this array, it is appended onto it. If it does already exist in the array, then an
increment value assigned to that element in the array is incremented by 1.
When a value is read by the Arduino which does not match a value on the accepted array, but
either does not appear on the rejected list, or appears on the rejected list with an increment
counter less than 3, the following occurs:
The Arduino sends a HIGH signal on PIN 7 to the RFID reader (ENABLE pin) to disable the
RFID reader. This is to make sure there are not any duplicate scans during system
operation.
A decimal command (17) is sent to the LCD screen on PIN 6. This will enable the
backlight on the LCD. The system is then delayed by 20ms for the command to process
correctly.
The increment variable for that unique tag ID value is increased by 1.
RFID Security System by Alkhadashi, Kaminski, and Puninske 24
The text file mentioned in the section above is opened and appended with the failed
card number. It is then closed for further editing.
The Arduino prints “Access Denied” to the LCD.
The Arduino sends a decimal command (222) to the LCD screen on PIN 6. This prompts
the LCD to play a D# note.
The system is delayed for 1 second. This is to allow the user to read the message.
The Arduino send a decimal command (12) the LCD screen on PIN 6. This will clear the
LCD screen and reset the cursor to (0,0). The system is then delayed 5ms for the
command to process.
The Arduino sends a LOW signal on PIN 7 to the RFID reader (ENABLE PIN). This enables
the RFID reader to start reading cards again.
Fig. 11 NAK message seen if rejected card ID is scanned less than three times
REJECTED CARD (3 OR MORE ATTEMPTS)
When a card is scanned and determined to be rejected, if it is the third time being rejected; the
following occurs:
The Arduino sends a HIGH signal over PIN 7. This disables the RFID reader to avoid
multiple during system processing.
The Arduino prints “Please Contact: 586-943-6075”, to the LCD screen. This phone
number could be changed to a system administrator contact number.
The Arduino send two decimal commands over PIN 6 (222, 220). This is a third, unique,
tone that acts as an auditory cue to the user.
The Arduino then runs the “Picture” program, which has the camera snap a picture of
the user. The image is then passed to the host program which runs within the main loop
program. The image is now accessible from the Arduino’s local IP address. This address
is given to the user upon system startup.
RFID Security System by Alkhadashi, Kaminski, and Puninske 25
The image data is then processed and saved to the SD card. This is the lengthiest portion
of the entire program. It takes up to 30 seconds to save all the data to the SD card.
The system then delays for 1.5 seconds for processing.
The Arduino then sends a decimal command (12) over PIN 6 to the LCD screen. The
system is then delayed by 5ms to process the command.
A proxy server, hosted by Temboo is then called. This service allows the Arduino,
properly networked, to access and send emails from a private email client.
A Temboo Client is instantiated; this allows for the email to be sent.
All relevant fields for the email are then added to the Temboo Client. A short message
notifying the system owner is then sent. This also serves as an approximate timestamp.
The Temboo Client is then closed.
The Arduino sends a LOW signal to PIN 7 to enable the RFID reader.
Fig. 12 NAK message seen when a card ID is rejected 3 times
RFID Security System by Alkhadashi, Kaminski, and Puninske 26
OVERCOMING CHALLENGES
While constructing the project, our team had to overcome a number of issues. These issues and
their resolutions are detailed below.
Challenge Solution
Hosting the image from the SD card should only be a conditional outcome, however
hosting any data on an IP address is a real time, continuous process. During our first
implementation, the data would only be sent once to the IP address, this translated to only
a partial picture being hosted.
We moved the host() program to the main void loop() structure in the Arduino IDE. This ensured that the data would be continuously hosted when a GET request is sent to the IP
address. We then instantiated a global variable for the file name that we wanted to host. This value is overwritten each time a
picture is taken and saved. This allowed us to ensure that the data is always hosted while being updated each time a picture is taken.
Decision Making: Rejected cards need to be identified as rejected and need to be tracked.
If three different rejected cards scan once, the third card may be rejected. We wanted
to avoid this.
Three arrays were constructed. The first array contained all accepted card values. The second contains all rejected card values. The second array is linked to the third, which is
populated with increment values. Each time a card is scanned, it is first compared to all accepted array values. If it does not match any of the values, it is then compared to all
rejected card values. If it still does not match, it is added to the rejected array and its
increment value is set to one. If it does match a rejected value, it increments the associated
increment value by one.
When first testing the system, the values read from the serial monitor did not match
the same value when typed.
After troubleshooting, it was discovered that a line return character (\n) was embedded into the string of bytes read from the RFID reader. After stripping the character, the
values started to match.
RFID Security System by Alkhadashi, Kaminski, and Puninske 27
OPERATIONAL PROCEDURE
This section is meant to outline the procedure for operating the Network Connected RFID
Security System. The system is stored on EEPROM, so as long as the system has power, it should
run with no outside input from the user. For power, the system draws power from a serial cable
connected to the user’s console.
Fig. 13 Ethernet cable and USB cable connected to Arduino board
The following steps will enable the user to operate the system:
Connect the network cable into the Arduino.
Connect the USB serial cable to the Arduino.
Turn the 12VDC battery pack ON.
Turn on the Serial Monitor in the Arduino IDE.
Once each of the modules becomes initialized, a message is displayed to the user.
RFID Security System by Alkhadashi, Kaminski, and Puninske 28
Fig. 14 Example of system boot up messages to the user
Once the Ethernet connection is established, the Arduino’s local IP address and port are
displayed to the user. This is the IP address on which the image will be hosted.
Once the Ethernet connection is established, the system is now fully operational and
ready for use.
Fig. 15 Example of process feedback on the serial monitor. Pictured is feedback for the picture, storage, hosting, and email programs.
RFID Security System by Alkhadashi, Kaminski, and Puninske 29
ANALYSIS/DISCUSSION
The initiative of this project began with maximum ambition to provide a robust RFID security system with multiple functionality and unique features. It turned out to be a bit intricate when a vigorous proposition of include a photographic device in the system was brought to the table. The idea of including a photographic device is being able to confirm the identity and physical presence of the individual when three failed attempts occur. This project was pre planned thoroughly prior to attempting implementation. The plan was straightforward and obstacles were identified prior to attempting the actual implementation. The project turned out to be more challenging than originally anticipated. One of the major challenge was the coding part. The coding was done individually for each component then integrated together. Each individual task of coding had a level of difficulty when writing. For example, it was very difficult getting the camera to capture image and store it in an SD card because the PDF instructional manual did provide any troubleshoot hints. Originally there was no way to confirm if the camera is actually a working device. Then after a lot of research, it was found that the camera can be connected to a television via RCA cable. An RCA cable was made and the camera was streaming on the television successfully. At that stage, it was confirmed that the camera works and it was insured that the camera will perform the task once the code is working correctly. Another challenging part of the coding was integrating the code together and getting the image to host on an IP address. The original plan was to have the captured image email to the owner’s email address. It was very difficult to do so. Therefore, another approach was taken by taking the and generating an Arduino based IP address to host the image to be viewed. This technique of displaying the image was the only candidate as the implementation of the project continues. As the implementation of the project came to an end and the system performed the desired task, the team continued to enhance the system, some of which was that the emailing the image was a success. It very difficult but managed to be included to be as part of the system. The security system performed the anticipated task successfully. Since this is a research project and the first of its kind to be implemented and demonstrated, these type of components were the best candidates. There are other components that could replace the components being used in this project within the technical scope of this project.
While brainstorming for alternative design ideas, a number of future improvement were put to
the table. An alternative design idea would be to include Wi-Fi as an internet connection
instead of Ethernet connection. This would be great because there would be no need for shield
and location of the RFID reader could be place would not depend on where the Ethernet cord is
available. The only disadvantage about using a Wi-Fi is the signal strength may vary and in some
cases be weak. The system would require a separate SD shield and there would be no option
RFID Security System by Alkhadashi, Kaminski, and Puninske 30
for Power over Ethernet (PoE). another alternative implementation would be the raspberry Pi
implementation instead of the Arduino. This would work great because the raspberry Pi is
faster and more powerful than the Arduino. Another advantage is that if in the future image
processing would be implemented, then it can be done on the raspberry Pi board whereas the
Arduino doesn't have that capability. The only disadvantage of using a raspberry Pi is that it is
expensive and it's a bit more difficult to implement. While there is still potential for enhancing
the system, the overall performance of this system performed the anticipated task.
RFID Security System by Alkhadashi, Kaminski, and Puninske 31
RELEVANT OSHA/FCC REGULATIONS
During the development of this security system, safety taken into consideration every step of the way. Measurements were taken to account for any danger in all aspects. This system can be connected to a 120V wall outlet. Some of the component would have to require a voltage regulator. The datasheet for every component are included in this report and in there it describes in details the voltage and current specifications. The wires used in the entire system are per OSHA regulations. The wires in the circuit are 24 gauge, which makes them safe to handle the 200mA in the circuitry of the Arduino. Other wires such as the wires going into the solenoid are 18 gauge to ensure the safety of the current running through there. The following is a OSHA regulation regarding current. 1910.303(b)(5)
“Circuit impedance and other characteristics. The overcurrent protective devices, the
total impedance, the component short-circuit current ratings, and other
characteristics of the circuit to be protected shall be selected and coordinated to
permit the circuit protective devices used to clear a fault to do so without the
occurrence of extensive damage to the electrical components of the circuit. This fault
shall be assumed to be either between two or more of the circuit conductors, or
between any circuit conductor and the grounding conductor or enclosing metal
raceway.”
Just like any circuitry in a residential or commercial structure, a circuit breaker is required. To protect any overload or shortage. The RFID security system designed to compensate for the compatibility of OSHA regulation safety in terms of circuit breakers.
1910.303(f)(5)(i) “Where circuit breakers or fuses are applied in compliance with the series
combination ratings marked on the equipment by the manufacturer, the equipment
enclosures shall be legibly marked in the field to indicate that the equipment has
been applied with a series combination rating.”
The component that will be exposed or be placed outdoors are being protected from any form of subject that can endanger the safety of users. The exposed components are weatherproof, waterproof and fire safety per OSHA regulations. The capable of using an effective ground path per OSHA regulation “NEC-250-51” for all the circuitry.
Since the RFID security system will be using the Ethernet. It has been taken into account for
following the Federal Communication Commission (FCC) regulations that allow for modern
usage. The Ethernet being used will only be utilized for hosting the image purposes.
RFID Security System by Alkhadashi, Kaminski, and Puninske 32
CONCLUSION
In conclusion, our group learned a great deal about the operation and applications of RFID
systems. Using the SD card in conjunction with the Ethernet Shield allowed us to explore the
connectivity and image processing abilities of the Arduino. This allowed our group to explore
the application of the Internet of Things (IoT) in regards to our project. This application opens
up extensions for our project. Some of the additions we are interested in implementing include:
Implementation of a Raspberry Pi 3 to decrease image processing time.
Development of an app, which would allow a user to access information from
anywhere.
Back-end facial recognition, which would allow the user to match the face of anyone
attempting to gain access to the system with a set of known faces.
Implementing these additions would represent novel and unique aspects of a RFID security
system.
RFID Security System by Alkhadashi, Kaminski, and Puninske 33
REFERENCES Adafruit. (2016, December 12). Adafruit. Retrieved from Adafruit:
https://www.adafruit.com/product/397
Ahsan, K. H. (2010). RFID applications: An introductory and exploratory study. arXiv preprint,
1002-1179.
Jechlitschek, C. (2016, 12 12). A Survey Paper on Radio Frequency IDentification (RFID) Trends.
Retrieved from http://www.cse.wustl.edu/~jain/cse574-06/ftp/rfid/
K. Ahsan, H. S. (2009). Context Based Knowledge Management in Healthcare: An EA Approach.
AMCIS .
Kaur, M. e. (2011). RFID technology principles, advantages, limitations & its applications.
International Journal of Computer and Electrical Engineering, 151.
RFID Journal. (2016, December 12). Basics of an rfid system. Retrieved from RFID Journal:
http://rfid.atlasrfidstore.com/hs-fs/hub/300870/file-252314647-pdf/Content/basics-of-
an-rfid-system-atlasrfidstore.pdf
Stilp, L. (2004, August 5). Google Patents. Retrieved from Google:
https://www.google.com/patents/US20040150521
Stilp, L. (2006, April 4). USA Patent No. 7,023,341. Retrieved from Google:
https://www.google.com/patents/US7023341
Tapp, H. a. (2012, December 18). Google Patents. Retrieved from Google:
https://www.google.com/patents/US8334775
RFID Security System by Alkhadashi, Kaminski, and Puninske 34
APPENDIX I: PARTS LIST
Manufacturer & Model Unit Price Quantity
TTL Camera: Adafruit Learning Systems #397 $39.95 1
Arduino Mega 2560 $49.95 1
Wiznet W5100 Ethernet Shield/SD card slot $29.95 1
Parallax Serial LCD #27977 $29.95 1
Parallax Serial RFID Reader #28140 $29.95 1
RFID Tags $4.00 4
Solenoid Locking System $15.00 1
12 V Relay $5.00 1
12 V Battery Pack $5.00 1
10k Resistor ∓5% $0.00 2
5v Relay $7.00 1
Total $213.75
RFID Security System by Alkhadashi, Kaminski, and Puninske 35
APPENDIX II: COST ANALYSIS
After finishing the project, the total cost was $213.75. The largest portion of this cost came from the Arduino Mega 2560 development board at $49.95. This specific cost could have been mitigated by buying the development board from a 3rd party supplier as opposed to direct from Arduino. The price can be as low as $20.00 from certain retailers which would have brought the price for this prototype down significantly. The price of each other component, however, seemed to be competitive. If this were scaled for mass production, the cost would be able to be improved significantly. The price of the purchased Arduino development board, even at the lower price point, is massively larger than the price of the individual processors that would be used.
Price also played a factor in our choice of an Arduino over Raspberry Pi. Even though they have
similar development board costs, the Raspberry Pi has many additional static costs that go into
operating the microcontroller. A keyboard, monitor and HDMI cable are necessary to begin
interfacing with your Raspberry Pi.
RFID Security System by Alkhadashi, Kaminski, and Puninske 36
APPENDIX III: SCHEMATICS
RFID Security System by Alkhadashi, Kaminski, and Puninske 37
APPENDIX IV: PROJECT CODE
The follow section will detail the full project code. Due to MS Word formatting issues, the code
may be difficult to read in its entirety. For the reader’s convenience, the Arduino sketch will be
included with the digital version of this report.
/******************************************************************
* Project: Network Connected RFID Security System *
* Authors: Mike Kaminski, Mohamed Alkhadashi, Benjamin Puninske *
* Class: ECE 4600 Capstone *
* Advisor: Dr. Syed Mahmud *
* Date: 12/12/16 *
* Purpose: *
* To operate an RFID reader which scans cards and checks *
* against an array of accepted cards. If the scanned card is on *
* the list, the system will display a "Welcome" message on the *
* LCD screen and send a HIGH signal to a relay, which will then *
* operate a solenoid lock. *
* *
* If the card is no in the accepted array, the system will then *
* check against a rejected array. If the card is included in the *
* rejected array, an increment counter is increased by one. If *
* it is not in the rejected array, the card ID is added to the *
* rejected array. *
* *
* If a card is rejected but the number of rejections is less *
* than three, the system will send an "Access Denied" message *
* to the LCD. *
* *
* If a card is rejected three times. The system will prompt *
* the camera to take a photo and store it on a SD card. Once *
RFID Security System by Alkhadashi, Kaminski, and Puninske 38
* this is done, the photo will be hosted on the Arduino's *
* local IP address. The system will also send an email to the *
* user notifying them of an unauthorized access attempt. *
* *
* The system will also keep a local log of all access attempts *
* on a text file. *
******************************************************************
*/
/****************************************
* Inclusion of all necessary libraries *
* **************************************
*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
/******************************************
* Setting Temboo parameters. Temboo is *
* a proxy service which allows us to *
* access email accounts to automatically *
* send emails. *
* ****************************************
*/
RFID Security System by Alkhadashi, Kaminski, and Puninske 39
#define TEMBOO_ACCOUNT "capstonegrp1" // Your Temboo account name
#define TEMBOO_APP_KEY_NAME "myFirstApp" // Your Temboo app key name
#define TEMBOO_APP_KEY "GzmE6s1nZRZDJV7ZLBFI2nUvjLONFUXl" // Your Temboo app key
/**********************************************
* Creation of SoftwareSerial Objects. This *
* allows us to write commands to the LCD and *
* camera modules. *
* ********************************************
*/
SoftwareSerial LCD = SoftwareSerial(255,6);
SoftwareSerial cameraconnection = SoftwareSerial(69, 3);
Adafruit_VC0706 cam = Adafruit_VC0706(&cameraconnection); //Using imported library from Adafruit to
create camera object
/****************************
* Setting global variables *
* **************************
*/
const int chipSelect = 4;
const int RFIDpin = 7;
const int lockPin= 9;
int val = 0;
char code[10];
int bytesread = 0;
String out;
char* GoodReads[]={"13000A7116\n", "14007889F6\n", "456"};
String BadReads[]={"","","","","",""};
int inc[]={1,1,1,1,1,1};
RFID Security System by Alkhadashi, Kaminski, and Puninske 40
byte mac[]={0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
char filename [13];
int numRuns = 1;
int maxRuns = 10;
String readString;
/*****************************************
* Using the Ethernet Class to create a *
* client for the email program and a *
* server for the host program. *
* ***************************************
*/
EthernetServer server(84);
EthernetClient client;
void setup() {
Serial.begin(9600); //Setting up the first serial connection.
if(!SD.begin(chipSelect)){ //Check to see if the SD card is initialized.
Serial.println("Card failed, or not present.");
return;
}
Serial.println("Card initialized"); //If the SD card is set up, print a message to the serial monitor.
Serial1.begin(2400); //Initialize the second serial connection for the RFID module.
pinMode(RFIDpin,OUTPUT); //Set RFID pin to output mode.
digitalWrite(RFIDpin,LOW); //Set RFID pin to LOW
Serial.println("RFID reader initialized."); //Print ready message to serial monitor.
pinMode(6,OUTPUT); //Set LCD pin to output and HIGH
digitalWrite(6,HIGH);
LCD.begin(2400); //Initialize LCD screen at 2400 bps
RFID Security System by Alkhadashi, Kaminski, and Puninske 41
delay(100); //Requred delay for LCD
LCD.write(12);
delay(5); //Reset display on LCD
Serial.println("LCD Initalized"); //Print LCD ready message to serial monitor
pinMode(lockPin,OUTPUT); //Set pin to relay as OUTPUT
Serial.println("Initializing Ethernet connection.......");
Ethernet.begin(mac); //Setting up ethernet connection using MAC address
delay(2000); //Mandatory system delay
server.begin(); //Starting Ethernet Server
Serial.println("Ethernet connection Initialized");
Serial.print("Please connect to: ");
Serial.print(Ethernet.localIP()); //Poll the Arduino's local IP address and display it to the user
Serial.println(":84"); //Display the port number
LCD.print("System Ready"); //Display a system ready message to the LCD screen
delay(1000); //Mandatory system delay
LCD.write(12); //Clear LCD screen
delay(5); //Mandatory system delay
}
void loop(){
host(); //Run host program at all times
int goodRead=0; //reset goodRead to 0
if(Serial1.available() > 0) { //If the Serial 1 connection is available...
if((val=Serial1.read()) == 10) { //If the read byte is 0x0A or 10 in decimal
bytesread = 0; //set index value
while(bytesread 0) { //If the serial 1 connection is still avaialable...
val = Serial1.read(); //assign val to byte read from serial connection
if((val == 10) || (val == 13)){ //if val is 0x0A or 0x0D, break loop
break;
RFID Security System by Alkhadashi, Kaminski, and Puninske 42
}
code[bytesread] = val; //append new byte to array
bytesread++; //increment index value
}
}
if(bytesread == 10) { //if the number of bytes read is 10 (tag ID length)
Serial.println(out); //print the array (debug)
out=String(code); //cast the array to a string
out.remove(10,2); //remove garbage characters
out=out + "\n"; //append line return character
File newFile = SD.open("RFID.txt",FILE_WRITE); //create new file to write to
for(int i=0;i
RFID Security System by Alkhadashi, Kaminski, and Puninske 43
digitalWrite(lockPin,LOW); //Disable solenoid
break;
}
}
if(goodRead==1){
Serial.println("Good Value");
}
else{ //if the value is not in the accepted array
Serial.println("Bad Value");
digitalWrite(RFIDpin,HIGH); //disable RFID reader
LCD.write(17); //turn backlight on
delay(20); //delay 20ms
for(int i=0; i
RFID Security System by Alkhadashi, Kaminski, and Puninske 44
delay(5);
digitalWrite(RFIDpin,LOW); //enable RFID reader
break;
}
if(!out.equals(BadReads[i]) && BadReads[i].equals("")){ //if the value does not equal any rejected
values and system reaches empty slot in array
BadReads[i]=out; //add read value to array
int k=inc[i]; //increment value is set to 1
k++;
inc[i]=k;
LCD.print("Access Denied"); //print Access Denied to LCD
LCD.write(222); //play D# tone
delay(1000);
LCD.write(12); //clear LCD
delay(5);
digitalWrite(RFIDpin,LOW); //enable RFID reader
if(newFile){ //print value to text file
newFile.println("Failure: " + out);
newFile.close();
}
else{
Serial.println("Error with printing new card failure");
}
break;
}
if(out.equals(BadReads[i]) && inc[i]>=3){ //if the value does equal a rejected card value and the
increment value is equal to 3
Serial.println("Value is locked out");
inc[i]=1; //reset increment value to 1 (for testing)
LCD.print("Please Contact:"); //print contact information on LCD
LCD.write(148);
LCD.print("586-943-6075");
RFID Security System by Alkhadashi, Kaminski, and Puninske 45
LCD.write(222); //play two notes for user
LCD.write(220);
picture(); //run picture program, this will take up to 30 seconds
delay(1500); //mandatory system delay
LCD.write(12); //clear LCD
delay(5);
// Set Temboo account credentials
TembooChoreo SendEmailChoreo(client);
SendEmailChoreo.begin();
SendEmailChoreo.setAccountName(TEMBOO_ACCOUNT);
SendEmailChoreo.setAppKeyName(TEMBOO_APP_KEY_NAME);
SendEmailChoreo.setAppKey(TEMBOO_APP_KEY);
// Set Choreo inputs
String FromAddressValue = "[email protected]";
SendEmailChoreo.addInput("FromAddress", FromAddressValue);
String UsernameValue = "[email protected]";
SendEmailChoreo.addInput("Username", UsernameValue);
String ToAddressValue = "[email protected]";
SendEmailChoreo.addInput("ToAddress", ToAddressValue);
String SubjectValue = "[ALERT] Attempted Entry";
SendEmailChoreo.addInput("Subject", SubjectValue);
String PasswordValue = "xhxuujhdbisdznwu";
SendEmailChoreo.addInput("Password", PasswordValue);
String MessageBodyValue = "There has been an attempted entry. Please connect to system IP
address to see image.";
SendEmailChoreo.addInput("MessageBody", MessageBodyValue);
// Identify the Choreo to run
SendEmailChoreo.setChoreo("/Library/Google/Gmail/SendEmail");
RFID Security System by Alkhadashi, Kaminski, and Puninske 46
// Run the Choreo; when results are available, print them to serial
SendEmailChoreo.run();
while(SendEmailChoreo.available()) {
char c = SendEmailChoreo.read();
Serial.print(c); //Print response from email server
}
SendEmailChoreo.close();
digitalWrite(RFIDpin,LOW); //enable RFID reader
break;
}
}
}
}
}
}
}
void picture() {
// When using hardware SPI, the SS pin MUST be set to an
// output (even if not connected or used). If left as a
// floating input w/SPI on, this can cause a potential system lock.
#if !defined(SOFTWARE_SPI)
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
if(chipSelect != 53) pinMode(53, OUTPUT); // SS on Mega
#else
if(chipSelect != 10) pinMode(10, OUTPUT); // SS on Uno, etc.
#endif
RFID Security System by Alkhadashi, Kaminski, and Puninske 47
#endif
Serial.begin(9600);
Serial.println("VC0706 Camera snapshot test");
// Try to locate the camera
if (cam.begin()) {
Serial.println("Camera Found:");
} else {
Serial.println("No camera found?");
return;
}
// Print out the camera version information (optional)
char *reply = cam.getVersion();
if (reply == 0) {
Serial.print("Failed to get version");
} else {
Serial.println("-----------------");
Serial.print(reply);
Serial.println("-----------------");
}
// Set the picture size - you can choose one of 640x480, 320x240 or 160x120
// Remember that bigger pictures take longer to transmit!
cam.setImageSize(VC0706_640x480); // biggest
//cam.setImageSize(VC0706_320x240); // medium
//cam.setImageSize(VC0706_160x120); // small
// You can read the size back from the camera (optional, but maybe useful?)
uint8_t imgsize = cam.getImageSize();
RFID Security System by Alkhadashi, Kaminski, and Puninske 48
Serial.print("Image size: ");
if (imgsize == VC0706_640x480) Serial.println("640x480");
if (imgsize == VC0706_320x240) Serial.println("320x240");
if (imgsize == VC0706_160x120) Serial.println("160x120");
if (! cam.takePicture())
Serial.println("Failed to snap!");
else
Serial.println("Picture taken!");
// Create an image with the name IMAGExx.JPG
strcpy(filename, "IMAGE00.JPG");
for (int i = 0; i < 100; i++) {
filename[5] = '0' + i/10;
filename[6] = '0' + i%10;
// create if does not exist, do not open existing, write, sync after write
if (! SD.exists(filename)) {
break;
}
}
// Open the file for writing
File imgFile = SD.open(filename, FILE_WRITE);
// Get the size of the image (frame) taken
uint16_t jpglen = cam.frameLength();
Serial.print("Storing ");
Serial.print(jpglen, DEC);
Serial.print(" byte image.");
RFID Security System by Alkhadashi, Kaminski, and Puninske 49
int32_t time = millis();
pinMode(8, OUTPUT);
// Read all the data up to # bytes!
byte wCount = 0; // For counting # of writes
while (jpglen > 0) {
// read 32 bytes at a time;
uint8_t *buffer;
uint8_t bytesToRead = min(32, jpglen); // change 32 to 64 for a speedup but may not work with all setups!
buffer = cam.readPicture(bytesToRead);
imgFile.write(buffer, bytesToRead);
if(++wCount >= 64) { // Every 2K, give a little feedback so it doesn't appear locked up
Serial.print('.');
wCount = 0;
}
//Serial.print("Read "); Serial.print(bytesToRead, DEC); Serial.println(" bytes");
jpglen -= bytesToRead;
}
imgFile.close();
time = millis() - time;
Serial.println("done!");
Serial.print(time); Serial.println(" ms elapsed");
}
void host (){
EthernetClient client = server.available();
if (client) {
while (client.connected()) {
if (client.available()) {
char c = client.read();
RFID Security System by Alkhadashi, Kaminski, and Puninske 50
//read char by char HTTP request
if (readString.length() < 100) {
//store characters to string
readString += c;
Serial.print(c);
}
//if HTTP request has ended
if (c == '\n') {
///////////////
Serial.println(readString); //print to serial monitor for debuging
client.println("HTTP/1.1 200 OK"); //send new page
client.println("Content-Type: image/jpeg");
client.println();
File myFile = SD.open(filename);
if (myFile) {
byte clientBuf[64];
int clientCount = 0;
while(myFile.available())
{
clientBuf[clientCount] = myFile.read();
clientCount++;
if(clientCount > 63)
RFID Security System by Alkhadashi, Kaminski, and Puninske 51
{
Serial.println("Packet");
client.write(clientBuf,64);
clientCount = 0;
}
}
//final 0) client.write(clientBuf,clientCount);
// close the file:
myFile.close();
}
delay(1);
//stopping client
client.stop();
readString="";
}
}
}
}
}
RFID Security System by Alkhadashi, Kaminski, and Puninske 52
APPENDIX V: PARTNER CONTRIBUTION
Task Mohamed Alkhadashi
Mike Kaminski Benjamin Puninske
Project Brainstorming
33% 33% 33%
Wiring of components
12.5% 12.5% 75%
Code: LCD 30% 40% 30%
Code: RFID reader 30% 40% 30%
Code: Camera 60% 40% 0%
Code: SD card
30% 40% 30%
Code: Ethernet host 30% 40% 30%
Code: Email 30% 40% 30%
Code Integration 0% 100% 0%
Prototype Assembly 0% 0% 100%
Research 33% 33% 33%
Project Report 25% 50% 25%
Project Presentation 33% 33% 33%
Troubleshooting 33% 33% 33%
RFID Security System by Alkhadashi, Kaminski, and Puninske 53
APPENDIX VI: DATASHEETS
The following datasheets will be attached to the hard copy of this report. They will also be
included with this file when submitted for evaluation.
Robotics & CNC: Lock-Style Solenoid – 12VDC
Parallax Serial LCD #27977
Parallax Card Reader, Serial #28140
Arduino Ethernet Shield
PCB Relay, G5LE Power Relay