Project – Simple RFID access system

In this tutorial you can make an RFID access system. It’s very simple and can be used with a wide variety of end-uses.

Updated 18/03/2013

The purpose of this project is to prototype a basic RFID access system. Although it is not that complicated, this article is my response to a kit reviewed in the Australian “Silicon Chip” (November 2010) electronics magazine. Their article describes the kit in detail – operation, schematic, use and installation. However the code for the microcontroller (PIC16F628A)  is not published due to the kit manufacturer holding copyright over the design.

This is a shame, as many organisations have been quite successful selling open-source kits. So instead of moaning about it, I have created my own design that matches the operation of the original, instead using the ATmega328 MCU with Arduino bootloader. Consider this a basic framework that you can modify for your own access system, or the start of something more involved.

articless

There are pros and cons with the original vs. my version. The biggest pro is that you can buy the whole kit for around Au$40 including a nice PCB, solder it together, and it works. However if you want to do it yourself, you can modify it to no end, and have some fun learning and experimenting along the way. So let’s go!

The feature requirements are few. The system must be able to learn and remember up to eight RFID access tags/cards, etc – which must be able to be altered by a non-technical user. Upon reading a card, the system will activate a relay for a period of time (say 1 second) to allow operation of a door strike or electric lock. Finally, the RFID tag serial numbers are to be stored in an EEPROM in case of a power outage. When a tag is read, a matching LED (1~8) will show which tag was read. There are also two LEDs, called “Go” and “Stop” which show the activation status. The original kit has some more LEDs, which I have made superfluous by blinking existing LEDs.

This is a simple thing to make, and the transition from a solderless breadboard to strip board will be easy for those who decide to make a permanent example. But for now, you can follow with the prototype. First is the parts list:

  • Atmel ATmega328 with Arduino bootloader;
  • 16 MHz resonator (X1 in schematic);
  • ten LEDs of your choice;
  • two normally-open push buttons;
  • two 560 ohm resistors (all resistors 1/4 watt);
  • one 1k ohm resistor;
  • three 10k ohm resistors;
  • one BC548 transistor;
  • three 0.01 uF monolithic capacitors;
  • one 100 uF electrolytic capacitor;
  • one 1N4004 diode;
  • Microchip 24LC256 EEPROM;
  • 125 kHZ RFID module;
  • 125 kHz RFID tags/cards;
  • connecting wire;
  • large solderless breadboard;
  • LM7805 power regulator;
  • relay of your choice with 5V coil (example).

When selecting a relay, make sure it can handle the required load current and voltage – and that the coil current is less than 100mA.

If attempting to switch mains voltage/current – contact a licensed electrician. Your life is worth more than the money saved by not consulting an expert.

And here is the schematic (large version):

simplerfidschematic

Here is the prototype on the solderless breadboard. For demonstration purposes an LED has been substituted for the transistor/relay section of the circuit, the power regulator circuitry has not been shown, and there are superfluous 4.7k resistors on the I2C bus. To program the software (Arduino sketch) the easiest way is by inserting the target IC into an Arduino-compatible board, or via a 5V FTDI cable and a basic circuit as described here.

rfidbboardss

The Arduino sketch is also quite simple. The main loop calls the procedure readTags() to process any RFID tag read attempts, and then monitors button A – if pressed, the function learnTags() is called to allow memorisation of new RFID tags. Each tag serial number consists of 14 decimal numbers, and these are stored in the EEPROM sequentially. That is, the first tag’s serial number occupies memory positions 0~13, the second tag’s serial number occupies memory position 14~28, and so on. Two functions are used to read and write tag serial numbers to the EEPROM – readEEPROMtag() and writeEEPROMtag().

The EEPROM is controlled via the I2C bus. For a tutorial about Arduino, I2C bus and the EEPROM please read this article. For a tutorial about Arduino and RFID, please read this article. The rest of the sketch is pretty self-explanatory. Just follow it along and you can see how it works. You can download the sketch from hereAnd finally, a quick video demonstration:

So there you have it. I hope you enjoyed reading about this small project and perhaps gained some use for it of your own or sparked some other ideas in your imagination that you can turn into reality.

In the meanwhile have fun and keep checking into tronixstuff.com. Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column? And join our friendly Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.

The following two tabs change content below.

John Boxall

Founder, owner and managing editor of tronixstuff.com.

12 Responses to “Project – Simple RFID access system”

  1. Ante Vukorepa says:

    An idea for further UI simplification – introducing an RFID “master key” which doubles as the “learn/unlearn” button.

    If you ID it first, then move an unknown RFID tag in vicinity (within a preset timeframe), the unknown RFID tag gets assigned to the first empty slot (or a “temp” slot). If you ID it first, then move a known RFID tag in vicinity, the known RFID tag gets deleted from memory.

  2. krishnakanth says:

    it’s so nise,,

  3. DIVYA says:

    WHAT ABT D COMPONENTS REQD?

  4. Daniel yew says:

    Hi, I’m Malaysian my country really hard to find this RFID system. You selling it right?? So how am I going to have this ? And you said the price around Au$40 so how am I going to pay by? Please reply as fast as possible. Thanks.

  5. Paul Jager says:

    Hi I have a RDM880 13.56 card reader. It requires a get ser No command to be send, on the bread board using the reader only it works fine. I was just wondering it can be integrated into your above project which outputs the card hex code when a card is near without a read command.

    Thanks Paul

    • John Boxall says:

      Afraid I’m not familiar with that reader.

      • Paul Jager says:

        Thanks can get it to read by sending a serial hex command, which puts the module into to read mode for mifare cards. The only thing is it outputs when a card is near of 11 char hex code but when no card is near it outputs a 7 hex code for no card available

        AA 0 2 1 83 80 BB –
        AA 0 2 1 83 80 BB –

        card read
        AA 0 6 0 0 6B CF 70 D6 4 BB –
        AA 0 6 0 0 6B CF 70 D6 4 BB –
        AA 0 6 0 0 6B CF 70 D6 4 BB –
        AA 0 6 0 0 6B CF 70 D6 4 BB –

        no card
        AA 0 2 1 83 80 BB –
        AA 0 2 1 83 80 BB –

        With my limited ability was thinking that I could ignore if hex code is not 11 long but might not be able to use eeprom as it continually spits out through serial. Will keep trying and may have to change to the above module you are using.

        Its fun to experiment though :)

Trackbacks/Pingbacks


Leave a Reply

Receive notifications of new posts by email.

The Arduino Book

Arduino Workshop

Für unsere deutschen Freunde

Dla naszych polskich przyjaciół ...

Australian Electronics!

Buy and support Silicon Chip - Australia's only Electronics Magazine.

Use of our content…

%d bloggers like this: