I made a soil moisture sensor out of two metal poles, adjustable resistor, for a project I am making. The first run with the project the sensor worked amazing and gave clear and concise readings, 0-800 depending on water. I then unhooked the sensor and left it in the soil while I fine tuned the code (added warnings to the areas that would read to low), and while testing the code without the sensor being hooked up my arduino uno (Sparkfun Pro Mini) would read a value of 330(area). I thought this strange but didnt worry about it.

Well I hooked up my sensor (just power, ground, and to the A1 pin) and now my readout for the readings jump from 0 to 800, 0 to 512, 0 to another random number. I commented out everything in the code BUT the part that sets up the pin and displays the analog reading and its still the same issue. I also checked all my wires, changed the resistor setting, changed to a 10k single resistor, nothing changed.

Does anyone have any idea on what could be wrong?

  • 1
    Could you post the simplest code that is effected by the error? Commented Dec 16, 2014 at 0:21
  • The sensor could be oxidized. I don't quite get how you've wired the sensor. It sound like you have not connected it in a voltage dividers configuration.
    – Gerben
    Commented Dec 16, 2014 at 11:51
  • I will post code a bit later (At work now). But here is how the probe is wired up. arduinodiy.files.wordpress.com/2012/03/… I doubt the sensor is Oxidized after 30mins of overall use, I have even cleaned the probes and the same effect happens. I will create a video tonight and upload code during lunch hours.
    – Trea
    Commented Dec 16, 2014 at 15:03
  • @BrettM Here is a really simplified part of the code. <code> #include <serLCD.h> #include <SoftwareSerial.h> #include <LiquidCrystal.h> int moistpin = A1; //Moisture Sensor pin int moistreading; int pin = 1; //SerLCD pin serLCD lcd(pin); //SerLCD pin void setup(){ lcd.clear(); lcd.print("Welcome to"); lcd.selectLine(2); lcd.print("Water-Me 1.0!"); } void loop(){ moistreading = analogRead(moistpin); lcd.clearLine(1); lcd.print(moistreading); delay(350); </code>
    – Trea
    Commented Dec 17, 2014 at 14:23
  • Have you tried using Serial.print() to print the value to a serial console? Could be a valid check to eliminate possible errors with the lcd. Commented Dec 20, 2014 at 6:04

1 Answer 1


You are constantly running .5mA through 2 nails in wet earth. What are they made of, that won't undergo some electrolysis in 1/2 hour? Gerben appears to have hit the, er, nail on the head in one, above.

You can avoid this to an extent by using a.c. drive to the probes, which reverses the effect so they only tarnish at about the normal rate for metal X in soil.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.