How to setup and use Backup Sunlight (Raspberry Pi)

The following information is useful for when you are operating the Raspberry Pi, specifically if you are integrating with another system.

Step-by-step Guide

  1. Setup the Pi
    1. IF DEBUGGING Use an external monitor connected to the Pi via HDMI cable to view the start up process for the Pi. This is done to ensure there are no errors, warnings, or issues with the Pi or any files on it.
    2. To power on the Pi use a 12v power supply connected to wall power and a 12v voltage converter. Connect and use the two leads (positive and negative) connected to the power supply and feed them into the voltage converter. On the other side of the voltage converter, insert the USB and connect it to the Pi. 
    3. Connect the CAN wires or any other wires needed for integration or testing. The two wires (yellow and green) should go in the CAN1 high and low ports
      1. High = Yellow
      2. Low = Green
    4. After powering on the Pi wait about 30 - 60 seconds to allow it to start up correctly. (See the common issues section for more details on troubleshooting)
    5. IF DEBUGGING SSH into the Pi using the command "SSH pi@raspberrypi.local"
      1. Password: pi
    6. If you need to turn off the Pi use the command: 
      1. sudo shutdown now

  2. Setup the server
    1. Clone the DataAcquisition repo if you have not already done so.
    2. Ensure you have Docker Engine installed and running.
    3. Check the Ethernet IPv4 address of the server
    4. In docker-compose.yaml, look under “services”, “app”, and then “ports”. The port listed should match the Ethernet IP address of the server. If it does not match, update the code and save before building.
    5. Open the Data Acquisition directory in the terminal and run the command "docker compose up"
      1. If you do not have the containers in your docker yet the command will install them for you. After the process finishes installing make sure the containers are running
    6. The server must be running before any code on the Pi is run. This is because the Pi will be looking for a server to send data to and if the server is not setup it will cause an error
  3. IF DEBUGGING Setup Mutagen (syncs files from your laptop to the Pi)
    1. Download the latest version of mutagen from: "https://mutagen.io/documentation/introduction/installation"
    2. Create a mutagen session from the DataAcquisition/BackupSunlight directory 
      1. In a terminal use the command to create a session:
        1. mutagen sync create --name=backup-sunlight . pi@raspberrypi.local:~/DataAcq-BackupSunlight
      2. See Other useful information > Mutagen Commands for more information on how to use Mutagen
  4. Opening the Influx database
    1. Once docker is running it exposes the services on the following ports. Just type them into a web browser to access it:

      1. localhost:8086 
    2. Username: admin
    3. Password: lhr-pi
  5. Opening the dashboard (on grafana)
    1. After the docker containers are running you can open the dashboard by pasting the following in a web browser:
      1. localhost:3000
    2. Username: my-user
    3. Password: my-password

Other useful information

Mutagen commands

  • Create a session: mutagen sync create --name=<session_name> . pi@raspberrypi.local:~/<directory to sync files>
  • Pause a session: mutagen sync pause <session_name>
  • Terminate a session: mutagen sync terminate <session_name>
  • See all current mutagen sessions: mutagen sync list


Note: Before uploading or deleting files on the Pi make sure to pause or terminate the mutagen session to avoid issues.

Previous Issues and possible solutions

On startup issue: ipconfig_script.sh: command not found

  • This was an issue with some files not being 
    • Solution was to add a dos2unix to “./home/pi/DataAcq-BackupSunlight/ipconfig_script.sh”

Most issues can be resolved by turning off the Pi and turning it back on.