Document usage of control server and added example systemd unit

This commit is contained in:
Gregor Riepl 2021-01-31 16:56:47 +01:00
parent d5713b5e43
commit d9f2166259
2 changed files with 55 additions and 5 deletions

View file

@ -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 diagrams, printed circuit board layouts and source code for anyone to use and
modify. Refer to the LICENSE file for details. 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 (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. 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. 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, This module requires firmware. Connect an Atmel programmer to the ISP header
change into the firmware directory `feedback/firmware/` and run: of the feedback board, make sure the programming jumper is shorted and run:
```shell ```shell
cd feedback/firmware/
make flash make flash
``` ```
@ -77,10 +78,11 @@ make flash
Interface between CAN bus and power board. Interface between CAN bus and power board.
This module requires firmware. Connect an Atmel programmer to the ISP header, This module requires firmware. Connect an Atmel programmer to the ISP header
change into the firmware directory `poweriface/firmware/` and run: of the poweriface board, make sure the programming jumper is shorted and run:
```shell ```shell
cd poweriface/firmware/
make flash make flash
``` ```
@ -92,6 +94,43 @@ Environment sensor interface.
Wring schema of the old vending machine. 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 ## Bus
### Topology ### Topology

11
uncanny/uncanny.service Normal file
View file

@ -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