Introduction: Keyless Dorm Entry

Picture of Keyless Dorm Entry

The basic problem behind this project was that keys are something very easy to forget or lose, and they are the only way into my dorm room. This is especially a pain when leaving the room for a short time, such as to go check mail or give something to a friend. It's a bad idea to leave the room unlocked, but a pain to take keys. A solution to this would be to provide another method of access with something easier to carry, or not even needing anything to carry anything at all. This must also be accomplished without modifying the door in any unauthorized way.

Step 1: Solution

A device will be attached to the door that is able to lock and unlock the door by pulling the lock. It will do this when the correct number is typed in, or an ID is scanned. A school idea is much easier to carry around, and is required to get into the building anyway. And even without it, typing in the correct number requires carrying nothing additional.

Step 2: Parts List

SX48 Proto Board ($15) - - This is the microcontroller that is the 'brain' of the project. Almost any microcontroller would work just as well.

Magnetic Card Reader ($3.50) - - This is the card reader that was used to read the school IDs.

Keypad ($7.50) - - This is the keypad that is used to type in passwords.

Servo ($5) - This is what unlocks the door.

Screen (???) - The screen to display the currently typed code. This was recycled from an older device and therefore not purchased.

Step 3: Magnetic Card Reader

Picture of Magnetic Card Reader

The first step in this project is establishing how the card reader actually works. The datasheet can be found here:

The two most important data lines are RDT and RCT, which are data and clock respectively. The way this card reader sends what it's reading is using these two pins. When the clock line goes from 1 to 0, that means the next bit of the card is present on RDT. There is an example in the first picture.

The RDT line is inverted, meaning when the clock goes from 0 to 1, if a 0 is present on RDT, that means there's a 1 on the next bit of the card. The example above shows what might happen if the data "1101" was on the card. Note that the frequency of the clock pulses are purely dependent on the rate in which the card is scanned. They are not necessary uniform width.

The next part after grabbing the data is interpreting it. Most magnetic cards use the same format, including the school IDs. There is a picture of example data provided.

The data is in groups of 5 bits with 4 data bits and one odd parity bit. The first bit is a semi-colon, or a 'start sentinel'. It has the value of 11, and signifies the beginning of the card. There is also one parity byte at the end of the card. For this simplified design, the parity bits are ignored, because any misread card will simply result in an access denied error.


Step 4: Keypad

Picture of Keypad

The keypad was probably the simplest thing to interface. It has a pin for every button plus one for ground. When a button is pressed, that pin is grounded. Connecting every pin to the microcontroller along with the microcontrollers internal pull-up resistors was enough to easily get which keys were pressed.

Step 5: Servo

Picture of Servo

This is what connects directly to the doors lock. This specific servo was controlled by sending specific frequency pulses into one of its pins. The appropriate frequencies were found by experimentation and then programmed into the microcontroller. Thus this was a very simple solution to unlocking the door.

Step 6: Screen

Picture of Screen

The screen was recycled from another old device. The protocol for the screen is luckily very common and very well documented. It even has its own Wikipedia page here: It works similar to the magnetic card reader in that there's a clock pin and data pins. The difference is there are more than one data pins that are used so that entire bytes can be sent at once. Also, communication is only one way; from the microcontroller to the screen. There are a few 'command' bytes and a data bytes. Command bytes are used for things like moving the cursor or clearing the screen. Whether or not a byte is a command is controlled by the R/S or Register Select pin of the LCD. If sending data, the byte is written to the screen where the cursor is and it uses standard ASCII text. I won't go too much into the details of the screen as it's very thoroughly documented elsewhere. For further reading, see

Step 7: Software

Picture of Software

The last part of it all is creating the software that ties it all together. Unfortunately, the SX has a very limited amount of memory to work with so it required a few tricks to make the software work.

There is a flow chart of the design.

Some important things to keep in mind: Because of the limited memory of the SX48, it's not a good idea to attempt to store the entire data of the card or the entered key. The simple solution to this is to have a byte that remembers what 'place' it's on in the key or card. When a mistake is made, that is remembered, and the place variable is increased. That way, it only needs to remember if there was ever a mistake, and if there wasn't, and the end of the key/card is reached, the data must be OK. For security reason, it's very important that the system keep letting you scan a card or type a key once it determines a mistake has been made. Otherwise, it would be easy to break such a system by trying different keys. With all of these design considerations in mind, the system will remain completely secure while at the same time not need to worry about the limits of the hardware.


Step 8: Conclusion

The end result of the project is a fully working door that can be opened from without a key. The total cost of the project is under $40 which is a very good price for the final result. A lot of enhancements could easily be made. For example, the system currently is not able to relock your door, but such a thing would be trivial to add into the code. It wouldn't be too difficult to add some different ways of unlocking the door, such as texting a number or making a microphone to listen for a secret knock.


rrrmanion (author)2011-02-03

why not.. get another door, modify that, then replace it.. then put the original back when you go?

mikebook (author)2010-12-12

So I take it that this uses odd parity? Also, doesn't having the left most bit being the ones place go against most convention of binary? Finally, is the data in ASCII or is it raw binary to decimal data conversion?

Foxtrot70 (author)2010-05-15

Nice Instructable.  Definately need to secure the ribbon cable better.  There is another Instructable using RFID the author there had a chip implanted in his hand (same type used for dogs) all he does is wave his hand at the door and it unlocks as I recall it is on his car.  Possibilities with the chip are endless one has to decide if they want they want to get implanted.

andrew_h (author)Foxtrot702010-05-20

 I've done RFID too and i'd be keen to get an implant but so far i have been unable to find a 'medical grade' 125kz manchester tags in low quantities in Australia

Foxtrot70 (author)andrew_h2010-06-17

Hey Andrew I would think that a vet would have these on hand, provided they are the same type. The problem then might be in Australia any medical laws in using a product designed for animal husbandry for human medical. Since they would be implanted into a canine it too would need to be "sterile" or of "medical grade". Mike aka: Foxtrot70

andrew_h (author)Foxtrot702010-06-17

I've found one now! They are on their way from America as i type. Hopefully within a week i will have one in my hand (literally)! Just trying to find/convince a medical person to do it for me. As you mentioned, because they are not certified for implantation in humans, most medical practitioners will not do it due to liability issues. I'm open to doing it myself but i'd rather that someone with medical experience done it for me. Even piercing shops seem to be reluctant though.

Foxtrot70 (author)andrew_h2010-06-18

Hey Andrew - They are concerned with infection and product failure. If you do it yourself, get in touch with a Vet or MD or even piercing shop and review insertion and sterilization procedures and local anesthetics, again this might be problematic as to who is administrating the anesthetic. You might try looking up the Instructable of the individual who made an RFID controller for his car and has chip emplanted in his hand he might be able to provide more information in this area.

andrew_h (author)Foxtrot702010-06-18

The chip i have bought is a HitagS 2048 from Brett @ He's a great guy, he helped me determine it's compatibility with the ID-12 chip. They are programmable to 'modes' and in particular he has programmed it to EM4102 standard for me (which can be read by the ID-12). I'm quite well aware of the reasons people seem reluctant to help out but failling to find someone to actually do it for me, i will be seeking propper medical advice on how to make sure i do it safe. The last thing i want is to have it get infected and end up in hospital to have it removed. I'ts sort of a catch 22 situation where if i get a medical person to do it for me, there is much less risk but they won't take that little risk. On the other hand, there is much more risk if i do it myself but i'll only do it myself if i can not find a 'propper' person to do it for me. So far 3 peircing parlours have declined my request to do it for me which seems odd. One of them is known as a more extreme peircing place too. I'm going to see if my GP will do it for me next.

Foxtrot70 (author)andrew_h2010-06-19

Sounds like you have a good handle on everything. After looking at the various comments about implanted chips amazing the level of ignorance out there from all quarters. Since your project is a very limited one your personal identity security is not a question unless you decide later on to include internet access. Your project is really good one and pardon the pun...very handy!

andrew_h (author)Foxtrot702010-06-24

Well, it's done! I now have a HitagS tag implanted in my hand....

Foxtrot70 (author)andrew_h2010-06-25

Hey Andrew - COOL BEANS! Tell me asbout the procedure. Currently do you experience any discomfort? Have you had a chance to try the circuitry? This is really exciting! - Mike

andrew_h (author)Foxtrot702010-06-25

Well i finally found a local piercer to do it for me. He was actually quite excited to do it - the very opposite of all the others. It was a very simple, quick and nowhere near as painful as i expected. He simply grabbed a 10g peircing needle (probably could have got away with a 12), peierced the skin and pushed it in till the tip was about where the end if the chip should be. Then he just twisted the needle about 90deg to open the hole a bit more. That probably hurt the most. Then he removed the needle and popped the tag in, giving it some help from the back of the needle. A little pressure and a couple of minutes later i was on my way with a bandaid to cover the wound. Note that this was a piercing needle, not a normal syringe type needle. On a pain scale out of 10 for me, only about a 2-3 and that was when he twisted the needle, other than that, it was about a 1. Within about 2 hours i barely even knew i had it done other than some tenderness around the injection site. Now, about 36 hours later its almost painless unless i have something push hard into the webbing where it pushes the implant in further. That should go with healing though. It took a while to get the smile off my face the first time i heard that gratifying 'beep' as the tag read on my door entry system after getting it done! the pic is a little deceptive, it looks like the injection site is in the webbing but it's not.

Foxtrot70 (author)andrew_h2010-06-25

Hi Andrew - Pic looks great! Did the piercer use a local anesthestic? What was the cost of the chip and cost for implantation? When you wave your hand at the sensor, pardon me I have to ask this, do you command, "Open Seseme"? What is the furthewst distance you can be from the door sensor? Upon further consideration I think this would be rather secure, short of a retina scanner, no keys or access cards to loose. - Mike

andrew_h (author)Foxtrot702010-06-25

No anasthetic. Not really needed. The chip was US$10 plus shipping from and they charged me US$35 to implant it but i suplpied my own sterile needle. It can be read through my hand by the ID12 but not much more than that. So about 3-4cm. That could be better with an external antenna though. I would not say it's any more secure than keys but it is definately more convinient. The tags CAN be copied so there is risks but with a read distance very short, someone would have to get pretty personal with me to read it and not only that, they would have to care and think it would be EASIER than just smashing my window or door down. It's not as if i use this for access to my bank account or something that would offer much reward if it was compromised.

willrandship (author)andrew_h2010-09-06

Cool! I have one question, though. Do electronics and other stores give you trouble when leaving by setting off alarms? That would seem to be the only problem after everything is said and done.

andrew_h (author)willrandship2010-09-06

No, not at all. They operate on different frequencies so there is no problems. Airport scanners are fine too.

Foxtrot70 (author)andrew_h2010-06-18

Can you send me apic of the chip?

Foxtrot70 (author)andrew_h2010-06-18

Hey Andrew - Here is a comical thought...If I were going to implant one of these chips I think I would have it implanted in my second finger, that way when ever I used the chip I would be giving the device "The Bird" - LOL

tristantech (author)2010-05-23

All electronics no longer stocks the card reader!! :-(

nerd12 (author)2010-05-22

you said not modifying your door in an unauthorized way.
since when is this become authorized
the matron would kill you if you did this without its permission

wesie42 (author)2010-05-21

this was completely pointless, because in order to lock it in the first place you need a key, and you would be outside the you would have the key anyways DER DUH DERRR

doughnutguy1 (author)2010-05-21

you know, if someone was pissed at you and they wanted to trash your dorm they could just kick the door open o.O

baggins (author)2010-05-20

Just one comment about the flowchart. You don't want to tell anybody that the PIN is wrong until they are done entering it, otherwise it would take significantly fewer tries to figure out the PIN.

Assuming your PIN is 9999 and the attacker works through numbers ascending from 1 on a numpad from 1-9.

Instant denial: 8+8+8+9 = 33 tries to break in
(the first three are eight because by once the attacker gets to 8 he knows the next digit is 9 and can proceed to the second digit of the code)

Denial at the end: 9*9*9*9 = 6561 tries to break in

baggins (author)baggins2010-05-20

Sorry, I misread the flowchart. I saw "mark key wrong" and didn't notice the "Unlock?" step just checked to see if the key was wrong.

leinad23ec (author)2010-05-16

Hey there, I am always amazed at the creativity of all members in this site, I love it. But I would just like to ask anyone, what career would I have to study in order to get the knowledge necessary to create something like this on my own.

I have a lot of ideas, but i lack the education to put it all together

I would to create stuff with circuit boards, or even little programming, how to read electric schematics and stuff, because the more interesting Instructables I find are solar energy, or ones like this from spare electronic parts!

Thanks in advance.

Just get a book on electronics for beginners. Make: Electronics is a very good one that starts with the basics.

From what I've seen, almost everything on Instructables is stuff that anybody can do. You don't need to get a degree to build a circuit board, you just need to mess around at home and read some books.

Syko Pyro (author)leinad23ec2010-05-18

Generally, Electronics Engineering with a major in your chosen area, for university. Or, a trainee/apprentiship.

Varenberg (author)2010-05-20

Why don't you just change the lock in a automated door lock, would make things a whole lot easyer, and cheaper if you think about it

Zovits (author)Varenberg2010-05-20

"This must also be accomplished without modifying the door in any unauthorized way."
He lives in a dormitory, where it's probably highly regulated what one can do with their room (including the door).

ardrhi (author)2010-05-20

Ize in ur dorm rum eatin ur pi

OruKun (author)2010-05-16

 Wont you still need to have a key to close it, unless you have it automatically closes itself. Instead of using a string that just pulls it open, use a metal line, or straight piece of metal that can open and close the deadbolt.

JefffN (author)OruKun2010-05-16

Yep. I will most likely make that modification, or add a 2nd servo in the future for that reason.

OruKun (author)2010-05-16

 Wont you still need to have a key to close it, unless you have it automatically closing itself.

Morriscow (author)2010-05-16

 thats a deadbolt, dont you need a key to lock it?

thatoneguydavid (author)2010-05-15

great implementation of a card reader. 

i do have a couple of suggestions however:
*move all of the electronics to the other side of the door (the locked side) and have only the card reader on the outside.  this way you would only have the card reader data bus exposed. i imagine that it is just serial, so maybe 4 wires, +/- RX and TX?
*add the ability to lock the door with the card.  this would mean changing your servo set up slightly.  you could probably still do it with one servo though.  And that way you could eliminate the need for the key all together. 

I Hate Keys!

JefffN (author)thatoneguydavid2010-05-15

Yeah, all important electronics are on the locked side. The only things in the box on the front are the card reader, the LCD screen and the keypad. The data is sent over that ribbon cable that's shown in the pictures.
Having it also lock would either require another servo, which would be pretty easy to add, or to reposition the single servo so that it can also lock. I will most likely be doing that in the future, as I also hate dealing with keys.

Arbitror (author)2010-05-15

There is one problem though. I don't know what the level of stupidity there is at your dorm, but I would expect some moron to come and cut the ribbon...

zack247 (author)Arbitror2010-05-15

like iamtoats said, put  some metal sheilding over it to protect it. only if they are smart will they test the wires after cutting them to trigger the servo and unlock the door

Arbitror (author)zack2472010-05-15

Most people with malicious intention probably isn't smart enough. But even if someone who would try to "hot wire it", could be stopped by using a signal that only the box on the outside can produce, that the electronics on the inside would recognize. That way you can only initiate that signal by entering the right code.

JefffN (author)Arbitror2010-05-15

That is exactly how it works. The only data sent through that cable is what keys were pressed, what card was scanned or what needs to be shown on the screen. There is no 'unlock door' command, only a 'I typed code x' or 'I scanned card with data x' commands which if you knew which command to send, you could have just typed the correct code anyway.

Arbitror (author)JefffN2010-05-15

I should have read your 'ible first, I just saw the exposed wires and though how risky that was.

iamtoats (author)Arbitror2010-05-15

 You could attach the console/servo to the door via a thin piece of metal hung over the door. (like some coat hooks) Then you could run the ribbon along or behind that in some way that it couldn't be cut.

super_kool_dude29 (author)2010-05-15

as soon as i saw this i noticed the wires could be cut easily. no one has to "hot wire" it. all they got to do is cut it and hope you don't carry a key just in case, then your locked out again. it would be kinda hard to do but a cell phone idea would be great so nothing is shown on the outside of the door.

Kiteman (author)2010-05-15

I like this - not least because it requires no permanent modification to the door, and the device itself could be attached to almost any door-lock (it might need a beefier servo to turn a church-door lever-lock, though...)

About This Instructable




More by JefffN:Keyless Dorm Entry
Add instructable to: