Sie sind auf Seite 1von 6

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/235673820

Coding Method For a RFID Control Access in a Microcontroller

Conference Paper · January 2010

CITATIONS READS
0 195

5 authors, including:

Michael Barros
Waterford Institute of Technology
49 PUBLICATIONS   126 CITATIONS   

SEE PROFILE

Some of the authors of this publication are also working on these related projects:

Application of Control Theory in Molecular Communication for the Treatment of Alzheimer’s Disease View project

Ca2+-signalling-based Molecular Communication Systems Towards Nanomedicine Development View project

All content following this page was uploaded by Michael Barros on 05 May 2014.

The user has requested enhancement of the downloaded file.


CODING METHOD FOR A RFID CONTROL
ACCESS IN A MICROCONTROLLER
Michael Taynnan A. de Oliveira Barros, Wagner Régis de Araujo, Daniella Dias C. da Silva,
Israel Cavalcante Portela, Jeosafá de Melo Freitas Jr
Federal Institute of Education, Technology and Science of Paraı́ba - IFPB
Av. Tranquilino C. Lemos, 671 - Dinamerica - Campina Grande - PB - CEP 58.107-000
e-mail: {michael.taob, wraraujo, danidias.jp, rael.portela, jotajr}@gmail.com

Resumo—Due to increased urban violence, comes the need


for an efficient access control. In this context, RFID technology
has become a good solution. The main advantage in using this
solution is that it is possible to get identification tag without a
direct contact with the RFID reader. So, it is possible to get
information about persons and vehicles while they are moving.
In this paper, a control access system using RFID technology
is described. The system was implemented in a microcontroller
since this architecture is more appropriate for places as access
gates and watches. It was also developed a data encoding method
in order to save space in storage memory. To ensure the correct
functioning of system, it was developed a prototype using a
RFID reader and tags. It occupied 77% of the PIC‘s program
memory, and decreased 24% of all data stored in the system.
This prototype, after all simulations concluded, will become a
new commercial product. Figura 1. RFID System Diagram

I. I NTRODUCTION
In this project, a RISC microcontroller PIC 16f877A from
RFID technology (Radio-Frequency IDentification) has it Microchip Technology Inc. [11] [12] was used. This chip
roots in the radar system in the Second World War. The includes :
Germans, Japanese, Americans and English used the radars to
warn the people that the plane was very near. With the success • A CPU (Central Processor Unit) to interpret the instruc-
of this technology, studies and advances in the radar and RF tion program;
(Radio Frequency) communications area continued through the • A PROM memory (Programmable Read Only Memory)
decades [1]. So, until nowadays many applications emerged, will record in a permanent way all the instruction program
such as: health care [2], postal package tracking [3], aviation wrote in a high or a low language;
industry [4], defense and military [5], baggage and passenger • A RAM memory (Random Access Memory) to record
tracing in airports [6] [7], robotics [8] and control access [9]. the variables utilized in the program;
A RFID system follows a simple architecture: a tag, a reader, • I/O lines (in/out) to control the external devices as
a processing unit and an output system. For identification a tag sensors, keys, displays and others;
is necessary. This tag can be of two types: a passive and an • Auxiliary devices like: clock generator, bus, counter,
active one. The active tag requires an internal energy. Unlike watchdog timer, UARTS, etc;
the passive one, the energy is provided by the RFID reader. In this work, it was developed a control access system for
The figure 1 shows a RFID system. students and teachers in an educational institute. Each user
Basically the RFID has several methods of identification, has one RFID tag that identifies only the user in the system.
but in this project and the most common one is to store a When the user approaches the watch, the place where a RFID
serial number that identifies a person or object [10]. After reader is installed, he will be identified, facilitating the security
the captured data have been processed, it will be sent to job. Also a coding method was developed due to reduce the
an output system. Depending on where the security system memory space necessary in memory. This approach provides
will be implanted, for example, in a watch, the use of a a greater number of registered users, since the microcontroller
personal computer becomes inadequate. In this case, it is has limited memory space and improves the efficiency of
necessary another computational architecture for the project the system. This paper is organized as follows. In Section 2
processing unit. In this context, the use of microcontroller the developed system architecture is presented. In the section
becomes the most interesting solution and with a low cost. 3 is described how the coding method works .In Section 4
results of this project are showed and the benefits of its use. the communication process the reader needs to do a digital
Finally, Section 5 discusses about future implementations and modulation to turn the aero environment accessible to the data.
the project extension. The modulation used by the reader is the ASK (Amplitude
Shift Key). This module gets the tag identification through an
II. DEVELOPED SYSTEM internal RFID reader working on 125 KHz and RS232C is
The Figure 2 presents the developed system diagram. used as the data communication interface. This frequency is
the appropriate one to Access Control, because it provides a
lot of channels for the communications and a short traffic of
data. To the internal interface this reading is performed with
a physical connection of pin 3 from reader to microcontroller
pin RC7. The reader sends serially the RFID tag identification
using a baud rate of 9600 bauds. When the RFID tag is about
the reader, it generates an interruption that triggers all the
processing for this tag. The interruption is generated by CP
pin (pin 1 from the reader) determining that an ID is ready for
transmission through the serial interface. Pin 6 from reader is
set in a high level state to use the ASCII characters. A library
that makes the reading of data from reader is written using
the C programming language.
This module was made to increase the free space in the
PIC‘s external memory. In encoding process the Translator
Module intends to represent ASCII characters in a nibble with
six bits. Once in decoding process each nibble is represented
in ASCII. All the translator process is showed in Section 3.
B. Search Module
Figura 2. Developed System Diagram On this project, it was used an external flash memory
since PIC internal memory size is not enough to store all
The reader sends an ID tag in four bytes which are in users registers. The goal of this module is to perform the
ASCII format. These digits are received by Serial Module external memory search. I2C protocol [13] was used for
(SD). SD receives these data and sends to the Translator serial communication with flash memory. To search the user’s
Module (TM). TM returns the coded ID (IDC) in three bytes information an index search is made. The address is calculated
which are coded in four nibbles. The IDC is sent to the based on the length of the register with the user’s ID.
Main Module (MM) which stores it in a FIFO (First In, First
Out). The FIFO is stored in the PIC’s internal memory and T Roriginal = N nibbles ∗ N registers (1)
an interruption is started. When this interruption occurs the
Each register has 33 ASCII characters, where 4 characters
Search Module gets the first IDC in the FIFO. Based on IDC
represent the ID, 28 characters the name and 1 character the
the user information is recovered from the external memory.
codified information data (function).The leght of the original
Calculation from address is explained after that. The user
register in bytes is expressed by the equation 1. The register
data are recorded in an external flash memory in a codified
will be stored in the flash memory in 6 bits format (nibble).
form. This codification intends to save space in memory and
Calculating the total of bytes with the equation 2 :
will be explained afterwards. The read data for the Search
Module are passed to TM and it decodes the data to the ASCII
format, forming a register (RC) that includes the user’s name ((N nibbles ∗ 6) ∗ N registers)
T Rreduced = (2)
and function (student/teacher/server). The register is passed to 8
Display Module (DM) which shows user’s information in a it’s obtained 24.75 bytes for a reduced register with 33nib-
LCD Display. The operation of each module is presented in bles and one register. Hence, it was used 25 bytes to store the
the next sections. 33 nibbles (24bytes + 1nibble). Note that the last byte has 6
useful bits, so the two MSB (More Significant Bit) bits are
A. Serial Module defined as 0. In storing it is used a union 3byte4 nibbles. This
The protocol that organizes this module was made as union receives 4 nibbles and converts it to 3 bytes format. The
the following description: External Interface and the Internal process was made in the first nibble to 32th, 4 nibbles a time,
Interface. All the communication data was made by digital totaling 192bits (24 bytes). The last nibble (33th) is treated
communication, and the tag that it was used is a passive one separately, on account of the two 0 in MSB bits. Byte format
that don‘t need any battery to provide power, the power is 25: [X X X X X X 0 0] (X= nibble.) In reading a byte array is
provide by the magnetic field of the reader. So to do all used to read information in flash memory. After that, a union
of 3bytes4 nibbles is used. This union gets 3 bytes a time and The domain of all characters is 64 letters and symbols.
converts it to 4 nibbles format. The process was made in the The total number of symbols might be compressed in 6
first byte to the 24th, in 3 a group of 3 bytes, totaling 192 bits(nibble). So was utilized 6 bits to represent all the charac-
bits. The last byte (25th) is treated separately, on account of a ters in this system. Economy of 2 bits in every single character.
needed right shift two (>> 2) to a byte to nibble conversion. The need of ASCII characters processing was considered a
way to code and decode the data. It must be in a practice
C. Display Module and quickly way to not overload the system. So was build
LCD (Liquid Crystal Display) was used to show user a translation table for the all single characters being coded
information. Basically the alphanumeric LCDs follow a default in 6 bits form. In the decoding process, the characters are
interface specification, which are 14 access pins (for LCD analyzed in relation of it‘s position in the translation table.
without back-light illumination) or 16 pins (for LCD with If the character is at the range of 0h00 to 0h3F is added the
back-light illumination). In this project it was used an LCD value 0h40 to get the character in the ASCII table.
with 14 pins. Data bus consists of pins 7 to 14. This bus
receives data and commands. Pins 4 and 5 signal if data bus Algorithm 1: To encode the characters
information is command or data. First step consists of config- if byte->value between range(20h, 5F h) then
uring PIC ports that will be used. PortD (4 bits mode) was used if byte->value between range(40h, 5F h) then
for data and portE (E2,E1,E0) was used for control commands. byte− > value = byte− > value − 40h;
Control pins correspond respectively to RS (Register Select),
RW (Read/Write) and E (Enable). After LCD configuration
process a list of commands is performed for the LCD is really
able to be used. In addition to this, the LCD is reset not
Algorithm 2: To decode the characters
to interfere with the data that will be displayed. So, Display
Module is able to show the user’s information. if (byte->value between range(00h, 3F h) then
if byte->value between range(00h, 1F h) then
III. CODING METHOD byte− > value = byte− > value + 40h;
The PIC’s coding method (or translation) must compress the
size of the PIC’s memory data. It reduces the space necessary
in the memory. Notice that the group of characters used by Figure 4 shows the coding and decoding process.
the system is a sub-group at the ASCII table. In this case,
it was used characters in the range of: A-Z,a-z,0-9 and some
specials characters including the space. The system works with
ASCII characters because it’ll be processed and showed at
LCD display. The characters of the ASCII table that will be
used, are in a sequential order assuming the range of values of
0h20 to 0h5F, or 32 to 95 in decimal totalizing 64 characters.
The coding needs that the MSB (Most Significant Bits) must
be zero. The translation was made to the last 32 characters, to
the range of 0h00 to 0h3F. This way will help to reduce the
number of needed bits to the characters representation in the
storing moment. This process is shown by the Figure 3 .

Figura 4. (a) Encoding and (b) Decoding processes

In the (a) part, the user’s information is represented in


ASCII pure characters, which are the fist array of bits. Af-
terwards, the algorithm, explained in the beginning of this
Figura 3. Translation Process module, will be run with the characters, which are the second
array. And finally, the two MSB bits are discarded forming the
n−1
encoded register, which is the third array. After this process, X 100 ∗ T Rreduced[n]
( )
the data will be recorded in the flash memory by the search T Roriginal[n]
n=0
module. In the (b) part, an encoded register is rescued in SS% = (3)
n−1
the flash memory by the search module separating the array
and completing the data with 0 bit in MSB. After that, the
algorithm, showed in the beginning of this module, is run. So,
the final data is pure ASCII characters, ready to be used in
the display module.
IV. RESULTS
The whole system has been simulated and the results were
grateful. Coding and decoding process demonstrate a real
saving space in memory. In simulation process ID tag input
was replaced by random data which was transmitted by serial
interface. To prove the correct functioning of the system it
was developed a prototype using an internal RFID reader and
MicroGenios PIC KIT 16f Family v3.0 [14] (Fig 5). Grateful
results were obtained.

Figura 6. Saving Space (%) Graph

The figure 6 indicates that the percentange of saved space


is constant with the increase of the number of registers. So,
the benefits of this fact is shown in the figure 7 that indicates
the linear increase of saved space in bytes. Having a large
number of register in bytes the system can save them data
ocupping 25% less and utilizing this saved space for more
data storage. Concluding that the efficiency and behavior of
the coding method is constant even with large amounts of data.
So as more registers greater memory saving.

Figura 5. System Prototype

For implementation of the whole system, 77% of the PIC’s


Program Memory was used. PI02- (R2/W)/P RFID reader
[15] was the choice for the prototype. It works in 125MHz
frequency, and it reads tags up to 7 cm of distance. The reader
sends the data in two ways: codified with the Wiegand26
protocol or in a serial mode. In this project, serial mode was
used. When reader sends data in a serial mode, pin 6 must be
connected to VCC and the data output is transmitted through
pin 3. It is also necessary to connect pin 1 of reader to PIC’s
pin responsible by interruption. So, when a new tag is read
by RFID reader, an interruption (through pin 1) is started and
recognized by PIC which begins all process relating to this
tag.
For a one simple nibble is reduce 25% of the original
Figura 7. Saving Space (Bytes) Graph
character. For a one simple register is reduce the same 25%
of the original register. And if the institute has 3000 registers
the coding method reduces 24% of the original 3000 registers. V. FINAL CONSIDERATIONS
And if the institute has n registers the total of saved space(%) After prototype development other improvements can be
is given by : done. The next step is the system implantation in the Federal
Institute. For this a RFID reader with a greater range will be
necessary. Gate control through the system is also a desired
improvement. And an improvements have been started to relate
the coding method of this project and the Lempel-Ziv algo-
rithm(another coding method). Studies have been made about
the interference of the RFID reader in the microcontroller PIC.
This interference is due to the magnetic field sent by the reader
which can generate a lot of noise in the PIC’s circuit. Possible
solution for this problem is a bigger distance between PIC and
RFID reader. Another characteristic is when a vehicle enters
the reader’s magnetic field all the data sent by the reader
returns to it. It is because the metallic body of the vehicle
returns all the signals, acting as a mirror. Solutions must be
studied to solve these problems.
ACKNOWLEDGMENT
Thanks to the Federal Institute of Education, Science and
Technology of Paraiba IFPB for the research program that gave
us the opportunity to did this work.
R EFER ÊNCIAS
[1] The History of RFID Technology, RFID Journal,2009.
[2] C. Swedberg , Hospital Uses RFID for Surgical Patients. RFID Journal,
2005.
[3] P. Harrop , RFID in the Postal Service. MoreRFID,2005.
[4] J. Collins, ABoeing Outlines Tagging Timetable. RFID Journal, 2005.
[5] J. Collins, DOD Tries Tags That Phone Home. RFID Journal, 2006.
[6] R. B. Fergunson, Logan Airport to Demonstrate Baggage, Passenger
RFID Tracking. eWeek, May 2006.
[7] Meingast, M., King, J., Mulligan, D. K, Embedded RFID and Everyday
Things: A Case Study of the Security and Privacy Risks of the U.S. e-
Passport. IEEE International Conference on RFID, 2007.
[8] Zhou, Y., Liu, W., Preliminary Research on Indoor Mobile Robot Local-
ization using Laser-activated RFID . IEEE International Conference on
RFID, 2007.
[9] Blythe, P., RFID for road tolling, road-use prcing and vehicle access
control. IEEE RFID Technology, 1999.
[10] Derakhshan, R., Orlowska, M. E., Li, X., RFID Data Management:
Challenges and Opportunities . IEEE International Conference on RFID,
2007.
[11] http://www.microchip.com/. Microchip, 2009.
[12] Bates, M, Interfacing PIC Microcontrollers. Newnes, 2006.
[13] De Sousa, D. J. e Lavinia, N. C., PIC 16F877A Conectando o PIC..
Editora Érica, 2003.
[14] http://www.microgenios.com.br/. MicroGenios, 2009.
[15] http://www.akiyama.com.br/. Akiyama Tecnologia, 2009.

View publication stats

Das könnte Ihnen auch gefallen