-
Notifications
You must be signed in to change notification settings - Fork 0
BeagleBone Black Environment Setup
###Dependencies
Download the latest software stack for the devices by cloning this repository:
mkdir /root/GitHub
cd /root/GitHub
git clone https://github.com/jon-whit/airU-bb.git
The following Apt packages are necessary for the system to operate properly:
build-essential
python-dev
python-smbus
anacron
gpsd
gpsd-clients
To install these, issue the command:
sudo apt-get update
sudo apt-get install build-essential python-dev python-smbus anacron gpsd gpsd-clients
A few non-default Python packages need to be installed:
Adafruit_BBIO
Adafruit_GPIO
Adafruit_BMP
Adafruit_DHT
pyserial
You can install these easily using the requirements.txt
file provided:
pip install -r requirements.txt
###System Startup Services ####Clock Initialization We're going to create a service that will synchronize the system time on system boot up.
To start, create a directory and copy the clock_init.sh
script into that directory:
mkdir /usr/share/rtc_ds1307
cp clock_init.sh /usr/share/rtc_ds1307/
Next, we'll create a service that will get started on boot, and execute the script we just created. To do this, copy the rtc-ds1307.service
into the systemd system services directory:
cp rtc-ds1307.service /lib/systemd/system/
Finally, we need to actually enable the service so it starts each time as the system boots:
systemctl enable rtc-ds1307.service
####Station Registration We're going to create a service that will register the system on boot up.
To start, create a directory and copy the register-station.sh
script into that directory:
cp register-station.sh /usr/local/bin/
Next, we'll create a service that will get started on boot, and execute the script we just created. To do this, copy the register-station.service
into the systemd system services directory:
cp register-station.service /lib/systemd/system/
Finally, we need to actually enable the service so it starts each time as the system boots:
systemctl enable register-station.service
####GPS Daemon
The Debian load on the BeagleBone Black doesn’t use the /etc/init.d/gpsd
file out of the box to start and stop the GPS daemon. It uses the default /lib/systemd/system/gpsd.service
file to start and stop the daemon.
The problem with this is the gpsd.service file does not use the information in the /etc/default/gpsd
file, which contains the configuration information for the GPS daemon.
To fix this, simply replace the gpsd.service file with the gpsd.service
file provided in this repository:
cp gpsd.service /lib/systemd/system/
Finally, set the GPSd options using the dpkg-reconfigure
command by following the "Setting the gpsd options" guide section linked here. In (Step 3), set the device to /dev/ttyO2
instead of /dev/ttyO4
.
To add the system Cron Jobs for the toolchain, enter the crontab -e
command at the stations terminal interface and add the following entries (omitting the descriptions):
*/1 * * * * python /root/GitHub/airU-bb/data-gather.py
- Samples the sensor (occurs every minute).
*/90 * * * * python /root/GitHub/airU-bb/data-upload.py
- Uploads any data collected in Field mode which has not been uploaded yet (occurs every 90 minutes).
To add the system Anacron Job(s) for the toolchain, append the entries below (omitting the descriptions) to the /etc/anacrontab
file:
365 10 cron.clean run-parts --report python /root/GitHub/airU-bb/data-clean.py
- Cleans any residual data (occurs every year).