Keyless Dorm Entry





Introduction: 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

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

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

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

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

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.



    • Science of Cooking

      Science of Cooking
    • Microcontroller Contest

      Microcontroller Contest
    • Spotless Contest

      Spotless Contest

    We have a be nice policy.
    Please be positive and constructive.




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

    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?

    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.

     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

    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

    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.

    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.

    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.

    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!

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