Soil Moisture Meter for the Arduino

  

Some time ago I needed to measure the water content of soil in various places around the island where I live. I built my own probe from two nichrome wires cast into a small plaster of paris tube about 1cm in diameter. When dry the probe has a very high resistance, but as the soil becomes wet moisture soaks into the sensor and the resistance lowers. The resistance of the probe is therefore dependant on the soil moisture content and the Arduino is nothing more than a resistance meter.

Sensors like the one shown above have become available for around £1 on eBay, although the probe would be more suitable for indoor use in a flower pot than outside in the ground. A simple device to warn you that your plant needs watering, or even one that watered your plant automatically, is easily built.

An amazing example of using the Arduino comes from the Van De Leer vineyard in California. They developed a system called the Vinduino for checking soil water content in a vineyard and you can visit this site here. The sketch switches the current flow in the probe to avoid electrolytic effects corroding the sensor. Vinduino outputs the results to an LCD display and they also show how to build probes using plaster of paris (gypsum).

If you want to try making a simple moisture sensor tha will light a LED when your favourite plant needs watering you can try the following sketch. The sensor shown in the photograph has four connections, Ground, Vcc, analogue and digital. The trip level is set with the potentiometer and output  goes from Low to High when the soil dryness reaches a certain level.


/*
# Example code for the moisture sensor
#
# Connect the sensor to the A0(Analog 0) pin on the Arduino board
#
# the approximate moisture levels for the sensor reading
# 0 to 300 dry soil
# 300 to 700 humid soil
# 700 to 950 in water
*/

# define ledPin 13
# define sensorPin 14 // is the same as A0

int trigger = 300; // set the level

void setup(){
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
digitalWrite(ledPin, LOW); // turn off LED
}

void loop(){


Serial.print("Moisture Sensor Value:");
Serial.println(analogRead(sensorPin)); // read the value from the sensor
if (analogRead(sensorPin) >= trigger) {
digitalWrite(ledPin, HIGH); // turn on the LED
}
else{
digitalWrite(ledPin, LOW); // turn off LED
}
delay(500);
}

Advertisements

1 thought on “Soil Moisture Meter for the Arduino”

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s