Project:ElectronicDoorLock

From Oxford Hackspace
Jump to: navigation, search

Contents

Door Locking Project

CURRENTLY IN BETA TESTING

TL;DR. The project is currently in the space (to the right of the door as you go in). Assuming that the radio hasn't been disconnected from the Raspberry Pi, you should be able to beep in with one of the RFID tokens that's hung on the wall. The white card should produce a high-pitched pip from the speaker, whilst the blue key fob should make a lower, longer tone that means 'no'.

It would be lovely if someone could make a nice little web interface or something to make adding other cards easier (if you have an older Oyster card or some other RFID entry card, it should work).

Synopsis

Make an electronically controlled lock for the Hackspace studio door. This will replace the existing mortice lock in the door and allow every paid-up member to enter the space with their key. Additionally, this is the first step to automating the door into OVADA which would mean 24hour access to the space and remove the burden on our keyholders. It's important to note that this isn't intended to prevent visitors or new members from accessing the space; it's a technology demo to show what we can do for access control and to give us a head-start for the eventuality that we move somewhere bigger in the future.

Project Design

The door will be fitted with a Mortice Latch which fits inside the door (similar to the existing lock) but latches locked whenever the door closes. The door frame will have an "Electronic Strike", like you'd find on the door entry system to a block of flats. The strike releases the latch when it receives a voltage input and allows the door to open. The electronic lock is in addition to a standard key and it not a replacement. The existing key holders (and OVADA) would probably hold a key and be able to get into the space in the event of a power-cut.

The access control will be achieved by some sort of ID tag: currently the two known possibilities are iButtons or RFID fobs/cards; there may be others. The reader for the ID tag will be connected to an Arduino, Raspberry Pi or other micro controller and will read the information from the tag, decide whether it's a valid key and then energise the door strike to allow the door to open.

There ought to be some sort of database that contains a list of valid tags so that we can keep a list of who is allowed in and revoke access (for instance if someone lost their key). In an ideal world, this database would be stored somewhere online (so that changes don't need to be made physically on the door lock) but also cached locally to the space - either in the lock mechanism itself, or in a central controller. For a simple demo, it would be possible to program the key list into the lock micro-controller.

Also, wouldn't it be cool to have the ID tag connected to the beer fridge so that you could put some cash into the kitty, and then use that to pay for drinks, snacks, etc. What about a bot that posts to IRC when you enter the space, or a feature on the website that shows whether there's someone in the space right now? What about turning the heating on/off when you arrive or leave? There are a lot of possibilities for this to be extended into a heap of cool automation features, but for now, let's just get the lock built.


Parts Already Acquired

  • Arduino Mini(?) x2
  • NRF24L01+ Radio Transceivers x2


Parts to Purchase

Project Plan

  • Specify design
  • Choose lock mechanism and parts
  • Code micro-controller, central database, etc
  • Breadboard electronics and test system
  • Purchase lock parts
  • Install system

Skills Required

  • Programming (Arduino, Web database, C/C++, python, [insert favourite language here])
  • Electronics (to wire the thing together)
  • Woodworking (to fit the new lock mechanism into the door)

Completed Work

  • Specify design
  • Code micro-controller, database, etc. (First version on github https://github.com/timstephens/Dorbot)
  • Breadboard electronics
  • Built prototype on Stripboard, ready for testing at the space.

The README on the github page gives information about how to connect stuff together, although there's a stripboard prototype finished and available for playing with as folks wish. The next steps will be to look at how to actually interface this with the door, including which lock to purchase, how to interface with that, etc.


Stripboard Prototype

Connections The RFID reader is connected to the main board with an 8-way ribbon cable. The cable itself has 10 wires, with the extra two being reserved for an LED and/or a beeper. The TONE wire (number 9) is connected back to Pin 3 on the Arduino. The LED wire is (as of 23 March 2014) not connected, but can be wired up to a spare pin or ground -- you could use this as the second anode for a bi-colour LED, or to flash a LED if the card is accepted, or something else...

The radio is connected on an 8-way IDC socket that was butchered out of a floppy disk cable. It's superglued together, and should be OK -- don't go crazy with it though!

The arduino sits in two rows of sockets that connect it to the stripboard. It's also got 6 pins on the end that connect it to the Serial-USB converter for programming. This particular Arduino doesn't have a boot loader programmed into it, so you need to reset then board when you're about to program it. The sequence:

  • Click Upload in the Arduino IDE
  • Wait until the status bar shows 'Uploading'
  • Press the microswitch on the Arduino to reset it
  • If you get an error in the Arduino IDE, repeat and try a slightly different timing to press the button. It's a little fiddly, but there's a ~2s window to get it right, so a few tries ought to sort you out.

Power The stripboard has got two regulators on it (The Arduino runs at 5V and the Radio/RFID at 3.3V). To power the board up, connect the Red/Blue wire to positive on a power supply and the Orange/Black wire to Ground. The regulators are 30V tolerant, but it's better to use something in the range 7-12V to prevent them getting too hot. My bench supply says that the system draws about 80mA at 7.5V.

Personal tools

Variants
Actions
Navigation
Tools