Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing the initialize RPi script with hardware in the loop #20

Open
2 of 6 tasks
danineamati opened this issue Feb 17, 2025 · 0 comments
Open
2 of 6 tasks

Testing the initialize RPi script with hardware in the loop #20

danineamati opened this issue Feb 17, 2025 · 0 comments
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers

Comments

@danineamati
Copy link
Contributor

Context

In PR #17, we added the initialize_rpi.sh script to set up the Raspberry Pi as a "SMesh Logger Raspberrry Pi." While we did verify that it works on the software side, there may be some hardware-in-the-loop checks that may be worthwhile to verify before any field deployment.

Please document throughout with screenshots and images!

Hardware needed for checks

  • Real-Time Clock (RTC) with clock battery
  • "Normal" Meshtastic Radio
  • Mobile device (ideally both iOS and Android devices)
  • Laptop with Raspberry Pi Imager
  • Presence in Packard

Code snips separated by Hardware-in-the-loop checks

  • Can connect to wifi automatically (e.g., EE-IoT):
    # Set up EE-IoT and SMesh phone hot spot SSID's. Give them time to connect.
    nmcli radio wifi on
    # INSERT Wifi configuration section... TODO
    nmcli connection add type wifi ifname wlan0 con-name "EE-IoT" ssid "EE-IoT"
    nmcli connection modify "EE-IoT" wifi-sec.key-mgmt wpa-psk
    nmcli connection modify "EE-IoT" wifi-sec.psk "INSERT_PASSWORD"
    nmcli connection modify "EE-IoT" 802-11-wireless.hidden yes
    nmcli connection modify "EE-IoT" 802-11-wireless-security.proto rsn
    nmcli connection up "EE-IoT"
    # currently sleeping for 15 seconds... this seems to make a difference for the time required
    # to setup the connection
    sleep 15
    • Verified 16 Feb from the third-floor bridge over the atrium. Have we tested this from a fresh Pi Image?
  • Connects to Real Time Clock:
    # Enable overlays to activate the I2C real time clock and
    # the shutdown/reboot switch on GPIO 3 (pin 5). If no RTC available, will throw no issues
    sudo echo -e "\ndtoverlay=i2c-rtc,ds1307\ndtoverlay=gpio-shutdown,gpio_pin=3\n" | sudo tee -a /boot/firmware/config.txt
  • Verify that the swap is set correctly:
    # Setup swap space to be 1G
    # turn off swap file such that we can change it
    sudo dphys-swapfile swapoff
    sudo sed -i '0,/^CONF_SWAPSIZE=/s/^CONF_SWAPSIZE=.*/CONF_SWAPSIZE=1024/' /etc/dphys-swapfile
    sudo dphys-swapfile setup
    sudo dphys-swapfile swapon
    # TODO: LED showing RPi running https://drive.google.com/file/d/1JKwW2ykTD3mngxr49Tp5c5CxWLDgQb8F/view?usp=share_link
    # Change swappiness from a default of 60 to 1to decrease swap activity to preserve the life of the SD card
    sudo echo -e "vm.swappiness=1\n" | sudo tee -a /etc/sysctl.conf
  • Meshtastic radio gets properly configured:
    # Initialize the radio (if connected)
    python -m meshtastic --configure /home/pi/Documents/smesh/firmware/build_1_config.yaml
  • Commands are correctly added to cron and are run at reboot (i.e., rather than immediately):
    # Set up the logger script, which will run automatically each time the RPi boots
    echo "$(echo '@reboot source /home/pi/.bashrc; cd /home/pi/Documents/smesh/snode; python scripts/rpi_logger.py /dev/ttyUSB0 >> data/rpi_stdouterr.txt 2>&1' ;) " | crontab -
    crontab -l
  • SSH to pi is functional through pi hotspot:
    # WiFi hotspot to SSH into RaspberryPi
    # TODO, come back and make this where it won't recreate this wifi network
    sudo nmcli con add type wifi ifname wlan0 mode ap con-name 'accesspoint' ssid "smesh_INSERT_NAME" autoconnect true
    sudo nmcli con modify 'accesspoint' 802-11-wireless.band bg ipv4.method shared ipv4.address 192.168.6.1/24
    sudo nmcli con modify 'accesspoint' ipv6.method disabled
    sudo nmcli con modify 'accesspoint' wifi-sec.key-mgmt wpa-psk
    sudo nmcli con modify 'accesspoint' wifi-sec.psk "smesh1234"
    sudo nmcli con up 'accesspoint'
    • Verified 16 Feb using the Terminus App on Pixel 6a. Have we tested on an iOS device?
@danineamati danineamati added documentation Improvements or additions to documentation good first issue Good for newcomers labels Feb 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant