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

**URL:** <https://forums.digi.com/t/what-do-my-printed-adc-values-from-my-moisture-sensor-really-mean/21558>\
**Category:** XBee Programamble (S2C & 900 HP)\
**Tags:** adc, analog-input, sensor, xbee2, gpio\
**Created:** [July 15, 2020, 10:56am UTC](https://forums.digi.com/t/what-do-my-printed-adc-values-from-my-moisture-sensor-really-mean/21558 "2020-07-15T10:56:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![edunn106](https://avatars.discourse-cdn.com/v4/letter/e/dc4da7/32.png) [@edunn106](https://forums.digi.com/u/edunn106)\
**Post date:** [July 15, 2020, 10:56am UTC](https://forums.digi.com/t/what-do-my-printed-adc-values-from-my-moisture-sensor-really-mean/21558/1 "2020-07-15T10:56:31Z")

</div>

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! 🙂

---

<div class="post-metadata">

**Author:** ![mvut](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.digi.com/mvut/32/31_2.png) [@mvut](https://forums.digi.com/u/mvut)\
**Post date:** [July 15, 2020, 12:42pm UTC](https://forums.digi.com/t/what-do-my-printed-adc-values-from-my-moisture-sensor-really-mean/21558/2 "2020-07-15T12:42:44Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![edunn106](https://avatars.discourse-cdn.com/v4/letter/e/dc4da7/32.png) [@edunn106](https://forums.digi.com/u/edunn106)\
**Post date:** [July 15, 2020, 1:16pm UTC](https://forums.digi.com/t/what-do-my-printed-adc-values-from-my-moisture-sensor-really-mean/21558/3 "2020-07-15T13:16:15Z")

</div>

You are a veteran and at the ready hah - you’ve answered most of my posts 🙂 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!

---

<div class="post-metadata">

**Author:** ![mvut](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.digi.com/mvut/32/31_2.png) [@mvut](https://forums.digi.com/u/mvut)\
**Post date:** [July 15, 2020, 1:18pm UTC](https://forums.digi.com/t/what-do-my-printed-adc-values-from-my-moisture-sensor-really-mean/21558/4 "2020-07-15T13:18:56Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![edunn106](https://avatars.discourse-cdn.com/v4/letter/e/dc4da7/32.png) [@edunn106](https://forums.digi.com/u/edunn106)\
**Post date:** [July 15, 2020, 1:27pm UTC](https://forums.digi.com/t/what-do-my-printed-adc-values-from-my-moisture-sensor-really-mean/21558/5 "2020-07-15T13:27:29Z")

</div>

I was following this video ([https://www.youtube.com/watch?v=9LxrX5Eeukg&amp;t=260s](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.
