A new door controller, because the members area is broken and nobody can fix it
This code allows the existing door-controller2 hardware work with Nottinghack's HMS2 members area software.
- 1 - MFRC522_3V3
- 6 - MFRC522_Ground
- 15 - Door strike/latch
- 16 - MFRC522_IRQ
- 18 - LED
- 19 - MFRC522_MOSI
- 21 - MFRC522_MISO
- 22 - MFRC522_RST
- 23 - MFRC522_SCK
- 24 - MFRC522_SDA
# Installation
- Commission the raspberry pi (host) with Linux, set up SSH as desired, VDU as desired.
- Make the above wiring.
- Enable SPI and GPIO.
- Connect the host with the HMS server, if they are not on the same LAN then this is should be done using an encrypted VPN tunnel, usually openvpn:
- Install openvpn on the host.
- Generate a new client key for the host on the HMS server, this is normally done using openvpn-install.
- The configuration generated is for full-tunnel but we need split-tunel, add
route-nopull
to the config file on a new line just before the certificates. - Copy the generated openvpn config to the host at
/etc/openvpn/client.conf
, make sure the extension is.conf
. - Restart openvpn
sudo systemctl restart openvpn
(if this doesn't pick up the config just try a reboot). - Test the connection to the database:
nc -zv 10.8.0.1 3306
.
- Build the door controller (this repo):
- Install Go on your machine.
- Run
make doord
.
- Install the door controller:
- Create a user for doord to run as:
useradd -G spi,gpio doord
. - Make the logging directory:
mkdir /var/log/doord chown doord:doord /var/log/doord
- Copy
dist/etc/logrotate.d/doord
from this repo to/etc/logrotate.d/doord
on the host. - Disable login on tty1 because doord will use it:
systemctl mask [email protected]
. If you want to log in on the console you can use ctrl+alt+F2 to use the next tty. - Copy
dist/etc/systemd/system/doord.service
from this repo to/etc/systemd/system/doord.service
on the host and edit the-hms
argument inside it to be the correct DSN for the database, edit the-door
and-side
arguments to be the correct side of the correct door (these settings will eventually be in a proper config file, see #1). - Copy
doord
to the host at/usr/local/bin/doord
. - Enable doord at boot:
sudo systemctl enable doord
- Create a user for doord to run as:
- Reboot to stop tty1 login, start doord and make sure it does start on boot.