Monitoring your rootzone with OpenMinder™

First iteration of the OpenMinder™ HAT

At Autogrow we are all about open-collaboration and APIs and one thing we have rolled out is an open-source device for monitoring rootzone runoff as a HAT for a Raspberry Pi 2 or 3. Both the HAT PCB and the source code are released as open-source under the Creative Commons BY-NC-SA license.

OpenMinder™ is perfect for developers interested in improving and building on agtech. It’s also the perfect product for an NGO to fund for countries whose farmers need a subsidized (or free) water run-off monitoring system.

In this post we will be doing a quick tutorial on how to setup the OpenMinder™.


What is rootzone monitoring?

Rootzone monitoring is measuring the nutrient, pH, and water volume that is going into the plant, and comparing it with what is coming out of the plant. This gives you the data to make decisions about your irrigation practices. You may be able to modify your irrigations to increase yield by preventing crop loss and disease associated with under or over shooting the runoff ratio.

There are two sides to rootzone monitoring, the irrigation side which measures the variables going into the plant and the runoff side which measures the variables coming out of the plant.

For more accurate calculations you can also take into account the number of drippers going into the irrigation side sample pot and the runoff side sample pot in cases where they are different. For instance in the above image it appears that there are two drippers that will come out of the runoff side, while only one is feeding into the irrigation side.

What you will need

You will need the following things to get started:

  • 1 x Raspberry Pi 2/3 with Raspbian preinstalled (henceforth referred to as the RPi)
  • 1 x OpenMinder™ HAT
  • 2 x Autogrow Intelligent EC Probes (these are the same ones used on the IntelliDose)
  • 2 x pH Probes (any with a BNC connector should work)
  • 2 x tipping buckets
  • 2 x container to catch the water in for measurement (sample pot)
  • 1 x CF/EC buffer calibration solution
  • 1 x pH4 buffer calibration solution
  • 1 x pH7 buffer calibration solution

You can purchase most of these things from hydroponics suppliers but checkout this page for specific links.

Connecting everything up

Connecting everything up is pretty straight forward. The HAT slots on top of the RPi just as any other HAT does. Obviously the pH probes connect to the BNC connectors and the green connector should be wired up like in the following diagram.

As you can see the tipping buckets share a common ground as they are just simple switches. It doesn’t matter which way round they are connected as they don’t have a positive or a negative. Both EC probes share all connections (red, white and black) as they are both on the same, formerly proprietary protocol called ASLBUS.

Installing the OpenMinder™ service

Now we need to power up the RPi and install the OpenMinder™ service so we can get some readings. Login to your RPi via SSH or the terminal. Then we can install the pre-built Debian package available from our public repository:

curl -s https://packagecloud.io/install/repositories/autogrow/public/script.deb.sh | sudo bash
sudo apt-get install openminder

Now the service will be installed and should be running. You can verify this by doing a simple request using curl:

curl -s http://localhost:3232/v1/readings

This should print out a line of JSON containing the current readings.

With the package also comes a helper command called omcli . This helps to do some repetitive, math heavy or multi step operations. We will make use of this in the next few steps.

Configuration of the service

There is a config file located at /etc/openminder.json which contains some configuration options for the service. You can see what each means on the Autogrow Lab site, as we just want to configure the number of drippers at this stage. In the config file you will see the following fields:

"drippers_per_plant": 0,
"runoff_drippers": 0,
"irrig_drippers": 0

You should change these values to reflect a) how many drippers feed each plant, b) how many drippers feed into the runoff sample pot and c) how many drippers feed into the irrigation sample pot, respectively. You will then need to restart the service:

sudo systemctl restart openminder

Calibrating the probes

Every probe will have some degree of inaccuracy. To ensure the readings are accurate we need to calibrate each probe using buffer solution so the inaccuracies can be accounted for when reading them. The probe calibrations should be done every 6 weeks.

The wizard for the nutrient and pH probes is slightly different but in both cases you need to specify if you are configuring the probe for the irrigation side or run off side.

EC Probes

This is the command to start a calibration for the irrigation side EC probe. Note that by default it expects 2.77mS/cm2 buffer but you can change it (i.e. to 2.80mS/cm2) using the -buffer 2.8 argument.

omcli -calib -ec -irrig

This will start the wizard which will take you through a series of steps:

  1. wash the probe and put it in the buffer solution then push enter
  2. wait 30 seconds for the readings to settle
  3. type y and push enter to save the calibration

Now your EC probe is calibrated! You will want to repeat this step for the runoff side by running:

omcli -calib -ec -runoff

pH Probes

The pH probe calibration is a little more complicated because it requires 2 readings to calibrate. It can be started like so:

omcli -calib -ph -runoff

This will start the wizard which will take you through the steps:

  1. wash the probe and put it in the pH7 buffer solution, then push enter
  2. wait 30 seconds for the readings to settle
  3. wash the probe and put it in the pH4 buffer solution, then push enter
  4. wait 30 seconds for the readings to settle
  5. type y and push enter to save the calibration

Now your pH probe is calibrated! You will want to repeat this step for the irrigation side by running:

omcli -calib -ph -irrig

Calibrating the tipping buckets

Calibrating the tipping buckets is pretty easy. By default the volume is the same as the amount of tips (the number of time the switch has been closed) You can use the omcli tool but we will include the API calls the tool does as well:

omcli -calib -set irrig_volume,5.0,0
omcli -calib -set runoff_volume,4.75,0

That command will set the irrigation tipping bucket as 5mL per tip, and the runoff tipping bucket as 4.75mL per tip. The tool is simply calling the following API endpoints:

curl -XPUT "localhost:3232/v1/calibrations/irrig_volume/5.0/0"
curl -XPUT "localhost:3232/v1/calibrations/runoff_volume/4.75/0"

Installing the sample dashboard

There is also a sample web interface dashboard you can install from Github. It uses the popular open source dashboard app smashing.io. First you must install Ruby and bundler:

sudo apt-get install ruby2.3 ruby2.3-dev
sudo gem install bundler

Now clone the project and install the requirements:

git clone https://github.com/autogrow/openminder-sample-dashboard.git
cd openminder-sample-dashboard
bundle install

Now you can start the dashboard via:

bundle exec smashing start

You will see it start on port 3030. If you installed it on a PC rather than the RPi you will need to modify the jobs/openminder_api.rb file to make it point to the RPi's IP address instead of localhost. Now you can see the readings on a nice dashboard:

More information and help

For more information you can visit the OpenMinder docs on the Autogrow Lab site, which includes the API documentation and goes into a little more depth on the project. If you need any help, please don’t hesitate to raise an issue on the Github project.