- Python 34.6%
- Prolog 33%
- JavaScript 17.2%
- HTML 11.1%
- TeX 2.8%
- Other 1.3%
|
|
||
|---|---|---|
| certificates | ||
| docker | ||
| htdocs | ||
| protocol_latex | ||
| python_scripts | ||
| schematic | ||
| .gitignore | ||
| cheat_sheet.md | ||
| LICENSE | ||
| mqtt__protocoll.xls | ||
| README.md | ||
| start-uwrhorn-in-chromium.sh | ||
| update-horn-software.sh | ||
Underwater Rugby Horn
Program for the time and sound management of an underwater rugby game. It is intended to run on a RaspberryPi.
Discord Server
Please join our Discord server if you have any questions or just want to get in contact:
UWR Horn Discord Server
Installation, startup and updating
Installation steps are described in the project's wiki:
https://gitlab.com/UnderWaterRugbyHorn/uwrhorn/-/wikis/Installation#software-installation
How to update is described there as well:
https://gitlab.com/UnderWaterRugbyHorn/uwrhorn/-/wikis/Installation#software-updates
Set up raspberry pi from scratch
- download current version of raspbian: https://www.raspberrypi.org/downloads/raspbian/
- Recommention: Use the version with x-server, but without extra software, ie. the middle one in size.
- Follow the install guide on the download page.
- in short:
unzip -p <downloaded raspbian file>.zip | sudo dd of=/dev/sdX bs=4M conv=fsync - Useful commands:
lsblk -p,sudo umount /dev/sdX
- in short:
- Insert SD card into RPi. Redo the previous step, it boot up fails.
- Connect Display and keyboard.
- Connect power supply to boot up RPi.
- Select country and language.
- Select password for user pi.
- Tip: It may still be US keyboard layout, so unhide the password
- Select WiFi network and connect to it
- Tip: It may still be US keyboard layout, so unhide the password
- Update the RPi.
- Reboot the RPi.
- Open RPi Configuration:
- System -> Hostname: uwr
- Interfaces -> SSH: Enable
- Interfaces -> I2C: Enable
- Localisation: Choose keyboard layout
- Load clock module by adding to the end of the file
sudo nano /boot/config.txt
dtoverlay=i2c-rtc,pcf8523
https://pimylifeup.com/raspberry-pi-rtc/
- Reboot RPi again
- From here on you can also input all the commands via ssh
ssh pi@uwrorssh pi@uwr.local- if the hostname
uwrcannot be resolved, sometime reboot the RPi helps, or add the ip of the RPi to your /etc/hosts
- Follow the general UWR Horn installation instructions: https://gitlab.com/UnderWaterRugbyHorn/uwrhorn/-/wikis/Installation#software-installation
- Autostart browser in fullscreen:
add the followin line to the end of the filesudo nano /etc/xdg/lxsession/LXDE-pi/autostart:@chromium-browser --start-fullscreen --disable-restore-session-state https://localhost/private/controller.html
Set up uwr router
The following settings create two WiFis, uwr and uwr-admin. Both WiFis can connect to the RPi. It can be reached under uwr.de The WiFi uwr is open, ie. it has no password. The WiFi uwr-admin is password protected. There is also a possibility to add a local router to the ethernet port Wan. If the local router has an internet connection, both the RPi and everyone connected to uwr-admin will have internet access as well. Everyone connected to uwr will not have internet access.
If someone us connected to one of the WiFis with a smartphone, she or he needs to switch off mobile data. Otherwise a connection cannot be established.
- Connect 5V power supply.
- Connect RPi to
LANethernet port. - Open a browser on the RPi and go to the address
192.168.8.1. - Select language and router password.
- Go to
INTERNETsettings:- Confirm that in the box
cablethe textNo cable detected in WAN. ...is present. - Connect ethernet cable from you local router to the
WANethernet port on the uwr router. - select
DHCP.
- Confirm that in the box
- Go to
UPGRADE:- If it is possible to update the router, do so. Then start from the beginning.
- Go to
WIRELESSsettings and set them as follows:- 2.4G WiFi:
- SSID:
uwr-admin - Set password
- SSID:
- 2.4G Guest WiFi
- SSID:
uwr - WiFi-Security:
OPEN
- SSID:
- Switch both WiFis on.
- 2.4G WiFi:
- Go to
MORE SETTINGS->Advanced. - Type in the router password in the new tab.
- Go to
System->System:- Set hostname to
uwrrouter. - Click and
Save & Apply. It might take a moment before you can reach the interface again.
- Set hostname to
- Open a console in the RPi and type
ifconfig eth0. - Remember the 12 numbers and letters behind the word ether.
- In the advanced settings go to
Network->DHCP and DNSand thenGeneral Settings:- At the bottom add a static Lease:
- Hostname:
uwr - MAC-Address: Select the numbers and letters you remembered in the console.
- IPv4-Address:
192.168.8.2 - Lease time:
infinite - Leave the last two options blank.
- Hostname:
- Click
Save & Apply.
- At the bottom add a static Lease:
- Go to
Network->Hostnames:- Change
console.gl-inet.comtouwrrouter.de. - Add another hostname:
- Hostname:
uwr.de - IP Address:
192.168.8.2
- Hostname:
- Click
Save & Apply.
- Change
- The last two steps can also be done for a Wi-Fi printer.
- Go to
Network->Firewall:- In the tab
General Settings:- At the bottom click
Editin theguestzonerow. - In the
destinationfield changewanto onlylan. - Click
Save & Apply.
- At the bottom click
- In the tab
Port Forwards:- Add the first new port forward:
- Name:
wan_http - Protocol:
TCP + UDP - External zone:
wan - External port:
80 - Internal zone:
lan - Internal IP address:
192.168.8.2 - Internal port:
80
- Name:
- Add a second with the Name
wan_mqttand port1883. The rest is the same. - Add a third with the Name
wan_websocketsand port1884. The rest is the same. - Add a fourth with the Name
wan_mqtt_secand port8883. The rest is the same. - Add a fifth with the Name
wan_websockets_secand port8884. The rest is the same. - Add a sixth with the Name
wan_sshand port22. The rest is the same. - Click
Save & Apply.
- Add the first new port forward:
- In the tab
- On your local router change the name of the uwr router to
uwr. You can find it either under the nameuwr2orGL-MT300N-V2-959.
set hardware clock
sudo date -s '2018-08-23 22:56'sudo hwclock -wsudo hwclock -r
Some networking commands
sudo raspi-configsudo iwlist wlan0 scan
see the logging info
- see complete logs of curent boot
journalctl -u uwrhorn - monitor logs live:
journalctl -f -u uwrhorn - between some time:
journalctl --since "2015-01-10" --until "2015-01-11 03:00" -u uwrhorn
if internet is needed
The raspberry pi can be conected to the internet either via the router'S WAN port or via WIFI. Choose one one the following methods:
- Connect WAN of UWR-router to a local network with an internet connection.
All users connected to theuwr-adminWLan network will then have internet acces as well. All users connected to the openuwrWLan networw will not have access. - Connect to a WLan and switch off the ethernet connection
- Use the touch screen to connect to a WLan
- SSH into the raspberry:
ssh pi@uwr.local - Switch off ethernet:
sudo ifconfig eth0 down - Reconnect ethernet after you are finished:
sudo ifconfig eth0 up
- Change the routing metric
- Run
ip route showand remember the ip of the wlan0 gateway - Add a new default route with lower metric then eth0:
sudo ip route add default via 192.168.10.1 metric 101
- Run
- Last time I tried this didn't work
- Add
8.8.8.8to/etc/resolve.confon pi - https://netbeez.net/blog/linux-how-to-resolve-a-host-and-test-dns-servers/
- Add
images of SD card
lsblksudo dd if=/dev/sdc | pv -s 15G> backup.imgtruncategzip- as su:
cat backup.img.gz | gunzip | pv -s 9G | dd of=/dev/sdc
printer
- printer port: uwr.local:631
- set default printer
- find printers: lpstat -p -d
- set default: lpoptions -d
- test printer: lpq
delete persistence file
Persisitance is currently switched off!
sudo rm /var/lib/mosquitto/mosquitto.dbsudo service mosquitto restart
Client Certificate UWR
This is not used anymore!
- create new client cert
openssl genrsa -out alice.key 2028 openssl req -new -key alice.key -out alice.csr openssl +509 -sha256 -req -in alice.csr -out alice.crt -CA /etc/apache2/ssl/server.crt -CAkey /etc/apache2/ssl/server.key -CAcreateserial -days 9999 openssl pks13 -export -out alice.pfx -inkey alice.key -in alice.crt - use this client cert
client_uwrhorn.pfx- passwort:
uwrhorn
accept cert in firefox:
This isn't necessary any more!
- accept cert
- settings -> advanced -> view certs
- install client.cert
- find CA uwr.local
- allow everything for this CA
mosquitto commands
- remove a retained message:
mosquitto_pub -h uwr -u "GameController" -P "<password>" -t "command/answer" -r -n - listen to all messages:
mosquitto_sub -h uwr -u "GameController" -P "<password>" -t "#" -v