diff --git a/README.md b/README.md index 97fc18a..1d9d0eb 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ All hardware and software was designed by members of diagrams, printed circuit board layouts and source code for anyone to use and modify. Refer to the LICENSE file for details. -The name "Matemat" is a portmanteau of "mate" (as in mate tea) and "automat" +The name "Matemat" is a portmanteau of "mate" (as in [yerba mate](https://en.wikipedia.org/wiki/Mate_%28drink%29) and "automat" (the German word for vending machine). The device is mainly intended to dispense mate tea based soft drinks, but may be used for other types of beverages too. @@ -66,10 +66,11 @@ End switch feedback interface. Senses the status of the end switches and sends CAN bus messages on changes. -This module requires firmware. Connect an Atmel programmer to the ISP header, -change into the firmware directory `feedback/firmware/` and run: +This module requires firmware. Connect an Atmel programmer to the ISP header +of the feedback board, make sure the programming jumper is shorted and run: ```shell +cd feedback/firmware/ make flash ``` @@ -77,10 +78,11 @@ make flash Interface between CAN bus and power board. -This module requires firmware. Connect an Atmel programmer to the ISP header, -change into the firmware directory `poweriface/firmware/` and run: +This module requires firmware. Connect an Atmel programmer to the ISP header +of the poweriface board, make sure the programming jumper is shorted and run: ```shell +cd poweriface/firmware/ make flash ``` @@ -92,6 +94,43 @@ Environment sensor interface. Wring schema of the old vending machine. +### uncanny + +Central controller software. Has a simple HTTP API for controlling output and +checking the current fill status of each slot. + +Written in Go, must be compiled before use: + +```shell +cd uncanny/ +go build ./cmd/uncanny +``` + +The resulting `uncanny` executable should be running on the controlling +Raspberry Pi. An example SystemD unit is provided in `server/uncanny.service`. +Copy `uncanny` to `/usr/bin`, install the service file to +`/lib/systemd/system/uncanny.service` and enable it with: + +```shell +cd uncanny/ +cp uncanny /usr/bin/ +cp uncanny.service /lib/systemd/system/ +systemctl daemon-reload +systemctl enable uncanny.service +``` + +A working CAN bus is required to run `uncanny`. You need to make sure the bus +is initialized at boot. On RaspberryOS/Raspbian/Debian, this can be achieved +with the following lines in `/etc/network/interfaces`: + +``` +auto can0 +iface can0 inet manual + pre-up /sbin/ip link set $IFACE type can bitrate 125000 loopback off sample-point 0.75 + up /sbin/ip link set $IFACE up + down /sbin/ip link set $IFACE down +``` + ## Bus ### Topology diff --git a/uncanny/uncanny.service b/uncanny/uncanny.service new file mode 100644 index 0000000..d505e5b --- /dev/null +++ b/uncanny/uncanny.service @@ -0,0 +1,11 @@ +[Unit] +Description=Matemat control server +Requires=network.target +After=network.target + +[Service] +Type=simple +ExecStart=/usr/bin/uncanny + +[Install] +WantedBy=multi-user.target