Part 2 – Software Setup
After installing Raspbian Buster Lite to a MicroSD, insert the SD into the PI and boot the PI. You will need to be using a USB TTL adapter or have a screen attached to continue with the following steps. Check out this section for more information
Now, we can begin installing the delta5 software and dependencies. Firstly we enable I2C and SPI interfacing on the PI. Navigate to interfacing options and enable I2C and SPI. Also, we need to connect to a wifi network if you are not using a ethernet cable. Enter the raspi configuration setup.
Enable the I2C, SPI and SSH options and complete the wifi setup wizard.
With that complete, test your internet connection. You should be able to ping google.com and get a reply. Hit ctrl+c to stop the reply. Note the IP address may be different in your case.
Pinging google.com [184.108.40.206] with 32 bytes of data: Reply from 220.127.116.11: bytes=32 time=28ms TTL=52 Reply from 18.104.22.168: bytes=32 time=29ms TTL=52 Reply from 22.214.171.124: bytes=32 time=29ms TTL=52 Reply from 126.96.36.199: bytes=32 time=28ms TTL=52
Now that we have an active internet connection, we can go ahead and update the packages. Run the commands independently.
sudo apt-get update sudo apt-get upgrade
Now we install the supporting packages for delta5 such as python and GPIO support.
sudo apt-get install python-dev python-rpi.gpio libffi-dev python-smbus build-essential python-pip git scons swig
Now we install the python interface.
sudo pip install cffi
In this next step we will update the I2C baud rate to allow uninterrupted communication over the I2C bus.
sudo nano /boot/config.txt
At the bottom of the config.txt we add the following lines.
Now we will clone the latest version of RotorHazard from github. First we navigate to the home directory, and clone the ZIP file containing the installation files and then we unzip it. We then move the newly extracted folder name RotorHazard v1.1.x to a new folder named RotorHazard with out the version prefix. And lastly, we will remove the downloaded ZIP file containing the installation files. Issue each command separately.
cd ~ wget https://github.com/RotorHazard/RotorHazard/archive/2.1.0-beta.1.zip -O temp.zip unzip temp.zip mv RotorHazard-2.1.0-beta.1 RotorHazard rm temp.zip
Now we navigate to the /home/pi/RotorHazard/src/server and we begin installing the web server packages and creating the python scons. All installation variables are stored in the requirements.txt. This process can take up to 30 minutes to complete so be patient 🙂
cd ~/RotorHazard/src/server sudo pip install -r requirements.txt
Once installation is complete, we give the entire server directory full read, write and execute permissions. Again, issuing each command individually.
cd ~/RotorHazard/src sudo chmod 777 server
Now, using systemctl we create a service to run the delta5 server on boot.
sudo nano /lib/systemd/system/rotorhazard.service
[Unit] Description=RotorHazard Server After=multi-user.target [Service] WorkingDirectory=/home/pi/RotorHazard/src/server ExecStart=/usr/bin/python server.py [Install] WantedBy=multi-user.target
Push Ctrl + x to save the document and update the permissions on the newly created script.
sudo chmod 644 /lib/systemd/system/rotorhazard.service
we need to reload the systemctl daemon and enable to newly created script to run with systemctl. Again, issuing each command individually.
sudo systemctl daemon-reload sudo systemctl enable rotorhazard.service
Lastly, we need to install the rpi_ws281x library for LED support. This is now mandatory for the timer to run correctly from 2.0 upwards.
cd~ sudo git clone https://github.com/jgarff/rpi_ws281x.git cd rpi_ws281x sudo scons
now install python
cd python sudo python setup.py install
And now, we need to update the rpi_ws281x library to the latest version.
sudo pip install --upgrade rpi_ws281x
Now, we are ready to attempt to run the delta5 service manually to check for errors and make sure all nodes are detected. In part 3 of this post I will go over manual starting of the service, resolving common errors and also list references and files for download.