Moisture Sensor

Hi there Folks!

Been wondering if any of you have used this moisture sensor, compatible with Arduino:

It has 3 terminals:

G: Ground
V: Vcc
S: Analog signal output

When I insert it into the soil (through a pot) it shows 1023 in the Arduino IDE.
If I just take out the sensor and put it on my wooden desk, it keeps on showing the same 1023, making no difference between being in the soil & out of it.

Here is the code used for the test:

int ASignal = A0;
void setup() 
void loop() 
int sensorValue = analogRead(ASignal);

The way the Sensor is attached to the Arduino is through the A0 port as you may see from below:

Any idea of how this sensor works talking about the Analog way?

I have read its datasheet but no big deal about its functionality.

Thanks in advance!

Edit: If I connect A0 to GND using a 10k resistor, it shows 0 in the IDE.

I had to add more water to the plant & see how the lecture of the analog output changed, showing:

It seems that

1023 - No moisture detected
Lower values - Moisture detected. The lowest, the more water the plant has

I am just guessing this is how this works.

Take a picture and show us how it is connected to the Arduino.
Do you have a Link?
What happens when you connect A0 to GND trough a 10K resistor?

Sure. Updated post! :slight_smile:

Sensor datasheet.
Is this a "dumb" (resistive) sensor, or does it have electronics on the other side of the board.

It’s got a little chip on the other side:

This other side, belongs to the digital “part”, this explains why the pot and 4 pins instead of three.

Seems to be a sensor from iteedstudio with an analogue and "digital" output.
The digital out is just a comparator (too wet/too dry).
The schematic on the website is (deliberately?) incomplete.
Looks to me that the sensor fingers and a 10k resistor make up a voltage divider.
That voltage is buffered by one half of the (LM358) opamp, and fed to the A-out.
The other half of the opamp, the comparator, goes to the D-out.
The pot sets the comparator threshold.

S-out is the switch output. It lets the user select the analogue, or comparator output on that S-pin.

OP. If you use the sensor on A-in of the Arduino, set the switch to analogue.
And connect VCC to +5, and GND to Arduino ground.
This sensor needs supply and ground for the IC to work.
I don't see that connected in your pictures.
The threshold adjustment pot is irrelevant.
Try dipping the tip of the sensor in a glass of water while looking at the serial monitor.
I guess you have to make your own "scale" from the data you're getting.