A hardware/software research project into the management of off-grid, autonomous sites. It collects and processes data from enviromental sensors and provides remote monitoring, control and automation.
Optionally it can also provide a host of other peripheral services that can run on the small embedded computer (wireless AP, internet connectivity, vpn remote access, tor gateway, file storage etc)
why was it made?
Since living off-grid Anton realised that he was lacking good information about the energy consumption and production, battery health and the various other subsystems of the boat.
One part of the project is about being able to better understand how those systems work by collecting, analysing and visualising their data.
The other interesting aspect is using realtime information from the sensors as well as historical data to make clever decisions and respond to external changes.
It seems that there was no free software based solution to fit my needs so Anton decided to Do It.
collecting data
At this point boattr has current, voltage, temperature and water pressure sensors. Data is collected from the sensors and stored in a db every minute. We can create real time graphs as well as mine the database for other historical data.
The heart of the system is a beaglebone black ARM embedded computer running Debian. Most of the sensors are analog and connected via a 10 channel ADC => I2c IC.
The temperature sensors are using the 1wire interface and one can read more details about the 1wire setup
Current sensing using the bidarectional allegro acs714 hall effect sensors using the breakout board from pololu
Voltage using a simple voltage divider
the software
The software part of boattr is made of a ruby module with two classes, Sensors and Data and the puppet provisioning code. The Sensors
class contains all the functionality to obtain the results from the the various different sensors connected to the system.Data
is responsible for processing resulting data, saving and sending to other places.
Here is an example of a box called ‘brain01’ on the boat retrieving data from the sensors, sending them to the database and real time graphs.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
|
A cron job will run the above code every minute saving json formatted documents on an instance of couchdb as well as real time graphs using graphite.
Puppet is used to configure the system, install packages, configuration files and cronjobs:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
|
The graphs look like this:
dashing is in the works.
The code is available on github
#provisioning
At the moment we need a BeagleBone Black (BBB) with debian. Recent revisions (the ones with 4GB eMMC ) come with debian as default. If you have an older one you will have to install it yourself.
Connect to the BBB with ssh. We assume You have debian wheezy already installed. For the following steps you have to be root. Make sure there is internet connectivity as well.
##change the hostname replace name in /etc/hostname and /etc/hosts. A restart is required after this step or before running puppet below.
##Install puppet git and librarian
apt-get update
apt-get install puppet git librarian-puppet
##clone the repo
cd /root/
git clone git://github.com/galp/boattr.git
cd boattr
##Install the required puppet modules with librarian
librarian-puppet install
##customise puppet
Have a look in provision/default.pp. You can either modify the ‘default’ node definition in this file or copy one of the blocks that looks more suitable to a different file called $HOSTNAME.pp in the same directory. Change the node name in the file along with anything else required. Make sure the fully quilified dns names much.
##run puppet to provision all the components
Run puppet like below pointing to the right file.
puppet apply --modulepath="/root/boattr/provision/modules/:/etc/puppet/modules/" --hiera_config="/root/boattr/hiera/hiera.yaml" --verbose provision/default.pp
It might take a few runs until all dependencies are resolved and you should have all the components installed.
boattr setup
config file
Boattr in this context is the ruby program that runs every minute collecting data from sensors, analyzing and sending to db and dashboard among other things.
There is a configuration file that we need to edit. This file is located at /root/boattr/config.yml. By default it does not exists so we can use the config_sample.yml as a starting point.
cp /root/boattr/config_sample.yml /root/boattr/config.yml