Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By ErikLem
#39757 After some trouble, I recently got my ESP-12 up and running. I've been able to upload sketches, run a web server and blink some leds, all worked like a charm. The next thing I want to do is hook up a soil soil moisture sensor, like this one:
Image

I hooked it up to 3.3v, gnd and connected the analog output to a0. Unfortunately I only get 1024 out of it, weather it's dry or completely submerged in water. When I use it on a arduino, I get the whole range of values from 0 to 1024

The sketch I'm using can't be simpler:

Code: Select allvoid setup() {
  Serial.begin(9600);
  pinMode(A0, INPUT);
}

void loop() {
  Serial.println(analogRead(A0));
  delay(100); 
}


Any idea where Im'n going wrong? The only thing I can think of is that the arduino powers the sensor with 5.5v, while with the ESP I'm powering it with 3.3v
User avatar
By ErikLem
#39774 ah, I did not know the ADC needed between 0 and 1 volts, that explains my readings.

I just measured what this sensor is giving me, it seems to give between 1.8v (fully submerged) and 3.3v (in air)
Is there any way I could convert those voltages and get a reliable output? Or could I better have a look at something like https://www.tindie.com/products/miceuz/ ... re-sensor/

Edit: Would a voltage divider like described here work? http://www.instructables.com/id/ESP8266 ... e-divider/