Rfid Based Door Lock Using Arduino [PDF]

  • 0 0 0
  • Gefällt Ihnen dieses papier und der download? Sie können Ihre eigene PDF-Datei in wenigen Minuten kostenlos online veröffentlichen! Anmelden
Datei wird geladen, bitte warten...
Zitiervorschau

RFID BASED Door Lock Using Arduino

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

1.2 Literature Survey Door lock security systems are classified based on technology used as Password Based Systems: The programmable electronic code lock device is programmed in such a way that it will operates only with the correct entry of predefined digits. It is also called an integrated combinational type lock. The programmable code lock is shown in Fig 1 as below. Fig 1: Programmable Electronic Code Lock International Journal of Computer Applications (0975 – 8887) Volume 153 – No2, November 2016 14 Electronics safe is its example. Based on the programmable electronic code lock, the reprogrammable digital door locks were invented in that the password can change any time as it stored in PROM. For operating the device, GSM/CDMA module can be used. When any person calls up from his phone, the call will be received by the system. And the door will opens only if the call is from specified user. Biometric Based System: The palmtop recognition is the next step for fingerprint recognition. It operates on the image of palmtop. Firstly system takes an image of the palmtop then it works on that image by partitioning it and process is required. At the end, verify the right person. Hence, it reduces the chances of error in other human recognition methods and clarifies the problems which were faced in the fingerprint recognition. The biometric technique is very useful in bank lockers. Except fingerprint recognition the vein detector and iris scanner gives best and accurate result so, in the bank security system microcontroller continuously monitors the Vein. GSM Based Systems: 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

Smart Card Based System: A model entryway security framework is intended to permit an authorized person for getting a safe (without need of any key) entryway where valid card of smart RFID is necessary for ensuring the pass of the door. Total control activity is performed by the microcontroller.

RFID Based Systems: 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 Systems: 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. Social Networking Sites Based Systems: A specific work .the digitalization and safety perspectives were accomplished by utilizing the phone device and web camera. The model can empower a pin to close and open a door from allotted region using SMS from a (social networking site) like Facebook, Whatsapp etc. Fig 3: Digital Door Lock model based on Internet of Things Recently, a new digital door lock system get designed which detects the unknown physical contact of a visitant then immediately informs to the owner through the smart phone as shown in Fig 3. At the moment, if wrong password gets detected more than the specified times, the system catches the picture of the unknown visitant and sends it to the owner through smart device. In this manner, increases the strength of the

ECE-HITS

3

2016-2020

RFID BASED Door Lock Using Arduino

security function. With help of latest advanced technology, demonstration of an intelligent door system using Internet of Things is given by S. Nazeem Basha et. al. OTP Based Systems: 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. Motion Detector Based System: The Motion Detector System working is based on the principle of amount of light falling on the photodiode. At the point when the laser light is falling constantly on the photodiode, its reading is 255 in decimals. But when it‟s hindered by deterrent, the voltage falls less than 50 in decimals. This flames the alarm and gives notification to the owner about the break in. And automatic lock can be activated. 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: The locker security system is as shown in Fig 4 in view of RFID, FINGERPRINT, PASSWORD and GSM technology containing door locking frameworks which can be without much of a stretch, initiated, authenticated and validated by the authorized person. It unlocks the locker door in real time manner. Firstly, moving objects are extracted from the scene by means of a frame-differencing algorithm and texture information based on grey scale intensity. However, shadows of moving objects belong also to the foreground. Shadows are removed from the foreground objects using top hat transformations and morphological operators.

Survey:

ECE-HITS

4

2016-2020

RFID BASED Door Lock Using Arduino

Srivastav Nandita (2006) : The ―Radio Frequency Identification (RFID) is an automatic identification system. RFID uses RF to identify ―tagged‖ items .This data is then collected and transmitted to a host system using an RF Reader. The data transmitted by the tag may provide identification or location information, or specifics about the product tagged, such as price, color, date of purchase; etc.In Bar code the scanner device directs a light beam at the bar code. The device contains a small sensory reading element. This sensor detects the light being reflected back from the bar code, and converts light energy into electrical energy. The result is an electrical signal that can be converted into data. Daniel M Dobkin et. al (2005): Every RFID system consists of at least one interrogator, more commonly known as a reader, which uses a radio link to communicate with at least one transponder. The tag generally contains one or more integrated circuits, and a unique identifying number stored in non-volatile memory. The reader is often (though not always) integrated into a network in order to make efficient use of the identification data it collects. There are three key architectural parameters that determine the type of RFID system in use: the frequency (practically equivalent to the mode of coupling), the means of powering the tag, and the communications protocol employed. Juels Ari (2005): 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. Jihoon Myung and Wonjun Lee (2006):

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. Kong Wa Chiang et. al (2008): 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. Yang H et. al (2006): 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 INTRODUCTION TO EMBEDDED SYSTEMS 2.1 Embedded Systems An embedded system is a computer system designed to perform one or a few dedicated functions often with real-time computing constraints. It is embedded as part of a complete device often including hardware and mechanical parts. By contrast, a general-purpose computer, such as a personal computer (PC), is designed to be flexible and to meet a wide range of end-user needs. Embedded systems control many devices in common use today. 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. Physically embedded systems range from portable devices such as digital watches and MP3 players, to large stationary installations like traffic lights, factory controllers, or the systems controlling nuclear power plants. Complexity varies from low, with a single microcontroller chip, to very high with multiple units, peripherals and networks mounted inside a large chassis or enclosure. In general, "embedded system" is not a strictly definable term, as most systems have some element of extensibility or programmability. For example, handheld computers share some elements with embedded systems such as the operating systems and microprocessors which power them, but they allow different applications to be loaded and peripherals to be connected. Moreover, even systems ECE-HITS

7

2016-2020

RFID BASED Door Lock Using Arduino

which don't expose programmability as a primary feature generally need to support software updates. On a continuum from "general purpose" to "embedded", large application systems will have subcomponents at most points even if the system as a whole is "designed to perform one or a few dedicated functions", and is thus appropriate to call "embedded". A modern example of embedded system is shown in fig: 2.1.

Fig. 2.1 A Modern Example of Embedded System Labelled parts include microprocessor (4), RAM (6), flash memory (7).Embedded systems programming is not like normal PC programming. In many ways, programming for an embedded system is like programming PC 15 years ago. The hardware for the system is usually chosen to make the device as cheap as possible. Spending an extra dollar a unit in order to make things easier to program can cost millions. Hiring a programmer for an extra month is cheap in comparison. This means the programmer must make do with slow processors and low memory, while at the same time battling a need for efficiency not seen in most PC applications. Below is a list of issues specific to the embedded field. 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 Embedded development makes up a small fraction of total programming. There's also a large number of embedded architectures, unlike the PC world where 1 instruction set rules, and the UNIX world where there's only 3 or 4 major ones. This means that the tools are more expensive. It also means that they're lowering featured, and less developed. On a major embedded project, at some point you will almost always find a compiler bug of some sort. 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. 2.1.4 Real Time Issues Embedded systems frequently control hardware, and must be able to respond to them in real time. Failure to do so could cause inaccuracy in measurements, or even damage hardware such as motors. This is made even more difficult by the lack of resources available. Almost all embedded systems need to be able to prioritize some tasks over others, and to be able to put off/skip low priority tasks such as UI in favour of high priority tasks like hardware control.

2.2 Need for Embedded Systems 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 Embedded debugging may be performed at different levels, depending on the facilities available. From simplest to most sophisticate they can be roughly grouped into the following areas: 

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. Because an embedded system is often composed of a wide variety of elements, the debugging strategy may vary. For instance, debugging a software(and microprocessor) centric embedded system is different from debugging an embedded system where most of the processing is performed by peripherals (DSP, FPGA, coprocessor). An increasing number of embedded systems today use more than one single processor core. A common problem with multi-core development is the proper synchronization of software execution. In such a case, the embedded system design may wish to check the data traffic on the busses between the processor cores, which

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 Embedded systems often reside in machines that are expected to run continuously for years without errors and in some cases recover by themselves if an error occurs. Therefore, the software is usually developed and tested more carefully than that for personal computers, and unreliable mechanical moving parts such as disk drives, switches or buttons are avoided. Specific reliability issues may include: 

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

2.3 Explanation of Embedded Systems 2.3.1 Software Architecture There are several different types of software architecture in common use. Simple Control Loop 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

1) Interrupt Controlled System Some embedded systems are predominantly interrupt controlled. This means that tasks performed by the system are triggered by different kinds of events. An interrupt could be generated for example by a timer in a predefined frequency, or by a serial port controller receiving a byte. These kinds of systems are used if event handlers need low latency and the event handlers are short and simple. 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 A non-pre-emptive multitasking system is very similar to the simple control loop scheme, except that the loop is hidden in an API. The programmer defines a series of tasks, and each task gets its own environment to “run” in. When a task is idle, it calls an idle routine, usually called “pause”, “wait”, “yield”, “nop” (stands for no operation), etc. The advantages and disadvantages are very similar to the control loop, except that adding new software is easier, by simply writing a new task, or adding to the queue-interpreter. 3) Primitive Multitasking In this type of system, a low-level piece of code switches between tasks or threads based on a timer (connected to an interrupt). This is the level at which the system is generally considered to have an "operating system" kernel. Depending on how much functionality is required, it introduces more or less of the complexities of managing multiple tasks running conceptually in parallel. 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. 4) Micro kernels And Exo kernels

ECE-HITS

12

2016-2020

RFID BASED Door Lock Using Arduino

A microkernel is a logical step up from a real-time OS. The usual arrangement is that the operating system kernel allocates memory and switches the CPU to different threads of execution. User mode processes implement major functions such as file systems, network interfaces, etc. 2.3.2 Stand Alone Embedded System 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 Eg: microwave oven, air conditioner etc. 2.3.3 Real-Time Embedded Systems Embedded systems which are used to perform a specific task or operation in a specific time period those systems are called as real-time embedded systems. There are two types of real-time embedded systems. 1) Hard Real-time 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 system in which we have to open a valve within 30 milliseconds. If this valve is not opened in 30 ms this may cause damage to the entire equipment. 2) Soft Real Time embedded systems: 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. 2.3.4 Network Communication Embedded Systems: A wide range network interfacing communication is provided by using 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.

Fig. 2.2 Network Communication Embedded Systems 2.3.5 Different Types of Processing Units: 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. .

2.4 Applications of Embedded Systems 

Consumer applications



Office automation



Industrial automation



Computer networking



Tele communications

ECE-HITS

14

2016-2020

RFID BASED Door Lock Using Arduino

CHAPTER 3 BLOCK DIAGRAM & HARDWARE DESCRIPTION 3.1 The Components Used in the Project 1. Arduino UNO/Genuino UNO 2. RFID Reader 3. RFID Tag 4. RGB LED 5. Resistors 6. Servo Motor 7. Buzzer 8. Power Supply

3.2 Block Diagram

Fig. 3.1 Block Diagram of project 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.

3.3 Component Description 3.3.1 ARDUINO UNO 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: A pin mode that intakes information. • output: A pin mode that sends information. • HIGH: Electrical signal present (5V for Uno). Also ON or True in boolean logic. • LOW: No electrical signal present (0V). Also OFF or False in boolean logic. • digitalRead: Get a HIGH or LOW reading from a pin already declared as an input. • digitalWrite: Assign a HIGH or LOW value to a pin already declared as an output. • analogRead:Get a value between or including 0 (LOW) and 1023 (HIGH). This allows you to get readings from analog sensors or interfaces that have more than two states. • 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

Stands for Pulse-Width Modulation, a method of emulating an analog signal through a digital pin. A value between or including 0 and 255. Used with analogWrite 3.3.1.1 Voltage Dividers 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:

Fig. 3.2 Arduino UNO R3

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); • To send a Digital signal use: digitalWrite(pinNumber, value); • Digital Input and Output are always either HIGH or LOW 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). 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%). On the Arduino UNO PWM pins are signified by a ~ sign. For more information on PWM see the PWM worksheets or S.I.K. circuit 12. Examples of Analog: Values: Temperature, volume level, speed, time, light, tide level, spiciness, the list goes on.... Sensors: Temperature sensor, Photoresistor, Microphone, Turntable, Speedometer, etc.... Things to remember about Analog:

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); • To send a PWM signal use: analogWrite(pinNumber, value); • 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) 3.3.1.4 10-bit ADC (Analog to Digital Converter) 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. 3.3.1.5 Output Signals 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: • Output is always Digital • There are two kinds of Output: regular Digital or PWM (Pulse Width Modulation) • To send an Output signal use analogWrite(pinNumber, value); (for analog) or digitalWrite(pinNumber, value); (for digital)

ECE-HITS

20

2016-2020

RFID BASED Door Lock Using Arduino

• Output pin mode is set using the pinMode command: pinMode(pinNumber, OUTPUT); • Regular Digital Output is always either HIGH or LOW • 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. 3.3.1.7 Input Signals A signal entering an electrical system, in this case a microcontroller. Input to the Arduino pins can come in one of two forms; Analog Input or Digital Input. Analog Input enters your Arduino through the Analog In pins # 0 - # 5. These signals originate from analog sensors and interface devices. These analog sensors and devices use voltage levels to communicate their information instead of a simple yes (HIGH) or no (LOW). For this reason you cannot use a digital pin as an input pin for these devices. Analog Input pins are used only for receiving Analog signals. It is only possible to read the Analog Input pins so there is no command necessary in the setup( ) function to prepare these pins for input. To read the Analog Input pins use the command: analogRead(pinNumber); where pinNumber is the Analog Input pin number. This function will return an Analog Input reading between 0 and 1023. A reading of zero corresponds to 0 Volts and a reading of 1023 corresponds to 5 Volts. These voltage values are emitted by the analog sensors and interfaces. If you have an Analog Input that could exceed Vcc + .5V you may change the voltage that 1023 corresponds to by using the Aref pin. This pin sets the maximum voltage parameter your Analog Input pins can read. The Aref pin’s preset value is 5V. 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. • To take an Input reading use analogRead(pinNumber); (for analog) • Or digitalRead(pinNumber); (for digital) • Digital Input needs a pinMode command such as pinMode(pinNumber, INPUT); • Analog Input varies from 0 to 1023 • Digital Input is always either HIGH or LOW Examples of Input: Push Buttons, Potentiometers, Photoresistors, Flex Sensors. 3.3.1.8 ATMEGA 328P Configuration

Fig. 3.3 ATMEGA 328P Based Microcontroller Pin Configuration

ECE-HITS

22

2016-2020

RFID BASED Door Lock Using Arduino

3.3.1.9 Pin Descriptions 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 MFRC522 (RFID Sensor) 3.3.2.1 Introduction

ECE-HITS

24

2016-2020

RFID BASED Door Lock Using Arduino

The MFRC522 is a highly integrated reader/writer IC for contactless communication at 13.56 MHz. The MFRC522 reader supports ISO/IEC 14443 A/MIFARE and NTAG. The MFRC522’s internal transmitter is able to drive a reader/writer antenna designed to communicate with ISO/IEC 14443 A/MIFARE cards and transponders without additional active circuitry. The receiver module provides a robust and efficient implementation for demodulating and decoding signals from ISO/IEC 14443 A/MIFARE compatible cards and transponders. The digital module manages the complete ISO/IEC 14443 A framing and error detection (parity and CRC) functionality.

Fig. 3.4 RFID reader The MFRC522 supports MF1xxS20, MF1xxS70 and MF1xxS50 products. The MFRC522 supports contactless communication and uses MIFARE higher transfer speeds up to 848 kBd in both directions. 3.3.2.2 Features 

Highly integrated analog circuitry to demodulate and decode responses



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



Supports ISO/IEC 14443 A/MIFARE and NTAG



Typical operating distance in Read/Write mode up to 50 mm depending on the antenna size and tuning

Supports MF1xxS20, MF1xxS70 and MF1xxS50

encryption in Read/Write mode 

Supports ISO/IEC 14443 A higher transfer speed communication up to 848 kBd Supports MFIN/MFOUT



Additional internal power supply to the smart card IC connected via MFIN/MFOUT



Supported host interfaces o SPI up to 10 Mbit/s o I 2C-bus interface up to 400 kBd in Fast mode, up to 3400 kBd in Highspeed mode o RS232 Serial UART up to 1228.8 kBd, with voltage levels dependant on pin voltage supply



FIFO buffer handles 64 byte send and receive



Flexible interrupt mode



Hard reset with low power function



Power-down by software mode



Programmable timer



Internal oscillator for connection to 27.12 MHz quartz crystal



2.5 V to 3.3 V power supply



CRC coprocessor



Programmable I/O pins



Internal self-test

ECE-HITS

26

2016-2020

RFID BASED Door Lock Using Arduino

Fig 3.5 : MFRC522 Pin Configuration 3.3.2.3 Serial Peripheral Interface A serial peripheral interface (SPI compatible) is supported to enable high-speed communication to the host. The interface can handle data speeds up to 10 Mbit/s. When communicating with a host, the MFRC522 acts as a slave, receiving data from the external host for register settings, sending and receiving data relevant for RF interface communication. An interface compatible with SPI enables high-speed serial communication between the MFRC522 and a microcontroller. The implemented interface is in accordance with the SPI standard.

Fig 3.6: SPI Connection to host 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. 3.3.2.4 SPI read data 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.

Table: SPI Read Data SPI write data 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.

Table: SPI Write Data

ECE-HITS

28

2016-2020

RFID BASED Door Lock Using Arduino

3.3.2.5 SPI address byte 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. Bits 6 to 1 define the address and the LSB is set to logic 0.

Table: SPI address byte

3.3.2.6 Connection to a host

Fig 3.7: Connection to host Remark: Signals DTRQ and MX can be disabled by clearing TestPinEnReg register’s RS232LineEn bit. 3.3.2.7 Selectable UART transfer speeds 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. 3.3.3 Servo Motor A servomotor is a closed-loop servomechanism that uses position feedback to control its motion and final position. The input to its control is a signal (either analogue or digital) representing the position commanded for the output shaft. 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.. 3.3.3.1 Servomotors vs. stepper motors Servomotors are generally used as a high-performance alternative to the stepper motor. Stepper motors have some inherent ability to control position, as they have built-in output steps. This often allows them to be used as an open-loop position control, without any feedback encoder, as their drive signal specifies the number of steps of movement to rotate, but for this the controller needs to 'know' the position of the stepper motor on power up. Therefore, on first power up, the controller will have to activate the stepper motor and turn it to a known position, e.g. until it activates an end limit switch. This can be observed when switching on an inkjet printer; the controller will move the ink jet carrier to the extreme left and right to establish the end positions. A servomotor will immediately turn to whatever angle the controller instructs it to, regardless of the initial position at power up. 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

Instead of servomotors, sometimes a motor with a separate, external linear encoder is used. These motor + linear encoder systems avoid inaccuracies in the drivetrain between the motor and linear carriage, but their design is made more complicated as they are no longer a pre-packaged factory-made system. 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. 3.3.3.5 Integrated servomotors Integrated servomotors are designed so as to include the motor, driver, encoder and associated electronics into a single package 3.3.3.6 Servo Motor Construction

ECE-HITS

31

2016-2020

RFID BASED Door Lock Using Arduino

Fig 3.8: Servo Motor 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

Fig. 3.9 LED symbol 3.3.4.1 LED Wavelength The second row on this table tells us the wavelength of the light. Wavelength is basically a very precise way of explaining what color the light is. There may be some variation in this number so the table gives us a minimum and a maximum. In this case it's 620 to 625nm, which is just at the lower red end of the spectrum (620 to 750nm). Again, we'll go over wavelength in more detail in the delving deeper section. ECE-HITS

32

2016-2020

RFID BASED Door Lock Using Arduino

3.3.4.2 LED Brightness The last row (labeled "Luminous Intensity") is a measure of how bright the LED can get. The unit mcd, or millicandela, is a standard unit for measuring the intensity of a light source. This LED has an maximum intensity of 200 mcd, which means it's just bright enough to get your attention but not quite flashlight bright. At 200 mcd, this LED would make a good indicator. 3.3.4.3 Viewing Angle

Fig. 3.10 Viewing Angle of LED 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 A buzzer or beeper isan audio signalingdevice, whichmaybe mechanical, electromech anical, or piezoelectric (piezo for short). Typical uses of buzzers and beepers include alarm devices, timers, and confirmation of user input such as a mouse click or keystroke. 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 Early devices were based on an electromechanical system identical to an electric bell without the metal gong. Similarly, a relay may be connected to interrupt its own actuating current, causing the contacts to buzz. Often these units were anchored to a wall or ceiling to use it as a sounding board. The word "buzzer" comes from the rasping noise that electromechanical buzzers made. 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

Fig 3.11: Piezoelectric disk beeper

ECE-HITS

34

2016-2020

RFID BASED Door Lock Using Arduino

A piezoelectric element may be driven by an oscillating electronic circuit or other audio signal source, driven with a piezoelectric audio amplifier. Sounds commonly used to indicate that a button has been pressed are a click, a ring or a beepInterior of a readymade loudspeaker, showing a piezoelectric-disk-beeper (With 3 electrodes ... including 1 feedback-electrode ( the central, small electrode joined with red wire in this photo), and an oscillator to self-drive the buzzer. A piezoelectric buzzer/beeper also depends on acoustic cavity resonance or Helmholtz resonance to produce an audible beep 3.3.5.8 Modern applications While technological advancements have caused buzzers to be impractical and undesirable, there are still instances in which buzzers and similar circuits may be used. Present day applications include: 

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)

3.3.6 Power supply 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.

Fig. 3.12 DC Power supply adapter DC Power Supply Circuit

Fig. 3.13 DC Power supply circuit       

Assemble the circuit on a good quality PCB or common board. The transformer T1 can be a 230V primary, 15V secondary, 1A step-down transformer. The fuse F1 can be of 1A. The switch S1 can be a SPST ON/OFF switch. The LED D1 acts as a power ON indicator. If 1A bridge B1 is not available, make one using four 1N4007 diodes. 78XX series ICs can deliver only up to 1A output current.



Most computer power supplies include a number of switched-mode supplies, which operate independently by producing a single voltage. These are linked together, so that they shut down as a group in case of a computer fault.

ECE-HITS

36

2016-2020

RFID BASED Door Lock Using Arduino

CHAPTER 4 IMPLEMENTATION AND ANALYSIS 4.1 Implementation 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. 4.3 Implementation of Code The Arduino Integrated Development Environment (IDE) is a crossplatform application (for Windows, macOS, Linux) that is written in the programming language Java. It is used to write and upload programs to Arduino compatible boards, but also, with the help of 3rd party cores, other vendor development boards. The Arduino IDE supplies a software library from the Wiring project, which provides many common input and output procedures. User-written code only requires two basic functions, for starting the sketch and the main program loop, that are compiled and linked with a program stub main() into an executable cyclic executive program with the GNU toolchain, also included with the IDE distribution.] The Arduino IDE employs the program avrdude to convert the executable code into a text file in hexadecimal encoding that is loaded into the Arduino board by a loader program in the board's firmware. 4.4 Method of Implementation 4.4.1 Arduino IDE software

ECE-HITS

37

2016-2020

RFID BASED Door Lock Using Arduino

Fig. 4.1 Arduino 1.8.10 4.4.2 CONCEPT OF COMPILER: Compilers are programs used to convert a High Level Language to object code. Desktop compilers produce an output object code for the underlying microprocessor, but not for other microprocessors. I.E the programs written in one of the HLL like ‘C’ will compile the code to run on the system for a particular processor like x86 (underlying microprocessor in the computer). For example compilers for Dos platform is different from the Compilers for Unix platform

So if one wants to define a compiler then compiler is a program that translates source code into object code. The compiler derives its name from the way it works, looking at the entire piece of source code and collecting and reorganizing the instruction. See there is a bit little difference between compiler and an interpreter. Interpreter just interprets whole program at a time while compiler analyzes and execute each line of source code in succession, without looking at the entire program

The advantage of interpreters is that they can execute a program immediately. Secondly programs produced by compilers run much faster than the same programs executed by an interpreter. However compilers require some time before an executable program emerges. Now as compilers translate source code into object code, which is unique for each type of computer, many compilers are available for the same language. 4.4.3 Working with Arduino IDE: 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

Screenshot of Arduino IDE 4.4.4 Plug Arduino to PC

Plugging Arduino to PC Connect the Arduino to your computer's USB port. 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. The Arduino Uno requires a male USB A to male USB B.

4.4.5 Setting Up Arduino

Setting Up Arduino step1

ECE-HITS

40

2016-2020

RFID BASED Door Lock Using Arduino

Setting Up Arduino step 2 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:

Tools --> Boards

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

4.4.6 Upload code

Click on upload key to upload the code to arduino. This will dump the code to arduino. Wait for it to finish the dumping.

Screenshot of Code dumped to arduino

ECE-HITS

42

2016-2020

RFID BASED Door Lock Using Arduino

CHAPTER 5 WORKING OF THE PROJECT

Fig. 5.1 Proposed Model Interfacing of RFID with Arduino can be done by the following steps 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

Interfacing of RFID with Arduino 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

Fig. 6.1 RFID Based Door Lock Using Arduino

ECE-HITS

45

2016-2020

RFID BASED Door Lock Using Arduino

CHAPTER 7 ADVANTAGES, DISADVANTAGES AND APPLICATIONS 7.1 Advantages 

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 

For Data safe rooms and highly secure access rooms.



For commercial lockrooms .



For Government protected room security for personal.



For E-parking.



For E- Ticketing

ECE-HITS

47

2016-2020

RFID BASED Door Lock Using Arduino

CHAPTER 8 CONCLUSION & FUTURE SCOPE 8.1 CONCLUSION 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. 8.2 FUTURE SCOPE 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. 2. Juels, “RFID Security and Privacy: A Research Survey”, IEEE Journal on Selected Areas of Communication, vol. 24, iss. 2, pg381-394, 2006. Because my project is about a reprogrammable door lock, I figure the research done in security is important. The most important part thing I’m gathering from this article is the integrity of RFID systems. The privacy issue is a nice bonus. According to Google Scholar, this has been cited 1222 times. This is a journal as well. 3. K. Finkenzeller, RFID Handbook: Radio-Frequency Identification and Fundamentals and Application, New York: John Wiley, 1999. This book gives basic information on simple uses for RFID and how it’s commonly used. This is very good source because it has been cited about 635 times. The author Klaus Finkenzeller is also very well known for this handbook. This is a book. 4. D. Hahnel, W. Burgard, D. Fox, K. Fishkin, M. Philipose, "Mapping and localization with RFID technology," Robotics and Automation, 2004. Proceedings. ICRA '04. 2004 IEEE International Conference on , vol.1, no., pp.1015,1020 Vol.1, 26 April-1 May 2004 This is just for a little extra work in possibly expanding my original idea. This will help me with the tracking people and possibly adding “fancy” features. This is cited slightly less (524 times) but comes from an IEEE journal which is respectable. This is a journal. 5. R. Sadr, “RFID System with Low Complexity Implementation and Pallet Coding Error Correction” U.S. Patent 8,552,835, October 8, 2013. This is a patent about a how to simply implement RFID systems. It goes over systems to decode data transmitted by RFID technology. This could provide useful details in how to properly implement the RFID reader in my project. The author is a CEO of Mojix Inc as well as a former research scientist at Boeing. This is a US patent.

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 RFID DUMP INFO 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 #include #define RST_PIN #define SS_PIN

9 10

// Configurable, see typical pin layout above // Configurable, see typical pin layout above

MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance 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; } // Select one of the cards if ( ! mfrc522.PICC_ReadCardSerial()) { ECE-HITS

50

2016-2020

RFID BASED Door Lock Using Arduino

return; } // Dump debug info about the card; PICC_HaltA() is automatically called mfrc522.PICC_DumpToSerial(&(mfrc522.uid)); } }

ACCESS LOCK code: #include #include #include #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