Soil Moisture sensor return 1023 when in water

Hi,
I'm new to Arduino and was testing soil moisture sensor program that was freely available.
when i run the test my soil moisture sensor sketch output value as 1023 when in water after that it stays in that value forever even if i remove sensor out of water.

Welcome to the forum

What happens if you dry the sensor ?

How is it connected? A little schematics please.

1 Like

Please post your freely available code you are using and a schematic of how things are connected.

Thank You
Ron

1 Like

I will take a SWAG and say With the components used and how they are connected it is working as expected. Post an annotated schematic showing exactly how you have wired it and links to technical information on the hardware items. Be sure to show all power, ground and power sources.

As i'm new user, site is not letting me to upload the photo but here is the link to project that i tried to do

It works fine only when probs are outside of water and touched with fingers but when sensors are kept inside soil or water motor it does not work as expected.

To post images etc. you need trust level 1, you can get there by:

  • Entering at least 5 topics
  • Reading at least 30 posts
  • Spend a total of 10 minutes reading posts

Users at trust level 1 can...

  • Use all core Discourse functions; all new user restrictions are removed
  • Send PMs
  • Upload images and attachments

When i test before placing it in water it works fine. Once i place in water then output value jumps to 1023 and after that i see some junk value printing in output window until i power down the UNO board.

added project details in this post - Soil Moisture sensor return 1023 when in water - #6 by learnerlwr

Added project details in this post - Soil Moisture sensor return 1023 when in water - #6 by learnerlwr

Links to projects and searching for information is not interesting. You do that and post schematics here.

I am surprised the Arduino is working, connecting motors to them is bad. Without proper annotation on your "schematic" I cannot be of much more help.
My Crispy Critter Rules:
Rule #1. A Power Supply the Arduino is NOT!
Rule #2. Never Connect Anything Inductive to an Arduino!
Violating these rules tends to make crispy critters out of Arduinos.

Test the soil sensor alone, with just the Arduino (remove everything else, and any code associated with those other functions).

The Arduino cannot be used to power motors or servos. Use a separate power supply for that, and don't forget to connect the grounds.

here is the schematic and below the program

const int sensorpin = A0;
const int sensorpower = 8;
const int LED1 = 2;
const int LED2 = 3;
const int LED3 = 4;
const int pumppin = 11;
int sensor;
const int delayTime = 1; 
int wet = 800;
int dry = 500;

void setup()
{
  pinMode(LED1,OUTPUT);
  pinMode(LED2,OUTPUT);
  pinMode(LED3,OUTPUT);
  pinMode(sensorpower,OUTPUT);
  pinMode(pumppin,OUTPUT);

  Serial.begin(9600);
}

void loop()
{ 
  digitalWrite(sensorpower,HIGH);
  delay(10);
  sensor = analogRead(sensorpin);
  digitalWrite(sensorpower,LOW);
  Serial.println(sensor);
  if(sensor>wet){
    digitalWrite(LED1,LOW);
    digitalWrite(LED2,LOW);
    digitalWrite(LED3,HIGH);
    digitalWrite(pumppin,LOW);
  }
  else if(sensor<dry){
    digitalWrite(LED1,HIGH);
    digitalWrite(LED2,LOW);
    digitalWrite(LED3,LOW);
    digitalWrite(pumppin,HIGH);
  }
  else{
    digitalWrite(LED1,LOW);
    digitalWrite(LED2,HIGH);
    digitalWrite(LED3,LOW);
    digitalWrite(pumppin,LOW);
  }
  delay(delayTime);
}

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.