Este curso (disponible en idioma inglés unicamente) nos permitirá comprender qué es la tecnología de identificación por radiofrecuencia (RFiD) y como es utilizada en la actualidad.
Además incluye una serie de cuestionarios para ejercitar lo aprendido.
I put together this web page to document my quest in building my own RFID reader. It was a fun journey for me, so stay tight and enjoy the ride.
RFID cards are commonly used for access control and bus/train tickets. They are convenient because no direct contact is required to transfer information to and from the card. The card itself is powered by the RFID reader, so there is no battery to change.
For my experiments, I'm using a HID ISOProx card. These cards are the simplest of all RFID cards as they only stores a single serial number and uses no encryption. The carrier frequency is 125KHz.
The first step is to see if I can make a very simple reader. I know the RFID cards is powered by the magnetic field emitted by the RFID reader. The RFID tags transfers information back to the reader by loading the magnetic field, which cause the RFID reader to sense the change in load.
The most common design for RFID reader is to use a series resonate circuit. This consists of a single inductor and a capacitor excited by a low impedance voltage source. If the Q of the circuit is high enough, the voltage at the sampling point will exceed that of the supplied voltage. When the RFID sends a one by loading the magnetic field, this causes the Q of the circuit to drop. The result is a in small change in voltage at the sampling point.
For some reason, I confused my self and started the design with 150kHz in mind instead of 125kHz. The RFID tags responds just fine at this higher frequency, so I kept the design as is since I'm too lazy to go back and redesign the entire circuit.
With this simple setup, I manage to see that the RFID tag changes the loading either 4 or 5 carrier frequency cycle. Since the signal should be AC with no DC signal, I assume the transmitted data is at a frequency of 150kHz / 8 = 18.75kHz or 150kHz / 10 = 15kHz. This is the point I found some really useful website that contain some nice information on RFIDs.
The tag seems to encode the data using FSK. The two frequencies are used to represent a 1 and a 0.
Where x, y is the length and width of the coil, h is the height and b is the thickness of the conducting part of the coil. I use x=y=6cm, h=1cm and b=0.3cm. The number turns out to be 34. I wrap the coil on a paper box I found, which is how I extracted the x and y. The finished coil is extracted and secured with tape.
To fine tune the resonant frequency of the entire system, I decided to just play with the capacitance. Using the function generator to sweep for the peak output observed with the scope, I played with the size of the capacitor until the peak response of the resonant circuit is at 150kHz. The capacitor that did the trick is 0.056uF. Unless my capacitor has a larger capacitance than it's marking, the coil I made must have a inductance higher than 160uH.
The next stage is to design the analog circuit. I use the trusty TL062 as my OPAMP of choice (Since I got a pile of these little OPAMP). The frequency involved in this project is quite low, so the low frequency performance of this OPAMP should not be an issue. Since I'm always lazy to put a complex circuit together, I elected to use the simplest design I can come up with. So the idea is to use a simple diode detector. The detected voltage goes through the first OP amp configured as a inverting amplifier with low pass frequency response. This will remove bulk of the carrier frequency. The next stage of the analog circuit is to extract the FSK signal. The simplest circuit I come up with is a resonant band pass circuit with a center frequency around 17kHz. This costs me one OPAMP only. The circuit is designed with SPICE, which the plot of the frequency response is shown at the end of the page.
The output of the bandpass signal is than feed directly into the PIC microprocessor. The processor I choose for this project is the good old trusty PIC16F628A. With an onchip comparator, I can feed the output from the OPAMP directly into the PIC and extract the digital signal.
The decoding of the FSK signal is done in software, which is really nice since there is no increase to BOM.
To decode the FSK signal, I implemented a subroutine that uses TMR0 to track the time past between the changes detected on the output of the onchip comparator. No interrupt is used, instead, the routine keeps looping until a change in state is detected. The loop that does the detection takes about three CPU cycle to run through, thus, depending on when the change occurred, there is an maximum error of 3 cycles.
Anyone who knows about the PIC hardware might ask why don't I use the onchip compare capture module. Unfortunately, I used the PWM module to generate the 150KHz carrier signal. The capture hardware shares resource with the PWM module, so only one function can be activated at a time.
In this plot, the number on the Y axes is the time taken(in CPU cycles) between each change of state on the incoming signal. I decided 85 is a fairly good number to decide if the incoming data is a zero or a one. Later on, I decided to change the decoding routine to count the time taken between each rising edge in the signal (Since the signal has zero DC component, and this will save me more memory by recoding 1 bit of data instead of 2). Thus, the constant used in the PIC firmware end up using 170 (2 x 85).
You can see the data starts with a lot of zeros, following a quite a number of ones than the actual data. The entire sequence continue to repeat.
With these rules in mind, I added the function to decode the data.
Este proyecto es un lector de tarjetas magnéticas experimental y está formado a partir de un mecánismo lector magnético. Esta unidad provee el cabezal magnético de lectura en un soporte mecánico junto a un amplificador de señal de bajo nivel. Además posee tres líneas de señal: presencia de tarjeta, reloj, y datos. Cuando se activa la lectura de una tarjeta se genera un consumo de 50mA sobre 5V.
Los datos provenientes desde la unidad lectora tienen un formato parecido a “track-2″. Esto es 4 bits más un dato de paridad impar. Los datos obtenidos se convierten fácilmente a código ASCII añadiendo una cabecera HEX-30 a cada palabra.
El microcontrolador PIC12F675 es otra de las piezas fundamentales de este proyecto. El par de resistores de 10k sobre los pines GP0 y GP1 están para permitir la programación “in-circuit” via un protoclip.
Como dato relevante, las tarjetas de credito y muchas otras del tipo comercial utilizan el sistema de datos “track-2″ para transmitir la información.