1. Home
  2. Docs
  3. Device Kits
  4. Kit 6: The Avimesa 1000 and Soil Moisture Sensing

Kit 6: The Avimesa 1000 and Soil Moisture Sensing

In this device kit, we’ll be attaching an MAS-1 soil moisture sensor to an Avimesa 1000 to monitor volumetric water content (VWC) of some soil via Avimesa.Live. The MAS-1 soil moisture sensor is a 4-20 mA current loop sensor (420 sensor for short). 420 sensors are used heavily in industry today and can measure a myriad of metrics. The Avimesa 1000 is Avimesa’s flagship hardware product that offers up to seven 420 sensor connections and IoT communication via BLE. In order for an Avimesa 1000 to communicate with the Avimesa cloud, you’ll also need an Avimesa IoT Gateway. Avimesa currently offers a Raspberry Pi IoT Gateway implementation that we’ll use for this tutorial. The last piece we’ll need before we get started is an Avimesa.Live account to calibrate and visualize our soil moisture sensor’s readings.

Components
Setup
Avimesa 1000 Setup
  1. Make sure the Avimesa 1000’s power switch, SW2, is in the off position.
  2. Connect your MAS-1 soil moisture sensor to CHANNEL_0 of the Avimesa 1000 (labels are on the back side of the Avimesa 1000)
    • (1) Plug the male connector of the MAS-1 soil moisture sensor into the female connector of the CD12M cabling: mas-1-connection.jpg
    • (2) Connect the exposed wiring of the CD12M cabling to CHANNEL_0 of the Avimesa 1000. The connections made here are shield, power, and return; there is a key on the Avimesa 1000 with this information as well. Visual: channel-connect.jpg
    • (3) Connect the 24V DC Avimesa 1000 power supply to a 120V AC power outlet and then attach it to the Avimesa 1000: power-connect.jpg
  3. Switch the Avimesa 1000’s power switch, SW2, to the on position.
  4. The first blue LED should begin to blink (it’s waiting for an Avimesa IoT Gateway)
Avimesa Raspberry Pi IoT Gateway Setup
  1. Connect the 5V DC power supply to a 120V AC power outlet and then connect the micro-USB end to the RPi
  2. Connect the RPi to the internet using one of the following methods (internet connectivity verified by visible LED being solid green):
    • Connect an ethernet cable to the RPi and to a router with internet
    • Connect the RPi to Wifi by doing the following:
      • Hold down the singular button on the RPi until the LED turns solid red
      • On a computer with WiFI connectivity, connect to the “Avimesa-Gateway” network
        • You may have to refresh the list of available networks a few times
      • Browse to “http://192.168.0.1”
      • (Under Network) Scan for the available networks
      • Select your WiFi network from the Router SSID dropdown
      • Enter the Router Password if applicable
      • Save (The device will then reboot and you should have internet) alt text
Initial Hardware Setup Verification

All you should have to do here is verify that the Avimesa 1000’s LEDs are doing the following sequence: first LED is solid blue for 1 – 3 seconds, first LED turns off and second LED is solid blue for 1 – 3 seconds, and, finally, second LED turns off and third LED is solid blue for 3 – 5 seconds. This sequence should repeat; if the first LED is continuously blinking (< 1 second blinks), visit here to figure out what’s going on.

Avimesa.Live Setup
  1. Login to Avimesa.Live
  2. Verify and then make note of the Avimesa 1000 you’re using in the Devices section (First four characters of the Device ID are pasted on the Avimesa 1000 with the QR Code – QR Code contains the entire Device ID)
  3. Navigate to the Sensors section of Avimesa.Live and then click the Add Sensor button above the list of all of your configured sensors.
    • Next, you’ll need to select the Avimesa 1000 we noted in 2. in the Device dropdown and then click Submit
    • Set Sensor Name to something applicable
    • Set Sensor Units to “VWC (%)”
    • (Optional) Give your sensor a Location description
    • Select “0” (IMPORTANT: this is the channel we connected our sensor to on the Avimesa 1000) for the Sensor channel no.
    • Set Min reading to 0.0
    • Set Max reading to 100.0
    • Finally, click Add sensor
  4. Once you successfully create the sensor, select it from your list of configured sensors and then scroll up to view your MAS-1 soil moisture sensor’s data feed (you should have live data that looks very similar to the following image for the first verification test).
Sensor Verification and Calibration via Avimesa.Live

NOTE: You’ll need a gallon (or greater sized) container for most of this procedure; anything smaller than one gallon will deteriorate the readings this sensor provides. Here’s the one gallon bowl I’ll be using: mas-1-bucket.jpg

To verify that the sensor is functioning properly, we will perform two simple tests: suspend the sensor in the air and then submerse the sensor in water. The outputs from the sensor for these tests are in Amperes (the SI unit of measurement for electrical current) and not volumetric water content (VWC). The outputs from the sensor for these tests is the raw 14-bit 420 reading from the Avimesa 1000. We’ll transpose these readings to VWC readings using Avimesa.Live’s PEMDAS expression analyzer shortly.

First, simply hold the sensor up in the air and you should see readings in Avimesa.Live in the range of 3.4 – 4.7 mA if the sensor is functioning properly NOTE: image is showing Amperes and not Milliamperes. amps-air.png

And for the second test, we’ll first want to fill our large container with nothing but tap water (do not use deionized or distilled water). Once we’ve filled out container to the brim, we’ll want to submerse our sensor completely and at least 5 cm (2 in) from any of the container’s surfaces. We should see readings in the range of 18.1 – 22.4 mA if the sensor is functioning properly. amps-water.png

If everything looks good, it’s time to actually submerse our sensor in the soil you’ll be burying it in. I simply filled my gallon bowl with the soil I intend to bury it in under my “Legend” tomato plant – potting soil based dirt. You’ll want to follow the guidance from the second test we performed: submerse our sensor completely and at least 5 cm (2 in) from any of the container’s surfaces. My soil was initially extremely dry. Here are, again, raw 14-bit 420 sensor readings in Amperes: amps-dirt.png

Time for some actual readings and PEMDAS magic: click on the cog to edit the sensor. Let’s enter the following equation for potting soil into the Data Transformation Equation field, obtained from the MAS-1’s data sheet, to transform our raw 420 reading into a VWC reading: 0.00531 * 2.71828 ^ (0.29 * 10 ^ 3 * x) * 100.0. You’ll then want to update the data feed for the sensor by clicking Submit changes. NOTE: There’s a little more going on in this equation than what’s proscribed in the MAS-1’s data sheet. I’m transforming Amperes into Milliamperes and I’m making the reading a percentage by multiplying it by 100.0. Here are my readings after applying some math to the data feed: vwc-dry-dirt.png

And here are my readings seconds after pouring ~1.5 L (1 L = ~1/4 of a gallon) of tap water onto my soil: vwc-wet-seconds.png

The previous image shows the spike in VWC as the water filters through the dirt extremely close to the sensor. From the following image, you can see that I had to wait ~30 minutes for the sensor’s VWC readings to level out: vwc-wet-minutes.png

Conclusion

Measuring soil moisture is a fickle thing and the Avimesa IoT Solution can simplify the process but only so much. Go bury this guy 10 – 20 inches under a plant you really care about and produce some food!