For the last few years I have been fairly heavily involved in HSBNE, Brisbane's hackerspace. As part of this I worked a lot on how we provide access to all of the members. This article is about the development, testing, revision and implementation of the board I designed to handle the "brains" part of doing this which is now the goal of this fundraiser on Tindie
Since day one (Dec 2009) when I first got involved with HSBNE this has been done through EM4100 125KHz RFID tags. Basically there is a tag reader somewhere near the door, you hold your tag near it and a few seconds later there's a "Click" and you can open the door. Originally this system was just an Arduino with a prototyping shield. On the shield was a breakout to connect the RFID reader to, and a MoSFET to control power to the door strike.
In May 2010 I was elected President of the group and we moved to new premises. At the time we were renting 1/3 of a large warehouse in Fortitude Valley and had built a wall sectioning off the part that we rented. We had a door strike set up on that pretty quickly but also needed to provide another reader for the external roller door that was the only street facing entrance to the building, so we added another RFID reader and another MoSFET to switch the roller door controller.
1. The Bare Warehouse. 2. The Wall we built. 3. The Roller door from outside. The little black dot at the right side of the door is the RFID reader.
After having a few, less than ideal, incidents where materials etc either turned up in (#$%@#$% CRT's!) or were removed from the space with no warning or clue as to who had done it, I started to push for logging the door to something where we could see both who and when someone used the RFID system to gain entry to the building. We added an Ethernet shield to the stack of boards and started logging it, but discovered that the shields had a tendency to work themselves apart over long periods from cable tension and other things. I tried to address this by putting it in a project box but it grew quite large and we quickly ended up having to cut a lot of holes in the box for various reasons.
Around the same the time we started to acquire some machine tools and discussion turned to how we would make sure untrained/unskilled people weren't using these potentially quite dangerous machines without authorization/oversight. I quickly realized the same setup that was being used for the entry into the building could also be used for controlling access to the machine tools. The problem was that once you start putting an Arduino and Ethernet shield in every machine it gets pretty expensive fast, and you've got a lot of failure points.
So in mid to late 2011 I started to look into alternatives for this and found a few, but none that really met my main 4 goals:
I'd been dabbling a bit in PCB design and had already successfully designed and built one board with a mix of SMT and PTH components that worked as designed. So I decided to design and build my own solution to this problem. It made sense to me that keeping it loosely based around the Arduino design was a good idea, as this made porting our existing code to it pretty simple and meant that if anyone else wanted to they could write their own code pretty simply for it. I spoke to a few of the other hackerspaces around Australia and they were fairly interested in seeing the board as well.
Having previously used Fritzing to design the first board I had done, I started sketching out some ideas in that and playing with a few components to see what I could come up with. On discussing it with others I also decided to keep the board 100% PTH so as to make it easier for other people make their own boards from the design files, as well as allows noobs to solder them together.
Jan 2012 I announced to a few of the hackerspace mailing lists around Australia that I had come up with 2 boards, one that was completely standalone for controlling a single door or tool, and one that was designed to plug into an Arduino Mega that provided everything needed to control up to 3 doors/devices. After a few discussions with people about the pros/cons of the two boards, I decided to drop the larger board and focus on the smaller one as it worked out to about the same cost in components/space to control three doors with three of them.
Thus the SNARC was born.
Simple NetworkAble RFID Controller
This is a render of the original prototype PCB:
In all the PCB renders in this article, I have removed the ground fill to make it easier to follow the traces and see how things are laid out. Yellow traces are top layer, orange traces are bottom layer. Any unconnected pins are connected to the ground plane.
And here's a prototype:
With some help from friends for funding them I ordered enough parts and components for 10 boards. Once everything had arrived myself and one of the other members built the first small batch of boards and found a couple of mistakes I'd made. The data lines on the SPI bus to the Ethernet module were transposed (I'd swapped MISO and MOSI), so I had to go through all 10 boards and add a "blue wire" fix to make the Ethernet work. I'd also managed to order the wrong version of the micro-controller to work with the Arduino environment. I'd ordered ATmega328-pu, what I'd needed to order was ATmega328p-pu. A small but ultimately annoying distinction as it made putting the boot-loader on the board a bit tedious.
While these problems were annoying, realistically they were minor and didn't stop the hardware from working. We've now had one of these boards running the front door at the hackerspace for nearly 12 months non stop with only 1 SNARC hardware related issue. A significant improvement over the old board.
After a few months I'd had a number of comments about how to make the board better, one of which was a request for an FTDI compatible header to make programming simpler. I'd only put an ICSP header on the board which I now also realised needed a lot more room around it to make programming simpler. Because the FTDI header needs to be plugged into the only hardware serial port on the chip, I decided to add a "Soft Serial" header as well connected to two of the micro-controller's GPIO pins. Realizing I was going to have to shuffle things around quite a bit to fit all this on I went back and managed to come up with version 1.1 and in the process added a bunch of extra filtering caps, and re-jigged how a few things worked. Also people were complaining about the way I had setup the two LED's on the board (they are effectively charlieplexed) so I thought I'd better be benevolent and change it.
Render of the v1.1 PCB
Unfortunately I don't seem to have any photo's of v1.1 hardware. All of the V1.1 boards went to a place here in Brisbane called The Edge for an RFID check in system. Think foursquare but local and anonymous.
Again I ordered enough components and PCB's for another 10 boards, built the first board up and went to program the boot-loader onto it... and it wouldn't program. I built another board thinking I might have a faulty component and it wouldn't program either. I went and grabbed one of the original ones and was able to program it fine. It really had me stumped. I started looking back over my schematic and PCB...
Cue epic face palm.
In fixing the issue with the SPI data lines being reversed to the Ethernet module on the first version of the board I'd managed to now reverse it on the ICSP header, meaning that I had to make a very bodge little adaptor to reverse those two lines and allow me to put the boot-loader on the board. Once this was done the boards worked but there were still some annoying little issues that I wanted to fix. The ICSP header was too close to the Ethernet making it a little hard to use, some of the components were also too close together making them hard to solder in place.
Time for another version.
V1.2 PCB Render
V1.2 Hardware built, tested and working.
I'm pretty happy with how this one turned out, as you can see there is plenty of room around the ICSP header finally, I rearranged a few traces and components to make a bit more room around the mounting holes and to make some of the components easier to solder in. I was fairly certain this was going to be the release version but I wanted to make sure the board was STABLE when used for long periods. Unfortunately we discovered that there was sometimes a race condition between the micro-controller and the Ethernet module where upon reset or power on of the board, the reset lines of both were tied together, the ethernet module would sometimes boot up slower than the micro-controller for whatever reason. This meant that if the board lost power for some reason, or someone (inadvertently or not) hit the reset button, the board would sometimes hang hard. This is not an ideal situation for something that controls the front door to your building!
So I went and had a look at a few different fixes for this and ultimately decided the best way to fix this was to add another header that allowed you connect the Ethernet modules reset line to a GPIO pin on the micro-controller, we'd already put this in as a blue wire fix on the boards that were in use and changed the code to allow it, so this fix works well.
V1.3 PCB Render, none of these built as yet, that's what the fundraiser is for!
And here is the Schematic for this board.
All the files to make your own boards if you so wish are available on my github repo.
Implementing the SNARC
Implementation of the board is pretty simple, as this was always one of my goals for it.
Once the board has had the bootloader flashed onto it (all kits come with a pre-flashed micro-controller) you can use it with an FTDI cable or other TTL Serial interface and program it using the software of your choice, including the Arduino IDE. This serial connection can also be used for "console" mode in the demo firmware which allows you to do things like add cards, remove cards or wipe the entire device.
There is a full software solution for the SNARC and a back-end server on this github repo. This software allows you to setup a number of SNARC's on a network, have them logging back to a central server and then manage the codes that are allowed access to which doors or machine tools via a google doc spreadsheet!
We've been using this system for well over a year now and it works really well.
In terms of hardware you need to make a door work?
Connect it all up to the relevant headers/connectors and you have an access control system ready to go.
You can install this on almost any door for well under $100 which beats any commercial system I have seen. If you are wanting to control access to a machine or something other than a door, replace the door lock with a relay or if it's drawing less than 12V 3A you can put it straight onto the SNARC itself as the MoSFET and board will happily handle this much.
When used in machine tools there is also a header on the board for the SNARC to allow the board to be wired in parallel with the E-stop (most proper e-stop switches have low voltage contacts for this purpose) which means the SNARC knows the machine has been stopped, and can report this fact back to the server. Useful from a data logging point of view. In an access control scenario this also makes a great place to put a "Request Exit" button as it's connected to an interrupt internally and thus the micro-controller can be programmed to give it absolute priority.
There's also 6 spare GPIO not used for any on-board functions that can be used to wire in extra sensors/buttons etc. It wouldn't be hard to wire a small LCD into it if you wanted to have that sort of feedback as well!
Where can I get one?
Or you can find all the files to make your own here
So where to now?
Well now that I have proved the design is sound I plan on making other versions of the board with more advanced features. Things like PoE, onboard Real Time Clock, Integrated RFID reader, Battery charger for battery backup, etc, etc.
I also have a number of other boards I am working which I may post up threads about if there is enough interest and if I have time in between working on these ones.
So please, ask questions, provide feedback, let me know what you'd like to see on future versions etc and I will do my best to accommodate, but please keep in mind I do this first and foremost as a hobby and am almost entirely self taught.
These, in no particular order, are the people who have helped me with this board, in either monetary, advice or other ways. There are a lot of you so if I haven't mentioned you here I apologise profusely, feel free to contact me if you think you deserve to be here.