Monday, May 2, 2011

RFID lock: ready! finally...

After years and years of thinking, googling and trying things out, I finally managed to finish my RFID lock!

So here is what it is: I have a door from the outside to the garden, which I use to get the bikes in the garden. There is a small slope leading to said door. I find it pretty annoying to have to go down the slope, get the keys out of the pocket, unlock the door, get in with the bike, put the bike in the shed, get the keys out again, lock the door. Especially in the rain, and in the winter, when all this implies the further step of taking the gloves out, and finding the lock hole in the dark.

For a long time I did not lock the door. I simply left it unlocked, but that always felt like a big security risk, so I started locking it. But in the back of my mind there was always the will to get it automatic. At work I have a badge which I use to get all the doors open until I reach the bike shed, and this is pretty easy to get out of the jacket pocket, even with the gloves on, so why shouldn't it be also easy to do at home.

So here is the final solution:

- a JeeNode, for wireless connectivity;
- a RFID reader module for Mifare cards, from Stronglink, an SL30
- an Abloy EL561 electronic lock (this is the expensive part of the project)

The RFID module is pretty nice, it uses I2C for communication, and can be put into sleep mode. Stronglink has a pretty good service too! quickest delivery - modules arrived in 3 days from Beijing - and when I had a problem with the power saving mode, they couldn't help me, but sent a whole new set of modules to replace mine, in case it was a hardware problem. The sleep mode problem is still there, as it doesn't quite work as expected, but I managed to get it to work in a procedure that is close to voodoo :) change something in the code and it mysteriously stops working. I wrapped it in FIMO to make a module to have on the outside, since the range on the sensor is not very big - about 4cm.

Then the Jeenode. It controls the whole thing, and when the card number is an authorised one, it closes a SSR relay, which provides 12V to the lock, thereby enabling it to be opened just by using the door handle. It also sends a radio message to the server informing which card was used. It does not yet using central authorisation, as I will need to get encryption going on for that. The Jeenode sleeps for most of the time, but wakes up every 500ms to check for a card, it then wakes up the SL30 module, checks for a card, puts the module back to sleep and sleeps again. It is now powered by 4.5V, so lets see how long before the batteries need replacement. I am hoping they will last a few months, but I will be glad if they last 1 month...

And the lock, is a pretty nice lock, which locks automatically, so the door is always locked also provides a lot of signals, like cylinder used, handle down, door open, and a few more I think, but I do not yet make use of them. I want to, but that will be the next hardware iteration.

There are a lot more details, but those are for next time.

here are a few photos:

The electronics box, with the Jeenode, 12V battery for the lock, 3xAA for the controller, and the cables coming in, one from the lock, and one from the sensor outside the door.

The sensor on the outside.


Charlie said...

Awesome! Would you mind sharing your code for the JeeNode?

Alex said...

I have placed it on github:

It is meant to work with the SL030 RFID module from Stronglink.