loading

Here's a really simple way to detect moisture in plant soil.

You'll need:

  • An Arduino
  • Two steel nails
  • one 10k ohm resistor
  • some lengths of wire
  • soldering iron
  • solder

Step 1: The Contraption

The layout is dead simple:

One nail goes to the +5V line on the Arduino. The other nail goes to an analogue pin (zero in my case) but also to the 10K resistor and then to ground.

Easy as that!

What we're effectively doing is putting +5V through the soil (with one nail) and detecting what we can with the other nail. The more water in the soil, the less resistance we'll get (and vice versa).

Step 2: The Code

Here's the simple code:

int moistureSensor = 0; //one nail goes to +5V, the other nail goes to this analogue pin
int moisture_val;

void setup() {
Serial.begin(9600); //open serial port
}

void loop() {
moisture_val = analogRead(moistureSensor); // read the value from the nails
Serial.print("moisture sensor reads ");
Serial.println( moisture_val ); // print the moisture level to the serial monitor
delay(500);
}

Step 3: The Result

To view the output you need to open the Arduino IDE serial monitor.

I have the nails all the way down in my plant pot, but play around with one nail part in, both part in, and you'll see that you get different results depending on the placement and depth of the nails.

For my little plant the sweet spot was around 695 to 705.

I've already upgraded this to a version with three LEDs to give a visual representation of the soil using red, green and yellow lights. I'll upload that if people want to see it.

<p>Worked! I didnt have a 10K resistor, instead I used a 10K potentiometer. And no soldering. </p>
good work, but you have to prevent electrolysis from happening. I bet your nails are already corroded.
<p>Not yet, but I did read that it would inevitably happen. I'll keep an eye on them though to see how quickly the nails begin to deteriorate.</p>
Soil = minerals, water, electric current passing every 0.5 seconds?<br>I bet they already have.
<p>I can certainly see a bit of rust after about an hour.</p><p>I've since updated this circuit though to have traffic lights for output and the 'voltage' is now from a digital pin that I switch on/off once every hour for a check.</p><p>I'll keep an eye on the nails and see how they are with hourly checks. Might need to make it even less frequent. We'll see. :)</p>
<p>The frequency doesn't matter. Your nails will be gone and become useless before you can say &quot;corrosion&quot;, and you don't want to be changing your nails every other month. </p><p>You should switch the voltage flow as much as possible, much like AC current, to prevent electrolysis from eating away your nails. Take a look into that! :)</p>
<p>For the most recent revision of my waterbot, I am switching the sense current on for a few seconds before a read, reading the resistance a number of times, reversing the current, letting it 'settle', reading it the same number of times in the other direction, then switching it off again and using the average of all of the reads as my soil moisture value. </p><p>Using only 14-gauge galvanized steel (electric fence wire) as my electrodes, it has run several times in this configuration for up to six months at a time with no significant corrosion evident.</p>
<p>Sounds like a plan.</p><p>I've altered the system to only read when a button is pressed, so the nails should last a LOT longer:</p><p>https://www.instructables.com/id/SoilMoisture-Detection-System/</p>
<p><a href="http://www.simplecircuitdiagram.com/2010/10/19/cd4093-water-level-sensor-detector/" rel="nofollow">http://www.simplecircuitdiagram.com/2010/10/19/cd4...</a></p><p>This should help you on your way!</p>

About This Instructable

2,739views

44favorites

License:

Bio: Self-taught part-time artist who paints, draws and doodles.
More by ronnietucker:Go/Baduk/Weiqi Game Board Brewduino Soil/Moisture Detection System 
Add instructable to: