Table of Contents
RFID Door System
Overview
Quelab now has an electronic sign-in system for members. There's a hom^H^H^H Quelab-made system with an RFID reader in the window to the left of the front door, and we'll be giving everybody RFID keys.
Signing In
To sign in, put your key on the window in front of the reader, and hold it there until the green light appears (it will take about one second). A half-second later the door will unlock, so you don't need to enter the door code to get in. The light will stay lit for five seconds, and when it turns off, the door will re-lock (unless the knob inside is set to keep the door unlocked).
If you get a red light instead, it means we don't like you anymore. Remember to pay your monthly dues, and we'll like you again. Also, the yellow light flashes continuously while the reader detects any key in range. If the yellow light isn't flashing, then the reader doesn't see your key, so you'll get neither a red nor a green light. This can happen if you're wiggling your key; the reader can only detect it if you hold it still.
Until you get your key, you can still use the door code to get in. When you get your key, if you have any problems with it, then use the door code, sign in on the paper sign in sheet, and report to me so I can try to figure out what's wrong.
Besides logging electronic sign-ins, the system also logs when the door is locked and unlocked (using the door code, the knob inside, or the RFID system) and opened and closed. It also has a network connection, so we can get daily reports of sign-ins for accurate accounting of Quelab member traffic, set it to make noises or email the facilities manager if the door is left open or remains unlocked after 10pm, etc.
Maintenance
Member Maintenance
For Geoff, or whoever registers new members:
- The system automatically records every RFID key it reads.
- When new members sign up, give them keys, then edit the database to assign their names to the keys and mark the keys as authorized for entry.
- When members fail to pay their monthly fees, mark their keys as unauthorized. When members lose their keys, mark the keys as unauthorized, and issue new ones.
Registering a New Key
- Hold the key in front of the reader. You'll get a red light.
- On the sign-in laptop, press ctrl-alt-F7.
- Log in with username doorctrl. There's a database editor already running.
- Select the RFID_tags table, and select the row with the tag number that matches what's printed on the key.
- Enter the member's name in the username field
- change the authorized field from 0 to 1
- Select the Events_24hrs table, then Press the WRITE CHANGES button near the top.
- Move the mouse to the terminal window at the bottom, press the keyboard up arrow to select the xscreensaver lock command from the command history, and press enter to lock the console for doorctrl.
- Press ctr-alt-F5 to switch back to the display of sign-ins during the past 24 hours (it runs under username quelab, and remains unlocked even when you lock doorctrl).
- Have the member try the key, and make sure he gets a green light and his name appears on the display.
VERY IMPORTANT
- after making any edits, you MUST press WRITE CHANGES in the database editor.
- All RFID keys are disabled while you're editing the database until you write the changes.
- If you get a flashing yellow light but no red or green light when you try a key, check whether the WRITE CHANGES button is enabled, which means you have unwritten changes.
If you need to register multiple keys, you can hold them all in front of the reader one at a time, then authorize them all and enter all the usernames, then write all the changes at once, to save time. You can also log in to the laptop on the network with username doorctrl and edit Quelab_entrance_public.db using whatever editor you want. Do that also if you want to automate revocation of authorization for lack of payment.
Technical Details
The obsolete Thinkpad T43 by the door was buried under junk and had a thick layer of dust on it when I found it in the shop last week. It now serves several useful functions:
- A display to replace the paper sign-in sheets, so everybody can still see who signed in during the past 24 hours
- A battery back-up for the RFID entry system
- The access control database
- A database editing terminal
- The network interface
It's configured to allow public read-only access to the database. Log in to the laptop1) , and read the Sqlite3 database file /home/doorctrl/rfid_iface_arduino/Quelab_entrance_public.db using sqlitebrowser or whatever else. Editing requires logging in with username doorctrl and a password that I'm giving to Geoff. 2)
In addition to the ID that's printed on the key and transmitted to the RFID reader, each key also has a code that's transmitted to the reader but not printed on the key. Our system stores the code in Quelab_entrance_secret.db, which is readable only under username doorctrl, and verifies the code when reading a tag. This means if you try to clone a key just from the printed ID, you won't have the right code, and the system will detect that the key is counterfeit. The table Counterfeits_read records what its name says, and presumably we'll want the system to email the facilities manager if anything ever appears in it.
Source code for the Arduino firmware, the host computer's control program, and the display program are in /home/doorctrl/rfid_iface_arduino/ and are publicly readable. I'll draw a schematic for the hardware, maybe later today. I jerry-rigged a temporary contact switch last night for detecting when the door is open, but Anders is going to replace it with something less embarrassing. However, the scotch tape on the circuit board is intended to be permanent because scotch tape is awesome. Every Arduino I've ever built into anything, including my keyboard, is still held in place with scotch tape. Scotch tape is in fact far better than Arduinos, though that isn't saying much.