If multiple devices are connected to a raspberry pi, at some point the devices may switch USB ports due to inevitable manual reconfiguration of the raspberry pi setup. It is then important for the raspberry pi to specifically identify devices no matter which USB port they are plugged into. To perform this:
You should now have created a universal link to your device. Add this link to relevant programs as needed. To check this:
Note, this method may not work if connecting multiple devices using identical converters/cords that do not have accessible serial numbers.
The December 2023 MetTrailer /etc/udev/rules.d/10-usb-serial.rules file is:
SUBSYSTEM==“tty”, ATTRS{serial}==“A9HL1DV3”, SYMLINK+=“ttyUSB_Gillsonic_MetTrailer”
SUBSYSTEM==“tty”, ATTRS{serial}==“A9N4KUII” SYMLINK+=“ttyUSB_VaisalaWXT536”
SUBSYSTEM==“tty”, ATTRS{serial}==“A928AYH7”, SYMLINK+=“ttyUSB_YoungPressure”
SUBSYSTEM==“tty”, ATTRS{serial}==“A1056QAY”, SYMLINK+=“ttyUSB_CS125”
SUBSYSTEM==“tty”, ATTRS{serial}==“DN02E2J3”, SYMLINK+=“ttyUSB_IMetXQ2”
To start all acquisition programs manually, the {ADPAA_DIR}/src/acquire_python/start_all_MetTrailer script is available. However, the system is setup to run programs upon startup without having to manually startup each program.
Automatic Startup of Programs using startlxde-pi. Best to place files in ~/.config/autostart than in /usr/bin/startlxde-pi:
Note, this process only works for Raspberry Pi's that are attached to monitors or some visualization interface. Not headless.
The December 2023 MetTrailer /etc/xdg/lxsession/LXDE-pi/autostart file include the following at the end:
If you want to run python programs upon startup and show the output of each program in a separate terminal:
Sources:
1. If Xterm isn't installed, use the following command
sudo apt install xterm -y
2. Make the following directory using the following command
mkdir /home/pi/.config/autostart
3. Create and edit a .desktop file
sudo nano /home/pi/.config/autostart/PROGRAM_NAME.desktop
4. In the file, copy and paste the following
[Desktop Entry] Type=Application Name=PROGRAM_NAME Exec=xterm -hold -e '/usr/bin/python3 /home/ABSOLUTE_PATH_TO_PROGRAM/PROGRAM_NAME.py'
5. Save and exit
6. The Xterm application should now begin upon booting.
If you want to run programs without monitors or some sort of visualization interface connected upon startup: