Same code yields different results UnoClone/Thing-Dev with moisture detector

Hey everyone. New question for a project I’m working on. I’ve written a library to use in an Arduino sketch and on my Arduino Uno clone I’m getting the results I expect, but on the Thing Dev I’m getting a very consistent MAX VALUE reading.

What I’m doing:

I’m reading a value from a moisture sensors analog output (A0) expecting to read a value from 0-1024 from the Thing-Devs analog read pin (A0, ADC)

What I’m getting:

I’m reading a maxed value of 1024 while fully submerged and while dried out on thing-dev.

What I’ve done to try and figure out the problem:

-I trimmed out all the networking code down to isolate the problem

-I’ve played with the calibration knob to no effect.

-I disconnected the A0 output on the moisture detector; That got me lower inconsistent reading but indeterminate of moisture level. Just wacky readings, not sure how it got those values (same result when I disconnected the power pin).

-I disconnected from the Thing-Dev and connected to proper pins of Arduino Uno Clone- that worked and I was able to read a difference from wet to dry. Never lower than about 200 when submerged, and almost getting to 990 when dry- these are the readings I’m used to working with.

#include <ESP8266WiFi.h>
#include <ClimateSensor.h>

const int moistureSensor = A0, moisturePower = 5;

MoistureDetector MoistureDetector(moistureSensor, moisturePower);

void setup() {
  Serial.begin(9600);
  
  pinMode(moisturePower, OUTPUT);
}

void loop() {
  MoistureDetector.power(true);
  delay(10);
  int moistureReading = MoistureDetector.getSensorValue();
  MoistureDetector.power(false);
  Serial.println(moistureReading);
  delay(2000);
}

Anyone have any idea why it isn’t working on the Thing-Dev but is on the Uno clone? Does the Uno clone take a signal voltage more powerful than the Thing-Dev?

what does your hardware circuit looks like? The ESP8266 seems to have TOUT/A0/ pin6 input a 10 bit precision and its voltage range is between 0 and 1 volt. With the Arduino Uno however will provide a 10 bit precision number of an input voltage between 0 and 5V.

So the output of the MoistureDetector needs to be connected to a voltage divider where the moisturesensor output is connected to a resistor (R1), where the other side of that resistor (R1) is connected to the A0 AND another resistor (R2) from which the other side is connected ground. So if you have max voltage of 5V, you should have an R1 that is 4 x R2 : e.g. R1 = 4K, R2 = 1K. (in case of 3.3V it should be 2 : 1)

Nailed it! thanks @paulvha