3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

Arduino RFID Door Lock

Arduino RFID Door Lock
«
  • Screen shot 2010-08-09 at 1.23.27 PM Aug 9.png
  • IMG_0227.jpg
  • Screen shot 2010-08-09 at 1.22.26 PM Aug 9.png
  • IMG_0579.jpg
***Updated 8/9/2010***

I wanted to make an easy and secure way to enter my garage. RFID was the best way to unlock my door, even with my hands full I can unlock the door and push it open! I built a simple circuit with a basic ATMega 168 arduino chip and a ID-20 RFID reader to control an electronic door lock.

The circuit consists of 3 separate parts, a Reader to read RFID tags, a Controller to accept data from the reader and control the output of the RGB LED and the Electric door lock. The door lock is first installed in a door and tested with a 9v battery to ensure correct installation. In most cases you want a Normally Open circuit on the door lock, or Fail Secure. This means the door stays locked when no current passes through it. When 12vDC is passed through the electromagnet in the door lock, a plate in the lock gives way and allows the door to be pushed open freely.

The reader is placed on the outside of the door and is separate from the controller on the inside so that no one can circumvent the security by breaking open the Reader and trying to short circuit the reader. The controller receives serial data from the Reader and controls the RGB led and the Door lock. In this case I have put both on separate bread boards for testing. Here is a video overview of the system in action Read on to see how to build one for your self!



**Update** 
All of the code, schematics, and PCB designs have been tested and refined. They are all posted here as of 8/9/2010

Updated video of the final system installed and working.
 
Remove these adsRemove these ads by Signing Up
 

Step 1Parts Needed

Parts Needed
Here are a list of parts and links to SparkFun.com where I bought them. This is the basic set of parts you need to build and arduino and a circuit to read RFID tags into the arduino. I am assuming you have a breadboard, power supply and hookup wires already.

Arduino Stuff

ATmega168 with Arduino Bootloader $4.95

Crystal 16MHz $1.50

Capacitor Ceramic 22pF $0.25 (x2)

Resistor 10k Ohm 1/6th Watt PTH $0.25

Mini Push Button Switch $0.35

Triple Output LED RGB - Diffused $1.95

RFID stuff

Either one of these, 20 has better range, 12 is smaller
RFID Reader ID-12 $29.95
RFID Reader ID-20 $34.95

RFID Reader Breakout $0.95

Break Away Headers - Straight $2.50

RFID Tag - 125kHz $1.95

Other

TIP31A transistor (radio shack/local electronics store $1.50)

Door Lock is from ebay.
Door Fail Secure access control Electric Strike v5 NO
$17.50 (kawamall, bay)

« Previous StepDownload PDFView All StepsNext Step »
260 comments
1-40 of 260next »
May 23, 2010. 8:52 PMpingywon says:
I own a pizzeria and the delivery drivers come in and out of the back door all the time. I have taken your schematic and the modified version of your code (including the eraser card) and modded it myself a little further. I am currently installing this as a system on my back door. I have currently finished all the wiring and am just waiting for a few more parts from spark fun. I have made some changes to fit my actual wants and needs of the location, but overall it is the same lay-out. The whole project has proven REALLY fun so far and I hope to have it all wrapped up with in a week or so.
May 30, 2010. 10:05 PMpingywon says:
So like I said it should be a week later and my project is all done. I have some pics and am uploading a "demo" video to you tube right now. I used RJ45 to run everything and with the 8pins there was one short coming of my version of the project. I will let all of you be the judge to see if you can figure it out. The whole system performs flawlessly....so far anyway.

If there is anyone who decides to do anything else with this code I would really love to see it or even help you test it.


The vid link doesnt show up as a reply. I'll make another post with it.

Jun 1, 2010. 5:48 AMpingywon says:
Thanks man. I really appreciate that. I havent soldered anything this "complicated" in about 2 years, so my soldering started out terrible and by the time I was done it was looking great. I wanted to go back and resolder the whole thing, but I decided to leave good enough alone.

The "outside board" with the rfid reader... I enclosed it in a water proof box, but I also took the time to "paint" all the connection with "Liquid Electrical tape" to help water/moisture proof the whole thing.

Like I had said before if anyone had an additions to the code or design, I would love to see it. Maybe even impliment some of it.
Jun 1, 2010. 8:07 PMpingywon says:
I like the idea of one time use cards or "day pass" cards. In order for this system to meet my needs perfectly it would need to have an hours of operation type feature. So that my workers would not be able to enter the door in the middle of the night (11pm-7am) but at the same time I would like my card to work.
That is a feature I would like.
I also think im going to put a simple switch push button on the Arduino RX line so that I can push the button and break the connection between the ardunio and the ID-12 so that I can just jack in to the black box inside housing the ardunio to change the code. instead of having to curently open the box and disconnect the wire.
I was going to use software serial, but I just wanted to get the project done.

Please let me know as you make any new code. I would love you review it and possibly even help test it.
May 14, 2012. 5:29 PMdtechusa says:
if it will not compile and you get an EEPROM error:
change #include to this

#include

its the first line of the code
May 14, 2012. 6:07 PMdtechusa says:
LOL, well it doesnt show up when I use the actual characters

#include alligator eats EEPROM.h alligator leaves

alligator eats is <
alligator leaves is >
May 13, 2012. 11:30 AMredfox05 says:
Whats R3, as its not mentioned in the "parts needed" section. Are there any other things that are needed in addition to the initial parts list? Not a complaint, I know you cant specify 'every' single thing, but I want to make sure I can order everything in one go, as the electronics store is not particularly close to me.

Many thanks!
Russ
May 9, 2012. 3:43 AMredfox05 says:
Hi, great instructable, its my first arduino project! One question though:

For the FTDI Programmer, do I need a 3.3v o 5v? I have bought the ATmega328 as this is newer than the 168 which appears to be outdated now. Is this correct/still compatible?

Ftdi choices (i hope its one of these :)
3.3v - http://uk.rs-online.com/web/p/communication/0429307/
5v - http://uk.rs-online.com/web/p/communication/6877770/

The are many other choices on the site, what are the differences???
http://uk.rs-online.com/web/c/?searchTerm=Usb+to+ttl&sort-by=P_breakPrice1&sort-order=asc&view-type=List&sort-option=Price

P.s. im UK based in case of tips for other shops.

Thanks,
Russell
May 9, 2012. 3:32 PMredfox05 says:
Thanks for the quick reply pcmofo. I'll go with 5v then. One more question, is there any difference/preference between a cable ftdi and a breadboard one?
May 10, 2012. 5:30 AMredfox05 says:
Im buying the parts right now from RS Components, and they dont have any 0.167w resistors. The lowest ones they do are 0.25w would tht work? How does the wattge affect it, as even the arduino.cc site just says a 10k ohm resistor, without stating wattage.

Sorry for all the questions, but i want o go out and buy these today so I can start on the project tonight.

Thanks in advance!
Russell
Mar 2, 2012. 6:06 AMyadoo86 says:
I just want to inform you that your lovely tutorial has been published on our facebook page ( http://www.facebook.com/faceuino ). Please feel free to join us and add your future tutorials.

Thnx for your effort
Faceuino team
Nov 8, 2011. 5:01 PMweekendtech says:
How do i fix the "eeprom was not declared in this scope" error
I am doing this for a college project and have never used arduino before we are building it to interface it with computer help would really be appreciated is there part of the code i am missing?
Feb 29, 2012. 6:02 AMloizosgroutas says:
I had the same problem. To fixed is easy. paste at the firt line
#include // Needed to write to EEPROM storage
this .
Now look like this.
#include // Needed to write to EEPROM storage.

Sorry for my english.
Dec 7, 2011. 4:59 PMelectfire says:
On the second video @ 3:24 when you are showing the power supply socket.... Is that a modified wall plate for connecting built-in speakers in a home theater? It looks like it... so instead of connecting it for left and right audio channels you used it for positive and negative power connections... This is a neat idea... though it would really only be worth it if you intend on using many things that run on 12 volts...
Also I hope you have this hooked up to back up power!
Oct 30, 2011. 3:27 PMJsmxbox says:
Hey im getting a problem i have 4 RFID keyrings they all work and i can read them all fine but the problem is 2 of them start with 00 00 and will not work as master, delete or wipe but the other 2 start with 00 01 and work without problems any reason why this would happen?

many thanks

Jamie!
Oct 30, 2011. 3:34 PMJsmxbox says:
Also found a floor in it too being that if you scan a key that ain't stored in the EEprom more than 3 times it still unlocks the "door"
Sep 22, 2011. 11:03 AMStomp says:
Can someone pls. tell me all the components I need to the PCB Techno Dancer have maked for this excelent project? Referering to his Eagle files...

Regards

Mikkel
Jul 10, 2011. 9:03 AMagsking says:
could you use this project to lock/unlock a deadbolt lock instead? if so, what deadbolt would work with this?

thanks
Aug 2, 2011. 11:58 AMLegoGuy23 says:
I would Imagine so. If you connect the Arduino to a servo attached to the deadbolt, I think it could work. Just a theory though.
Sep 19, 2011. 6:13 PMAlfaZulu says:
hey, i'm just a little confused with how you programmed the eeprom. I was planning on using an arduino uno with an ATMega 328p, mainly because i don't believe they make the 168 anymore..

would this code work just fine straight in the arduino software?
Sep 19, 2011. 12:50 PMSilent99 says:
Willing to pay someone with experience to build me one of these or provide all instructions I would need to build one myself. Msg me
Sep 12, 2011. 12:15 AMkgee says:
i also had a question about the RFID cards that you programmed to work for the door... that wasn't for the door. like you made a copy. but can you erase it?
Jul 28, 2011. 8:04 AMnmstar56 says:
I'm getting "error: 'EEPROM' was not declared in this scope" for "EEPROM.write(i, 0);"

Please help.
Aug 14, 2011. 4:17 PMTrueHybridX says:
did you include the eeprom header files?
Aug 7, 2011. 10:55 AMjlim10 says:
would it be possible to program your fingerprint with a biometric reader as the mastercard?
if so can you guys teach me how, im really bad at programming
Jun 16, 2011. 2:32 AMnatsud1 says:
Hi i have an Arduino328 and a parallax rfid reader but i dont really know how to write code although im trying to learn my first problem is that when i load the code and run it the blue led is not on but the other 2 are so i looked at your "normalModeOn" part and it looks to me that it is exactly backward of what i thought it should be since you have the "powerpin" high and the rest low and the tricolor led has one + and three - electrodes this seemed backward .all i have hooked up is the reader and the tricolor led if i reverse the normalModeOn from high to low and the lows to high i get the blue led so i then swiped a card and nothing happensi cant seem to figure out what to do or what to change is it because of the different arduino and reader or am i just supposed to figure out where the code needs to be changed for theses Pleas Help i dont know much about code
Jun 16, 2011. 3:32 AMnatsud1 says:
OK so its been another 3 hrs but i made some progress i had a different rfid code that would read the card and diaplay it in the serial monitor and i found this "if((val = Serial.read()) ==10)" was different than your code yours was: "if((val = Serial.read()) ==2)" so i changed all instances to the number 10 and i got it to make the led blink odd color purpleish .. like i asked before about the led out highs and lows being reversed in the void sections well i reversed all of them and now when i swipe my non master/non saved card it turns red and when i swipe my master it goes to the program blinky sequence and it grants access to the former card when i reswipe it so i think i got some of it working but im not sure about the door lock part i have an led stood in place of the lock but it doesnt light up yet ill let you know if i get anywhere else on it sorry about the long comments this is a great 'ible im sure all my problems stem from lack of knowledge of code and other stuff hope what i said made since and maybe helps somone else
Jun 3, 2011. 10:50 PMkidmosey says:
That enclosure seems to have enough space to add a keypad as an alternative means of entrance, in case you lose your rfid tag. Might also be good to disable the tumbler lock, since any Joe Smith can pick a lock, nowadays.

Also, if you put your rfid tag in a retractable thumbdrive (lined with aluminum), would that prevent people from passively thieving your rfid?
Jun 1, 2011. 9:05 AMtinker234 says:
wow use the star trex door with this
May 11, 2011. 3:58 AMjoshnosh says:
iv got quite far on this project now
iv got it working on a bread board and iv made a PCB i just need to drill and assemble. I cant get the newer code to work but oh well ill live

anyway iv been in discussion with someone and realised it would be a good idea to include a high voltage diode across the door lock pins.
when the door lock is closed the magnetic feald collapses in the door strike and this can cause quite high voltages to be produced as it collapses. these voltages will try and discharge through your tip31a transistor and can damage it over time
putting a diode there will allow the the door strike to loop back through itself and discharge. its not needed but it might help improve the reliability of the system
May 8, 2011. 9:36 PMinsignia96 says:
What's Hilarious is that I, at this point in time, have an arduino, i am custom etching a shield, I have an outlet box, 2 RGB status leds, and to shorten this list up almost an identical project/Instructable I am working on and This is the first time I have read through this. Pretty funny, I guess great minds think alike!
Apr 30, 2011. 7:41 AMboudreau-inventor2 says:
I have couple questions. Where did you find the breadboard power supply for 12 volts? And, what size is the breadboard you are using?
Apr 7, 2011. 10:57 AMPrivatHost says:
Which Values has the Resistors R1, R2, R3, R4, R5?
1-40 of 260next »

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
81
Followers
5
Author:pcmofo
I like to take things apart, sometimes they go back together sometimes they end up as something entirely different then where they started.