Part 3 – Starting the Services
Now we are ready to manually launch the delta5 server. We want to manually launch the service to see if there are any errors printed out or any nodes not being detected. We will do some additional configuration changes such as editing the admin username and password, and changing the default web server port.
First, lets make sure the delta5 service is not running from the previous service created in systemctl.
sudo systemctl stop rotorhazard.service
Now, lets navigate to the server directory and manually launch the delta5 server.
Now start the delta5 service.
sudo python server.py
Changing HTTP Port and Password
From the src/server directory copy config-dist.json to config.json
cd RotorHazard/src/server sudo cp config-dist.json config.json
Now edit the file
sudo nano config.json
You will see the following code, scroll down to the #General section and change the following values to your preference. Using port 80 for the HTTP_PORT will not require a port number to be defined when connecting with your web browser. Be sure to change only the values shown in BOLD below, removing any a single entry of syntax will cause issues.
5000, "SECRET_KEY": "secret!", "ADMIN_USERNAME": "admin", "ADMIN_PASSWORD": "rotorhazard",
Now hit ctrl+x and type Y to save.
Reboot the timer.
Some common issues you may run into are missing packages or database issues. If you have issues starting the delta5server, I suggest you try deleting the database file first, database.db in the server directory. To do this, make sure you are in the server directory.
sudo rm database.db
Then try restart the service. Additional common errors relate to the I2C baud rate being too high. If you are getting [Errno 121] Remote I/O Errors, this is most likely the cause. You need to change the baud rate of the I2C bus. To do this, edit your boot config
sudo nano /boot/config.txt
This will force the I2C bus to run at a baud of 75000.
Lastly, if you are getting errors relating to the Neopixel libraries being incompatible or something along those lines (cant remember the exact error), then follow the steps below.
sudo apt-get install python-dev git scons swig
cd ~ git clone https://github.com/jgarff/rpi_ws281x.git
cd rpi_ws281x sudo scons
cd python sudo python3 setup.py build
sudo python3 setup.py install
Now try launching the server again.
cd ~ cd RotorHazard/src/server sudo python server.py
Updating the Timer
To update the your installation of Delta 5, we need to remove the old directory and re clone the GIT.
cd ~ sudo rm RotorHazard
Now we re clone and unzip the new RotorHazard source. We need to find the latest version of the RotorHazard fork and replace the version in the text below before cloning. Where 1.1.2 marks the current version, visit the RotorHazard latest releases page for more information on the latest release and replace 1.1.2 with the version you want to clone. In this case we use 1.1.2, the latest version at the time this article is updated.
cd ~ wget https://codeload.github.com/RotorHazard/RotorHazard/zip/v1.1.2 -O temp.zip unzip temp.zip mv RotorHazard-1.1.2 RotorHazard rm temp.zip
Now, restart the RotorHazard service.
cd RotorHazard/src/server sudo python server.py
Additional updates to the server components can be performed by running the command below. The above method will only clone the server contents, such as the base python files and the web server files. It will not update the scons and other core server dependencies. I highly suggest doing a backup of your PI image before continuing onto this step.
cd /home/pi/RotorHazard/src/server sudo pip install -r requirements.txt
Links & References
Ready to flash Image!
Below is a image I have created which is pre-configured with the latest version of RotorHazard timer software and is also running the hostapd WiFi hotspot. This is a clean image with no errors so assuming you have all hardware setup correctly, you can flash this image to your PI SD card and just boot the race timer! Connect to it via WiFi, and browse to the IP with your web browser.
Firstly, download and install Win32 Disk Imager.
Now, before running win32, insert a blank SD Card into your computer. Now launch win32 Disk Imager.
Now, select the downloaded and extracted .img file to be flashed. Also select the path of your MicroSD card, be sure to get this right! Now hit write. This will write the image to the SD and when complete, you can just throw the SD into the PI and boot!
Pre-Build RotorHazard Image (Ready To Flash)
RotorHazard v2.0.0 Race Timer IMG – Updated 07.07.19 Version 2.0.0
Image Details (Advanced Users):
SSH Enabled I2C Enabled SPI Enabled UART 1 Enabled (Serial UART in case you f&*% something up!) Use pins 8 & 10 Hostapd configured for wlan0 only. eth0 on DHCP
Default Usernames and Passwords:
SSID: racetimer Password: rotorhazard Static IP: 192.168.10.1 Web Login: Username: admin Password: rotorhazard Web server port: 80 Raspbian SU Login (default): Username: pi Password: rotorhazard (I suggest changing this, if you have others connect to the timer as you have SSH enabled. Type passwd in CLI.)
MD5 Hash: 582e92f273df984e3ce9e8b03e4532a9
On the next page, we will look at backing up your current PI image file. If you have everything working perfectly then its a good idea to back it up before doing any major updates, or just in case your SD fails!