Hello, since I got my RFID reader, I just wanted create a RFID door unlock system for my apartment's door. At first, I designed the work flow above, as a Newbie, its not quite an easy task to accomplish for me, then I found similar project on Instructables and modified it for use with specific RFID Reader (MFRC522 SPI Protocol).
With this project, you can let people to unlock apartment's door without a key, or modify the code for something else to do. Simply, this project gives you an opportunity to build what you want with this particular RFID reader.
-------- Features ----------
Unlocks a Door (controls a relay actually) using a RC522 RFID reader with SPI interface on your Arduino. You define a Master Card which acts as a Programmer then you can able to choose card holders who can able to unlock the door or not.
* Easy User Interface *
Just one RFID tag needed whether Delete or Add Tags to memory. You can choose to use Leds for output or Serial LCD module to inform users. Or you can use both, of course.
* Stores Information on EEPROM *
Information stored on non volatile Arduino's EEPROM memory to preserve Users' tag and Master Card. No Information lost if power lost. EEPROM has unlimited Read cycle but 100,000 limited Write cycle.
* Easy to Modify *
You can modify the code and use a Servo motor instead of a relay. My apartment's door lock runs on 12vAC, when 12vAC applied it unlocks the Door Lock. I am new to coding, and know how it is hard to understand whole code as a newbie, I tried to create fully commented code for newbies like me. Maybe its not complete but there are many comments.
* Security *
To keep it simple we are going to use Tag's Unique IDs. It's simple, a bit secure, but not hacker proof.
What you will need: (Minimum Setup)
1x Arduino of your choice (UNO, Nano, Pro Mini)
1x RC522 13.56MHz RFID Reader Writer (Every module with MFRC522 compatible)
1x Relay Module or Relay Circuit that you build (You can DIY or buy as module)
nx RFID Tags (Mifare 13.56 Mhz as many as users)
1x 3.3v Voltage Regulator if you don't have any 3.3v power source. (For powering RC522 Module)
1x Common cathode or anode RGB led or just use regular single color leds (to inform users)
1x Serial LCD Module (to inform users)
Now you don't need to know Master RFID card's UID. Master Card can be defined when first use, just scan a card and it will become the Master Card. Also now there is a Wipe Mode to wipe every record (including master card) on EEPROM. While holding wipe button, power up your Arduino and wait 10 second without releasing the button, everything will be erased (Careful: this process can not be undone).
For more information follow this link: http://forum.arduino.cc/index.php?topic=256260
Step 1: Software Setup
You will need MFRC522 Library from here
Add this library to your Arduino IDE
If you don't know how to add a Library to Arduino IDE you can follow this guide:
And grab Main Sketch here
https://github.com/omersiar/RFID522-Door-Unlock/ (latest code always be here)
Try to Verify. There should be no errors if you installed Library correctly (IDE 1.0.5-r2).
Step 2: Hardware Setup
I suggest build everything on breadboard then tweak for your exact needs, since we don't know how every door unlocks you need to modify the setup.
Connect RC522 RFID Module
Pin layout should be as follows
For not-Mega Arduinos
MOSI: Pin 11 / ICSP-4
MISO: Pin 12 / ICSP-1
SCK : Pin 13 / ISCP-3
SS : Pin 10 (Configurable)
RST : Pin 9 (Configurable)
For Arduino Mega:
MOSI: Pin 51 / ICSP-4
MISO: Pin 50 / ICSP-1
SCK : Pin 52 / ISCP-3
SS : Pin 53 (Configurable)
RST : Pin 5 (Configurable)
Connect RGB Leds and Relay (All Configurable)
Red: Pin 7
Green: Pin 6
Blue : Pin 5
Relay : Pin 4
Wipe Button : Pin 3
Step 3: You are almost Ready.
Upload code to the Arduino, open serial monitor experiment, tweak, and build your final setup.
When your Arduino first run it will flash Blue Led and wait you to scan a card in order to set this card as Master Card. Which will be act as programmer for users' tag.