loading
***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.

Step 1: 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)

<p>For over a year I've been wanting to do this and I finally got around to it. Since I lived in a college dorm (now I'm in an apartment), we can't modify the locks or install an electric door strike, so I used a servo motor wired to the deadbolt with string instead. I have modified the original sketch so it works with a servo motor. I also connected a pushbutton switch so it can be unlocked from the inside. When the pushbutton switch is pressed or a tag is read, the servo motor attaches and instantly turns the deadbolt to unlock, and relocks it in 10 seconds. The servo motor detaches after relocking so that the regular key can be used in case of emergency (and to comply with building rules).<br><br>Anyway here's my modified sketch: <a href="https://www.dropbox.com/s/85ch1b2y5wp61di/RFID_Door_Lock.ino" rel="nofollow">https://www.dropbox.com/s/85ch1b2y5wp61di/RFID_Doo...</a><br><br>I tried cloning my own Arduino but something's wrong in my circuitry so I just used an Arduino Uno instead. I put the RFID circuit outside and wired it to the Arduino inside conveniently via a single Ethernet cable (used 6 out of the 8 wires). I also connected an RGB LED both inside and outside the door.</p>
<p>Update: Link broke. Here's the project folder with the sketch. <a href="https://drive.google.com/folderview?id=0B46P4ekTjBTAZjJjdXZfSHZMUjA&usp=sharing" rel="nofollow">https://drive.google.com/folderview?id=0B46P4ekTjB...</a></p>
<p>Link broke again (empty folder, specifically, after some reorganization). New link: https://drive.google.com/folderview?id=0B46P4ekTjBTAeTRaTlFGX2VTUDQ&amp;usp=sharing</p>
<p>The best part about using a servo is I don't have to modify the existing door frame to fit an electric door strike, and it's fairly portable since everything is just hot glued or Command stripped to the door, no screws required. The USB power cable for my Arduino Uno is taped down. The Ethernet cable connecting to the black box RFID reader outside the door is routed down from the Arduino box and through the gap under the door, back up on the outside of the door to the reader. Usually apartment doors have wide enough gaps underneath.<br><br>The worst part about using the servo is getting the string to mesh with the deadbolt perfectly so there's just enough tension both opening and closing the deadbolt. That part takes hours. I wish I could just use a Lockitron that fits right over the deadbolt. Maybe I can 3D print a unit that mounts the servo to the deadbolt easily and without the use of strings.<br><br>The string I used is the strong, unstretchy kind used in window blinds. I reused a piece from broken window blinds.<br><br></p>
<p>Awesome! Thanks for sharing your code. </p>
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.<br />
&nbsp;Thats awesome! Glad to see you are getting some practical use out of my project. I am etching some prototype boards this week and hope to&nbsp;permanently&nbsp;install it on my garage brewery this week.
So like I said it should be a week later and my project is all done. I have some pics and am uploading a &quot;demo&quot; video to you tube right now. I&nbsp;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.<br /> <br /> 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.<br /> <br /> <br /> The vid link doesnt show up as a reply. I'll make another post with it.<br /> <br />
After a couple prototypes and attempts I have worked out all of the bugs and published the updated PCB designs and schematics. I also embeded a video on the main page showing the new boards and the system working in action. Im looking into getting boards made somewhere incase others would like to order them.
&nbsp;Wow, I am impressed. You did a really nice job of &nbsp;throwing that together without using a PCB. I like the eraser card code as well. I cant wait to get mine up and running as well. I hope you had fun building this. It looks like it turned out really nice.&nbsp;
Thanks man. I really appreciate that. I havent soldered anything this &quot;complicated&quot; 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.<br /> <br /> The &quot;outside board&quot; with the rfid reader... I enclosed it in a water proof box, but I also took the time to &quot;paint&quot; all the connection with &quot;Liquid Electrical tape&quot; to help water/moisture proof the whole thing.<br /> <br /> 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.<br />
&nbsp;Nice! someone here made a PCB design to get the boards printed... I am going to print and etch my own reader board to fit a small electronic enclosure and mount it outside like you have done. It's under a patto so it should not be too exposed. For now I am going to leave the breadboard inside so I can play with the code more. <br /> <br /> I designed the circuit diagram so you can still connect a programmer and reprogram it. I really like the idea of a master erase card. One idea I thought of is to have a &quot;programming&quot; master card... then a function card, like... &quot;Add&quot; &quot;Erase&quot; &quot;Erase All&quot; etc. which would allow more&nbsp;customized&nbsp;programming. I'm thinking stuff like one-time-access, access at a specific time of day or span of days.... say someone is coming to do electrical work.. they can go in and out all day but the card wont work the next day etc....<br /> <br /> Also planning on using a networked RFID system to track and identify customers/beers we are brewing in the brewery.... so planning on using the same readers and tags for everything.... such that anyone carrying a empty keg into the brewery gets access via the keg because clearly they are helping carry heavy things and dont have time to mess with keys.... or the same tag for a friend may allow them to pour as much beer as they want and pay later but not access into the brewery unless I authorize it etc....<br /> <br /> So basically I have lots of plans for RFID and this door reader is only the&nbsp;beginning.&nbsp;<br /> <br /> Working on an arduino remote car starter next... may or may not have RFID... but I expect to be playing around with both sets of code regardless soon.&nbsp;<br />
I like the idea of one time use cards or &quot;day pass&quot; 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. <br /> That is a feature I would like. <br /> 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.<br /> I was going to use software serial, but I just wanted to get the project done.<br /> <br /> Please let me know as you make any new code. I would love you review it and possibly even help test it.<br />
<p>how to add code door lock RFID to LCD and keypad</p>
<p>What are the values of resistors R1 to R5 for the RFID Reader?</p>
<p>Is it possible to use your phone's NFC function to unlock the door?<br>Or would that require some other kind of reader?</p>
<p>here is the code and the fritzing file</p>
<p>Nick perfect code and perfect project, this is what I was looking for actually I want to modify my door at home and make it super duper secure but yet easy to access, so your project works really great for me! .. I was also gonna ask if you can help me with editing the code a little bit since I am a newb with IDE. I was thinking if it is possible to add one more security feature when a user misses the code for 3 times, and I think that would be somewhere after line 107, so my idea is after 3 missed attempts to do a digitalWrite(soundAlarm, HIGH) and trip the other micro controller or device which is listening for variations in voltage and sound the alarm. Would be also good to add in the second attempt to be shown on the display so that the user knows he have one more chance to enter the correct pin code.</p><p>BR</p><p>Vlatko.</p>
<p>Hi,</p><p>You can add an infrared sensor and place it at the backside of the door and use it to unlock the door when anyone wants to go out but without the need of FRID tag.</p><p>Just an additional facillity ;-)</p>
<p>Hi pcmofo and all other commenters!</p><p>Really fab project and some great upgrades, I love it. I am (trying to) making an RFID clocking in/out machine to create a more realistic simulation for motor vehicle college students in workshop practice. I have my UNO, an Adafruit RFID shield, RTC clock and SD card with 40x2 LCD. It works really well at the basic level in that I swipe tag, it reads and displays the UID and displays the time. You guys may be able to help as what I really want to do is swipe the tag, the arduino compares it to a list of tag ids on a datafile on the SD card and returns the students name instead of the tag UID. I know what I want but it seems no one else has done it before and my ardweebo self simply hasn't got a clue. </p><p>What file set up do I use? CSV? plain text? </p><p>How do I get the arduino to look at list on file? Is it something like this:</p><p>File dataFile = SD.open(&quot;TAGID.csv&quot;, FILE_READ);</p><p>How do I get it to compare tag id (I have no clue here!) </p><p>How do I get it to return the student's name? is it something like this:</p><p>if (UID Value == cb135f74)</p><p>{</p><p>lcd.print(&quot;studentName &quot;);</p><p>}</p><p>Any help is greatfully appreciated as one day I would like to creat an instructable and link it to this page !</p><p>Cheers guys!</p>
Would this work with an subcutaneous RFID chip?
<p>I combined this project and the Lets Makeit project found here <br><iframe allowfullscreen="" frameborder="0" height="281" src="//www.youtube.com/embed/GyprsoB887Y" width="500"></iframe></p><p>I optimized the code to require the password to be fully entered before it was compared to the actual code. I used a Parallax RFID reader which is taped underneath the rest of the components. I used a electric door strike for the locking mechanism. not pictured.</p>
<p>Awesome job with the keypad, I've thought about doing this myself. Nice video.</p>
<p>@<a href="/member/nickzano/" rel="nofollow">nickzano</a> looks amazing! Any chance you could post an instructable?</p>
<p>see below comment I the posted code and the schematic</p>
<p>That's nice! I want to do exactly the same, could you share some schematics and/or code?</p>
<p>see below comment I the posted code and the schematic</p>
<p><iframe allowfullscreen="" frameborder="0" height="281" src="//www.youtube.com/embed/DkZPGq0zNZU" width="500"></iframe></p><p>Here's a video of it in action (installed in my apartment building). See my other comments and the description in the video for details.</p>
<p>Nice job! it looks great.</p>
<p>can u send me cade for same project but using lpc2148</p>
<p>can u send me cade for same project but using lpc2148</p>
<p>Hello, can i use a regular Arduino Uno R3 on this door lock? please respond quick</p>
<p>you can use any Arduino you wish.</p>
<p>Nice</p>
<p>Is there such a thing as an Electronic and Mechanical Strike all in one? I'm curious what to do if the strike can't get power? The door would remain locked and people would be stuck inside or outside of the door. </p><p>Do you have any recommendations to solve this?</p>
<p>It will be awesome if you could make the same tutorial for raspberry pi!</p>
<p>Great work! <br>I've just programmed my arduino with your code, and it works smooth!</p><p>I like your programming, its neat. I didn't know about the XOR and cheksum.</p><p>Thanx, great fun :)</p><p>Svein</p>
<p>Excellent Instructable. I modified the code to work with the mega cheap RC522 and an Arduino clone. Hadn't really used EEPROM stuff before so I was pleased to learn how this all works. Does the Arduino sketch store new cards at the first available memory location or cycle through different locations to ensure the 10,000 write limit takes longer to come into play? I couldn't follow the code but I guess from EEPROM reader sketches I have I could work it out.</p>
<p>im not much of a programmer and have never used this system, but i was wondering if you could make the &quot;outside&quot; card reader just read, not let it program new cards? I fear someone finding or figuring out my mastercard and programing their own new cards into the system. Or is the mastercard going to work on both readers if you have a reader on both sides of the door. </p>
<p>In this schematic that you uploaded above, will I be able to use the same schematic I/O on an Arduino Micro or an <a href="http://www.amazon.com/Solarbotics-Ardweeny-smallest-bread-board-Arduino-compatible/dp/B004D0D6O0/ref=sr_1_1?ie=UTF8&qid=1424810668&sr=8-1&keywords=ardweeny" rel="nofollow">Ardweeny</a>? And will I have to make any changes to the code?</p>
<p>please i want just ask you about the TIP31A if i replace it with a TIP41C </p>
<p>nevermind the comment from me before!, i got it thanks a lot! great project</p>
<p>What is it? </p>
What do you need for the power supply? Can you take the controller pcb.pdf and the reader pcb.pdf and have them etched somewhere?
<p>Can someone please tell me what kind of breadboard powersupply that is, or where i can buy one. i really need it for a school project. Thanks alot!</p>
<p>Hi Do you have the ready set, I want to purchase it......</p>
&nbsp;Very good and clever. &nbsp;Im a little curious about how you could add a log. &nbsp;It sounds like a challenge :P

About This Instructable

515,254views

1,286favorites

License:

Bio: I like to take things apart, sometimes they go back together sometimes they end up as something entirely different then where they started.
More by pcmofo:Papoy! Minion Unicorn Toy from Despicable Me Easy Change Floating Photo Wall Brett's Buffalo Chicken Dip v3.0 
Add instructable to: