What do my printed ADC values from my moisture sensor really mean?

Ok so here are my brief setup details:

xbee coordinator communicating with xbee remote router module both in API mode. I have a YL-69 moisture sensor connected to the YL-38 meter. On the YL-38 meter I have pin “D0” connected to remote xbee pin 20 (DIO0_AD0) configured as ADC. Vcc is connected to Vcc and GND to GND.

In code I basically get the adc value of IOLine DIO_AD0 and print it out every couple seconds.

Running the program:

When I dip the moisture sensor in water the program prints “1023”
When I remove the moisture sensor from the water the program prints “90”. (sometimes 89 or 92 or 93, so far).

So what do these values mean / where are they coming from?

Many thanks! :slight_smile:

The ADC input on the XBee is a 0 - 1023 value (10 bit). 0 would mean dry in this case and 1023 is max value. In this case, the meters max output value.

You are a veteran and at the ready hah - you’ve answered most of my posts :slight_smile: thanks!

My code setup is either backwards or you got the order backwards based on my post… when I dip in the water its ~90. When I keep it dry its 1023.

so,
dry = 1023
varying degrees of wetness is <= 1022.

I dont get why I connect the sensor’s DO(digital out) pin to the xbee’s ADC pin. when there is an AO pin on the sensor… I would think I would connect the AO(analog out) pin to the xbee’s ADC (analog to digital converter). But when I do that it doesn’t work lol. Fundamentals get the best of me.

10 bit value, gotchya. cool!

Yea I misread what you had.

Why are you connecting a Digital Out to an Analog input? That line on the XBee should be configured for Digital Input instead.

I was following this video (https://www.youtube.com/watch?v=9LxrX5Eeukg&amp;t=260s) of someone using the same sensor but with a Raspberrypi. He connected DO to the rasppi’s AO I’m pretty sure. and then in my code I am using a get_adc_value type deal. It works haha. But probably not working the way it could/should right :D.
I am interested in both making use of digital sensing that tells me HIGH/LOW states and equally interested in analog values so I can have different set points that trigger different functions.