Arduino RFID Door Control System

Whilst I’m waiting for the last bits of my new ESX server to turn up I’ve been thinking about another project I’ve wanted to play with for a while. For the last five years I’ve been playing with home automation or IoT on and off. I’m good with the software part but it’s been many years since I did much real work with hardware.

The Raspberry Pi has been great for some interesting projects. I worked on an in-car entertainment system earlier this year using one with an iPad for output connected over WiFi but it’s just bolting together a selection of USB components and chucking out some code for the most part so hasn’t really grown my non-existent electronics engineering skills.

I’ve been thinking about a few ideas for RFID recently and wanted to make a start with something simple – how about a door lock? Every day at work for the last decade I’ve probably opened most doors with an RFID card yet I still have archaic keys at home. I’ve decided I’m going to try and up my electronics knowledge by creating an RFID reader door lock that connects to my network to determine whether there should be access granted to a door or not. I figure it may finally give me a real excuse to buy a 3D printer as well.

Whilst not an electronics expert I have learnt a little bit about how a typical office electronic door lock works over the years so here’s the basic details.

Originally readers would have been for magnetic stripe cards. This led to the creation of what is known as the Wiegand Interface. It’s an extremely basic protocol with two 5V signaling lines – D0 and D1. If both lines are 5V it means no data is being sent, if D0 is pulled to a low voltage whilst D1 remains high it represents a zero being sent and vice versa for a one.

The Wiegand Interface connects from the door reader to a controller capable of reading the data. The original standard defines 26 bits of data – 8 bits for a site code and 16 bits for the card number. Over the years the limitations have led to various modifications to the protocol to add extra capabilities – although often still sent via Wiegand.

Once a door controller has verified a card has access it opens the door. There are various types of magnetic lock but they all tend to work in the same way – the ground line is interrupted when the card is read successfully and the door unlocks.

My first thoughts for implementing something at home was to buy a second hand Wiegand reader for £10 on eBay and then to connect it to a Raspberry Pi and read the data. This looked like a fairly costly and relatively bulky way to do the job though so I thought I’d take my first jump into Arduino. Additionally if I’m using RFID simply using the Wiegand Interface doesn’t give me access to enough interesting information on the card – there’s a lot more than can be done with RFID when interfacing directly with a reader.

For this project I’ve decided to go with an Arduino Ethernet POE connected to an Adafruit RFID shield. The whole lot comes in at around £70 including a few test cards purchased from eBay. The 802.11af POE will let me power the Arduino and the RFID reader directly from my Ethernet minimising the cable runs required. I’m not decided on how to provide the 12V and reasonably high amps for the lock yet but suspect I’ll run that back to a central controller.

I’ve ordered some parts but I’m hoping to implement the following gradually:

  • RFID is read from card by Arduino
  • RFID transmitted to network server to validate it
  • If RFID is successful the lock is opened for a few seconds
  • Add in manual “press to exit” buttons
  • Add a telnet interface for management
  • Ability to auto-update firmware from a network location on boot

To enhance security I’ll be playing with some of the basic encryption functionality on a card rather than simply using the serial number assigned to the card.

Parts now ordered so hopefully I’ll at least get the reading going this weekend and can post some sketches. If this works well I’m hoping to add some attractive LEDs, a backlit screen and encase it in a custom enclosure to put on our locks. In the UK most doors are UPVC multi-point which will pose it’s own challenges (from an insurance perspective at the very least) so we’ll see where we get to with it.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s