Door Lock Provides Peace Of Mind With Real-Time Security

arduino door lock

[HSP] got tired of locking his door with a key, so he decided to upgrade to a keypad system which he’s designed himself.

It uses an Arduino Mega with the standard 44780 display, a standard keypad, and the “key override” (shown above) for fun. The locking mechanism is a standard 12V actuator based lock which was modified to run off of only 7.5V, by softening up the spring inside and running it upside down (as to let gravity help do the work). The whole system draws less than half a watt on standby, and engaging the lock peaks at only 4-7W.

What’s really clever about this design is how he locks it from inside the room. He’s programmed the Arduino to write 1 to address 128 of the EEPROM — at power on it will increment this by 1, and after 5 seconds, it will reset to 1. This means it can detect a quick power cycle, so you can lock the door by turning it off, turning it on for a few seconds, and turning it off and on again — he did this so he didn’t have to make a button or console, or any kind of wireless control on the inside.

Now we know that kind of adds a huge flaw to the overall security of the system… but [HSP] learned his lesson last time he built something “too” secure.

The relay board is inside the box on the wall on the outside, and the lock is only locked with power. This is insecurity by design. This is to keep the casual people out. The door itself is thin wood with cardboard in between. I previously had a lock which was locked on power failure, and the machine (Windows) running it, crashed. I got to climb through the roof window, 7 meters up to get inside without trashing the door, so now I have a little respect for the possibility of failure, and design my systems for the expected threat-level.

32 thoughts on “Door Lock Provides Peace Of Mind With Real-Time Security

  1. But EEPROM has a finite write life! After 100,000 cycles that address will start to fail. Oh, sure, it may work for a while, but what if he locks his door twice a day and he lives in the same house for 135 years? THEN WHAT?

    1. Use EEPROM that have 1M read/write cycles. Tons of them.

      Hint: lower density EEPROM made with older technology and not FLASH! i.e. thicker SiO2 layers. Not like you are storing a movie or something, the smallest I2C EEPROm would do.

      Not like the FLASH retention of your firmware is guaranteed over 20 years (order of magnitude. Check your datasheet for actualy numbers).

    2. I actually considered making the value change place throughout the lifetime of the device. But then I did the math and found out I had to open and close it all day long for an entire year to get anywhere near the limit.

      1. Not to mention the fact that it can be overridden with a key switch anyway, which (from the looks of it) is a bog-standard device you can get master keys for, or just pick with basic tools.

        1. They used to use those on PC cases, sometimes to actually lock the case so it couldn’t be opened, but more often to lock the keyboard so it couldn’t be used (this was before mice). I’m not sure why this was so important, but every PC had this.

          Anyway, one day I was idly reading an IBM manual while tying an onion to my belt (as was the style at the time) when I encountered the official instructions for when you lost the key:

          1) Find another key.
          2) Find some pliers.
          3) Insert key into lock.
          4) Using the pliers, twist the key until the locks breaks.
          5) Order a new lock & key from IBM, part number xxxxxxx.

      2. Quote-ception:
        “Quote “I design my systems for the expected threat-level” Ummm Dude, your door is made out of thin wood and cardboard.”

        Isn’t that still designing for the expected threat-level? I normally work as a software dev, so I’m used to that kind of stuff. Designing a system with minimal security where minimal security is needed.. Why not? :p

        (And I kinda imagine all HaD users laying in their bunkers with 30 different locks, watching the outside world through CCTV cameras.)

  2. Hey, I’m [HSP]. I didn’t seriously think this would go on Hackaday, but why not! Cool!

    I like how your primary concern is the lack of security. This thing is build for fun and as I said:
    “The door itself is thin wood with cardboard in between.”

    Sure, I could do some crazy fingerprint-scanning, with a passcode changing every day, and a OTP password generator in a keyfob.. Oh let us put it inside an aluminium enclosure with tripwires and lasers. And let’s run it all on some obscure FPGA for the lolz. But WHY!? The door is made of freaking cardboard!
    It’s an inner door. I’m pretty sure my 14 year old cousin cold break this door down in a single kick or two.

    Do you want to completely honest reason for building this lock?
    It keeps my parents out while I’m having sex. There you have it! ;)
    (And it does a great job, of just that!)

    1. Wow the door looks much more sturdy on the video. So this is at your house not school? I’m surprised your parents let you bugger up the walls. And you seriously think we think your having sex with someone else and you want to stop your parents from seeing that? Is your partner called “Mano”? (LOL)

      1. Here are some tips on hardening your secure-area on the fly… get one of those security bars or make one and your 14-year old cousin nor your parents can kick in the door when they hear you making the “O-face” :-)

        Rig up a tape recorder playback (endless loop cassette) or a looped MPG file on your PC wired to the mouse switch to repeat a canned message repeatedly every time someone disturbs the door “What do you want? Can’t you see I’m busy? Go away!”

        Also put in a auto-activated webcam to see who is snooping around your room when your gone. An old-school method is to put a matchstick or toothpick in the edge of the door after you depart the room. If it’s laying on the floor or gone you know your room has been breached. The breachers NEVER think to put it back EXACTLY where you put it on the door. Mom will just pick it up and throw it away. Dad will never notice it. He’ll probably not be the breacher either. Either nosy mom or your nosy siblings probably will try and breach your room security. “What the hell is he doing in there that he needs a door lock?” (LOL)

      2. Yeah, this is actually our own house. And they are used to me bugging up the walls. I’ve done it since I was 10 years old or so, so I’ve learned to repair the walls afterward too. :p

  3. Even though Occam’s Razor really has nothing to do with Bill Ockham, I would like to point out there is a really LOW-TECH alternative which can be a bit secure if executed properly. Since there is a built-in EM solenoid lock in that door, you can supply the 24VAC it needs in a very sneaky way. BTW the door in the video is NOT thin and is not pressed wood. It’s obviously a low-profile high-security door at his school or something. I’ll bet a football jock will have a hard time crashing it in. The EM lock is obviously a deadbolt too. Good luck smashing into this lab.

    So I admire the OP’s ingenuity here. But sometimes the simplest solution is the best. Now how about wiring the solenoid in series with a magnetic reed switch from a burglar alarm system to the 24 V supply? Hide it in a very secret place near the door. Maybe even embed it in the wall using some power tools and some duct tape (or spackle) to cover it up. The school maintenance guy will go ballistic when he sees your shoddy drywall renovation work!

    Now go to Walmart and buy a pack of those cheap niobium magnets in the arts & crafts department. You can glue them to a ring or a old expired credit card. Just don’t put them near a good credit card or a computer diskette (who uses them anymore?). You could hang it off your belt with a retractable lanyard also found at Walmart.

    When you arrive at the door just hold up your magnet to the switch and the deadbolt retracts or buzzes allowing you access. If lock bolt spring-loaded it automatically resets back to lock mode. If it toggles then you have to touch the switch again to lock it. If that’s the case put a pushbutton on the other side to toggle the bolt from inside the room. That means more drilling into the wall. Good luck with explaining that to the dean. (LOL)

    1. Oh I take some of this back:

      1) it’s a 12 volt lock system.

      2) He can turn it upside down and weaken the spring so it must not be internal to the door.

      3) And buggering up the walls is not a problem as I can see he already did this with that quick and dirty carpentry work for the console.

      4) He could put LED’s on this to show open and closed mode too.

    2. This is at our home. The lock is external, and I guarantee you that door is thin. We have one just like it in the kitchen, and my mom once smacked it so hard that a piece of it broke apart at the handle! :D
      I like your idea, but I like my code panel just fine thanks. I can change the code on this thing if some irritating family member every learns it.

  4. Never, ever, ever incorporate Windows in a mission critical system. Good thing that this guy learned that lesson early on. Always makes me wince when I come across an industrial machine sporting the Start button of Satan.

    1. That was back in the day when I were a full-blooded Windows dev sworn to C#.
      I’ve since come to enjoy PHP and Javascript (NodeJS) as my primary languages, with Python, Java and C++ as secondary. Everything is Linux now (and Mac for our personal computers).
      I actually managed to lock myself out TWICE because of that Windows machine, and the other time I had to literally break down the door. It took me a couple of hours to repair my door-frame. That and Windows 8 is why I’m on OS X and Linux.

  5. Or, since we’re talking about the deterring the casual people, if when messed with, use the Star Ship Trooper method, and start the voice recording that says “I’m a ten second bomb… I’m a nine second bomb…” LOL I’m betting they won’t hangout to see if it’s not real. leaving your cardboard and matchstick door intact. (Though there may be a mess to clean up when you get back )

    I think adding a bright read moving alarm light may add to the ambiance as well…

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.