Simple NetworkAble RFID Controller Hardware by Lawrence ( Lemming ) Dixon Software (mostly) by David ( Buzz ) Bussenschutt For up-to-date information, please visit the homepage here: http://www.hsbne.org/projects/SNARC Please be aware this is still under active development and may change at ANY time. ------------------------------------------------------------------------------ HARDWARE ------------------------------------------------------------------------------ SNARC is a board developed by Lawrence "Lemming" Dixon for HSBNE and for other people or groups who are interested in a cheap and easy to implement RFID based access control system. The board is designed to be as simple as possible to implement, but also as flexible as possible. It uses an ATMega 328p micro-controller hooked to a Wiznet wiz820io Ethernet module. All the pins of the ATMega are either used on-board for various functions or broken out to various headers around the board. Functionally the board is very similar to an Arduino, it can be used for a basic locally authenticated RFID system, or it can be a fully networked access control system with other sensors attached to the board for data logging or environmental monitoring. The board is also quite small at 40mm x 65mm (some components overhang the edges slightly) Approximate height of the board is about 25mm to the top of the tallest component. The on-board functions are: ATMega 328p Micro-controller with 32KB Flash, 2KB SRAM and 512B EEPROM. Same as the one on an Arduino Socket for Wiz820io SPI Ethernet Module. This module uses the newer W5200 chip from Wiznet, it is implemented in the same fashion as the Arduino Ethernet shield. Please be aware there is a newer library for it. It's attached at the bottom of the page. Pins 5, 15, 16, 17, 18 & 19 are connected (Arduino pins 3, 9, 10, 11, 12 & 13) to the two sockets for this module. Pin 5(D3) is used as an interrupt to allow the Ethernet module to signal that there is traffic waiting. Pin 15(D9) is used to optionally power down the Ethernet module if you want to. Pins 16, 17, 18 & 19 (D10 - D13) are the SPI pins used for serial communication with the module. N Channel MOSFET output on pin 6 of the ATMega, if you are using the Arduino IDE it is Digital Pin 4. This is connected directly across the main power rails on the board, so will switch the input voltage (Vcc) across the 2 pins on the screw terminals. There is a 1n4004 Diode behind this to catch any inductive spikes at switch off. TTL serial header for an RFID reader or other TTL serial device. This is attached to the UART on the ATMega. If you need to use these pins for another purpose, RX maps to pin 2/digital pin 0. TX maps to pin 3/digital pin 1. Status LED's. There are two Charlieplexed Status LED's on the board. 1 Red and 1 Green. These are attached to pins 11 and 12. These map to Digital pins 5 and 6 for an Arduino. You turn on the respective LED's by writing 1 pin high and the other low. Writing pin 6 high and 5 low will turn the Red LED on, writing pin 5 High and pin 6 low will turn the Green LED on. E-Stop header. This is attached to pin 4/Digital pin 2. This is for using the board in an access control scenario in a machine shop. Pin 1 is connected to one of the two interrupt pins on the ATMega to allow it to be used to interrupt other operation and switch things off as fast as possible. The 2nd pin is connected to ground. You will need to write the pin high after setting it as an input so the internal pull up resistor is enabled in the ATMega. Pin 1 is marked with a small "1" on the board. On-board Vreg's. There are two voltage regulators on the board, one 5v running off the main power rail, and one 3.3v running from the output of the 5v regulator. The 5 volt regulator is designed for a wide input voltage and can handle upto 24v input, but will need to be heatsinked at anything above 12v. It is capable of upto 2A, but this varies with the input voltage. The 3.3v regulator is rated to 1A, but please keep in mind this is being drawn from the 5V line. Power needs for the board about 400mA on the 5v line, 200mA of this is to run the Ethernet module. These voltages can be accessed at the marked Vio header, there is also 5v on the ICSP & RFID headers. ICSP header. This can be used to program the board and is used to load the Arduino bootloader on to the board at manufacturing time. This can also be used to access the SPI bus, Pin1 is marked with a small "1" on the board. GPIO Headers. There are two headers on the board with access to spare GPIO pins. These are the "D7 D8" header located between the ICSP header and ATMega. and the "AREF - A5" header located between the screw terminals and the ATMega. These map exactly as the names would suggest. AREF - A5 is connected to the 6 ADC pins on the ATMega, the first pin of this header is also the AREF pin. Pin 1 is again marked with a small "1" on the board. The analogue pins are here only as a convenience, I would not recommend relying on them for supreme accuracy. They can also be used as digital IO pins. Reset button. This should be pretty self explanatory, this will reset the ATMega and the Wiz820io module at the same time. ------------------------------------------------------------------------------ SOFTWARE ------------------------------------------------------------------------------ This *software* is released under the GNU GPL V2 or later. There are currently three different possible "usage" scenario/s supported by this formware: Overview: (1) Standalone system, with fixed list of pre-programmed keys. Static key-list is programmed at the same time as the firmware. (2) Standalone system, with "console" interface that allows programming new key/s on-demand via the USB inteface. (3) Network-enabled system, which queries a centralised "authentication server" ( written in PHP or similar ) on demand to verify key/s, and cache/s them locally after first use for reliability. Standalone (1): NOTES for manually managing keys inside this sketch, and programming them all at once. : (a) you can manually add a LOT of key assignment/s to the list of permitted keys near the bottom of this file ( search for "CODE LIST" ) (b) upload the revised code to the door via arduino (c) connect to the door via USB, enter programming mode as instructed, and type "w" into the programming mode. ( "w" writes all hard-coded keys from the script to the EEPROM ! ) Standalone (2): Keys are individually re-programmed via a USB cable: (a) connect a Serial console ( like the Arduino Serial Monitor ) to the RX/TX pins. (b) to enter "programming" mode, press reset on the board, and then quickly ( within 3 secs ) send a few keystrokes of data over the serial link , then ENTER( doesn't matter what you type before [enter]) Once in programming mode: (c) 'i' to initialise and wipe the eeprom ( you must do this the first time you use it) , this clears all previously programmed codes, so be warned! (d) 'r' to read existing eeprom key list and show them on-screen ( do not use this on a freshly programmed new device or it will hang, use the 'i' command first! ) (e) 'n' to program new a key to EEPROM. (f) 'x' to exit programming mode ( or press reset button again) Network-Enabled (3): * After each user swipes their card against the reader, the device scanns the EEPROM cache, and if the key is "known" from previous usage, it is permitted entry. * If there is no record of the card, a HTTP query is performed to the "authentication server" ( which is just a URL on the local subnet). * The "server" responds with the "access" level/s that the key has, and if it matches the local door, then the key is both permitted entry, and cached in the EEPROM for later re-use. * All that is required for this server is a web server like "apache", and a simple PHP script that recieves a keycode from the client, and tell the client that key/s permissions. * Example PHP script/s are available in the "server" folder, and these require the keys/permissions to be stored on-disk in JSON format. * Getting you user/key/authentication data onto your "server" can be as simple as writing your own web-gui, or having a "google docs" spreadsheet that auto-downloads to the "server" as required. ( we do this, and it works well ) . Example Workflow including an authentication server - programming new keys might be done like this: (1) record new key assignment ( ie key number, and persons name) in your private "docs" spreadsheet: (2) press the "Report to Auth Server" -> Do it Now" button. Done! (3) the next time the new person goes to use the door, it will be 5 second approx delay as it pulls the data from the server, and writes it to the EEPROM automatically. After that it's fast. TODO: (4) we'd like to make each door so it can have a revised "permitted keys list" pushed to it from the server at any time, but at the moment, the system is a "pull", not a "push". (5) the code to revoke keys over the network from the "permitted" list is non-existnat at the monent, this must be done by wiping the eeprom over the USB connection for now.