Attaching sensors to MultispeQ part 1: YwRobot soil moisture sensor

So now that production is in process (moving along, we had a minor hardware patch to apply so we’re waiting for a new shipment of boards, but we’re all ready to crank out boards otherwise) and we feel good about the core measurements of the MultispeQ, we decided it was time to see if we could easily slap on other sensors into the PhotosynQ framework.  First up – the YwRobot’s Soil Moisture sensor (actually, soil conductivity, but we’ll get into that later.  Let’s start by talking about how to connect to MultispeQ and what tools can be connected —

What can connect to MultispeQ?

The MultispeQ is built around a Teensy 3.1, so please see the Teensy’s capabilities here for details.  The lights, detectors, and existing sensors already use most of the existing pins (see here for Teensy pinout), but there are a few extra available pins:

  • 2 digital pins and 1 analog pin through-hole pins.
  • 10+ analog pads which are not through hole
  • I2C line
  • DAC
  • 3.3V line and ground

So the simplest device to connect is anything which outputs a 0 – 5V signal.  Our YwRoboto sensor does just that!

Soil Moisture Background and Experiment

Measuring soil moisture can be approximated by measuring soil conductivity.  Conductivity is influenced by the movement of ions in the material between the electrodes – see image below for what the device looks like.  So for a given soil type, more water increases the movement of ions.  However, it is very difficult to compare different soil types, because they will have different concentrations of ions and therefore different results.  So this is useful for relative soil moisture changes in a single location (like your house plant), not in different locations (like different fields in different soil types).

In our quick and dirty test, we made a matrix of 4 soil types x 3 moisture levels (from high to none) which you can see in the image below. We connected the pins between the moisture sensor and the MultispeQ as follows:

through-hole locations to connect to the MultispeQ
YwRobot Pin MultispeQ (Teensy 3.1) Pin
GND GND
VCC 3.3V
OUT A14

 

The YwRobot Moisture Sensor attached to a MultispeQ in potting soil
4 types of soil (3 potting mixes and 1 clay dense dirt from outside) with 3 levels of moisture (no moisture, 6ml moisture, and completely drenched)

The communication protocol between the PhotosynQ chrome app (or Android app) and the MultispeQ is in a JSON format.  In order to request the information from pin A14 (also referred to as pin 40), just add it to the JSON.  Below is an example simple JSON which requests temperature, relative humidity, and the analog read from pin 40.  It also specifies to take 2t00 measurements with a 2 second delay between them:

[{“environmental”:[[“temperature”,0],[“relative_humidity”,0],[“analog_read”,0,40]],”measurements”:100,”measurements_delay”:2}]

You can also create this protocol using menu-based drag-and-drop tools through the Chrome app, but I thought I’d give the details here so you could see it.

Initially, I compared soil moisture in each of 12 samples above.  Here’s what I got:

Measured soil conductivity of the 12 different soil samples. The two lowest moisture levels are not that different and sometimes opposite of expected

As you can see, the 6.5ml water addition versus dry doesn’t show a consistent positive correlate, which doesn’t make sense.  I think it may be due to the fact that I had to take out and put back in the probe each time.  So I just tried placing the probe in soil, and adding moisture to the surface without affecting the probe.  These results were much closer to what I would have expected:

Kept the probe in a single soil mix, and sprayed water onto surface to simulate rain. This makes much more sense, though even wiggling the probe slightly significantly changes the signal.

Conclusions

Overall, this sensor definitely relates to soil moisture, and the completely saturated cases of different soil types even show similar absolute response (about 45k counts). However, at less than saturated levels, soil conductivity varies quite a bit between the different soil types at least from this quick little introductory test so probably soil moisture can be accurately measured at a single location.

In terms of integrating this sensor into PhotosynQ, it was pretty easy. Connect 3 pins, add one small line to tell the device to look for it, and vioala – graphs!

Next Steps

The next step is to actually stick this thing into my yard and see what happens. We’ve been talking about trying to pull in weather data into PhotosynQ so you can correlate and analyze that in addition to the sensor data, which would be particularly fun here. Also, I think there is a new version which is gold plated and therefore much more robust which I’ve already ordered to play with. Finally, I should create a real research project (which others can join and participate in) out of this, instead of just taking one off measurements. Then we can see how the PhotosynQ online analysis tool could be useful to analyze the resulting data (see here for example of recent data taken in bean fields in North Dakota – please be patient while the data loads!).

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.