[2017 Update] I am proud to present new project that has almost what i have dreamed.
Hello;
I recently got a RC522 RFID Reader Module based on MFRC522 Datasheet
http://playground.arduino.cc/Learning/MFRC522
I just want create a RFID door unlock system for my apartment's door, Using miguelbalboa's
RFID library which is great and module is cheap (around 5-10$). I am inspired project from Brett Martin (His project). And I just want to publish my workings because there are some old informations about MFRC522 Library around in forum . And I am going to try comment all code lines as much as I can.
And here is the code and flow scheme.
Code on GitHub And Since i am new to coding, so any help will be appreciated.
Work Flow
Now code does not fit here, please grab it from GitHub
TODO:
[ x ] SD Card option for Data Storage
[ ] Web UI for Managing Remotely
[ ] Complete Embedded System with Ethernet Shield
*************** Updates *************************
23/07/2014 ***** Initial Upload Nothing Works, Updated GitHub link, Commented some lines
25/07/2014 ***** Massive code correction from Forum Member luisilva, Now code Works There are still issues with leds corrected Code is now more human readable (at least for newbies like me) compared to original code
26/07/2014 ***** Testing code for bugs, etc. So far, everthing works as expected Code optimized for BOTH Common Anode or Common Cathode Leds, or just use regular Leds Now it does not matter which led you are going to use, simply define what led you have
27/07/2014 ***** Buzzer code (not needed actually, added anyway) removed More information about project provided with code Now you can Exit Program Mode by scanning Master Card again if you entered accidently Corrected EEPROM code for cards which have only 4 byte UID
01/08/2014 ***** Some minor delay corrections, minor changes Relay Code. Code for controlling Relay not universal. You need to modify Relay Code for your needs.When in program mode led cycles through Red Green Blue I have been testing whole project for days, so far so good.
06/08/2014 ***** Refined Code - Version 1.0.0
10/08/2014 ***** 1.1.0 Modified Library to set receiver gain to maximum (48 db) Now module can scan cards from about 3 cm far (It was about 2 cm before). You can grab modified Library files from GitHub. Or modify your files.
Now Library supports Antenna Gain Control For details follow this link: Extend range for MFRC522 RFID Reader - Project Guidance - Arduino Forum
12/08/2014 ***** 1.1.1 Added Wipe Mode code. By default its not enabled.
13/08/2014 ***** 1.1.2 Thanks to Forum Members, wipe mode is now matured and enabled by default. digitalWriting to an INPUT is correct? - Programming Questions - Arduino Forum
17/08/2014 ***** 2.0.0 In this version, Master Card's UID no more need to be hard coded. It will be defined when first use.
27/08/2014 ***** 2.0.5 Minor Fixes - wipe mode led, checking if master card defined, etc.
02/09/2014 ***** Now a script can be used to remove access to known (UID) lost card. If you know UID of lost card you can delete it from EEPROM without having to wipe entire EEPROM. This will let you operate normally after reprogramming, known cards will be remain as they were. Script on GitHub.
01/11/2014 ***** 2.0.6 Minor Update - Program Mode will not exit until Master Card scanned again. It was quite taking time to program all cards, because we were exiting Program Mode whenever a card scanned.
11/11/2014 ***** 2.0.7 With latest update Library supports Gain Control. No need to modify library files anymore.
01/01/2015 ***** 2.0.8 Fix for those who have PICCs that have 7 byte UID. Actually this is a workaround not a complete fix.
30/05/2015 ***** 3.0 - 3.2 With starting version 3 I decided to develop more advanced system, and separated code for backward compatibility to users who want to use just old system. From now and on I am going to focus on developing an embedded system. Also reviewed old code and made small changes, Code now more RAM optimized, RFID hardware version check added, and made some minor code changes. Antenna Gain disabled for stability reasons (one report indicated that disabling antenna gain fixed an unstable run). Now there is SD Card option for data storage, like the old system program checks if master card is defined, master.dat file on sd card holds UID information of master card. Rest of the cards' UID information will be stored as XXXXXXXX.dat file where XXXXXXXX replaced by UID information of the card. This is simplest way i can guess to store information on SD card, it may change in future development. That's it for now.
04/06/2015 ***** 4.3b Web UI Lists UID list and Usernames if defined in UID files. Coded just snippet not actual release.