Software
Last updated
Last updated
You don't have to program the compute module yourself, but you have to set it up. The following steps help you to setup your Tracker.
If you want to have a deeper insight in the code itself, you can find the documented code in the github repository:
Install Raspberry Pi OS Lite 64bit with the with the following settings:
Hostname: boat1.local (replace number accordingly)
Username and Password: As you like
Wlan: Use the hub network
Time/location: As you need
Power up the Raspberry Pi
Connect via SSH - ) - this extension in visual studio code cold make you life easier.
Update and upgrade: sudo apt-get update && sudo apt-get -y upgrade
Reboot with: sudo reboot
Install the python3-venv:
Activate the environment with: source codeenv/bin/activate
pigpiod itself is a daemon that provides low-level access to Raspberry Pi’s GPIO pins. Paste the following code in the terminal:
Open rasp-config with: sudo raspi-config
Select: “Interface options” > “I2c” > “Activate i2c” _> yes
Exit raspi-config
Open the firmware configuration file with: sudo nano /boot/firmware/config.txt
Search for the "dparam" line
Uncomment the line by removing the hashtag
Add the following, so it looks like this: → changing from 400khz to 100khz:
dtparam=i2c_arm=on,i2c_arm_baudrate=100000
Reboot with: sudo reboot
Install git with: sudo apt-get install git
Clone the repository: git clone https://github.com/oliverheisel/DataDrivenSailing.git ddsrepo
Copy the code that we need to where we need it: cp -r ddsrepo/Tracker/Software/code /home/globaladmin/code
Remove the rest: rm -rf ddsrepo
Install all required packages:
Go to the folder with: cd code
Install the packages: pip install -r requirements.txt
Open the code configuration file (it is a python script, so use your ide):
/home/globaladmin/code/config/config.py
Change the hostname number accordingly (it needs to be the same as you defined in the firmware - see Task 1)
Make sure that Type = "Boat" and the others are commented out
Save and Reboot with: sudo reboot
Create new service file with: sudo nano /etc/systemd/system/startmain.service
Paste the following in the file and exit it with "Ctrl"+"X" > "Y" > "Enter"
Enable service:
Rsync uses SSH Keys to transfer the data securly.
SSH into the Hub
Create an SSH Key: ssh key authentification: ssh-keygen -t rsa -b 2048
!!! You only need to do this for the first device! It will be saved on the hub !!!
Copy the key to the Tracker (change the host accordingly): ssh-copy-id globaladmin@boat1.local
Test it (change the host accordingly): ssh globaladmin@boat1.local
-> it should work without entering a password
Congrats, you made it 🎉