Documente Academic
Documente Profesional
Documente Cultură
CHAPTER 1
INTRODUCTION
1.1 Introduction to the Project
The project that we will be working on is an RFID door lock that will be available
to the general public at an affordable price. The goal of this project is to create a more
convenient way to unlock your door than the traditional key. In the key’s place is an
RFID tag that will unlock the door by proximity. However, the improvements of this
RFID door lock must outweigh the complications of implementation. The list of
customer needs (in the Requirements and Specifications section) was constructed with
that fundamental goal in mind. The design consists of two components. The first
component is the actual door lock that must be installed in the doorframe. This will be
controlled by a magnetic lock and will need to be powered. The second component is
a relatively small module that you can install anywhere near the door. This module is
responsible for the RFID sensing. Chapter 2 goes over the requirements and
specifications determined for the RFID door lock. The requirements are inspired by
surveys of various groups as well as personal interest. The specifications are designed
in order to meet these requirements. These are created before the actual design of the
RFID door lock had been created so the requirements and specifications may not
exactly meet the final product. However, the final product is still designed with these
ideas in mind. In the Functional Decomposition (Chapter 3), the design of the final
product is shown and explained. This chapter also documents the tests and
complications confronted throughout the design. The design is split into 5 modules
which were tackled individually until finally bringing the whole product together. The
necessity of each module is included.
ECE-HITS 1 2016-2020
RFID BASED Door Lock Using Arduino
In many door lock security systems, GSM is used for communication purpose. The
purpose of a work cultivated by utilization of a circuits like a GSM module which
gets activated by a controller for sending SMS in emergency to proprietor and for
sending corresponding services of security at the time of break in. For detecting
obstacles, the system requires various sensors. It gathers data from the sensors and
settles on a choice.
ECE-HITS 2 2016-2020
RFID BASED Door Lock Using Arduino
These types of security systems used for digital door lock are utilizing inactive
RFID tags (passive). With the help of this, it ensures that only valid person can get
entry. Such systems are working in real time basic for opening the door in which user
have to place the tag in contact with RFID detector, then the entryway gets opens and
in the central server the registration data is stored with necessary data of the users.
Attendance and person tracking is possible by using such type of system.
Bluetooth based system is a bit like sarvy house innovations that utilizes
Bluetooth function available in smart devices .The framework using Bluetooth turns
out to be more simple and productive for proper utilization. Such systems are
generally based on Arduino platform. The hardware of such framework is the combo
of android smart phone and Bluetooth module. Arduino microcontroller here is acting
as a controller and solenoid can be acting as output of locking system.
ECE-HITS 3 2016-2020
RFID BASED Door Lock Using Arduino
The proposed method in latest work does not need administrator‟s help to
access the facility if the user knows OTP technique and has a registered mobile phone
. Likewise the OTP is generated and sent to the proprietor‟s mobile phone whenever
user requests to access facility. Then the OTP should enter through keypad on the
door ,the door will open. In case if the mobile is not available or off then the option to
open the door is to answer the security question ask by system.
VB Based System:
Electronic eye represents the model for capturing the door images with the
help of microcontroller to ensure the safety for offices and houses. In this system, the
image gets captured when the door is opened and these images are displayed by using
VB application on computing system.
Combined System:
Survey:
ECE-HITS 4 2016-2020
RFID BASED Door Lock Using Arduino
RFID raises two main privacy concerns for users: clandestine tracking and
inventorying.RFID tags respond to reader interrogation without alerting their owners
or bearers. Thus, where read range permits, clandestine scanning of tags is a plausible
threat. Most RFID tags emit unique identifiers, even tags that protect data with
cryptographic algorithms In consequence, a person carrying an RFID tag effectively
broadcasts a fixed serial number to nearby readers, providing a ready vehicle for
clandestine physical tracking. Such tracking is possible even if a fixed tag serial
number is random and carries no intrinsic data. The threat to privacy grows when a
tag serial number is combined with personal information.
ECE-HITS 5 2016-2020
RFID BASED Door Lock Using Arduino
The query tree is a data structure for representing prefixes which is sent by the
reader in the query tree protocol. A reader identifies tags through consecutive
communications with tags. The query tree protocol consists of rounds. In each round,
the reader transmits a query and tags respond with their IDs. The query has a prefix.
Only tags of which IDs match the prefix respond. When only a tag answers, the reader
successfully recognizes the tag. When more than one tags answer, responses collide
and the reader cannot get any information about the tags.
Prefix Randomised Query Tree protocol builds a binary search tree according
to the prefixes chosen randomly by tags rather than using their IDbased prefixes.
Therefore, the tag identification time of the proposed protocol is no longer limited by
the tag ID distribution and ID length as the conventional tree search protocol. The
Query-Tree protocol is simple, but it has scalability problem because its worst-case
time complexity is on the order of n(k + 2 − log2 n) [2], where n is the number of tags
and k is the length of ID string.The time complexity of the protocol is derived and
shown that it can identify tags faster than the Query-Tree protocol.
Static broadcast tree protocols have been proposed to optimize the querying
procedure in sensor networks. The solution is given to mitigate the unevenness of
energy distribution and its undesirable effects like reduced network lifetime and loss
of connectivity in a sensor network that are caused by static broadcast trees. a
―Dynamic Query-tree Energy Balancing‖ (DQEB) protocol is used to dynamically
adjust the tree structure and minimize the overall broadcast cost. The proposed
algorithm scales well, is distributed and does not need any global information.
Locally, the broadcast power consumption is minimized while globally, the broadcast
load and power distribution are balanced across the whole sensor network. Simulation
results verify that the DQEB protocol achieves significantly better balance in the
battery power distribution and extends the network’s lifetime considerably.
ECE-HITS 6 2016-2020
RFID BASED Door Lock Using Arduino
CHAPTER2
Embedded systems are controlled by one or more main processing cores that
are typically either microcontrollers or digital signal processors (DSP). The key
characteristic, however, is being dedicated to handle a particular task, which may
require very powerful processors. For example, air traffic control systems may
usefully be viewed as embedded, even though they involve mainframe computers and
dedicated regional and national networks between airports and radar sites.
Since the embedded system is dedicated to specific tasks, design engineers can
optimize it to reduce the size and cost of the product and increase the reliability and
performance. Some embedded systems are mass-produced, benefiting from
economies of scale.
ECE-HITS 7 2016-2020
RFID BASED Door Lock Using Arduino
2.1.1 History
One of the first recognizably modern embedded systems was the Apollo
Guidance Computer, developed by Charles Stark Draper at the MIT Instrumentation
Laboratory. At the project's inception, the Apollo guidance computer was considered
the riskiest item in the Apollo project as it employed the then newly developed
monolithic integrated circuits to reduce the size and weight
ECE-HITS 8 2016-2020
RFID BASED Door Lock Using Arduino
2.1.2 Tools
2.1.3 Resources
To save costs, embedded systems frequently have the cheapest processors that
can do the job. This means your programs need to be written as efficiently as possible.
When dealing with large data sets, issues like memory cache misses that never matter
in PC programming can hurt you. Luckily, this won't happen too often- use
reasonably efficient algorithms to start, and optimize only when necessary. Of course,
normal profilers won't work well, due to the same reason debuggers don't work well.
The uses of embedded systems are virtually limitless, because every day new
products are introduced to the market that utilizes embedded computers in novel
ways. In recent years, hardware such as microprocessors, microcontrollers, and FPGA
chips have become much cheaper. So, when implementing a new form of control, it's
wiser to just buy the generic chip and write your own custom software for it.
Producing a custom-made chip to handle a particular task or set of tasks costs far
more time and money. Many embedded computers even come with extensive
libraries, so that "writing your own software" becomes a very trivial task indeed.
From an implementation viewpoint, there is a major difference between a computer
ECE-HITS 9 2016-2020
RFID BASED Door Lock Using Arduino
and an embedded system. Embedded systems are often required to provide Real-Time
response. The main elements that make embedded systems unique are its reliability
and ease in debugging.
2.2.1 Debugging
Interactive resident debugging, using the simple shell provided by the embedded
operating system (e.g. Forth and Basic)
External debugging using logging or serial port output to trace operation using either
a monitor in flash or using a debug server like the Remedy Debugger which even
works for heterogeneous multi core systems.
An in-circuit debugger (ICD), a hardware device that connects to the microprocessor
via a JTAG or Nexus interface. This allows the operation of the microprocessor to be
controlled externally, but is typically restricted to specific debugging capabilities in
the processor.
An in-circuit emulator replaces the microprocessor with a simulated equivalent,
providing full control over all aspects of the microprocessor.
A complete emulator provides a simulation of all aspects of the hardware, allowing all
of it to be controlled and modified and allowing debugging on a normal PC.
Unless restricted to external debugging, the programmer can typically load and run
software through the tools, view the code running in the processor, and start or stop its
operation. The view of the code may be as assembly code or source-code.
ECE-HITS 10 2016-2020
RFID BASED Door Lock Using Arduino
requires very low-level debugging, at signal/bus level, with a logic analyser, for
instance.
2.2.2 Reliability
The system cannot safely be shut down for repair, or it is too inaccessible to repair.
Examples include space systems, undersea cables, navigational beacons, bore-hole
systems, and automobiles.
The system must be kept running for safety reasons. "Limp modes" are less tolerable.
Often backup is selected by an operator. Examples include aircraft navigation, reactor
control systems, safety-critical chemical factory controls, train signals, engines on
single-engine aircraft..
Designing with a Trusted Computing Base (TCB) architecture ensures a highly secure
& reliable system environment.
An Embedded Hypervisor is able to provide secure encapsulation for any subsystem
component, so that a compromised soft/ware component cannot interfere with other
subsystems, or privileged-level system software. This encapsulation keeps faults from
propagating from one subsystem to another, improving reliability. This may also
allow a subsystem to be automatically shut down and restarted on fault detection.
Immunity Aware Programming
In this design, the software simply has a loop. The loop calls subroutines, each
of which manages a part of the hardware or software.
ECE-HITS 11 2016-2020
RFID BASED Door Lock Using Arduino
Usually these kinds of systems run a simple task in a main loop also, but this
task is not very sensitive to unexpected delays. Sometimes the interrupt handler will
add longer tasks to a queue structure. Later, after the interrupt handler has finished,
these tasks are executed by the main loop. This method brings the system close to a
multitasking kernel with discrete processes.
2) Cooperative Multitasking
3) Primitive Multitasking
As any code can potentially damage the data of another task (except in larger
systems using an MMU) programs must be carefully designed and tested, and access
to shared data must be controlled by some synchronization strategy, such as message
queues, semaphores or a non-blocking synchronization scheme.
ECE-HITS 12 2016-2020
RFID BASED Door Lock Using Arduino
These systems take the input in the form of electrical signals from transducers
or commands from human beings such as pressing of a button etc.., process them and
produces desired output. This entire process of taking input, processing it and giving
output is done in standalone mode. Such embedded systems come under standalone
embedded systems
These embedded systems follow an absolute dead line time period i.e.., if the
tasking is not done in a particular time period then there is a cause of damage to the
entire equipment.
Eg: Consider a TV remote control system, if the remote control takes a few
milliseconds delay it will not cause damage either to the TV or to the remote control.
These systems which will not cause damage when they are not operated at
considerable time period those systems come under soft real-time embedded systems.
ECE-HITS 13 2016-2020
RFID BASED Door Lock Using Arduino
Eg: Consider a web camera that is connected to the computer with internet can
be used to spread communication like sending pictures, images, videos etc.., to
another computer with internet connection throughout anywhere in the world.
Consider a web camera that is connected at the door lock. Whenever a person
comes near the door, it captures the image of a person and sends to the desktop of
your computer which is connected to internet. This gives an alerting message with
image on to the desktop of your computer, and then you can open the door lock just
by clicking the mouse. Fig: 2.2 show the network communications in embedded
systems.
The central processing unit can be any one of the following microprocessor,
microcontroller, digital signal processing.
Among these Microcontroller is of low-cost processor and one of the main advantage
of microcontrollers is, the components such as memory, serial communication
interfaces, analog to digital converters etc.., all these are built on a single chip. The
numbers of external components that are connected to it are very less according to the
application.
Consumer applications
Office automation
Industrial automation
Computer networking
Tele communications
ECE-HITS 14 2016-2020
RFID BASED Door Lock Using Arduino
CHAPTER 3
Here, this block diagram has six main blocks, namely Arduino, RFID Reader,
Power supply, RGB LED, Buzzer and the servo motor. Arduino plays the role of a
micro controller.
Basic Commands
ECE-HITS 15 2016-2020
RFID BASED Door Lock Using Arduino
• setup( ): A function present in every Arduino sketch. Run once before the loop( )
function. Often used to set pinmode to input or output. The setup( ) function looks
like: void setup( ){ //code goes here }
• loop( ): A function present in every single Arduino sketch. This code happens over
and over again. The loop( ) is where (almost) everything happens. The one exception
to this is setup( ) and variable declaration. ModKit uses another type of loop called
“forever( )” which executes over Serial. The loop( ) function looks like: void loop( ) {
//code goes here }
• input:
• output:
• HIGH:
Electrical signal present (5V for Uno). Also ON or True in boolean logic.
• LOW:
• digitalRead:
• digitalWrite:
• analogWrite:
Assign a value between or including 0 (LOW) and 255 (HIGH). This allows you to
set output to a PWM value instead of just HIGH or LOW.
• PWM:
ECE-HITS 16 2016-2020
RFID BASED Door Lock Using Arduino
What is a voltage divider? Voltage dividers are a way to produce a voltage that is a
fraction of the original voltage. Why is a voltage divider useful? One of the ways this
is useful is when you want to take readings from a circuit that has a voltage beyond
the limits of your input pins. By creating a voltage divider you can be sure that you
are getting an accurate reading of a voltage from a circuit. Voltage dividers are also
used to provide an analog Reference signal. What is in a voltage divider? A voltage
divider has three parts; two resistors and a way to read voltage between the two
resistors. How do you put together a voltage divider? It’s really pretty easy. Here is a
schematic and explanation detailing how:
3.3.1.2 Digital
An electronic signal transmitted as binary code that can be either the presence or
absence of current, high and low voltages or short pulses at a particular frequency.
Humans perceive the world in analog, but robots, computers and circuits use Digital.
A digital signal is a signal that has only two states. These states can vary depending
ECE-HITS 17 2016-2020
RFID BASED Door Lock Using Arduino
on the signal, but simply defined the states are ON or OFF, never in between. In the
world of Arduino, Digital signals are used for everything with the exception of
Analog Input. Depending on the voltage of the Arduino the ON or HIGH of the
Digital signal will be equal to the system voltage, while the OFF or LOW signal will
always equal 0V. This is a fancy way of saying that on a 5V Arduino the HIGH
signals will be a little under 5V and on a 3.3V Arduino the HIGH signals will be a
little under 3.3V. To receive or send Digital signals the Arduino uses Digital pins # 0 -
# 13. You may also setup your Analog In pins to act as Digital pins. To set up Analog
In pins as Digital pins use the command: pinMode(pinNumber, value); where
pinNumber is an Analog pin (A0 – A5) and value is either INPUT or OUTPUT. To
setup Digital pins use the same command but reference a Digital pin for pinNumber
instead of an Analog In pin. Digital pins default as input, so really you only need to
set them to OUTPUT in pinMode. To read these pins use the command:
digitalRead(pinNumber); where pinNumber is the Digital pin to which the Digital
component is connected. The digitalRead command will return either a HIGH or a
LOW signal. To send a Digital signal to a pin use the command:
digitalWrite(pinNumber, value); where pinNumber is the number of the pin sending
the signal and value is either HIGH or LOW. The Arduino also has the capability to
output a Digital signal that acts as an Analog signal, this signal is called Pulse Width
Modulation (PWM). Digital Pins # 3, # 5, # 6, # 9, # 10 and #11 have PWM
capabilities. To output a PWM signal use the command: analogWrite(pinNumber,
value); where pinNumber is a Digital Pin with PWM capabilities and value is a
number between 0 (0%) and 255 (100%). For more information on PWM see the
PWM worksheets or S.I.K. circuit 12. Examples of Digital: Values: On/Off, Men’s
room/Women’s room, pregnancy, consciousness, the list goes on....
Sensors/Interfaces: Buttons, Switches, Relays, CDs, etc.... Things to remember about
Digital:
• Digital Input/Output uses the Digital pins, but Analog In pins can be used as Digital
• To receive a Digital signal use: digitalRead(pinNumber);
3.3.1.3 Analog :
ECE-HITS 18 2016-2020
RFID BASED Door Lock Using Arduino
A continuous stream of information with values between and including 0% and 100%.
Humans perceive the world in analog. Everything we see and hear is a continuous
transmission of information to our senses. The temperatures we perceive are never
100% hot or 100% cold, they are constantly changing between our ranges of
acceptable temperatures. This continuous stream is what defines analog data. Digital
information, the complementary concept to Analog, estimates analog data using only
ones and zeros. In the world of Arduino an Analog signal is simply a signal that can
be HIGH (on), LOW (off) or anything in between these two states. This means an
Analog signal has a voltage value that can be anything between 0V and 5V (unless
you mess with the Analog Reference pin). Analog allows you to send output or
receive input about devices that run at percentages as well as on and off. The Arduino
does this by sampling the voltage signal sent to these pins and comparing it to a
voltage reference signal (5V). Depending on the voltage of the Analog signal when
compared to the Analog Reference signal the Arduino then assigns a numerical value
to the signal somewhere between 0 (0%) and 1023 (100%). The digital system of the
Arduino can then use this number in calculations and sketches. To receive Analog
Input the Arduino uses Analog pins # 0 - # 5.
These pins are designed for use with components that output Analog information and
can be used for Analog Input. There is no setup necessary, and to read them use the
command: analogRead(pinNumber); where pinNumber is the Analog In pin to which
the the Analog component is connected. The analogRead command will return a
number including or between 0 and 1023. The Arduino also has the capability to
output a digital signal that acts as an Analog signal, this signal is called Pulse Width
Modulation (PWM).
ECE-HITS 19 2016-2020
RFID BASED Door Lock Using Arduino
• Analog Input uses the Analog In pins, Analog Output uses the PWM pins • To
receive an Analog signal use: analogRead(pinNumber);
• Analog Input values range from 0 to 1023 (1024 values because it uses 10 bits, 210)
• PWM Output values range from 0 to 255 (256 values because it uses 8 bits, 28)
All of the electrical signals that the Arduino works with are either input or output. It is
extremely important to understand the difference between these two types of signal
and how to manipulate the information these signals represent.
Digital Pins # 3, # 5, # 6, # 9, # 10 and #11 have PWM capabilities. This means you
can Output the Digital equivalent of an Analog signal using these pins. To Output a
PWM signal use the command: analogWrite(pinNumber, value); where pinNumber is
a Digital Pin with PWM capabilities and value is a number between 0 (0%) and 255
(100%). For more information on PWM see the PWM worksheets or S.I.K. circuit 12.
Output can be sent to many different devices, but it is up to the user to figure out
which kind of Output signal is needed, hook up the hardware and then type the correct
code to properly use these signals. Things to remember about Output:
• There are two kinds of Output: regular Digital or PWM (Pulse Width Modulation)
ECE-HITS 20 2016-2020
RFID BASED Door Lock Using Arduino
• PWM Output varies from 0 to 255 Examples of Output: Light Emitted Diodes
(LED’s), Piezoelectric Speakers, Servo Motors
3.3.1.6 Input
All of the electrical signals that the Arduino works with are either input or output. It is
extremely important to understand the difference between these two types of signal
and how to manipulate the information these signals represent.
Input can come from many different devices, but each device’s signal will be either
Analog or Digital, it is up to the user to figure out which kind of input is needed, hook
ECE-HITS 21 2016-2020
RFID BASED Door Lock Using Arduino
up the hardware and then type the correct code to properly use these signals. Things to
remember about Input:
• Input is either Analog or Digital, make sure to use the correct pins depending on
type.
• Digital Input is always either HIGH or LOW Examples of Input: Push Buttons,
Potentiometers, Photoresistors, Flex Sensors.
ECE-HITS 22 2016-2020
RFID BASED Door Lock Using Arduino
VCC
Digital supply voltage.
GND
Ground.
Port B (PB7:0)
XTAL1/XTAL2/TOSC1/TOSC2 Port B is an 8-bit bi-directional I/O port with
internal pull-up resistors (selected for each bit). The Port B output buffers have
symmetrical drive characteristics with both high sink and source capability. As inputs,
port B pins that are externally pulled low will source current if the pull-up resistors
are activated. The Port B pins are tri-stated when a reset condition becomes active,
even if the clock is not running. Depending on the clock selection fuse settings, PB6
can be used as input to the inverting oscillator amplifier and input to the internal clock
operating circuit. Depending on the clock selection fuse settings, PB7 can be used as
output from the inverting oscillator amplifier. If the internal calibrated RC oscillator is
used as chip clock source, PB7..6 is used as TOSC2..1 input for the asynchronous
Timer/Counter2 if the AS2 bit in ASSR is set. The various special features of port B
are elaborated in Section 13.3.1 “Alternate Functions of Port B” on page 65 and
Section 8. “System Clock and Clock Options” on page 24.
Port C (PC5:0)
Port C is a 7-bit bi-directional I/O port with internal pull-up resistors (selected for
each bit). The PC5..0 output buffers have symmetrical drive characteristics with both
high sink and source capability. As inputs, Port C pins that are externally pulled low
will source current if the pull-up resistors are activated. The port C pins are tri-stated
when a reset condition becomes active, even if the clock is not running.
PC6/RESET
If the RSTDISBL fuse is programmed, PC6 is used as an input pin. If the RSTDISBL
fuse is unprogrammed, PC6 is used as a reset input. A low level on this pin for longer
than the minimum pulse length will generate a reset, even if the clock is not running.
The minimum pulse length is given in Table 28-4 on page 261. Shorter pulses are not
guaranteed to generate a reset. The various special features of port C are elaborated in
Section 13.3.2 “Alternate Functions of Port C” on page 68.
ECE-HITS 23 2016-2020
RFID BASED Door Lock Using Arduino
Port D (PD7:0)
Port D is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for
each bit). The port D output buffers have symmetrical drive characteristics with both
high sink and source capability. As inputs, port D pins that are externally pulled low
will source current if the pull-up resistors are activated. The port D pins are tri-stated
when a reset condition becomes active, even if the clock is not running. The various
special features of port D are elaborated in Section 13.3.3 “Alternate Functions of
Port D” on page 70.
AVCC
AVCC is the supply voltage pin for the A/D converter, PC3:0, and ADC7:6. It should
be externally connected to VCC, even if the ADC is not used. If the ADC is used, it
should be connected to VCC through a low-pass filter. Note that PC6..4 use digital
supply voltage, VCC.
AREF
AREF is the analog reference pin for the A/D converter. ATmega328P
[DATASHEET] 5 7810D–AVR–01/15
ADC7:6
(TQFP and QFN/MLF Package Only) In the TQFP and QFN/MLF package, ADC7:6
serve as analog inputs to the A/D converter. These pins are powered from the analog
supply and serve as 10-bit ADC channels. Pin14-P0.29/ CAP0.3/ AD0.2/MAT0.3
P0.29 is a GPIO digital pin
3.3.1.10 Applications
1. Microcontrollers
2. Mixed signal devices
3. Smart sensors
4. Automotive body electronics and airbags
3.3.2.1 Introduction
ECE-HITS 24 2016-2020
RFID BASED Door Lock Using Arduino
3.3.2.2 Features
Buffered output drivers for connecting an antenna with the minimum number of
external components
ECE-HITS 25 2016-2020
RFID BASED Door Lock Using Arduino
o SPI up to 10 Mbit/s
Programmable timer
CRC coprocessor
Internal self-test
ECE-HITS 26 2016-2020
RFID BASED Door Lock Using Arduino
ECE-HITS 27 2016-2020
RFID BASED Door Lock Using Arduino
The MFRC522 acts as a slave during SPI communication. The SPI clock signal SCK
must be generated by the master. Data communication from the master to the slave
uses the MOSI line. The MISO line is used to send data from the MFRC522 to the
master.
Data bytes on both MOSI and MISO lines are sent with the MSB first. Data on both
MOSI and MISO lines must be stable on the rising edge of the clock and can be
changed on the falling edge. Data is provided by the MFRC522 on the falling clock
edge and is stable during the rising clock edge.
Reading data using SPI requires the byte order shown in Table 6 to be used. It is
possible to read out up to n-data bytes. The first byte sent defines both the mode and
the address.
To write data to the MFRC522 using SPI requires the byte order shown in Table 7. It
is possible to write up to n data bytes by only sending one address byte.
The first send byte defines both the mode and the address byte.
ECE-HITS 28 2016-2020
RFID BASED Door Lock Using Arduino
The address byte must meet the following format. The MSB of the first byte defines the
mode used. To read data from the MFRC522 the MSB is set to logic 1. To write data to the
MFRC522 the MSB must be set to logic 0.
The internal UART interface is compatible with an RS232 serial interface. The
default transfer speed is 9.6 kBd. To change the transfer speed, the host controller
must write a value for the new transfer speed to the SerialSpeedReg register.
Bits BR_T0[2:0] and BR_T1[4:0] define the factors for setting the transfer speed in
the SerialSpeedReg register.
The motor is paired with some type of encoder to provide position and speed
feedback. In the simplest case, only the position is measured. The measured position
ECE-HITS 29 2016-2020
RFID BASED Door Lock Using Arduino
of the output is compared to the command position, the external input to the
controller. If the output position differs from that required, an error signal is generated
which then causes the motor to rotate in either direction, as needed to bring the output
shaft to the appropriate position. As the positions approach, the error signal reduces to
zero and the motor stops..
Many applications, such as laser cutting machines, may be offered in two ranges, the
low-priced range using stepper motors and the high-performance range using
servomotors.
3.3.3.2 Encoders
The first servomotors were developed with synchros as their encoders.Much work
was done with these systems in the development of radar and anti-aircraft
artillery during World War II.
Simple servomotors may use resistive potentiometers as their position encoder. These
are only used at the very simplest and cheapest level, and are in close competition
with stepper motors. They suffer from wear and electrical noise in the potentiometer
track. Although it would be possible to electrically differentiate their position signal
to obtain a speed signal, PID controllers that can make use of such a speed signal
generally warrant a more precise encoder.
ECE-HITS 30 2016-2020
RFID BASED Door Lock Using Arduino
3.3.3.3 Motors
The type of motor is not critical to a servomotor and different types may be used. At
the simplest, brushed permanent magnet DC motors are used, owing to their
simplicity and low cost. Small industrial servomotors are typically electronically
commutated brushless motors. For large industrial servomotors, AC induction
motors are typically used, often with variable frequency drives to allow control of
their speed. For ultimate performance in a compact package, brushless AC moto with
permanent magnet fields are used, effectively large versions of Brushless DC electric
motors.
Drive modules for servomotors are a standard industrial component. Their design is a
branch of power electronics, usually based on a three-phase MOSFET or IGBT H
bridge. These standard modules accept a single direction and pulse count (rotation
distance) as input. They may also include over-temperature monitoring, over-torque
and stall detection features. As the encoder type, gearhead ratio and overall system
dynamics are application specific, it is more difficult to produce the overall controller
as an off-the-shelf module and so these are often implemented as part of the main
controller.
3.3.3.4 Control
Most modern servomotors are designed and supplied around a dedicated controller
module from the same manufacturer. Controllers may also be developed
around microcontrollers in order to reduce cost for large-volume applications.
Integrated servomotors are designed so as to include the motor, driver, encoder and
associated electronics into a single package
ECE-HITS 31 2016-2020
RFID BASED Door Lock Using Arduino
Tiny and lightweight with high output power, this tiny servo i Helicopter, Quadcopter
or Robot. durability. Servo can rotate approximately 180 degrees (90 in each
direction), and works just like the standard kinds but smaller. You can use any servo
code, hardware or library to control these servos. Good for beginners who want to
make stuff move without building a motor controller with feedback & gear box,
especially si (arms) and hardware.
3.3.4 LEDS
ECE-HITS 32 2016-2020
RFID BASED Door Lock Using Arduino
Next, we've got this fan-shaped graph that represents the viewing angle of the LED.
Different styles of LEDs will incorporate lenses and reflectors to either concentrate
most of the light in one place or spread it as widely as possible. Some LEDs are like
floodlights that pump out photons in every direction; Others are so directional that
you can't tell they're on unless you're looking straight at them. To read the graph,
imagine the LED is standing upright underneath it. The "spokes" on the graph
represent the viewing angle. The circular lines represent the intensity by percent of
maximum intensity. This LED has a pretty tight viewing angle. You can see that
looking straight down at the LED is when it's at its brightest, because at 0 degrees the
blue lines intersect with the outermost circle. To get the 50% viewing angle, the angle
at which the light is half as intense, follow the 50% circle around the graph until it
intersects the blue line, then follow the nearest spoke out to read the angle. For this
LED, the 50% viewing angle is about 20 degrees.
3.3.5 BUZZER
3.3.5.1 History
ECE-HITS 33 2016-2020
RFID BASED Door Lock Using Arduino
3.3.5.2 Electromechanical
The electric buzzer was invented in 1831 by Joseph Henry. They were mainly used in
early doorbells until they were phased out in the early 1930s in favor of musical
chimes, which had a softer tone.
3.3.5.3 Piezoelectric
Piezoelectric buzzers, or piezo buzzers, as they are sometimes called, were invented
by Japanese manufacturers and fitted into a wide array of products during the 1970s to
1980s. This advancement mainly came about because of cooperative efforts by
Japanese manufacturing companies. In 1951, they established the Barium Titanate
Application Research Committee, which allowed the companies to be "competitively
cooperative" and bring about several piezoelectric innovations and inventions.[3]
3.3.5.4 Types
3.3.5.5 Electromechanical
3.3.5.6 Mechanical
A joy buzzer is an example of a purely mechanical buzzer and they require drivers.
Other examples of them are doorbells.
3.3.5.7 Piezoelectric
ECE-HITS 34 2016-2020
RFID BASED Door Lock Using Arduino
Novelty uses
Judging panels
Educational purposes
Annunciator panels
Electronic metronomes
Game show lock-out device
Microwave ovens and other household appliances
Sporting events such as basketball games
Electrical alarms
Joy buzzer (mechanical buzzer used for pranks)
This is a simple approach to obtain a 12V and 5V DC power supply using a single
circuit. The circuit uses two ICs 7812(IC1) and 7805 (IC2) for obtaining the required
voltages. The AC mains voltage will be stepped down by the transformer T1, rectified
by bridge B1 and filtered by capacitor C1 to obtain a steady DC level .The IC1
regulates this voltage to obtain a steady 12V DC. The output of the IC1 will be
regulated by the IC2 to obtain a steady 5V DC at its output. In this way both 12V and
5V DC are obtained.
Such a circuit is very useful in cases when we need two DC voltages for the operation
of a circuit. By varying the type number of the IC1 and IC2, various combinations of
ECE-HITS 35 2016-2020
RFID BASED Door Lock Using Arduino
output voltages can be obtained. If 7806 is used for IC2, we will get 6V instead of
5V.Same way if 7809 is used for IC1 we get 9V instead of 12V.
A power supply provides components with electric power. The term usually pertains
to devices integrated within the component being powered. For example, computer
power supplies convert AC current to DC current and are generally located at the rear
of the computer case, along with at least one fan.
A power supply is also known as a power supply unit, power brick or power adapter.
CHAPTER 4
The implementation part is the most important phase of the project. in this
phase, we code the entire project in the chosen software according to the design laid
during the previous phase. the software program and the implementation of the
hardware components are discussed in this section .by using the Arduino software we
will be able to write a program which controls the microcontroller used in this project
and then we implement it to the hardware that is to the kit.
4.2 Software
The software used in our project is Arduino IDE software for programming.
ECE-HITS 37 2016-2020
RFID BASED Door Lock Using Arduino
Before you can start doing anything with the Arduino, you need to download and
install the Arduino IDE (integrated development environment). From this point on we
will be referring to the Arduino IDE as the Arduino Programmer.
The Arduino Programmer is based on the Processing IDE and uses a variation of the
C and C++ programming languages
ECE-HITS 38 2016-2020
RFID BASED Door Lock Using Arduino
Plugging Arduino to PC
Please note that although the Arduino plugs into your computer, it is not a true USB
device. The board has a special chip that allows it to show up on your computer as a
virtual serial port when it is plugged into a USB port. This is why it is important to
plug the board in. When the board is not plugged in, the virtual serial port that
ECE-HITS 39 2016-2020
RFID BASED Door Lock Using Arduino
Arduino operates upon will not be present (since all of the information about it lives
on the Arduino board). It is also good to know that every single Arduino has a unique
virtual serial port address. This means that every time you plug in a different Arduino
board into your computer, you will need to reconfigure the serial port that is in use.
ECE-HITS 40 2016-2020
RFID BASED Door Lock Using Arduino
Before you can start doing anything in the Arduino programmer, you must set the
board-type and serial port.
To set the board, go to the following:
Select the version of board that you are using. Since I have an Arduino Uno plugged
in, I obviously selected "Arduino Uno."
ECE-HITS 41 2016-2020
RFID BASED Door Lock Using Arduino
Click on upload key to upload the code to arduino. This will dump the code to
arduino. Wait for it to finish the dumping.
ECE-HITS 42 2016-2020
RFID BASED Door Lock Using Arduino
CHAPTER 5
The necessity of power supply for RFID readers varies from one product to another.
There are many RFID readers are available in the market with 5v, 9v and 12v. But,
here a 5v RFID reader is used for an interfacing. You may confirm the RFID reader
and RFID tags are frequency compatible
RFID gives mainly two possible outputs, one is TTL compatible o/p and another one
is RS232 compatible o/p. A TTL compatible o/p pin can be connected to an Arduino
board directly. While the output pin of an RS232 compatible must be changed to TTL
using an RS232 to TTL converter
The automatic door lock system circuit diagram using an Arduino is shown below.
This circuit is mainly used for an interfacing of RFID reader with an Arduino. This
ECE-HITS 43 2016-2020
RFID BASED Door Lock Using Arduino
project can be enhanced by connecting an LCD display to display the outputs. The
circuit of this project uses three separate parts, namely a reader, a controller and door
lock. Where a reader reads the RFID tags, a controller is used to accept the data from
the RFID reader and control the o/p of the door lock and RGB LED.
When the door lock is placed on a door and tested with a battery to check the
installation. In many cases we need a simple circuit on the door lock, that means the
automatic door stops locked when there is no flow of current. When 5 volts DC is
supplied through the servo motor in the door lock system, a mechanism in the door
lock offers a way to permit the door to be pushed open easily.
ECE-HITS 44 2016-2020
RFID BASED Door Lock Using Arduino
CHAPTER 6
RESULT
We have implemented a digital security system contains door lock system using
passive RFID. A centralized system is being deployed for controlling and transaction
operations. The door locking system functions in real time as when the user put the
tag in contact with the reader, the door open and the check-in information is stored in
central server along with basic information of the user. We utilize RFID technology to
provide solution for secure access of a space while keeping record of the user
ECE-HITS 45 2016-2020
RFID BASED Door Lock Using Arduino
CHAPTER 7
One of the main advantages of a RFID door lock is not needing to carry a key
with you. You’ll no longer need to worry about losing your key or fidgeting at
the door to get it open.
It also means that you won’t need to store a spare key somewhere on your
property, as many homeowners and hoteliers currently do. Because most
criminals are used to looking around to find a spare key, eliminating the need
for one will help make your home safer.
Another advantage of RFID door locks is that you can provide entry to your
home for others at your discretion. You will not need to make copies of a key
or leave keys for dog walkers, housekeepers, or house guests to get in to your
home. Rather, you’ll simply need to tell those people the proper code in order
to gain access. It have large capacity which can store many of users and codes.
Also you can delete any user or code that had added in the lock.
With the system in place, you can also tell exactly when and how people
attempted to access your home. This gives you a good idea of how secure your
house is. Even more, you can check the open door records through the lock
record card. It’s become a smart home protector more than a door lock.
7.2 Disadvantages
While there are many benefits to including a RFID door lock system in your
home, there are also some major drawbacks to consider as well. While RFID door
lock systems are generally safe and designed to alert police or other authorities if
incorrect codes are entered too many times, it is nonetheless possible that an
intruder may be able to gain access to your home through this system by guessing
or hacking the code.
Just as you can forget your keys and be locked out of your home, you can also
forget the passcode to access your RFID entry system and be locked out. While it
is safer to use a completely random code and avoid obvious choices like birth
ECE-HITS 46 2016-2020
RFID BASED Door Lock Using Arduino
dates or simple, repetitive numbers, this can pose a problem if you have a difficult
time remembering things. So customers need to set a code that easy to remember
but not easy to break.
One final disadvantage of RFID door locks is that electrically-powered systems
may not function properly in the case of a power failure. This can leave your door
completely locked throughout the failure, or it may result in the door not locking
properly and remaining open. Fortunately, most systems have battery backup
systems as a fail-safe. There is a low power alarm system in RFID door locks. The
customers need to change the batteries in time. Then you’ll never meet this
problem.
There is no a perfect product, but people will keep going to infinite close to
perfect. RFID door locks will become more smarter, convenient and safer.
7.3 Applications
ECE-HITS 47 2016-2020
RFID BASED Door Lock Using Arduino
CHAPTER 8
RFID based security and access control system is more secure and fast responded as
compared to the other system like biometric. The advantage of the RFID system is
contact-less and works without-line-of-sight. By using arduino it is easy to access and
works very quickly while burning the code it is like plug and play device. Users can
change the function accordingly by using arduino. It is easier to use and accurate also.
Hence this project can be useful for implementation of access control application for
tracking system as well as providing the security benefits. This project can improve
by raising the range of reader in which the tag read. V.
It depends upon how original one could be to enhance the use of this project. But for
us this project is practical for future uses such as Smart cart can be interfaced with
wireless technologies to make it completely portable in the near future. Payment of
bills using mobile can be implemented. A low cost RFID scanner can be
manufactured and used which can scan multiple tags (products) simultaneously for
faster processing and lesser resources. Automatic scanning & availability of products
ECE-HITS 48 2016-2020
RFID BASED Door Lock Using Arduino
REFERENCES
1. R. Want, “An Introduction to RFID Technology”, IEEE Pervasive Computing,
vol. 5, iss. 1, pg 25-33, 2006. Provides and easy to understand overview of
RFID and how it is used. This is a reliable source, cited 769 times according to
Google Scholar. This is a journal.
Web Reference
www.electronicsforyou.com
www.sci-hub.io
www.slideshare.com
www.microtronics.com
ECE-HITS 49 2016-2020
RFID BASED Door Lock Using Arduino
APPENDIX
Program Code
*
* Typical pin layout used:
* -----------------------------------------------------------------------------------------
* MFRC522 Arduino Arduino Arduino Arduino Arduino
* Reader/PCD Uno/101 Mega Nano v3 Leonardo/Micro Pro
Micro
* Signal Pin Pin Pin Pin Pin Pin
* -----------------------------------------------------------------------------------------
* RST/Reset RST 9 5 D9 RESET/ICSP-5 RST
* SPI SS SDA(SS) 10 53 D10 10 10
* SPI MOSI MOSI 11 / ICSP-4 51 D11 ICSP-4 16
* SPI MISO MISO 12 / ICSP-1 50 D12 ICSP-1 14
* SPI SCK SCK 13 / ICSP-3 52 D13 ICSP-3 15
*/
#include <SPI.h>
#include <MFRC522.h>
void setup() {
Serial.begin(9600); // Initialize serial communications with the PC
while (!Serial); // Do nothing if no serial port is opened (added
for Arduinos based on ATMEGA32U4)
SPI.begin(); // Init SPI bus
mfrc522.PCD_Init(); // Init MFRC522
delay(4); // Optional delay. Some board do need
more time after init to be ready, see Readme
mfrc522.PCD_DumpVersionToSerial(); // Show details of PCD -
MFRC522 Card Reader details
Serial.println(F("Scan PICC to see UID, SAK, type, and data blocks..."));
}
void loop() {
// Reset the loop if no new card present on the sensor/reader. This saves the
entire process when idle.
if ( ! mfrc522.PICC_IsNewCardPresent()) {
return;
}
ECE-HITS 50 2016-2020
RFID BASED Door Lock Using Arduino
return;
}
#include <SPI.h>
#include <MFRC522.h>
#include <Servo.h>
#define SS_PIN 10
#define RST_PIN 9
#define LED_G 5 //define green LED pin
#define LED_R 4 //define red LED
#define BUZZER 2 //buzzer pin
MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance.
Servo myServo; //define servo name
void setup()
{
Serial.begin(9600); // Initiate a serial communication
SPI.begin(); // Initiate SPI bus
mfrc522.PCD_Init(); // Initiate MFRC522
myServo.attach(3); //servo pin
myServo.write(0); //servo start position
pinMode(LED_G, OUTPUT);
pinMode(LED_R, OUTPUT);
pinMode(BUZZER, OUTPUT);
noTone(BUZZER);
Serial.println("Put your card to the reader...");
Serial.println();
}
void loop()
{
// Look for new cards
if ( ! mfrc522.PICC_IsNewCardPresent())
{
return;
}
// Select one of the cards
if ( ! mfrc522.PICC_ReadCardSerial())
{
ECE-HITS 51 2016-2020
RFID BASED Door Lock Using Arduino
return;
}
//Show UID on serial monitor
Serial.print("UID tag :");
String content= "";
byte letter;
for (byte i = 0; i < mfrc522.uid.size; i++)
{
Serial.print(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " ");
Serial.print(mfrc522.uid.uidByte[i], HEX);
content.concat(String(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " "));
content.concat(String(mfrc522.uid.uidByte[i], HEX));
}
Serial.println();
Serial.print("Message : ");
content.toUpperCase();
if (content.substring(1) == "8D 20 06 85") //change here the UID of the card/cards
that you want to give access
{
Serial.println("Authorized access");
Serial.println();
delay(500);
digitalWrite(LED_G, HIGH);
tone(BUZZER, 500);
delay(300);
noTone(BUZZER);
myServo.write(180);
delay(5000);
myServo.write(0);
digitalWrite(LED_G, LOW);
}
else {
Serial.println(" Access denied");
digitalWrite(LED_R, HIGH);
tone(BUZZER, 300);
delay(1000);
digitalWrite(LED_R, LOW);
noTone(BUZZER);
}
}
ECE-HITS 52 2016-2020