SparkFun Forums 

Where electronics enthusiasts find answers.

Have questions about a SparkFun product or board? This is the place to be.
By SkyNTP
#192796
I am using the SparkFun Soil Moisture Sensor (SEN-13322, https://www.sparkfun.com/products/13322) but am having trouble getting the device to recognize moisture *content*.

The sensor's VCC and GND pins are connected to 3.3v and ground respectively. Meanwhile, the SIG pin is connected to a MCP3008 which is taking my readings. The MCP3008 returns readings as a value between 0 and 1023 (e.g. as a fraction over 1023 of 3.3v), and works just fine for other sensors.

Here are the values I read for the SEN-13322 in different locations:

* Air-dry: ~0
* Half submerged in a glass of water: ~350
* Fully submerged in a glass of water: ~700
* Half submerged in soil that hasn't been watered in two weeks: ~350
* Fully submerged in soil that hasn't been watered in two weeks: ~700
* Half submerged in freshly watered soil: ~350
* Fully submerged in freshly watered soil: ~700

In other words, the sensor doesn't seem to be reading water *content*, instead it seems to be reading water *level*. Is this the intended behaviour of the sensor?

If so, I seem to have been mislead in the function of this sensor. I'm also wondering why this sensor is being showcased as triggering a watering device when my own tests show that it'll return a saturated value even in 2-week dry soil.
By jremington
#192807
The sensor is intended to respond to the resistance of the soil between the probes, which certainly will change if the moisture content changes. Of course the resistance will also depend on the depth of insertion.

The basic idea has been used more or less successfully for a long time, however the sensor cannot be powered continuously or chemical reactions will drastically interfere with the readings. Commercial probes often use AC current, to avoid electroplating.

Your results showing the same response (at the same insertion depth) to wet or dry soil are really strange and I can't see how account for them. Try some experiments with different types of soil (wet and dry), all at the same insertion depth, and let us know what you find.

If you have a digital multimeter, please measure the resistance between the probes themselves (with no other connections to the sensor) and report that as well.
#192842
>The basic idea has been used more or less successfully for a long time, however the sensor cannot be powered continuously or chemical reactions will drastically interfere with the readings. Commercial probes often use AC current, to avoid electroplating.

I raise 3.3v about 10 milliseconds before taking a reading

> If you have a digital multimeter, please measure the resistance between the probes themselves (with no other connections to the sensor) and report that as well.

Here are the results

* Air-dry: inf ohms
* Half submerged in a glass of water: 45k ohms
* Fully submerged in a glass of water: 28k ohms
* Half submerged in soil that hasn't been watered in two weeks: 59k ohms
* Fully submerged in soil that hasn't been watered in two weeks: 132k ohms
* Half submerged in freshly watered soil: 33k ohms
* Fully submerged in freshly watered soil: 21k ohms

Note that the soil that hasn't been watered in two weeks measures "4/8 moist" on a mechanical sensor. The freshly watered soil measures "8/8 wet" on a mechanical sensor.

The resistance measured at the probes is as I would expect, but I am still getting readings in the 750/1023 (3.3v) range, regardless of how much water. I am wondering if there is something wrong with my circuit. There isn't much in the way of diagrams on https://learn.sparkfun.com/tutorials/so ... okup-guide. I also tried testing with a 3.3v battery and voltmeter. I am reading 2.50v completly submerged in water and about 2.48v in wet soil. I'm out of dry soil, so I'll have to try that later. In any case, I feel that the margin of error on these readings is greater than any difference that might be explained by the moisture conditions. Readings I get off the MCP3008 vary by up to 10%, and don't correlate with when the soil is watered.
By jremington
#192850
Those resistance readings are very useful.

The circuit design simply doesn't work for low probe resistances, as shown by the results of the circuit simulation below (R2 represents the probe resistance). The transistor is not performing a useful function in this case. In fact this basic design is found in many places around the net, an example of how a poor idea can become set in stone.

You would be much better off removing the transistor, shorting the emitter base junction traces with a piece of wire, and replace R1 with about 100K to form a voltage divider. Better yet replace the 10K R1 with a small variable potentiometer of about 250K and adjust to about midway between some useful values of the probe resistance.

Note that the output of a voltage divider is most sensitive to changes in the value of one resistor if the two values are about equal.
moisture.gif
Divider response:
divider.gif
You do not have the required permissions to view the files attached to this post.