Introduction: HACCSY - Hackerspace Access Control and Check in System
HACCSY abreviation stands for Hackerspace Access Control and Check in System and that’s pretty much what it does.
HACCSY app is meant to run on a RaspberryPi that’s connected to internet and the front door electric strike lock. It does the job of a simple Check in System and Door Access Control System (2 in 1), it queries a REST service by handing it the scanned in RFID card reader and it will return ‘true’ if the key owner owes less than 2 months worth of their monthly payment. It will return ‘false’ otherwise. It does the same for checking in and out. The computer would then send the signal to the door lock actuator to open it if returned true or do nothing if false. It has a check IN/OUT button to indicate Check IN or Check OUT. It also has an LCD backlight display that displays messages for the user, and an RGB LED that turns RED for Access Denied, GREEN for Access Granted and WHITE to indicate offline mode. Through the REST API, you can also make it available for others to see if the hackerspace is open or not. See working example on the website header at www.prishtinahackerspace.org
Hardware and tools
HACCSY is built with the following hardware and electronic components:
- 2 Plastic Electrical Enclosures to place the electronics inside.
- In our case, 3 meters of UTP (Ethernet) cable
- Raspberry Pi
- USB RFID reader (hidraw0)
- AdaFruit LCD screen,
- 12V Power supply (12V LED power supply)
- 2 push buttons (Check in/out button, Exit button)
- Electric strike lock.
- N-Channel Mosfet (FK106269)
- Mosfet Resistor 1/4W ~47 kOhm
- Display Resistor 1/4W 470 Ohm
- Display Pot 10 kOhm
- 3x LED resistors ~330 Ohm
- Protection Diode 1N4007
- Snubber Resistor 100 Ohm
- Snubber Capacitor 0.47 uF 100V (not electrolytic)
We used the following tools:
- Glue gun
- Soldering iron
- Electric drill
- Box cutter
- Dremel tool
- Shear cutters
- Third hand
- Multi meter
Step 1: Prepare the Front Door Display and RFID Enclosure
- Measure your LCD Screen, and with a dremel tool cut the plastic electrical enclosure to fit the LCD screen.
- With the electric drill, drill holes for the RGB LED and the Check in Button.
- Don't forget to drill a hole in the back of the plastic electrical enclosure for extending the UTP cables inside the main box where the RaspberryPi will be.
- Dismantle the RFID USB reader, and with a glue gun attach it's components inside the plastic enclosure.
- Use the glue gun to place the LCD (after you've soldered the pins) and RGB LED in place as well
- After you're done with those, proceed with the wiring as shown in the project wiring schema built with Fritzing.
- Enforce the closure on the wall next to the door, and close it.
Step 2: Prepare the Main Enclosure
After you've extended the UTP cables wired from the LCD screen enclosure through the wall, follow the schema for wiring the following:
- Place the 5V/1A adapter for powering the Raspberry Pi,
- 12V adapter for powering the electric strike lock,
- RaspberryPi and other components with it,
- Place the Exit button in the main box like shown on the pics attached.
- Finally place the electric strike lock at the door.
Step 3: Install the Software #1
Your RaspberryPi should be running on raspbian
Install Seltzer CRM and HACCSY REST API in your remote server
Documentation for installing seltzer can be found in this link: https://github.com/elplatt/seltzer
After you're done with installing Seltzer CRM, from HACCSY github code repository proceed with installing the HACCSY REST API
HACCSY Github repository: https://github.com/PrishtinaHackerspace/HACCSY
The Seltzer PHP files (api folder) need to be uploaded via FTP to the same web server where you’ve installed Seltzer CRM. It should line up where this “api” folder is under the “crm” folder so that the URL looks like “http://yourserver.com/crm/api/query.php…..”
If you don’t want it to interface with Seltzer you could take out the part that updates the whitelist file and just populate the file manually with the valid users and their RFID serial numbers. The whitelist file should have a JSON array like this:
Then make sure to create the new tables and new columns by importing the "update.sql" file via phpmyadmin to your seltzer database.
See the documentation here for more detailed steps: https://github.com/PrishtinaHackerspace/HACCSY/tree/master/Seltzer/crm/api
An example query might be to check if a member is allowed in using their RFID scanned at the door via an RFID reader attached to a Raspberry Pi based on their payment status.
Simply read the RFID serial via a python script or similar program then put that string on the end of the URL like so:
Say the RFID reader returned this string after reading the card: 345A33008C
Then you'd stick it on the URL like this:
Then use whatever HTTP request functionality in your script to GET that URL and the response should resemble something like "true" or "false".
Then your script would be able to know immediately if it should open the door or not by turning a servo on the deadbolt or turning off the power to the electric strike lock via relay switch, etc.
Step 4: Install the Software #2
Setting up the RaspberryPi
The python files stored in the "RaspberryPi" folder go in the /home/pi folder.
There are several variables to set. They are all at the top and usually are ALL CAPS. Change these values if you need to such as the USERNAME and PASSWORD for your email server or HTTPAuth authenticating with htaccess when using REST API.
You need to run a few commands on the Raspberry Pi command line (terminal) to get it to run the Python scripts correctly.
sudo apt-get install python-dev python-rpi.gpio
Then get the AdaFruit LCD screen library and setup the I2C pins on the GPIO by following these directions:
NOTE: In our case, we have used different pins, so when testing the libraries, make sure to use our pin setup!
Finally, set up the RPi so that it runs the main python script as soon as it boots up as root user:
add this to the end of the cron:
@reboot python /home/pi/HACCSY.py & python /home/pi/Watchdog.py & python /home/pi/UpdateWhiteList.py &
@reboot bash /home/pi/WifiTest.sh
then save and exit and reboot the pi.
If you’re using a Wifi USB adapter, edit /etc/network/interfaces/ and at the wlan0 configuration add
Your configuration should look somewhat like this:
iface lo inet loopback
iface etho0 dhcp
iface eth0 inet manual
iface wlan0 inet dhcp
Here’s another tweak for the power management configuration
Create a new file:
sudo nano /etc/modprobe.d/8192cu.conf
options 8192cu rtw_power_mgnt=0 rtw_enusbss=0
then save and exit and reboot the pi.
The following should output 0 after reboot
WHOLA, WE'RE DONE!
We have a be nice policy.
Please be positive and constructive.