You Are Here: Home » AVR ATmega Projects » RFID security system using ATmega32 microcontroller

RFID security system using ATmega32 microcontroller

Introduction and Motivations:

For our final project, we designed and built (and exhaustively tested) an RFID-based proximity security system for use with Cornell Identification cards, which have been RFID-embedded since fall of 2003. The idea for this project was sort of spawned from our general interest in RFID technologies and the near-simultaneous occurance of Lab 2 (Keypad Security System) and the antiquated lock system at our fraternity house breaking.

Security System

At the highest level, our device uses an antenna coil to power the RFID tag embedded in our Cornell ID’s and read the induced response from the card. This response is then filtered and manipulated into useful data and interpreted by the Atmel Mega32 microcontroller which runs the actual security program. In addition to interactions with the ID cards, the system is in contact with an administrator computer via a serial communications link and hyperterm. The security system can store up to 20 45-bit codes which are derived from communications with each unique RFID tag. If a card is read and it is not in the code database, a red LED flashes for 3 seconds. Likewise, if the code can be found in the database, a green LED lights for 3 seconds. From hyperterm, the administrator has the power to add codes, delete codes, list all codes, “unlock” the door (the equivalent of the green LED flashing), and initialize routines which allow codes to be added to the database by gathering data from the reader itself.

Educational topics explored in this lab include (but are not limited to) passive filter design, active filter design, amplification circuits, RF antenna design, digital logic, serial communications, RFID theory, pin interrupts, timer interrupts, and soldering. In short, for this project we used elements of basically every introductory level ECE course we have taken. Since we are dealing with such a complicated topic, on the hardware side of things we tried to rely as much as we could on proven circuit designs. This would enable us to focus more on getting our system working well as a whole rather than spending countless hours debugging small parts of our project. For this, the Microchip® microID 125 KHz Reference Guide (see citations section) proved to be an invaluable resource for both theory and results.

High Level Hardware Design:

Before we start with actual circuit design, it is neccessary to understand the principals behind the technology that this project has set out to harness; passive RFID communications. Passive RFID tags work in such a way that they are actually powered by an external signal, which, in most cases is the carrier signal from the tag reader circuit. These tags are fairly simple and are comprised of merely an L-C antenna (similar to the one shown in the block diagram below) and the circuitry neccessary to modulate this carrier signal once powered on. The reader and tag communicate using magnetic coupling since their respective antennas can sense changes in magnetic field, which is observed as a change in voltage in the reader circuit.

The Cornell ID cards we use in this project were developed by HID®; specifically the HID DuoProx II cards. These are useful because they have both embedded RFID as will as a magnetic strip, while much of campus is starting to switch over to proximity entry systems, many current systems (including the dining halls) are still swipe-operated. From looking at their website, it was difficult to determine much information about the card’s operation, asside from the fact that it operates at a 125 KHz carrier frequency and it could have a tag size anywhere between 26 and 128 bits long.

After many hours of research we discovered that the modulation type used in the cards is Frequency Shift Keying (FSK), one of the more common ways used in RFID. FSK modulates the signal by essencially multiplying a lower amplitude, lower frequency signal with the carrier signal, creating an AM-like effect; the lower frequency enveloping the carrier frequency. To switch between a “1” and a “0”, the tag switches the modulating frequency. The two frequencies used by our cards were 12.5 KHz (125 KHz/10) and 15.625 KHz (125 KHz/8), which correspond to 1 and 0 respectively. The modulation produces an effect that looks similar to the figure below:

The job of the reader circuit is to provide the 125 KHz carrier frequency, transmit that to the tag, and detect the magnetic coupling from the tag, which should look like the figure above. In order to interpret this data, the carrier frequency must be removed, and the enveloping frequencies must be magnified into something measureable.

The block diagram/flow chart for our reader circuit can be found in the figure below:

Although each individual part of the circuit and program will be described in detail later, the general idea for circuit operation is as such: The Mega32 provides a timer-driven 125 KHz square wave for our carrier frequency. This is then sent through an RF choke, which is essentially a passive low-pass filter with steep drop-off to knock out the upper harmonics and leave us with only a sine wave. The sine wave is then amplified using an emmitter follower PNP transistor and a half bridge to maximize current. Since our resonant circuit is a series L-C circuit, maximum resonance is achieved at minimum impedance, so it is very important that we provide adequate current amplification as to not overdrive our microcontroller. To help reduce the strain (and ramp up the current more) further, the square wave output from the MCU is put through parallel inverters.

On the recieving end, the signal is first half-wave rectified, since the negative part of the signal doesn’t really make a difference, and is then fed through a half-wave R-C filter to help knock out most of the 125 KHz carrier and detect the envelope signal. This signal is then bandpass filtered using a series a Twin-T active bandpass filters, and lowpass filtered with an active Butterworth filter to further decrease gain in frequencies outside of the 10-20 KHz area and increase gain of the envelope signals such that it saturates the op-amps of the filters. As a final stage the signal is put through a comparator and resistive divider to produce a nice square wave at logic levels. Some D-flip flops and a decade counter are used to extract data from the modulating square waves. Which are fed into the MCU and processed.

For more detail: RFID security system using ATmega32 microcontroller

Leave a Comment

You must be logged in to post a comment.

Read previous post:
How Voice Mail Works
How Voice Mail Works

Types of Voice Mail There are several types of voice mail systems available. Such systems are designed to function differently...

Scroll to top