Author Topic: using capsense to measure soil moisture?  (Read 32558 times)

WhiteHare

  • Hero Member
  • *****
  • Posts: 1300
  • Country: us
using capsense to measure soil moisture?
« on: September 25, 2015, 10:58:25 AM »
I'd like to use some moteino's for measuring soil moisture.  I've been using conductive soil moisture sensors for over a year now, and the calibration drifts a lot.  For instance, fertilizing throws it off.  I want to upgrade to a sensor which isn't affected that way.

The two ways I'm considering are:

1.   Bury two moteino's say, half a meter apart.  Have one transmit and the other measure the RSSI.  It's known that water will attenuate the RF  signal.  So, the more soil moisture, the lower the RSSI.  I was previously thinking 2.4Ghz might be better, but it was proven to also work at 900Mhz:  http://ir.uiowa.edu/cgi/viewcontent.cgi?article=2048&context=etd

2.  Use Arduino's capsense library to measure soil capacitance.  This would avoid extra hardware.  Not sure how effective it would be though.  Anyone tried it as a means of measuring soil moisture?  I've read that some methods of measuring capacitance are skewed by soil conductivity, but that those taken by some method at 80Mhz or greater manages to avoid that problem (c.f. comments at:  http://zerocharactersleft.blogspot.com/2011/11/pcb-as-capacitive-soil-moisture-sensor.html)

Before embarking on either one, I thought I'd give a shout out to see if anyone else may have already tried or is using a method which isn't affected by soil conductivity.  Anyone?


kobuki

  • Sr. Member
  • ****
  • Posts: 289
Re: using capsense to measure soil moisture?
« Reply #1 on: September 25, 2015, 04:09:00 PM »
Sorry for sounding like an advocate, but I'm wondering if you'd be better off with a professional solution such as this. Its radio signal and frame format is well understood and can be received with Moteinos, if that's what you want, instead of using the factory receiver.

OTOH, I don't understand why you want to bury the motes, when you can just cable-hook them to the surface, on a pole, whatever. Something like this project.

WhiteHare

  • Hero Member
  • *****
  • Posts: 1300
  • Country: us
Re: using capsense to measure soil moisture?
« Reply #2 on: September 25, 2015, 04:17:40 PM »
Sorry for sounding like an advocate, but I'm wondering if you'd be better off with a professional solution such as this. Its radio signal and frame format is well understood and can be received with Moteinos, if that's what you want, instead of using the factory receiver.

OTOH, I don't understand why you want to bury the motes, when you can just cable-hook them to the surface, on a pole, whatever. Something like this project.

Huh?  I'm totally not seeing the connection between that and what I posted.

kobuki

  • Sr. Member
  • ****
  • Posts: 289
Re: using capsense to measure soil moisture?
« Reply #3 on: September 25, 2015, 04:25:06 PM »
I'm sorry about that, but then let's overview it, step by step.

1. You're looking for an accurate soil moisture sensor solution, is that right? The Davis equipment I linked is a soil moisture sensor station with 4 soil and 4 temperature probes. (Disclaimer: I'm not associated with them in any way, I'm just a happy user.)

2. The awesome compost project I linked shows a pretty clever use of Moteinos in a similar environment, where sensors are "underground" (in the compost being processed), and transmitters/motes are above ground, on top of those poles.

Are you still not seeing the connection? I'll gladly help you understand it, should that be the case. Am I misunderstanding anything?

WhiteHare

  • Hero Member
  • *****
  • Posts: 1300
  • Country: us
Re: using capsense to measure soil moisture?
« Reply #4 on: September 25, 2015, 05:11:15 PM »
I'm sorry about that, but then let's overview it, step by step.

1. You're looking for an accurate soil moisture sensor solution, is that right? The Davis equipment I linked is a soil moisture sensor station with 4 soil and 4 temperature probes. (Disclaimer: I'm not associated with them in any way, I'm just a happy user.)

I can't say that I've used their product, but I've read about it.  Davis uses Irrometer's granular matrix soil moisture sensors.  Those come with some caveats:
1. temperature sensitivity
2. Limited lifespan of the sensor.  It contains gypsum and possibly other dis-solvable minerals.  Once they dissolve away, the buffering is gone, and they'll be vulnerable to changes in soil salinity, just like other EC sensors.  They do manage to slow that down with their packaging, but it's still gonna happen.
3. Probably because of #2 directly above, Irrometer says they should be dug up each year and replanted in order to ensure good sensor-to-soil contact.  I'd really rather not do that, as it's extra work.
4.  Not cheap.  About $50 a pop.  I think for less than that I would get a vegetronix soil moisture sensor (about $35), which should last indefinitely and not require replanting.  The sensor costs start to get in the way of how many I might deploy.  So, if there were a way to leverage the arduino to reduce costs, perhaps by using the capsense library, then that would be great.


2. The awesome compost project I linked shows a pretty clever use of Moteinos in a similar environment, where sensors are "underground" (in the compost being processed), and transmitters/motes are above ground, on top of those poles.

As these are mostly going to be checking the moisture on a different sections of a lawn, having them underground is a bonus: nothing for a mower to hit or people to trip over.  Also, the temperature swings won't be as big, which might help with battery life.  I'm not too worried about receiving the signals.  I have some buried 802.15.4 sensors that measure soil conductance for over a year, and I'm not having any trouble receiving their signals.


« Last Edit: September 25, 2015, 05:14:30 PM by WhiteHare »

kobuki

  • Sr. Member
  • ****
  • Posts: 289
Re: using capsense to measure soil moisture?
« Reply #5 on: September 25, 2015, 05:18:57 PM »
Thanks for the write-up. Now we know a lot more about your goals. That will probably help in finding a better solution. However from what you summed up, on the long term you might benefit from a probe that isn't very cheap but lasts long, even it it adds up to a bigger sum. It's a one-time investment at the beginning. I think an Arduino-based controller would lend itself just fine for any of them. BTW, how many probes do you need?

WhiteHare

  • Hero Member
  • *****
  • Posts: 1300
  • Country: us
Re: using capsense to measure soil moisture?
« Reply #6 on: September 25, 2015, 05:23:18 PM »
At least 10, but I'd prefer a much larger number, like 30, for redundancy in case of failure and also for better coverage within each of the 10 irrigation zones.

joelucid

  • Hero Member
  • *****
  • Posts: 868
Re: using capsense to measure soil moisture?
« Reply #7 on: September 26, 2015, 12:59:34 PM »
I need to build an irrigation system but haven't started yet. I've thought about it a little. Using RSSI measurements is definitely a cool approach, but doesn't work with coin cells unless you have a RTC (show stopper :-) ). Oh wait with the burst/listen mode you could actually do it with coin cells.  However I think it's likely the method will be impacted by soil salinity just as much as the resistive method.

Capacitative sounds better - but you would need really high frequencies to drastically reduce the impact of changes in salinity. Which means extra chips, power consumption and effort.

What's the best we can do with a Moteino? The radio has a clock of 32mhz which can be routed to one of the pins. Feed that into a simple RC low pass filter (the C being the sensor). Feed the output into another low pass that only filters out the DC component and measure that with the ADC. 32mhz is probably good enough. And 2 resistors and 1 cap qualify as simple in my world.

Joe

WhiteHare

  • Hero Member
  • *****
  • Posts: 1300
  • Country: us
Re: using capsense to measure soil moisture?
« Reply #8 on: September 26, 2015, 03:17:58 PM »
Would this work?  Take an 80Mhz crystal oscillator (http://www.ebay.com/itm/1pc-80-000MHz-80MHz-FULL-SIZE-CRYSTAL-OSCILLATORS-KCO-110S-DIP4-/181552356877?hash=item2a455d1e0d), connect it directly to the soil capacitance probe, and then use the arduino input pin to measure the maximum voltage developed across it?  Presumably, the higher the capacitance, the lower the maximum voltage.

Alternately, this paper leverages an mcu to suggest a way using lower frequencies that doesn't look too bad:  https://eesensors.com/media/wysiwyg/docs-pdfs/ESP06_moistP.pdf

kobuki

  • Sr. Member
  • ****
  • Posts: 289
Re: using capsense to measure soil moisture?
« Reply #9 on: September 26, 2015, 04:25:01 PM »
I have a hunch that the invested workman hours, the design/refinement cycles, the creation and testing of multiple prototypes for endless days and nights isn't worth the price you'd actually pay in total for an established, tested and working product. You might not even save a cent. And at the end the result will be "good enough" for you only, and if all is well, it's going to return the investment only for you since it's not a marketable product. Of course it's fun and you learn a lot, but for example I think the Vegetronix is pretty good for the price. It doesn't need maintenance, it's unaffected by almost all factors the other sensors are plagued with. It's not cheap if you need 30 of them, though. But it's also a lot of work to interface to it, create your motes, make it ultra low power, base station software, adequate undergound shelter, yada yada.

I wonder if you've asked yourself the most basic questions: what accuracy you need and what precision. Do you only need a threshold indication, or you somehow want to analyse the quality of your soil over time, etc. For a lawn you might be fine with a simple threshold and some temperature sensors as auxiliary metrics or temperature compensation. Testing for a threshold is quite simple if you use common sense, your own experience on the field and a good reference meter.

OTOH, just on the net there are countless DIY solutions of the same problem. One of my older project ideas is to automate pot flower watering in our home, since we have quite a few pots. I'll make gypsum sensors for that, since they're very simple and dirt cheap and fit my purposes well. I don't need precision there. All I need is a small transmitter to send soil moisture metrics to my base, so I'm holding off until Joe makes his Tinos available ;)

joelucid

  • Hero Member
  • *****
  • Posts: 868
Re: using capsense to measure soil moisture?
« Reply #10 on: September 26, 2015, 06:20:10 PM »
Quote
Would this work?

I can't find a datasheet for this part. I wouldn't add a component just to increase the frequency from 32 to 80 MHz. In any case there needs to be a resistor before the probe. Without that the probe capacitor would charge in no time.

And then at 32mhz measuring the maximum voltage with a 16mhz 328p is not really possible. That's why I suggested to add another resistor and capacitor behind the probe to measure the dc component of the signal.

joelucid

  • Hero Member
  • *****
  • Posts: 868
Re: using capsense to measure soil moisture?
« Reply #11 on: September 26, 2015, 06:25:53 PM »
Quote
I wonder if you've asked yourself the most basic questions

Well to be fair whitehare already provided the critical info: he wants to bury 30 of these with no intention of ever digging them up again. Sounds sensible to me. And it seems neither gypsum nor resistive techniques are applicable in that case.

I'd be curious to know which approach Tom has taken with his moisture sensors.

Of course a threshold is what you're after. But that threshold needs to work regardless of ongoing changes in the environment. Irrigation itself for example is known to change salt levels over time. If one could assume constant salinity over the lifetime of the sensor things would obviously be simpler. Just not sure if that assumption is reasonable.
« Last Edit: September 26, 2015, 06:31:08 PM by joelucid »

kobuki

  • Sr. Member
  • ****
  • Posts: 289
Re: using capsense to measure soil moisture?
« Reply #12 on: September 26, 2015, 06:36:35 PM »
Well to be fair whitehare already provided the critical info

I wonder if you've asked yourself the most basic questions: what accuracy you need and what precision. Do you only need a threshold indication...

No, he hasn't. The basic parameters of the probe to achieve his set goal is very important when choosing the appropriate one. But yes, I agree, the criteria you mentioned are just as important. He needs something that's rugged and running rock solid for many years, underground. His project is huge. The sensor is only a tiny part of it, albeit one of the most important ones.

Reflecting to your latest edit: Vegetronix claims to be devoid of these problems with his probes. For a similar task, I'd prolly end up buying them.

WhiteHare

  • Hero Member
  • *****
  • Posts: 1300
  • Country: us
Re: using capsense to measure soil moisture?
« Reply #13 on: September 26, 2015, 07:37:47 PM »

If one could assume constant salinity over the lifetime of the sensor things would obviously be simpler. Just not sure if that assumption is reasonable.

I can say with certainty that it would  not a reasonable assumption.  If it were, then simple resistive soil probes would work well enough.  Unfortunately, most non-organic NPK fertilizers behave like salts and will skew the measurements enough that you have to re-calibrate

I honestly don't know whether organic fertilizers behave that way or not, but I'm assuming once they're broken down by soil micro-organisms they probably produce a similar effect.

In addition, as you point out, irrigation and/or rain might be adding salts or leeching them away. 

TomWS

  • Hero Member
  • *****
  • Posts: 1930
Re: using capsense to measure soil moisture?
« Reply #14 on: September 26, 2015, 08:20:25 PM »
Quote
I wonder if you've asked yourself the most basic questions

Well to be fair whitehare already provided the critical info: he wants to bury 30 of these with no intention of ever digging them up again. Sounds sensible to me. And it seems neither gypsum nor resistive techniques are applicable in that case.

I'd be curious to know which approach Tom has taken with his moisture sensors.
I currently use Watermark sensors which, as far as I've seen, haven't been discussed in this thread.  These are not gypsum blocks, at least not entirely.  According to the mfr,  "The sensor consists of a pair of highly corrosion resistant electrodes that are imbedded within a granular matrix. A current is applied to the WATERMARK to obtain a resistance value. The WATERMARK Meter or Monitor correlates the resistance to centibars (cb) or kilopascals (kPa) of soil water tension.

The WATERMARK is designed to be a permanent sensor, placed in the soil to be monitored and “read” as often as necessary with a portable or stationary device. Internally installed gypsum provides some buffering for the effect of salinity levels normally found in irrigated agricultural crops and landscapes."

I have used these for years and have had them buried in the yard for years with the only maintenance required when they are mechanically disturbed (like a person or mole digging around it).  I have cabled these as far as twenty feet from my telemetry equipment and couple a temperature sensor to the Watermark probe to handle temperature compensation in the telemetry equipment.

Are they accurate?  Who knows? I've never calibrated them to a kPa device.  However, I can look at the lawn and correlate a dry lawn with a 'dry' reading and vice versa. As long as they are repeatable, then I'm happy. Which brings us to:
Quote
Of course a threshold is what you're after. But that threshold needs to work regardless of ongoing changes in the environment.
Exactly so.  Just how precise a reading do you need?  You want to know if the root system is getting 'enough' water.  To my mind, any precision beyond this is a pointless fallacy.  How many kPa do you need?  I suppose a farmer investing in hundreds of acres of a crop that has a specific target specified would care - I don't have that kind of information for any of the plants I'm trying to keep alive.
Quote
Irrigation itself for example is known to change salt levels over time. If one could assume constant salinity over the lifetime of the sensor things would obviously be simpler. Just not sure if that assumption is reasonable.
From what I've read, the main variant to salinity levels would be due to fertilizer and you can make adjustments during the brief period that those are permeating the soil.  In theory I should have data that shows this behavior, but I don't recall specifically noticing the effect (maybe I didn't fertilize enough  ;)

Finally, I've seen reference to 'Irrometers' as 'gypsum blocks'.  Not so.  An 'Irrometer' is a brand of tensiometer that actually measures the 'pull' of water into the soil.  They are very accurate, expensive (by residential standards), and need to be removed before soil reaches freezing conditions.  Watermark probes can tolerate frozen soil.

Tom