Introduction: USB Reprogrammable IButton Door Lock
iButtons are small button like casings that communicate with only 2 wires. They are incredibly robust and all have a unique serial number which is hardware written into the device and never repeated. They are cheap (about 1 Pound / 1,50 Euro/ $2)
This serial number allows the keys to be truly unique and thus are effectively secure. I have seen them used:
>as the till logon device at bars
>in securicor money cases
>as secure dongles used with expensive software.
>...as door locks!
The problem with using them for the beginner, is that you have to be able to program hardware to read them and if you loose the key, the locking device is useless!
This Instructable shows you how to build a lock, and a USB programmer that enables you to write new keys to the lock in seconds, without dismantling the unit. Making the lock completely secure and updatable for up to 80 keys at a time. The lock can work on between 5-30V AC or DC and so is incredibly flexible; designed to work on the same voltage as your electronic door release - you can buy the cheapest or most expensive one you find, Fail-Locked or Fail-Unlocked, AC or DC, 12V or 24V.
What you will need:
>Components (see next)
>Electronic door release.
>PCB making equipment (if you want to make it look puurdy)
This is an old instructable that I haven't uploaded for some reason. If you have trouble building it, email me and I will happily help - however, I can't guarantee I've made it as simple as possible - sorry - hopefully it'll give inspiration if nothing else.
Step 1: The Process
Firstly you'll need to decide which type of lock you need.
FAIL SAFE/UNLOCKED remain open when the unit looses power. This would generally be used if the door nbeeds to be accessable in the event of a power failure - e.g Fire
FAIL SECURE/LOCKED remain locked unless power is applied to the lock. These would be more appropriate when using a traditional door entry system, having the door traditionally locked at all times, unless power is applied.
Below is a flow chart to show how the device operates.
Simply, if you enter a key, the microprocessor firsts checks to see if it's a programming key, or it's an access key.
If it's an [iButton] access key, the microprocessor checks against the list of known keys stored in it's EEPROM (memory), if it finds it, it lets you in. Otherwise it will send a red-light to say that no access is granted.
If it's a reprogrammable key of any type (e.g. an iButton with a new list of keys to store on the internal EEPROM). It will check if the ibutton is allowed to re-program the internal EEPROM but checking it's authentication code. (This is programmed into the iButton by the USB programmer and this you can't change - see last page for info).
If the iButton is allowed to program the internal EEPROM, the LED will flash Green/Orange and then microprocessor will pull all the key-codes off the iButton and store them to it's internal EEPROM. This will cause the LED to flicker and could take up to 20 seconds - do not remove the key while this is happening. The LEDS will then pulse green to indicate the programming is over - now remove the iButton.
Step 2: The Components
OK so the instructable is pretty easy, i give you the schematic, parts list, hex file, and you build it - simple!
I'm going to give the parts list and the Rapid Electronics ( http://www.rapidonline.com ) part number so you can source your own supplier - although rapid is pretty good!
Heres the parts list
1x Bridge Rectifier (rapid# 47-3202)
1x 5v 7805 voltage regulator (rapid# 47-3313)
1x SIL relay (rapid# 60-0670)
1x 100uf cap (rapid# 10-3260)
1x 470uf cap (rapid# 11-0275)
1x 220f cap (rapid# 11-0260)
2x 1k resistor
1x 4k7 resistor
1x 16f628 PIC micro
1x 24LC04 4k eeprom (rapid# 22-0170)
1x 8pin dil holder
1x 18pin dil holder
1x DPDT mini switch (rapid# 76-0220)
1x 3pin header (rapid# 22-0515)
1x jumper (rapid# 77-0237)
2x 2pin terminal block (rapid# 21-1700)
1x Electronic release ( http://www.directlocks.co.uk )
1x iButton probe with BiColour LED (MBL)(part# hc00039 http://www.homechip.com )
1-80x DS1990A iButtons ( http://www.homechip.com )
The USB programmer
1x 18f2550 PIC micro
1x 20MHz XTAL
2x 22pf caps (ceramic disc)
1x 220nf cap
1x 1k res
1x LED (any colour)
1x USB B-socket
1x iButton holder probe DS1402 (any will do) ( http://www.homechip.com )
1x DS1973 iButton ( http://www.homechip.com )
Some of the iButton hardware or buttons may be obtained free by ordering samples from http://www.ibutton.com (direct from maxim).
Step 3: Schematic and PCB for Lock
Below is the schematic, the PCB and the final example photo of the lock. For a printable PCB layout, see downloads.
For a high res version of the Schematic, click the i and download the file (14kb).
PCB layouts are available on the download page.
Step 4: Schematic, PCB and Photo of the Programmer
below is the schematic, example PCB and photo of the final produced PCB of the USB programmer
Step 5: Programming the PIC Microcontroller
OK, So some of us may have got to this point and thought - how the heck do i program a PIC controller. Well below is the simplest way.
Obtain a PIC programmer (ebay for example) that supports the PIC 18f4550, and follow instructions. Failling that, ask anybody at the local school or college, anybody in the electronics community, or, email me at instructyibATdandycoolDOTcoDOTuk and i'll see if i can program it for you, if you have trouble. It is HEAVILY documented on the web how to program these devices though.
Second thoughts... financial opportunity! I could sell you both the PIC's pre-programmed if you like (10GBP/ 15euro / $20) paypal. But i insist you can do it yourself easily enough.
Just program the PIC with the default fuses set. The HEX file (i think) should contain the information for the oscillator settings and such like, for me, i just plugged in and it all went.
It runs at 4MHz with an INT OSC, no WDT.
Step 6: Make It Look Flashy!
Now you can squeeze the two modules in some flashy gear to use as part of your new security system!
Step 7: Downloads!
Here you can download the software (requires .Net framework 3.5), pcb files and firmwares. Uses Mike o'brien's USB HID Library - Thanks Mike!
Schematics created using TinyCad
PCBs made using PCB Wizard 3
When printing the pcb from the pdf, print as an A4 sheet, make sure any shrink options in acrobat are disabled to keep the scale.
Step 8: And Finally..
One key can be programmed to update 1, or a 1000 locks, it doesn;t need reprogramming every time, so you can have an array of locks all with the same keys that will open it. Or mix and match. This will save hours on programming new locks, or updating locks if one key is lost - and hey, keys only cost a pound!
The original concept was to replace all locks in a building with electronic locks that everybody could have the one key that has access to only the desired areas.
Now, these locks CAN technically be reprogrammed by anybody with the same project built. The software does allow for a unique key code to be used so that no-body can over-write your lock's eeprom.
This key code is stored in the firmware and in the USB software application, so there is is the ability to start of running without any lengthy config.
However, should your needs go above that and you need a secure key code so that only you can re-program your locks, email me with a need and maybe I'll prepare you a custom app + hex code.
I'm sure the most budding with your reverse engineering and sluthing skills may find a way to do it... but I'm closely guarding it due to the potential for commercial exploitation by those naughty web2.0-ers out there!
No guarantee at all for it's functionality! Should not be used as a REAL security device, this is a conceptual project only. But it works pretty damn swish!
We have a be nice policy.
Please be positive and constructive.