Skip to content

February 10, 2014

5

PiDoor – Security Door Lock v2

Some readers may recall my old security door lock, which I made about a year ago. It was controlled with just a single AVR, which proved very inflexible. Though in theory it was capable, it was very limited unless I spent a lot of time and effort interfacing with an internet connectivity module. While that may have been an interesting challenge, the inflexibility and impracticality of the old system was simply too much for me, and I didn’t have time to maintain it. It was generally too time consuming to dismantle the module and reprogram it as required, and so when it broke (the strings simply snapped!) I decided it wasn’t worth the hassle, and went back to a good old-fashioned regular lock.

But, where’s the fun in that? Fast-forward a year to 2014, and I finally convinced myself to buy a Raspberry Pi to mess around with. I already have quite a bit of experience with Linux, so I wasn’t planning to use it to learn Linux. In fact, I didn’t know what I’d use it for until the night before it arrived when it hit me: I could use it to make a much better door lock! And so when it arrived, along with a servo I happened to order with it, I got to work. Here’s the end result:

At the start of the video, you see the Raspberry Pi on the left, the servo/circuit housing in the middle, and the lock itself on the right. In the second half, you can see the keypad connected via a ribbon cable to the circuit housing.

Features:

  • Keypad code locking/unlocking
  • Web interface to control and view status from any internet connected device

  • Easy to update (thanks to the Raspberry Pi itself being a Linux device)
  • Mains powered with a single 5v power source
  • GPIO ribbon cable/socket for easy removal of the Raspberry Pi

Read on to find out how it works.

The RPi (Raspberry Pi)¬†controls everything. It receives power via the GPIO header, meaning the servo and the RPi can share a single power source. It’s also connected to my home WiFi network via a WiFi dongle. The RPi runs a Python script which ¬†listens for UDP data from a specific server IP, and interfaces with the keypad to listen for physical input. If the key combination is correct or the UDP data is correct, then the door lock can be controlled.
The keypad is a simple £3 matrix keypad. Hook up the columns to RPi outputs, and rows to inputs. Set a column to high, and then look for input on all of the four rows. If a given row is high, you know the column and row of the key pressed and can infer the number pressed.

[Image: 2014-02-02_01-12-34.png]

The lock is controlled with some string and a non-continual rotation servo (which simply means a PWM duty cycle input to the servo corresponds to a target angle)
The servo/circuit housing connects the RPi to the servo, keypad, and power. You can see the GPIO header is connected via a ribbon cable to the circuit housing, where it’s plugged into a socket mounted onto some stripboard inside there. The circuit housing is connected to a 5.0v USB mains power adapter (phone charger!), which then feeds the servo and the RPi (via the GPIO) with power, making one neat mains power connection.

0+
5 Comments Post a comment
  1. Jul 4 2014

    This post is very interesting but it took me a long time to find
    it in google. I found it on 12 spot, you should focus on quality backlinks
    building, it will help you to rank to google top 10. And i
    know how to help you, just type in google – k2 seo
    tips and tricks

    0+
    Reply
  2. Adam
    Sep 8 2014

    I’d love to see a well made instructable or the like made with a products needed and even a download for the software used. Looks like an amazing project

    0+
    Reply
  3. Jack
    Dec 23 2014

    I’m trying to replicate this exact project for my own interest, could I see your sample code to help me set up the web control aspect of it?

    0+
    Reply
    • Oliver
      Dec 25 2014

      Hi Jack,

      I will endeavour to neaten up the code I used and post it all online some time in early January.

      Cheers

      0+
      Reply
  4. bart
    Jul 30 2015

    did you end up sorting the code for this? i am trying to do a similar thing but struggling with my lack of experience.

    thanks

    0+
    Reply

Share your thoughts, post a comment.

(required)
(required)

Note: HTML is allowed. Your email address will never be published.

Subscribe to comments

Fork me on GitHub