Go Down

Topic: How to: soil moisture measurement? (Read 43 times) previous topic - next topic


I saw two different circuits to measure soil moisture with arduino, bot of the low-cost based n the measurement of the reistance of the soil throught two nails.
These circuits are those:
The simple: http://www.make-digital.com/make/vol18/?pg=94
The complex: http://spaces.kisd.de/makethings/2008/05/12/how-to-build-a-soil-moisture-sensor/

I have three questions about it.
1) what are the practical difference between them? I mean is one of them more accurate than the other? or something like that?
2) is there a "standard" distance between the nails to measure the distance in a precise way (as precise as arduino made possible, of course)?
3) I suppose that a simple calibration process consist on measure the output from analogue pin when the nails are in the air (maximum resistance, humidity=0) and inside a glass of water (minimum resistance, Humidity= 100%)


Mike Rice

A simple circuit can be just as accurate as a more complex one. The more complex circuit is more sensitive though.

As for calibration, you're correct in how to get the zero and 100% points.

The simple 'two nails' probe works OK as an experiment, but accuracy degrades, slowly in some cases, rather quickly in others, depending a lot on soil chemistry. The nails corrode, and the use of a DC current aggravates the problem due to electro-migration.

A more practical probe will use an AC measuring current, and use corrosion resistant probes.

The AC measurement technique can be easily done with an Arduino, but it will cost you a two digital pins.
Your 'probe' (the two nails) are in series with a resistor, forming a voltage divider. The center of the divider is connected to an analog input. The voltage divider is connected between two digital outputs.

The following code fragment gives an example.


Connect two nails and a resistor as shown

digital 2---*
                 \ R1
analog 0----*
                 *----> nail 1
                 *----> nail 2
digital 3---*

#define moisture_input 0
#define divider_top 2
#define divider_bottom 3

int SoilMoisture(){
  int reading;
  // set driver pins to outputs

  // drive a current through the divider in one direction

  // wait a moment for capacitance effects to settle

  // take a reading

  // reverse the current

  // give as much time in 'revers'e as in 'forward'

  // stop the current

  return reading;



Hi Mike!

Thanks! This is a third possible circuit. I will try your circuitand code next weekend.
I know that the nails (also galvanized ones) are not the best sensors for accurate measurement, but i readed other post in this forum about a similar topic, and the main problem is that the commercial sensors are pretty expensive compared to other sensors that we could buy in our favorite electronic's store.

I will inform about my advances soon...

Mike Rice

Actually you can make a high quality sensor for less than $5!

What we are going to do here is re-purpose a Leaf Wetness sensor, which is available from hobby-boards dot com.
This sensor is gold-plated, so it will not tarnish or corrode except in quite extreme and very unlikely, circumstances.
And it only costs a couple of dollars.

Coat the board with Plaster of Paris, then wrap a layer of burlap (feel free to substitute) around it.
Let it dry, then apply another coat of plaster.
Ta Da! A $50 sensor for less than 5 bucks!

Plaster of Paris will absorb moisture from the soil around it, protect the board from mechanical damage, and removes
soil chemistry from the equation.


I tested a sensor which was basically two nails encased in Plaster of Paris. My only complaint was that once the sensor got wet it seemed to take much longer for the plaster to dry out than the soil around it. Using something like the Leaf Wetness sensor and a thin coat of plaster might improve the response.

I ended up using two thin strips of stainless steel held together with nylon screws to keep the spacing constant. I packed this in sand. The sand seems do to a good job of wicking in moisture from the soil and dries out more quickly than the Plaster of Paris.

This thread has a picture of my sensor and information about using a 555 timer to create an AC circuit and measuring the frequency of the timer circuit rather than directly measuring current. It is just another way to approach the problem.


Go Up