ACCESS CONTROL USING RFID AND ARDIUNO B.Tech. Project Report
A.PAVITHRA M.KALAVATHI S.KEERTHI SK.SABIRUNNISA
DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING
GOKARAJU RANGARAJU INSTITUTE OF ENGINEERING AND TECHNOLOGY (Affiliated to Jawaharlal Nehru Technological University)
HYDERABAD 500 090 2013
ACCESS CONTROL USING RFID AND ARDIUNO Project Report Submitted in Partial Fulfillment of the Requirements for the Degree of
Bachelor of Technology in Electronics and Communication Engineering by
A.PAVITHRA (Roll No. 10245A0401) M.KALAVATHI (Roll No. 10245A0408) S.KEERTHI (Roll No. 10245A0411) SK.SABIRUNNISA (Roll No. 10245A0412)
DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING GOKARAJU RANGARAJU INSTITUTE OF ENGINEERING AND TECHNOLOGY (Affiliated to Jawaharlal Nehru Technological University)
HYDERABAD 500 090 2013
Department of Electronics and Communication Engineering Gokaraju Rangaraju Institute of Engineering and Technology (Affiliated to Jawaharlal Nehru Technological University)
Hyderabad 500 090 2013
Certificate This is to certify that this project report entitled Access Control Using Rfid and Ardiuno by A. Pavithra (Roll No. 10245A0401), M. Kalavathi(Roll No. 10245A0408), S. Keerthi (Roll No. 10245A0411) and SK. Sabirunnisa(Roll No. 10245A0412), submitted in partial fulfillment of the requirements for the degree of Bachelor of Technology in Electronics and Communication Engineering of the Jawaharlal Nehru Technological University, Hyderabad, during the academic year 2012-13, is a bonafide record of work carried out under our guidance and supervision. The results embodied in this report have not been submitted to any other University or Institution for the award of any degree or diploma.
(Guide) N.ome
(External Examiner)
(Head of Department) Ravi Billa
ACKNOWLEDGMENT
It is a pleasure to express thanks to Mr. N.Ome, Associate professor, GRIET, Hyderabad, who is instrumental for the successful completion of this project with his constant guidance and able supervision throughout the course of this project.
We would like to express our sincere gratitude Mr. Ravi Billa , Head of the E.C.E Department, GRIET, Hyderabad, for being co-operative and encouraging during the tenure of the project.
Finally I thank all the ICS staff and E.C.E Department Staff who have been supportive and extended their timely help for the completion of this project.
A.Pavithra ________________________ M.Kalavathi ________________________ S.Keerthi ________________________ SK.Sabirunnisa ________________________
Abstract The concept of access control using Arduino &RFID technology is that to control the Door automatically. In this method RFID reader& Arduino board is placed far away to the door, whenever person (he is having RFID card)comes nearer to the Reader, RFID reader reads the data from his RFID tag. This data is send to the Arduino board, which is basically Microcontroller based board. Arduino board receives that number and compares with valid numbers .If that number is valid send ‘1’to the zigbee modem and send ‘0’ if that received number is invalid. Zigbee modem Transmit corresponding data( 0 or 1) to the coordinator. On the receiving side Depending on the Zigbee received data, the arduino will control the door, if zigbee ‘0’ is received , the arduino will send Logic HIGH signal to the POWER transistor, then power tr. is ON ,magnetic lock also on then door is closed. if zigbee ‘1’ is received , the arduino will send Logic LOW signal to the POWER transistor, then power transistor is off, Magnetic lock doesn’t conduct then door is open.
BLOCK DIAGRAM: RFID CARD
RFID READER
Transmitter Arduino uno board
Zigbee module
Receiver Zigbee module
Arduino uno board
ZIGBEE MODULE
ARDUINO UNO BOARD
RELAY
Magnetic lock(Door)
Hardware Required:
MAGNETIC LOCK
Arduino uno board
(DOOR)
RFID Reader RFID card Magnetic lock& Z44Transistor Software Required: Arduino, XCTU Software to Configure the XBEE Modems. i
List of figures 3. Arduino
5
3.1 Arduino board
5
4. RFID technology
23
4.1 RFID reader 4.2 Block diagram of RFID system 4.3 RFID tag diagram 4.4 RFID tag 4.5 Application diagram of RFID tag 4.6 Materials tracking using RFID tag 4.7 Automatic payment RFID card 4.8 Automatic gate check post using RFID technology
23 23 24 24 38 38 39 39
5.ZIGBEE
41
5.1 zigbee pin diagram 5.2 XCTU user interface 5.3 PC settings 5.4 Com test/query modem 5.5 Modem configuration as coordinator 5.6 To read source address 5.7 Modem configuration as router 5.8 To set destination address 5.9 open up serial port in the arduino IDE 5.10Router should connect to the coordinator
41 43 47 47 49 49 50 51 52 53
6. Magnetic lock
54
6.1 Magnetic lock 6.2 Basic magnetic wiring diagram
54 55
7. Implementation of access control using RFID and arduino
56
7.1 Block diagram of transmitter 7.2 Block diagram of receiver 7.3 Flow chart of transmitter 7.4 Flow chart of receiver 7.5 transmitter 7.6 receiver 7.7 Components used in the project 7.8 Normally when door is closed 7.9 Door closed message on serial port 7.10 when otherised person enter into door 7.11 Door open message display on serial port 7.12 Door closed for unauthorized persons 7.13 serial port displays that the person is unauthorized
56 56 59 60 65 66 67 68 68 70 71 72
ii
List of tables
4.RFID TECHNOLOGY
27
4.1 Comparison between active and passive tags
27
5.ZIGBEE
42
5.1 Pin description
42
iii
CONTENTS Abstract List of figures List of tables
i ii iii
1 Introduction
1
1.1 Background 1.2 Aim of this Project 1.3 Methodology 1.4 Significance of this Work 1.5 Outline 1.6 Conclusion
1 2 2 3 3 3
2. Literature Review
4
3.Arduino
5
3.1 3.2 3.3 3.4 3.5
5 6 6 8 8
introduction to arduino Uno Features of Arduino Uno Pins description communication Arduino Uno Programming
4. RFID TECHNOLOGY
21
4.1 Definition of RFID Technology 4.2 Automatic identification and data capture(AIDC) 4.3 components RFID system 4.4 RFID frequency 4.5 RFID TAG 4.6 Classification of tags 4.6.1 Passive Tags 4.6.2 Active Tags 4.6.3 Technical charecteirstics of active and passive RFID tags 4.6.4 Functional capabilities of active and passive RFID tags 4.6.5 semipassive RFID tags 4.6.6 Read only tag 4.6.7 Read write tag 4.6.8 Write once read many times tag 4.7 The RFID reader
21 21 22 24 24 25 25 26 26 28 30 30 30 30 31
4.8 Data base 4.9 Radio frequency for RFID system 4.10 Tag-Reader communication 4.11 Multiple set of standards guide RFID technology 4.12 Multiple organizations develop RFID standards 4.13 Application of RFID technology 4.14 conclusion
31 31 33 34 35 36 40
5.ZIGBEE
41
5.1 introduction 5.2 Network concepts 5.2.1 Personal area networks 5.3 XCTU 5.4 Testing the zigbee
41 42 43 43 51
6.Basic magnetic door lock system
54
6.1 Electromagnetic locks 6.2 System overview 6.3 System example 6.4 Simple wiring diagram
54 54 55 55
7. Implementation of access controle using RFID and Arduino
56
7.1 Block diagram 7.1.1 Block diagram of Transmitter 7.1.2 Block diagram of Reciever 7.2 Flow chart of transmitter 7.3 Flow chart of receiver 7.4 Code 7.4.1 Transmitter code 7.4.2 Receiver code 7.5 Components used 7.6 Result
56 56 56 59 60 61 61 63 67 68
Chapter 1 INTRODUCTION 1.1 Background: Even we having the barcode technology, Wi-Fi or Bluetooth and another microcontroller like 8051 we don’t require to do that all things, we may use simple and advanced techniques to replace above things efficiently. The advanced and improve version we are using they are RFID, Arduino and zigbee instead of barcode,8051 and Wi-Fi.
RFID has a wide and growing range of potential uses throughout industry, commerce, education and the public sector more widely. The main driver for the development of the technology is the capability to identify and track the movement of products through supply chain. The current method of product tracking with in supply chains is the barcode, but passive RFID tags provides some simple, but fundamental, advantages. Firstly, barcodes are usually printed on paper labels or packaging, and are therefore prone to damage. Secondly although barcodes can provide inventory data to the level of product category, they can not provide additional data such as ‘sell by ‘dates; this type of extra functionality has the potential to be developed further for things like home automation, where, for example, RFID tags embedded in clothes may, in the future, be able to provide washing instruction to washing machines. Also, because RFID systems use radio frequencies to communicate, they are able to identify an object without a line of sight. This means that RFID tags can be identified while they are attacked to items inside boxes or even behind wall.
The Arduino Uno is a microcontroller board based on the ATmega328 . It has 14 digital input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz ceramic resonator, a USB connection, a power jack, an ICSP header, and a reset button. It contains everything needed to support the microcontroller; simply connect it to a computer with a USB cable or power it with a AC-to-DC adapter or battery to get started. It has more advantages over 8051 they are firstly, in this instead of using different peripherals registers so as to access a peripheral we can directly use predefined instruction to do so. Secondly we have 10 bit ADC, it occupies less space, so simple to program, it has 2K SRAM, 1K EPROM and 32K flash memory.
Zigbee is a wireless communication protocol like Wi-Fi and Bluetooth. Why we use this zigbee is it has more advantages than wi-fi and Bluetooth. They are low power consumption, low cost, wireless network proprietary standard. The low cost allows the technology to be widely deployed in wireless control and monitoring applications, the low power
1
usage allows longer life with smaller batteries, and the mesh networking provides high reliability and large range. Zigbee operating frequency is 2.4 GHz.
1.2 Aim of this Project: The main aim of our project is to allow the otherised persons into the room and it will not allows the unauthorized persons and it displays that whether the persons is unauthorized or unauthorized.
The concept of access control using Arduino &RFID technology is that to control the Door automatically. In this method RFID reader& Arduino board is placed far away to the door, whenever person (he is having RFID card)comes nearer to the Reader, RFID reader reads the data from his RFID tag. This data is send to the Arduino board, which is basically Microcontroller based board. Arduino board receives that number and compares with valid numbers .If that number is valid send some command(‘1’) to the zigbee modem and send another command(‘0’) if that received number is invalid. Zigbee modem Transmit corresponding data to the coordinator.
On the receiving side Depending on the Zigbee received data, the arduino will control the door, if zigbee ‘0’ is received , the arduino will send Logic HIGH signal to the POWER transistor, then power tr. is ON ,magnetic lock also on then door is closed. if zigbee ‘1’ is received , the arduino will send Logic LOW signal to the POWER transistor, then power transistor is off, Magnetic lock doesn’t conduct then door is open.
1.3 Methodology: In our project we are giving an authorized ID to the arduino board, when the person having RFID tag comes near to the RFID reader at the door, then the ID num on the tag is given to the arduino board through the reader, arduino board compares the valid ID with received ID, if the ID is valid then, magnetic lock allows the person into door otherwise not allows.
2
1.4 Significance of this Work: The advantage of our project is security purpose, that means the person who has authentication to allow to the industry or any other use, that particular persons only allows our technology and do not allow the persons who doesn’t have authentication.
1.5 Outline of this Report: In our project chapter1 includes introduction of our project, chapter2 includes literature review, chapter3 includes arduino, chapter4 includes RFID technology, chapter5 includes Zigbee, chapter6 includes implementation of our project.
1.6 Conclusion To allow otherised person only, Lack of standardization, high costs of implementation, slow technology development, and the elimination of unskilled labor are all contributors currently preventing the adoption of new this technologies.
3
Chapter 2 LITERATURE REVIEW
Firstly we did work in transmitter side, in our project we study and implemented about RFID technology, we tested that the RFID identifies the RFID tags or not, if identified then we can able to know by indicating LED glow and buzzer sound. Then we proceed with the arduino, we wrote program in our arduino board that check the received ID number is valid or not by comparing with the valid ID number which already stored in arduino board. Then we observed that when we placing RFID near to the reader then the arduino board checks the received data and we can see the received ID is valid or not in serial port. Then we set the settings of zigbee by using XCTU tool. We are using two zigbee modules for serial communication one is at receiver side and another is at transmitter side, we set transmitter zigbee as a router and receiver zigbee as a coordinator. Now at receiver side the zigbee receives the data and gives it to the arduino board at the receiver side. In this arduino board we wrote a code that the if received data is valid then send LOW logic signal to the magnetic lock through the IRFZ44 MOSFET otherwise sends HIGH logic to magnetic lock, we wrote this code and checked it is working or not. Then we connected the IRFZ44 MOSFET to the magnetic lock through 12V battery, then we checked that if it receives valid ID then door is open or not, and also checked that when it received invalid data then the door is closed or not. Finally we implemented the whole thing in our kit and saw the result successfully.
4
Chapter 3 ARDUINO 3.1 INTRODUCTION: The Arduino Uno is a microcontroller board based on the ATmega328 . It has 14 digital input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz ceramic resonator, a USB connection, a power jack, an ICSP header, and a reset button. It contains everything needed to support the microcontroller; simply connect it to a computer with a USB cable or power it with a AC-to-DC adapter or battery to get started. The Uno differs from all preceding boards in that it does not use the FTDI USB-to-serial driver chip. Instead, it features the Atmega16U2 (Atmega8U2 up to version R2) programmed as a USB-to-serial converter.: "Uno" means one in Italian and is named to mark the upcoming release of Arduino 1.0. The Uno and version 1.0 will be the reference versions of Arduino, moving forward. The Uno is the latest in a series of USB Arduino boards, and the reference model for the Arduino platform; for a comparison with previous versions..
Fig.3.1 Arduino board
5
3.2 Features of Arduino Uno: Microcontroller
ATmega328
Operating Voltage
5V
Input Voltage (recommended) 7-12V Input Voltage (limits)
6-20V
Digital I/O Pins
14 (of which 6 provide PWM output)
Analog Input Pins
6
DC Current per I/O Pin
40 mA
DC Current for 3.3V Pin
50 mA
Flash Memory
32 KB (ATmega328) of which 0.5 KB used by bootloader
SRAM
2 KB (ATmega328)
EEPROM
1 KB (ATmega328)
Clock Speed
16 MHz
3.3 PINS DESCRIPTION: Power The Arduino Uno can be powered via the USB connection or with an external power supply. The power source is selected automatically. External (non-USB) power can come either from an AC-to-DC adapter (wallwart) or battery. The adapter can be connected by plugging a 2.1mm center-positive plug into the board's power jack. Leads from a battery can be inserted in the Gnd and Vin pin headers of the POWER connector. The board can operate on an external supply of 6 to 20 volts. If supplied with less than 7V, however, the 5V pin may supply less than five volts and the board may be unstable. If using more than 12V, the voltage regulator may overheat and damage the board. The recommended range is 7 to 12 volts. The power pins are as follows:
VIN. The input voltage to the Arduino board when it's using an external power source (as opposed to 5 volts from the USB connection or other regulated power source). You can supply voltage through this pin, or, if supplying voltage via the power jack, access it through this pin. 6
5V.This pin outputs a regulated 5V from the regulator on the board. The board can be supplied with power either from the DC power jack (7 - 12V), the USB connector (5V), or the VIN pin of the board (7-12V). Supplying voltage via the 5V or 3.3V pins bypasses the regulator, and can damage your board. We don't advise it. 3V3. A 3.3 volt supply generated by the on-board regulator. Maximum current draw is 50 mA. GND. Ground pins. IOREF. This pin on the Arduino board provides the voltage reference with which the microcontroller operates. A properly configured shield can read the IOREF pin voltage and select the appropriate power source or enable voltage translators on the outputs for working with the 5V or 3.3V.
Memory The ATmega328 has 32 KB (with 0.5 KB used for the bootloader). It also has 2 KB of SRAM and 1 KB of EEPROM. Input and Output Each of the 14 digital pins on the Uno can be used as an input or output, using pinMode(), digitalWrite(), and digitalRead() functions. They operate at 5 volts. Each pin can provide or receive a maximum of 40 mA and has an internal pull-up resistor (disconnected by default) of 20-50 kOhms. In addition, some pins have specialized functions:
Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial data. These pins are connected to the corresponding pins of the ATmega8U2 USB-to-TTL Serial chip. External Interrupts: 2 and 3. These pins can be configured to trigger an interrupt on a low value, a rising or falling edge, or a change in value. PWM: 3, 5, 6, 9, 10, and 11. Provide 8-bit PWM output with the analogWrite() function. SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI communication using the SPI library. LED: 13. There is a built-in LED connected to digital pin 13. When the pin is HIGH value, the LED is on, when the pin is LOW, it's off.
The Uno has 6 analog inputs, labeled A0 through A5, each of which provide 10 bits of resolution (i.e. 1024 different values). By default they measure from ground to 5 volts, though is it possible to change the upper end of their range using the AREF pin and the analogReference() function. Additionally, some pins have specialized functionality:
TWI: A4 or SDA pin and A5 or SCL pin. Support TWI communication using the Wire library. 7
There are a couple of other pins on the board:
AREF. Reference voltage for the analog inputs. Used with analogReference(). Reset. Bring this line LOW to reset the microcontroller. Typically used to add a reset button to shields which block the one on the board.
3.4 Communication: The Arduino Uno has a number of facilities for communicating with a computer, another Arduino, or other microcontrollers. The ATmega328 provides UART TTL (5V) serial communication, which is available on digital pins 0 (RX) and 1 (TX). An ATmega16U2 on the board channels this serial communication over USB and appears as a virtual com port to software on the computer. The '16U2 firmware uses the standard USB COM drivers, and no external driver is needed. The Arduino software includes a serial monitor which allows simple textual data to be sent to and from the Arduino board. The RX and TX LEDs on the board will flash when data is being transmitted via the USB-to-serial chip and USB connection to the computer (but not for serial communication on pins 0 and 1). A Software Serial library allows for serial communication on any of the Uno's digital pins. The ATmega328 also supports I2C (TWI) and SPI communication. The Arduino software includes a Wire library to simplify use of the I2C bus. For SPI communication, use the SPI library
3.5 Arduino Uno Programming: The Arduino Uno can be programmed with the Arduino software . Select "Arduino Uno from the Tools > Board menu (according to the microcontroller on your board). The ATmega328 on the Arduino Uno comes preburned with a boot loader that allows you to upload new code to it without the use of an external hardware programmer. It communicates using the original STK500 protocol. Arduino programs can be divided in three main parts: structure, values (variables and constants), and functions. Structure An Arduino program runs in two parts: Void setup() Void loop() setup() is preparation, and loop() is execution. In the setup section, always at the top of your program, you would set pin Modes, initialize serial communication, etc. The loop section is the code to be executed -- reading inputs, 8
Triggering outputs, etc.
Setup() Loop()
Setup()
The setup() function is called when a sketch starts. Use it to initialize variables, pin modes, start using libraries, etc. The setup function will only run once, after each power up or reset of the Arduino board. Loop() After creating a setup() function, which initializes and sets the initial values, the loop() function does precisely what its name suggests, and loops consecutively, allowing your program to change and respond. Use it to actively control the Arduino board. Example int buttonPin = 3;
// setup initializes serial and the button pin Void setup() { Serial.begin(9600); pinMode(buttonPin, INPUT); } // loop checks the button pin each time, // and will send serial if it is pressed Void loop() { if (digitalRead(buttonPin) == HIGH) serialWrite('H'); else serialWrite('L'); delay(1000);} Variables Variables are expressions that you can use in programs to store values, such as a sensor reading from an analog pin. Constants Constants are particular values with specific meanings. HIGH | LOW INPUT | OUTPUT 9
true | false Integer Constants Data Types Variables can have various types. int,long,unsigned long,float,double,string,array
They
are
Boolean,char,byte,int,unsigned
Functions Digital I/O
pinMode() digitalWrite() digitalRead()
pinMode() Description Configures the specified pin to behave either as an input or an output. See the description of digital pins for details on the functionality of the pins. Syntax pinMode(pin, mode) Parameters pin: the number of the pin whose mode you wish to set mode: INPUT, OUTPUT, or INPUT_PULLUP. (see the digital pins page for a more complete description of the functionality.) digitalWrite() Description Write a HIGH or a LOW value to a digital pin. If the pin has been configured as an OUTPUT with pinMode(), its voltage will be set to the corresponding value: 5V (or 3.3V on 3.3V boards) for HIGH, 0V (ground) for LOW. If the pin is configured as an INPUT, writing a HIGH value with digitalWrite() will enable an internal 20K pullup resistor (see the tutorial on digital pins). Writing LOW will disable the pullup. The pullup resistor is enough to light an LED dimly, so if LEDs appear to work, but very dimly, this is a likely cause. The remedy is to set the pin to an output with the pinMode() function.
10
Syntax digitalWrite(pin, value) Parameters pin: the pin number value: HIGH or LOW Example int ledPin = 13;
// LED connected to digital pin 13
void setup() { pinMode(ledPin, OUTPUT); }
// sets the digital pin as output
void loop() { digitalWrite(ledPin, HIGH); // sets the LED on delay(1000); // waits for a second digitalWrite(ledPin, LOW); // sets the LED off delay(1000); // waits for a second }
Sets pin 13 to HIGH, makes a one-second-long delay, and sets the pin back to LOW. digitalRead() Description Reads the value from a specified digital pin, either HIGH or LOW. Syntax digitalRead(pin)
11
Parameters: pin: the number of the digital pin you want to read (int) Returns HIGH or LOW Analog I/O
analogReference() analogRead() analogWrite() - PWM
Configures the reference voltage used for analog input (i.e. the value used as the top of the input range). The options are:
DEFAULT: the default analog reference of 5 volts (on 5V Arduino boards) or 3.3 volts (on 3.3V Arduino boards) INTERNAL: an built-in reference, equal to 1.1 volts on the ATmega168 or ATmega328 and 2.56 volts on the ATmega8 (not available on the Arduino Mega)
analogRead() Description Reads the value from the specified analog pin. The Arduino board contains a 6 channel (8 channels on the Mini and Nano, 16 on the Mega), 10-bit analog to digital converter. This means that it will map input voltages between 0 and 5 volts into integer values between 0 and 1023. This yields a resolution between readings of: 5 volts / 1024 units or, .0049 volts (4.9 mV) per unit. The input range and resolution can be changed using analogReference(). It takes about 100 microseconds (0.0001 s) to read an analog input, so the maximum reading rate is about 10,000 times a second. Syntax analogRead(pin) Parameters pin: the number of the analog input pin to read from (0 to 5 on most boards, 0 to 7 on the Mini and Nano, 0 to 15 on the Mega) Returns int (0 to 1023)
12
analogWrite() Description Writes an analog value (PWM wave) to a pin. Can be used to light a LED at varying brightnesses or drive a motor at various speeds. After a call to analogWrite(), the pin will generate a steady square wave of the specified duty cycle until the next call to analogWrite() (or a call to digitalRead() or digitalWrite() on the same pin). The frequency of the PWM signal is approximately 490 Hz. Syntax analogWrite(pin, value) Parameters pin: the pin to write to. value: the duty cycle: between 0 (always off) and 255 (always on). delay() Description Pauses the program for the amount of time (in miliseconds) specified as parameter. (There are 1000 milliseconds in a second.) Syntax delay(ms) Parameters ms: the number of milliseconds to pause (unsigned long) Serial communication functions Used for communication between the Arduino board and a computer or other devices. All Arduino boards have at least one serial port (also known as a UART or USART): Serial. It communicates on digital pins 0 (RX) and 1 (TX) as well as with the computer via USB. Thus, if you use these functions, you cannot also use pins 0 and 1 for digital input or output. You can use the Arduino environment's built-in serial monitor to communicate with an Arduino board. Click the serial monitor button in the toolbar and select the same baud rate used in the call to begin().
Serial.available() Serial.begin() Serial.print() Serial. println() Serial read() Serial.write() 13
Serial.begin() Description Sets the data rate in bits per second (baud) for serial data transmission. For communicating with the computer, use one of these rates: 300, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 38400, 57600, or 115200. You can, however, specify other rates - for example, to communicate over pins 0 and 1 with a component that requires a particular baud rate. Syntax Serial.begin(speed) Parameters speed: in bits per second (baud) - long Returns nothing Serial.available() Description Get the number of bytes (characters) available for reading from the serial port. This is data that's already arrived and stored in the serial receive buffer (which holds 64 bytes). Syntax Serial.available() Parameters none Returns the number of bytes available to read
14
read() Description Reads incoming serial data. Syntax Serial.read() Parameters None Returns the first byte of incoming serial data available (or -1 if no data is available) - int write() Description Writes binary data to the serial port. This data is sent as a byte or series of bytes; to send the characters representing the digits of a number use the print() function instead. Syntax Serial.write(val) Serial.write(str) Serial.write(buf, len) Arduino Mega also supports: Serial1, Serial2, Serial3 (in place of Serial) Parameters val: a value to send as a single byte str: a string to send as a series of bytes buf: an array to send as a series of bytes len: the length of the buffer
15
Returns byte write() will return the number of bytes written, though reading that number is optional Example print() Description Prints data to the serial port as human-readable ASCII text. This command can take many forms. Numbers are printed using an ASCII character for each digit. Floats are similarly printed as ASCII digits, defaulting to two decimal places. Bytes are sent as a single character. Characters and strings are sent as is. For example:
Serial.print(78) gives "78" Serial.print(1.23456) gives "1.23" Serial.print('N') gives "N" Serial.print("Hello world.") gives "Hello world."
An optional second parameter specifies the base (format) to use; permitted values are BIN (binary, or base 2), OCT (octal, or base 8), DEC (decimal, or base 10), HEX (hexadecimal, or base 16). For floating point numbers, this parameter specifies the number of decimal places to use. For example:
Serial.print(78, BIN) gives "1001110" Serial.print(78, OCT) gives "116" Serial.print(78, DEC) gives "78" Serial.print(78, HEX) gives "4E" Serial.println(1.23456, 0) gives "1" Serial.println(1.23456, 2) gives "1.23" Serial.println(1.23456, 4) gives "1.2346"
You can pass flash-memory based strings to Serial.print() by wrapping them with F(). For example :
Serial.print(F(“Hello World―))
To send a single byte, use Serial.write(). Syntax Serial.print(val) Serial.print(val, format)
16
Parameters val: the value to print - any data type format: specifies the number base (for integral data types) or number of decimal places (for floating point types) Returns size_t (long): print() returns the number of bytes written, though reading that number is optional println() Description Prints data to the serial port as human-readable ASCII text followed by a carriage return character (ASCII 13, or '\r') and a newline character (ASCII 10, or '\n'). This command takes the same forms as Serial.print(). Syntax Serial.println(val) Serial.println(val, format) Parameters val: the value to print - any data type format: specifies the number base (for integral data types) or number of decimal places (for floating point types) Returns size_t (long): println() returns the number of bytes written, though reading that number is optional Arduino Libraries Arduino support many libraries ,using these we can easily write the programs for any applications in arduino.Libraries provide extra functionality for use in sketches, e.g. working with hardware or manipulating data. To use a library in a sketch, select it from Sketch > Import Library. Standard Libraries
EEPROM- reading and writing to "permanent" storage 17
Ethernet- for connecting to the internet using the Arduino Ethernet Shield Firmata - for communicating with applications on the computer using a standard serial protocol. LiquidCrystal- for controlling liquid crystal displays (LCDs) SD - for reading and writing SD cards Servo - for controlling servo motors SPI - for communicating with devices using the Serial Peripheral Interface (SPI) Bus SoftwareSerial - for serial communication on any digital pins Stepper- for controlling stepper motors Wire - Two Wire Interface (TWI/I2C) for sending and receiving data over a net of devices or sensors.
In our project we are using SoftwareSerial –library for serial communication on any digital pins
SoftwareSerial Library The Arduino hardware has built-in support for serial communication on pins 0 and 1 (which also goes to the computer via the USB connection). The native serial support happens via a piece of hardware (built into the chip) called a UART. This hardware allows the Atmega chip to receive serial communication even while working on other tasks, as long as there room in the 64 byte serial buffer. The SoftwareSerial library has been developed to allow serial communication on other digital pins of the Arduino, using software to replicate the functionality (hence the name "SoftwareSerial"). It is possible to have multiple software serial ports with speeds up to 115200 bps. A parameter enables inverted signaling for devices which require that protocol. . SoftwareSerial(rxPin, txPin) Description A call to SoftwareSerial(rxPin, txPin) creates a new SoftwareSerial object, whose name you need to provide as in the example below. You need to call SoftwareSerial.begin() to enable communication. Parameters rxPin: the pin on which to receive serial data txPin: the pin on which to transmit serial data
18
SoftwareSerial: available() Description Get the number of bytes (characters) available for reading from a software serial port. This is data that's already arrived and stored in the serial receive buffer. Syntax mySerial.available() Parameters none Returns the number of bytes available to read
SoftwareSerial: begin(speed) Description Sets the speed (baud rate) for the serial communication. Supported baud rates are 300, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 31250, 38400, 57600, and 115200. Parameters speed: the baud rate (long) Returns none SoftwareSerial: read Description Return a character that was received on the RX pin of the software serial port. Note that only one SoftwareSerial instance can receive incoming data at a time (select which one with the listen() function). Parameters none Returns the character read, or -1 if none is available
19
SoftwareSerial: listen() Description Enables the selected software serial port to listen. Only one software serial port can listen at a time; data that arrives for other ports will be discarded. Any data already received is discarded during the call to listen() (unless the given instance is already listening). Syntax mySerial.listen() Parameters mySerial:the name of the instance to listen Returns None SoftwareSerial: isListening() Description Tests to see if requested software serial port is actively listening. Syntax mySerial.isListening()
20
Chapter 4 RFID TECHNOLOGY
4.1 Definition of RFID technology: RFID stands for Radio Frequency Identification. it uses radio waves to automatically identify people or objects. RFID is an automated data-capture technology that can be used to electronically identify, track, and store information contained on a tag. A radio frequency reader scans the tag for data and sends the information to a database, which stores the data contained on the tag.
4.2 Automatic Identification and Data Capture (AIDC) Technology Identification processes that rely on AIDC technologies are significantly more reliable and less expensive than those that are not automated. The most common AIDC technology is bar code technology, which uses optical scanners to read labels. Most people have direct experience with bar codes because they have seen cashiers scan items at supermarkets and retail stores. Bar codes are an enormous improvement over ordinary text labels because personnel are no longer required to read numbers or letters on each label or manually enter data into an IT system; they just have to scan the label. The innovation of bar codes greatly improved the speed and accuracy of the identification process and facilitated better management of inventory and pricing when coupled with information systems.
RFID represents a technological advancement in AIDC because it offers advantages that are not available in other AIDC systems such as bar codes. RFID offers these advantages because it relies on radio frequencies to transmit information rather than light, which is required for optical AIDC technologies. The use of radio frequencies means that RFID communication can occur:
Without optical line of sight, because radio waves can penetrate many materials,
21
At greater speeds, because many tags can be read quickly, whereas optical technology often requires time to manually reposition objects to make their bar codes visible, and
Over greater distances, because many radio technologies can transmit and receive signals more effectively than optical technology under most operating conditions
The ability of RFID technology to communicate without optical line of sight and over greater distances than other AIDC technology further reduces the need for human involvement in the identification process. For example, several retail firms have pilot RFID programs to determine the contents of a shopping cart without removing each item and placing it near a scanner, as is typical at most stores today. In this case, the ability to scan a cart without removing its contents could speed up the checkout process, thereby decreasing transaction costs for the retailers. This application of RFID also has the potential to significantly decrease checkout time for consumers.
RFID products often support other features that bar codes and other AIDC technologies do not have, such as rewritable memory, security features, and environmental sensors that enable the RFID technology to record a history of events. The types of events that can be recorded include temperature changes, sudden shocks, or high humidity. Today, people typically perceive the label identifying a particular object of interest as static, but RFID technology can make this label dynamic or even “smart” by enabling the label to acquire data about the object even when people are not present to handle it.
4.3 COMPONENTS OF RFID SYSTEM Radio frequency identification (RFID) is a technology that allows automatic identification an data capture by using radio frequencies. The salient features of this technology are that they permit the attachment of a unique identifier and other information – using a micro-chip – to any object, animal or even a person, and to read this information through a wireless device. RFIDs are not just "electronic tags" or "electronic barcodes". When linked to databases and communications networks, such as the Internet, this technology provides a very powerful way of delivering new services and applications, in potentially any environment
22
The main technology components of an RFID system are a tag, reader, and database. A radio frequency reader scans the tag for data and sends the information to a database, which stores the data contained on the tag.
Fig: 4.1 RFID reader
Fig:4.2 Block diagram of RFID system 23
4.4 RFID FRQUENCIES: RFID tags and readers must be tuned into the same frequency to enable communications. RFID systems can use a variety of frequencies to communicate, but because radio waves work and act differently at different frequencies, a frequency for a specific RFID system is often dependant on its application. High frequency RFID systems (850 MHz to 950 MHz and 2.4 GHz to 2.5 GHz) offer transmission ranges of more than 90 feet, although wavelengths in the 2.4 GHz range are absorbed by water, which includes the human body, and therefore has limitations.
4.5 RFID tag: An RFID tag, or transponder, consists of a chip and an antenna .A chip can store a unique serial number or other information based on the tag’s type of memory, which can be read-only, read-write, or write-once read-many. The antenna, which is attached to the microchip, transmits information from the chip to the reader. Typically, a larger antenna indicates a longer read range. The tag is attached to or embedded in and object to be identified, such as a product, case, or pallet, and can be scanned by mobile or stationary readers using radio wave
Fig:4.3 RFID tag diagram
Fig:4.4 RFID tag
24
4.6 Classifications of Tags Tags are classified into different types based on battery and memory. They are
Passive tags
Active tags
Semi passive tags
Read only tags
Read write tags
Write once read many times tags
4.6.1 PASSIVE TAGS The simplest version of a tag is a passive tag. Passive tags do not contain their own power source, such as a battery, nor can they initiate communication with a reader. Instead, the tag responds to the reader’s radio frequency emissions and derives its power from the energy waves transmitted by the reader. A passive tag contains, at a minimum, a unique identifier for the individual item attached to the tag. Depending on the storage capacity of the tag, additional data can be added. Under perfect conditions, the tags can be read from a range of about 10 to 20 feet. The cost of passive tags ranges from 20 cents to several dollars. Costs vary based on the radio frequency used, amount of memory, design of the antenna, and packaging around the transponder, among other tag requirements. Passive tags can operate at low, high, ultrahigh, or microwave frequency . Examples of passive tag applications include mass transit passes, building access badges, and consumer products in the supply chain. The development of these inexpensive tags has created a revolution in RFID adoption and made wide scale use of them a real possibility for government and industry organizations.
25
4.6.2 ACTIVE TAGS Active tags contain a power source and a transmitter, in addition to the antenna and chip, and send a continuous signal. These tags typically have read/write capabilities—tag data can be rewritten and/or modified. Active tags can initiate communication and communicate over longer distances—up to 750 feet, depending on the battery power. The relative expense of these tags makes them an option for use only where their high cost can be justified. Active tags are more expensive than passive, costing about $20 or more per tag. Examples of active tag applications are toll passes, such as “E-Z pass,” and the in-transit visibility applications on major items and consolidated cargo moved by DOD(Defence of Development).
4.6.3 Technical Characteristics of Active and Passive RFID tags
Active RFID and Passive RFID are fundamentally different technologies. While both use radio frequency energy to communicate between a tag and a reader, the method of powering the tags is different. Active RFID uses an internal power source (battery) within the tag to continuously power the tag and its RF communication circuitry, whereas Passive RFID relies on RF energy transferred from the reader to the tag to power the tag.
Passive RFID either 1) reflects energy from the reader or 2) absorbs and temporarily stores a very small amount of energy from the reader’s signal to generate its own quick response. In either case, Passive RFID operation requires very strong signals from the reader, and the signal strength returned from the tag is constrained to very low levels by the limited energy. On the other hand, Active RFID allows very low-level signals to be received by the tag (because the reader does not need to power the tag), and the tag can generate high-level signals back to the reader, driven from its internal power source. Additionally, the Active RFID tag is continuously powered, whether in the reader field or not.
26
Table:4.1
27
4.6.4 Functional Capabilities of Active and Passive RFIDTAGS The functional capabilities of Active and Passive RFID are very different and must be considered when selecting a technology for a specific application.
Communication Range For Passive RFID, the communication range is limited by two factors: 1) the need for very strong signals to be received by the tag to power the tag, limiting the
reader to
tag range, 2) the small amount of power available for a tag to respond to the reader, limiting the tag to reader range. These factors typically constrain Passive RFID operation to 3 meters or less. Depending on the vendor and frequency of operation, the range may be as short as a few centimetres. Active RFID has neither constraint on power and can provide communication ranges of 100 meters or more.
Multi-Tag Collection: As a direct result of the limited communication range of Passive RFID, collecting multiple collocated tags within a dynamic operation is difficult and often unreliable. Identifying multiple tags requires a substantial amount of communication between the reader and tags, typically a multi-step process with the reader communicating individually with each tag. Each interaction takes time, and the potential for interference increases with the number of tags, further increasing the overall duration of the operation. Because the entire collection operation must be completed while the tags are still within the range of the reader, Passive RFID is constrained in this aspect. For example, one popular Passive RFID systems available today requires more than 3 seconds to identify 20 tags. With a communication range of 3 meters, this limits the speed of the tagged items to less than 3 miles per hour. Active RFID, with operating ranges of 100 meters or more, is able to collect thousands of tags from a single reader. Additionally, tags can be in motion at more than 100 mph and still be accurately and reliably collected
28
Sensor Capabilities One functional area of great relevance to many supply chain applications is the ability to monitor environmental or status parameters using an RFID tag with built-in sensor capabilities. Parameters of interest may include temperature, humidity, and shock, as well as security and tamper detection. Because Passive RFID tags are only powered while in close proximity to a reader, these tags are unable to continuously monitor the status of a sensor. Instead, they are limited to reporting the current status when they reach a reader. Active RFID tags are constantly powered, whether in range of a reader or not, and are therefore able to continuously monitor and record sensor status, particularly valuable in measuring temperature limits and container seal status. Additionally, Active RFID tags can power an internal real-time clock and apply an accurate time/date stamp to each recorded sensor value or event.
Data Storage Both Active and Passive RFID technologies are available that can dynamically store data within the tag. However, because of power limitations, Passive RFID typically only provides a small amount of read/write data storage, on the order of 128 bytes (1000 bits) or less, with no search capability or other data manipulation features. Larger data storage and sophisticated data access capabilities require the tag to be powered for longer periods of time and are impractical with Passive RFID. Active RFID has the flexibility to remain powered for access and search of larger data spaces, as well as the ability to transmit longer data packets for simplified data retrieval. Active RFID tags are in common use with 128K bytes (1 million bits) of dynamically searchable read/write data storage.
29
4.6.5 SEMI PASSIVE TAGS: Semipassive tags also do not initiate communication with the reader but contain batteries that allow the tag to perform other functions, such as monitoring environmental conditions and powering the tag’s internal electronics. These tags do not actively transmit a signal to the reader. Some semi passive tags remain dormant (which conserves battery life) until they receive a signal from the reader. The battery is also used to facilitate information storage. Semi passive tags can be connected to sensors to store information for container security devices. Tags have various types of memory, including read-only, read-write, and write-once read-many. 4.6.6 READ ONLY TAGS: Read-only tags have minimal storage capacity (typically less than 64 bits) and contain permanently programmed data that cannot be altered. These tags primarily contain item identification information and have been used in libraries and video rental stores. Passive tags are typically read-only.
4.6.7 READ WRITE TAGS: In addition to storing data, read-write tags can allow the data to be updated when necessary. Consequently, they have larger memory capacity and are more expensive than readonly tags. These tags are typically used where data may need to be altered throughout a product’s life cycle, such as in manufacturing or in supply chain management.
4.6.8 WRITE ONCE READ MANYTIMES TAGS: A write-once, read-many tag allows information to be stored once, but does not allow subsequent alterations to the data. This tag provides the security features of a read-only tag while adding the additional functionality of read/write tags. In order for an RFID system to function, it needs a reader, or scanning device, that is capable of reliably reading the tags and communicating the results to a database
30
4.7 THE READER: A reader uses its own antenna to communicate with the tag. When a reader broadcasts radio waves, all tags designated to respond to that frequency and within range will respond. A reader also has the capability to communicate with the tag without a direct line of sight, depending on the radio frequency and the type of tag (active, passive, or semi passive) used. Readers can process multiple items at once, allowing for increased read processing times. They can be mobile, such as handheld devices that scan objects like pallets and cases, or stationary, such as point-of-sale devices used in supermarkets. Readers are differentiated by their storage capacity, processing capability, and the frequencies they can read.
4.8 DATABASE: The database is a back-end logistic information system that tracks and contains information about the tagged item. Information stored in the database can include item identifier, description, manufacturer, movement of the item, and location. The type of information housed in the database will vary by application. For instance, the data stored for a toll payment system will be different than the data stored for a supply chain. Databases can also be linked into other networks, such as the local area network, which can connect the database to the Internet. This connectivity can allow for data sharing beyond the local database from which the information was originally collected
4.9 Radio Frequencies for RFID systems: Choice of radio frequency is a key operating characteristic of RFID systems. The frequency largely determines the speed of communication and the distance from which the tag can be read. Generally, higher frequencies indicate a longer read range. Certain applications are more suitable for one type of frequency than other types, because radio waves behave differently at each of the frequencies. For instance, low-frequency waves can penetrate walls better than higher frequencies, but higher frequencies have faster data rates.In the United States, the Federal Communications Commission (FCC) administers the allocation of frequency bands for
31
commercial use and the National Telecommunications and Information Administration (NTIA) manages the federal spectrum.
RFID systems use an unlicensed frequency range, classified as industrial scientific-medical or short-range devices, which is authorized by the FCC.Devices operating in this unlicensed bandwidth may not cause harmful interference and must accept any interference received. The FCC also regulates the specific power limit associated with each frequency. The combination of frequency and allowable power levels determine the functional range of a particular application, such as the power output of readers.
There are four main frequencies used for RFID systems:
low frequency,
high frequency,
ultrahigh frequency,
microwave frequency
Low-frequency
Low-frequency bands range from 125 kilohertz (KHz) to 134 KHz. This band is most suitable for short-range use such as antitheft systems, animal identification, and automobile keyand-lock systems.
High-frequency High-frequency bands operate at 13.56 megahertz (MHz). High frequency allows for greater accuracy within a 3-foot range, and thus, reduces the risk of incorrectly reading a tag. Consequently, it is more suitable for item-level reading. Passive 13.56 MHz tags can be read at a rate of 10 to 100 tags per second and at a range of 3 feet or less. High-frequency RFID tags are used for material tracking in libraries and bookstores, pallet tracking, building access control, airline baggage tracking, and apparel item tracking. 32
Ultrahigh-frequency
Ultrahigh-frequency tags operate around 900 MHz and can be read at longer distances than high-frequency tags, ranging from 3 to 15 feet. These tags, however, are more sensitive to environmental factors than tags that operate in other frequencies. The 900 MHz band is emerging as the preferred band for supply-chain applications due to its read rate and range. Passive ultrahigh-frequency tags can be read at about 100 to 1,000 tags per second, with efforts under way to increase this read rate. These tags are commonly used in pallet and container tracking, truck and trailer tracking in shipping yards, and have been adopted by major retailers and DOD.
Microwave frequencies Tags operating in the microwave frequencies, typically 2.45 and 5.8 gigahertz (GHz), experience more reflected radio waves from nearby objects, which can impede the reader’s ability to communicate with the tag. Microwave RFID tags are typically used for supply chain management.
Within the federal government, the major initiatives at agencies that use or propose to use the technology include physical and logical access control and tracking various objects such as shipments, baggage on flights, documents, radioactive materials, evidence, weapons, and assets .Several agencies have initiated pilot programs to evaluate the use of RFID in specific applications. Of the 24 CFO Act agencies, 13 reported having implemented or having a specific plan to implement the technology in one or more applications
4.10 Tag-Reader Communication: Tag-reader communication is achieved by using a common communications protocol between the tag and the reader. Tag-reader communication protocols are often specified in RFID standards. Prominent international standards include the ISO/IEC 18000 series for item management and the ISO/IEC 14443 and ISO/IEC 1569standards for contactless smart cards. The most recent EPC global Class-1 Generation-2 standard is essentially equivalent to the ISO/IEC 18000-6C standard. 33
Communication Initiation Tags and readers can initiate RF transactions in two general ways:
Reader Talks First (RTF). In an RTF transaction, the reader broadcasts a signal that is received by tags in the reader’s vicinity. Those tags may then be commanded to respond to the reader and to continue transactions with the reader.
Tag Talks First (TTF). In a TTF transaction, a tag communicates its presence to a reader when the tag is within the reader’s RF field. If the tag is passive, then it transmits as soon as it gets power from the reader’s signal to do so. If the tag is active, then it transmits periodically as long as its power supply lasts. This type of transaction might be used when it is necessary to identify objects that pass by a reader, such as objects on a conveyer belt.
Readers and tags in an RFID system typically operate using only RTF or only TTF transactions, not both types. Active tag TTF operation may be easier for an adversary to detect or intercept, because active tags send beaconing signals even when they are not in the presence of a reader. The adversary could eavesdrop on this communication without risking detection because in TTF transactions the adversary never has to send a signal to ascertain the tag’s presence.
4.11 Multiple Sets of Standards Guide RFID Technology: RFID standards define a set of rules, conditions, or requirements that the components of a system (tag, reader, and database) must meet in order to operate effectively and that are needed to cover the air-interface operational requirements, ensure that tags meet intended designs provide adequate protection of data for both security and privacy issues, and define coding information contained on the tags. Currently, multiple sets of standards guide the use of RFID technology. Additionally, multiple standards-setting organizations have developed standards that support these needs. These standards can vary based on the type of activity the application is used for and the industry or country in which it is used
34
4.12 Multiple Organizations Develop RFID Standards: Multiple organizations, including international, national, private-sector, and industry organizations, are involved in the development of RFID standards International standards-setting organizations generally develop standards through a process that is open to participation by representatives of all interested countries, transparent, consensusbased, and subject to due process. ISO and IEC are actively involved in developing RFID standards for international use. ISO is an international association of countries, each of which is represented by its leading standards-setting organization. The scope of ISO is broad and includes all fields except electrical and electronic standards, which are the responsibility of IEC. ISO and IEC have jointly created several RFID standards.
National standards-setting organizations facilitate the development of national standards for use within their country. For example, the American National Standards Institute (ANSI) represents the United States to ISO and facilitates the development of U.S. standards. ANSI, as well as other national standards organizations, is involved in the development of RFID standards. For example, the Standardization Administration of China has established a National RFID Standards Working Group to draft and develop a national standard.
Private-sector organizations involved in the development of RFID standards can represent a single industry or multiple industries. For example, the Automotive Industry Action Group, Universal Postal Union, and International Air Transport Association have developed RFID standards for their respective industries. Private-sector organizations that represent multiple industries can develop a standard for a specific application. For example, EPC global Incorporated, which partners with various industry groups, has developed a series of specifications that DOD(Defence of Development) and various private-sector users are implementing in their supply chains.
35
4.13 Applications of RFID technology The standards-setting organizations have developed separate sets of standards governing RFID systems for specific applications. The standards used often depend on the type of activity the application is used for and the industry or country in which it is used. Requirements of applications often differ, and a single, common set of standards may not meet the needs of all applications
RFID applications such as supply chain, animal tracking, and access control use separate standards because the needs of these applications differ.
The
frequency used affects the
performance of tags in certain environments. For example, an animal tracking application will likely use a standard that specifies the use of the low-frequency range because this range performs well in environments that require reading through materials such as water and body tissue. An access control application that requires a read range of approximately 3 inches and the ability to read multiple tags simultaneously would likely use a standard that specifies the use of the high-frequency range. A supply chain application may likely use a standard that specifies the use of the ultra high frequency range because this range provides a read range of up to 15 feet and a read rate of 100 to 1,000 tags per second.
Industries such as the automotive, postal, and aviation, use standards for industry-specific applications. They may use standards developed by industry standards-setting organizations or standards developed by other standards-setting organizations, such as ISO, IEC, and EPC global. For example, the aviation industry uses a standard created by an industry organization for identifying airplane parts by means of bar code and RFID technologies. This standard requires the use of an ISO standard for tracking parts. There are also applications that only operate in a specific country. These applications, such as national identification cards, may be governed by national standards used only within that country.
36
RFID systems can be used just about anywhere, from clothing tags to missiles to pet tags to food - anywhere that a unique identification system is needed. The tag can carry information as simple as a pet owners name and address or the cleaning instruction on a sweater to as complex as instructions on how to assemble a car. Here are a few examples of how RFID technology is being used in everyday places: RFID systems are being used in some hospitals to track a patient's location, and to provide realtime tracking of the location of doctors and nurses in the hospital. In addition, the system can be used to track the whereabouts of expensive and critical equipment, and even to control access to drugs, pediatrics, and other areas of the hospital that are considered "restricted access" areas. RFID chips for animals are extremely small devices injected via syringe under skin. Under a government initiative to control rabies, all Portuguese dogs must be RFID tagged by 2007. When scanned
the tag can provide information relevant to the dog's history and its owner's
information.
RFID in retail stores offer real-time inventory tracking that allows companies to monitor and control inventory supply at all times.
The Orlando /Orange County Expressway Authority (OOCEA) is using an RFID based trafficmonitoring system, which uses roadside RFID readers to collect signals from transponders that are installed in about 1 million E-Pass and SunPass customer vehicles. The most common applications are asset management, asset tracking, automated payment.
Asset Management RFID-based asset management systems are used to manage inventory of any item that can be tagged. 37
RFID Technology Commonly used in
Store
Figure 4.5 Application diagram of RFID tags in store warehouse Library
Tracking: Used to keep track of the location of an item by recording the location of the last interrogator that detected the presence of the tag associated with the item. Examples:
Material tracking in production line
Animal tracking in Farm
Figure 4.6
Material tracking in production line using RFID tags 38
Matching Two tagged items are matched with each other and a signal (e.g., a light or tone) is triggered if one of the items is later matched with an incorrect tagged item.
Automated Payment RFID technology automates a variety of financial transactions, including fare collection on public transit systems (MRT), toll collection on roads, and retail payment using credit cards with embedded RFID tags
Figure 4.7 automated payment RFID card
Fig4.8 Automatic gate at check post using RFID technology 39
4.14 Conclusion: RFID
(Radio
Frequency
Identification)
is
a
Automated
Data-capture
Technology. It has several advantages compare to the barcode system , such as there is no need of line of sight propagation between tag and reader, accessing the data faster than barcode system, RFID tag can be automatically scanned by the reader without human intervention .In my project i have used RFID Technology at the check post, that is Active RFID tag at the vehicle and RFID reader at the check post. Active RFID tag contains vehicle identification code, whenever vehicle comes nearer to check-post, reader read the vehicle identification code from tag and this code is given to the system and it collects all information about the vehicle from data base management system (server) based on identification code.
40
Chapter 5 ZIGBEE 5.1 INTRODUCTION: Xbee is the module using Zigbee protocol. Zigbee is a wireless communication protocol like wifi and Bluetooth .ZigBee is a low-cost, low-power, wireless mesh networking proprietary standard. The low cost allows the technology to be widely deployed in wireless control and monitoring applications, the low power-usage allows longer life with smaller batteries, and the mesh networking provides high reliability and larger range.XBEE operating frequency is 2.4Ghz. Xbee can be used for wireless communication with low power consumption. A 3.6V 600mA Lithium battery may last 6 - 12 months for powering up an Xbee while the wireless range can up to 1 mile. It talks with well known UART interface and makes it easy to use. It is simple and straight forward if you only use 2 Xbee for communication. People use this for their own electronics projects for wireless communication. ZigBee defines a network layer above the 802.15.4 layers to support advanced mesh routing capabilities.802.15.4 is a standard for wireless communication put out by the IEEE (Institute for Electrical and Electronics Engineers).If the application strictly needs to communicate in a pointto-point or a point-to-multipoint fashion, 802.15.4 will be able handle all the communications between your devices and will be simpler to implement than trying to use a module with ZigBee firmware to accomplish the same goal. ZigBee is necessary if you need to use repeating or the mesh networking functionality.
Fig: 5.1 pin diagram
41
Table:5.1 Pin description
5.2 Networking Concepts ZigBee defines three different device types: coordinator, router, and end devices. A coordinator has the following characteristics: it • Selects a channel and PAN ID (both 64-bit and 16-bit) to start the network • Can allow routers and end devices to join the network • Can assist in routing data • Cannot sleep--should be mains powered. A router has the following characteristics: it • Must join a ZigBee PAN before it can transmit, receive, or route data • After joining, can allow routers and end devices to join the network • After joining, can assist in routing data • Cannot sleep--should be mains powered. A end device has the following characteristics: it • Must join a ZigBee PAN before it can transmit or receive data • Cannot allow devices to join the network • Must always transmit and receive RF data through its parent. Cannot route data. • Can enter low power modes to conserve power and can be battery-powered. 42
5.2.1 PAN ID - Personal Area Networks: ZigBee networks are called personal area networks or PANs. Each network is defined with a unique PAN identifier (PAN ID). This identifier is common among all devices of the same network. ZigBee devices are either preconfigured with a PAN ID to join, or they can discovery nearby networks and select a PAN ID to join.If multiple ZigBee networks are operating within range of each other, each should have unique PAN IDs.In ZigBee networks, the coordinator must select a PAN ID and channel to start a network. After that, it behaves essentially like a router. The coordinator and routers can allow other devices to join the network and can route data. After an end device joins a router or coordinator, it must be able to transmit or receive RF data through that router or coordinator. The router or coordinator that allowed an end device to join becomes the "parent" of the end device. Since the end device can sleep, the parent must be able to buffer or retain incoming data packets destined for the end device until the end device is able to wake and receive the data. Operating Channel ZigBee utilizes direct-sequence spread spectrum modulation and operates on a fixed channel. The 802.15.4 PHY defines 16 operating channels in the 2.4 GHz frequency band. XBee modules support all 16 channels and XBee-PRO modules support 14 of the 16 channel. The coordinator can auto decide which PAN ID and channel to use. When a channel is crowd , it will change to another one.
5.3 XCTU Digi International offers a convenient tools for Xbee module programming - X-CTU. With this software , the user be able to upgrade the firmware , update the parameters , perform communication testing easily. Fig:5.2 X-CTU User Interface
43
I attached a USB to Serial Port Adapter which has a FTDI Chip on it. FTDI Chip allows people to use the USB port talk to XBee. It offers a Virtual COM Port Driver , which will create a virtual serial COM port for user. So we can access a device (like XBee) which talks with serial port , through our USB port(since latest PC does not have serial port interface usually). In my PC , FTDI creates a "USB Serial Port(COM9)". You can see it from the picture above. X-CTU has four main tabs , the brief descriptions are described below : 1. PC Settings
You can configure the PC to talk to XBee or other devices using serial port interface. also test and query if an XBee is working properly in here.
You can
2. Range Test
After the configuration in PC Settings are correct, AND, the XBee has connected to another one, then you can use this function here. It gives you the ideas about how is the signal strength , how is the successful rate for sending / receiving data.
3. Terminal After the configuration in PC Settings are correct , then you can use this simple terminal talk to that device , such as XBee.
4. Modem Configuration A very good user interface for reading or writing the parameters of a XBee. You can also update the firmware here. Even you can change the modem type and function set base on how you are going to use it. ModifyXbeeParameter
For optimizing your XBee , you will need to modify the parameters in there. The most basic and important way for optimization is to modify its Baud Rate. You can boost the transfer rate from 9600 bps to 115200 immediately. Base on the datasheet , the Baud Rate of an XBee for a serial interface can be set up to 115200 bps , while the RF Data Rate is 250,000 bps. Which means , it is safe to use the highest serial interface transfer rate for XBee , unless the device which connect to it can not afford this transfer rate. After the modification , remember to reconfigure the PC Settings to the updated Baud Rate. Since the parameter of XBee you connected , has changed by this operation. 44
For change the communication baud rate of a new Xbee module , follow this procedure.
1.Execute [ Xbee Query ] and get a modem type and firmware version 2.Click on TAB : "Modem Configuration" 3.Uncheck : "Always update firmware" 4.Click on "Read" , it will read and display all the parameters of the Xbee Module if success 5.Searching for "Serial Interfacing" > "BD - Baud Rate" in the parameters 6. Click on "Write" , it'll show the status of writing parameter if success 7.Click on TAB : "PC Settings" 8.Set Baud to 115200 9.Click on "Test / Query"
On step 3. , since we just want to modify the parameter not update the firmware , so uncheck it. It is kind of annoying not necessary to update the firmware all the time , unless you know what it is for.
There're a lot of parameters in here , now just searching for "Serial Interface" and "BD - Baud Rate". Then change it to "7 - 115200". On step 7. , click on "Write" button to start updating the parameter. check the option "Always update firmware".
45
Make sure you did not
You will get this information if everything is right. It tells you it didn't update the firmware and just configure the AT parameters for you. Remember go back to PC Settings and set the new Baud Rate , else you won't be able to talk to your XBee. Setting up your XBees To set up your XBee you will need to download the X-CTU tool from Digi, which is a tool that configures your XBee with whatever settings you need. X-CTU.Once installed, you are ready to begin configuring your XBees. Since we are constructing a point-to-point network, meaning two devices are going to communicate together, one of the devices must be a Coordinator (all XBee networks require a Coordinator) and the other must be a Router (an 'endpoint' device). What we are going to do is create a Coordinator that will manage your network of XBees.
To begin, you need to take your XBee and plug it into your XBee USB Dongle, and plug it into your computer. Once connected, open the X-CTU configuration tool. The tool will list all serial ports on your computer, so make sure you select the one which was installed with your XBee USB Dongle. If you have 'only just installed your dongle, it will likely be the highest COM port available. Here you can see I have selected COM15, which is the Virtual COM Port created by my currently connected XBee USB Dongle.
46
Fig:5.3 pc settings
You can test you can connect to your XBee by pressing the Test / Query button. X-CTU will attempt to connect to your XBee and let you know its current firmware. If X-CTU cannot find your XBee, or you have an XBee from another supplier that has not come programmed you will see this pop-up:
Fig:5.4 Com test/Query Modem If your XBee correctly reports its firmware carry on, otherwise make sure you have selected the correct COM port. If your XBee does not report its firmware but you bought it from another supplier, it may not be programmed, in which case you can carry on. Now we are ready to program our XBee. The first XBee is going to be our Coordinator module, basically the boss of the private area network (PAN) we are going to create. To program an XBee we need to upload new firmware to it. To do this, navigate to the Modem 47
Configuration tab in X-CTU and choose the following configuration. Click Write and X-CTU will attempt to program you XBee, this should take 30 seconds or so, you may be asked to press the RESET buttononyourUSBDongle.
Fig:5.5 Modem configuration as coordinator When your XBee has been successfully programmed, press the Read button to retrieve the configuration of the device. All the details about the configuration will be downloaded and shown as below:
48
Fig:5.6 to read source address We are going to use all this information as there are many ways of setting up complex XBee configurations to suit specific applications. We are only going to set up a simple point-to-point network. This XBee will be the Coordinator node, and so all the 'end points' (Router nodes) will need to know the address of this node to communicate. Very simply, this means we want to get the Serial Number of this device to program into our Router. Write down the SH - Source Address High and SL - Source Address Low for us to use in the next step. The Coordinator node is now complete! Take this XBee (you may want to mark this XBee so you know it is the Coordinator) out of your XBee USB Dongle (carefully, make sure not to bend any of the pins on the module) and insert the next XBee we are going to program. 49
Follow the same procedure as last time, make sure you can connect to the XBee and then go to the Modem Configuration tab. This time instead of programming the node as a Coordinator, we are going to program it as a Router. Select the same configuration as below and press Write, this willtakeanother30seconds. fig:5.7 modem configuration as a router
. Once this XBee is programmed, press Read to get the configuration. To tell this XBee which Coordinator to connect to, we need to give it the address. We do that by setting the DH Destination Address High and DL - Destination Address Low with the serial number we took from the Coordinator. Put this information in and then press Write to write this new configuration to the XBee. 50
Fig:5.8 To Set The Destination address Congratulations! You have configured your XBees in a point-to-point wireless network! All we need to do now is test it, and then write a little application to make us of it.
5.4 Testing the Xbees To test the XBee network you've just created, I recommend creating a simple Arduino sketch that is going to transmit some information from your Router (end device) to your Coordinator. Swap the XBees over so that your Coordinator is in the XBee USB Dongle, and the Router is in 51
the XBee Developer. Open up X-CTU on your computer again and this time go to the Terminal tab. This tab will show you what your XBee is currently listening too. For the sketch, we are going to really simple and just get the Arduino to transmit 'Hello XBee Network!' over our point-to-point network. Open up your Arduino IDE and copy in the following code: void setup() { Serial.begin(9600); } void loop() { Serial.println("Hello XBee Network!"); delay(1000); } Send this to your Arduino then open up the Serial Port in the Arduino IDE. You should see
something like this: Fig:5.9 open up serial port in the Arduino IDE. The Arduino is just emitting serial text as it usually would! Well... lets introduce the Arduino to the XBee Developer board. Hook the XBee Developer board up to your Arduino by connecting the following pins: Arduino GND -> XBee GND Arduino TX -> XBee RX 52
Arduino RX -> XBee TX Arduino VIN -> XBee VIN Now when we run the sketch, the Router should connect to the Coordinator and begin sending the serial data wirelessly! If you look back at the Terminal tab in X-CTU of the XBee USB Dongle, you should see your text appear!
Fig:5.10 , The Router should connect to the Coordinator(on XCTU terminal tab) We have proved that oue XBee link is working. We have set up a point-to-point networking with the XBees. One XBee was set up as a Coordinator. One XBee was set up as a Router. The Router has a Destination Address of the Coordinator's serial number. We created an Arduino sketch to test our connectivity 53
Chapter 6 Basic Magnetic Door Lock System 6.1 Electromagnetic Locks: Electromagnetic locks are widely used in commercial and industrial applications. The lock is usually mounted on the header above the door and the armature is usually mounted on the door (see drawing below). Different arrangements can be made for inswing or outswing doors, and different holding forces, monitoring switches, and other variations and options are available. In this article I will discuss only the basics. As with any locking system, use of electromagnetic locks may be restricted by local authorities such as your local building inspector and/or fire mar shall. It is wise to check with these authorities before installing an electromagnetic lock.
Fig:6.1 magnetic lock
6.2 System Overview: To install the most basic electromagnetic locking system on an out-swinging hollow metal commercial door and frame you need the following: 1. The electromagnetic lock 2. A way in 3. A way out 4. A power supply The electromagnetic lock is an appliance. It unlocks when you shut off the power. Therefore the means of entry and egress will be switches of some form or other. Means of entry could be:
A key switch
An access control device like a card reader or keypad
A remote as for a garage door opener 54
Your choices for means of egress are limited by national, state and local life safety code. They could be:
A mechanical push bar with a mechanical switch inside
A pushbutton with pneumatic time delay clearly marked "Push to Exit" right next to the door
An exit sensor with redundant pushbutton
Your local Authority Having Jurisdiction (AHJ) may require that your power supply be connected to the building fire alarm so that in the event of an alarm, the panel can unlock the electromagnet. In any case you need a power supply with sufficient capacity to power your electromagnet.
6.3 System Examples A simple electromagnetic locking system using products by Schlage Electronics might include:
1 each 390+ electromagnetic lock
1 each 505 power supply
1 each 653-05 key switch
1 each 621RD EX DA exit pushbutton
A simple electromagnetic locking system by Security run might consist of:
1 each M62 electromagnetic lock
1 each BPS-24-1 power supply
1 each DK-26SS keypad
1 each XMS exit sensor
1 each EEB2 redundant exit pushbutton
6.4 Simple Wiring Diagram:
Fig:6.2 Basic magnetic wiring diagram 55
Chapter 7 Implementation of access control using RFID and Arduino 7.1 Block diagram:
7.1.1 Transmitter:
RFID CARD
RFID READER
ARDUINO
ZIGBEE
BOARD
MODULE
Fig: 7.1 block diagram of transmitter
7.1.2 Receiver:
ZIGBEE
ARDUINO
MODULE
BOARD
MAGNETIC RELAY LOCK
Fig: 7.2 block diagram of receiver
56
The concept of access control using Arduino &RFID technology is that to control the Door automatically. In this method RFID reader& Arduino board is placed far away to the door .This project employs RFID Short for radio frequency identification, RFID is a dedicated short range communication technology. The term RFID is used to describe various technologies that use radio waves to automatically identify people or objects. RFID technology is similar to the bar code identification systems we see in retail stores everyday; however one big difference between RFID and bar code technology is that RFID does not rely on the line-of-sight reading that bar code scanning requires to work.
With RFID, the electromagnetic or electrostatic coupling in the RF (radio frequency) portion of the electromagnetic spectrum is used to transmit signals. An RFID system consists of an antenna and a transceiver, which read the radio frequency and transfer the information to a processing device (reader) and a transponder, or RF tag, which contains the RF circuitry and information to be transmitted. The antenna provides the means for the integrated circuit to transmit its information to the reader that converts the radio waves reflected back from the RFID tag into digital information that can then be passed on to computers that can analyze the data. In RFID systems, the tags that hold the data are broken down into two different types. Passive tags use the radio frequency from the reader to transmit their signal. Passive tags will generally have their data permanently burned into the tag when it is made, although some can be rewritten. Active tags are much more sophisticated and have on-board battery for power to transmit their data signal over a greater distance and power random access memory (RAM) giving them the ability to store up to 32,000 bytes of data.
Radio Frequency Identification (RFID) is a generic term for non-contacting technologies that use radio waves to automatically identify people or objects. There are several methods of identification, but the most common is to store a unique serial number that identifies a person or object on a microchip that is attached to an antenna. The combined antenna and microchip are called an "RFID transponder" or "RFID tag" and work in combination with an "RFID reader" (sometimes called an"RFID interrogator").
There are two major types of tag technologies. "Passive tags" are tags that do not contain their own power source or transmitter. When radio waves from the reader reach the chip’s antenna, the energy is converted by the antenna into electricity that can power up the microchip in the tag (known as "parasitic power").The Sunrom RFID Card Reader is designed specifically for passive
57
tags. The tag is then able to send back any information stored on the tag by reflecting the electromagnetic waves as described above. Then the RFID reader get data from the RFID tag and the reader will blink the LED and gives the buzzer sound for RFID tag. then the reader converts the received analog data to digital form and sends the received data to the arduino board through serial communication.
The Arduino Uno is a microcontroller board based on the ATmega328 . It has 14 digital input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz ceramic resonator, a USB connection, a power jack, an ICSP header, and a reset button. It contains everything needed to support the microcontroller; simply connect it to a computer with a USB cable or power it with a AC-to-DC adapter or battery to get started.
Then the arduino board will compares the received data with the valid numbers already stored in the ATmega328 microcontroller. If the received data is same as any number stored in microcontroller then the received data is valid or invalid and it will send some commands to receiver through the zigbee. At the receiver side we are having zigbee,arduino and magnetic lock. when the zigbee receives the data from the transmitter then it sends same data to the arduino board. if the arduino board receives the command that the person is authorized then it sends logic low to the magnetic lock through IRFZ44 MOSFET.
Then the magnetic lock will conduct then door will be open, after some time the door will closed automatically by giving logic high to the magnetic lock.
58
7.2 Flow chart of transmitter: Start
Rfid card comes near to the rfid reader
Rfid reader gets the data and sends it to the arduino board
Arduino checks that Whether received data is valid or not
Sends command to the receiver, that the person is otherised through the zigbee Fig: 7.3 flow chart of transmitter 59
Sends command to the receiver that the person is unauthorized
7.3 Flow char of receiver: Start
Zigbee gives the received data to the arduino board
If the person is Otherised
Yes
No Otherwise arduino gives logic high signal to the magnetic lock
Then arduino board gives logic low signal to the magnetic lock
Magnetic lock will not conduct s and door open
Magnetic lock conduct s and door closed
Fig: 7.4 flow chart of receiver
60
7.4 Code: 7.4.1 TRANSMITTER CODE: #include SoftwareSerial mySerial(10,11); char *a[]={"1234567890","5656567890","9876543210","210097193B","20004BDC10"}; char d[10]; int j,I; void setup() { Serial.begin(9600); mySerial.begin(9600); } void loop() { int p=0; while(mySerial.available()==0); if(mySerial.read()==0x0a) { for(int i=0;i<10;i++) { while(mySerial.available()==0); d[i]=mySerial.read(); } } for( i=0;i<5;i++)
61
{ char *b=a[i]; // Serial.write(b); for(j=0;j<10;j++) {
if(b[j]!=d[j]) break;
} if(j==10) {p=1; //for(int k=0;k<10;k++) //while(1)
Serial.write('1'); } } if(p!=1) { Serial.write('0'); } }
62
7.4.2 RECEIVER CODE: void setup()
{ pinMode(8,OUTPUT); Serial.begin(9600); digitalWrite(8,HIGH); Serial.println("door closed");
} void loop()
{ int a; // digitalWrite(8,HIGH); while(Serial.available()==0); a=Serial.read(); Serial.println(a);
}
if(a==’0')
{
63
digitalWrite(8,LOW); Serial.println("door open"); delay(5000); digitalWrite(8,HIGH); Serial.println("door closed");
}
else
{
digitalWrite(8,HIGH); Serial.println("door closed");
}
}
64
Transmitter:
Fig: 7.5 transmitter
65
Receiver:
Fig: 7.6 Receiver
66
7.5 Components used in this project:
Magnetic lock 12V battery Arduino and zigbee As a transmitter
RFID reader
Arduino and zigbee As a receiver
RFID tags
IRF Z44 MOSFET
Fig: 7.7 Components used in project
67
7.6 Result: 1 Normally magnetic lock is conducting then it will glow the led and door is closed.
Fig: 7.8 normally door closed On pc:
Fig: 7.9 door closed message on serial port 68
2. Whenever person (he/she is having RFID card)comes nearer to the Reader, RFID reader reads the data from his RFID tag. This data is send to the Arduino board, Arduino board receives that number and compares with valid numbers .If that number is valid send ‘1’to the zigbee modem and send ‘0’ if that received number is invalid. Zigbee modem Transmit corresponding data( 0 or 1) to the coordinator If authorized person comes nearer to transmitter it will send ‘1’ to the Receiver.
On receiving side if zigbee ‘1’ is received , the arduino will send Logic low signal to the power transistor, then power transistor is off, Magnetic lock doesn’t conduct then door is open and door is automatically closed after certain time(here after one minute).
69
Fig: 7.10 when door is open
Fig: 7.11 door open display on serial port 70
3. UNAUTHEORIZED PERSON If a unauthorized person comes nearer to transmitter then the door will closed.
Fig: 7.12 door when unauthorized person comes near to the door On pc: If a unauthorized person comes nearer to transmitter it will send ‘0’ to Receiver.
71
On receiving side if zigbee ‘0’ is received , the arduino will send Logic HIGH signal to the power transistor, then power tr. is ON ,magnetic lock also ON then Door is closed.
Fig: 6.13 serial port displays that the person is unauthorized
72