Arduino soil moisture sensor

In this Tutorial i will show you how you can build a cheap and simple moisture sensor and read the data from the Arduino to your PC.

What you need:

Part 1: Moisture Sensor

Mix the plaster with water and fill the plastic tube with it. Let it dry a little bit and stick the nails in it. Let it try for about 2 hours, than remove the plastic tubing and then let them dry for 24h hours. You can read about the details here.

IMG_5828 IMG_5830

Part 2: Read from Arduino into PC

The circuit setup is pretty easy:

Screen Shot 2013-05-30 at 12.30.50
With the Analog In Port 0 we will observe how the electricity flows through the sensor through the resistor. If the sensor is dry there will be no electric flow.

This is all you need to get the sensor data from the Arduino.

The Arduino code to read the Analog0 Pin:

int analogPin = 0;
int val = 0;

void setup()
  Serial.begin(9600);          //  setup serial

void loop()
  delay(10000); // 10 Seconds delay
  val = analogRead(analogPin);    // read the analog pin
  Serial.println(val);             // write value to debug console

My test setup:

As an addition, i added an Ethernet shield to this which uploads the measurement data every hour to an PHP Script which shows it in a nice graph.