I am using an ESP8266 12 F Module with 3 x 1,2 V Batteries. I tried to connect an infamous chinese soil moisture sensor YL 69 like this (LINK) to the anaolog pin of the ESP8266 Module. The Module works from 3,3 Volt on to 5 V and comes with an electronic board that includes a potentiometer
I figured that since I am not going to use the digital output I don't need that extra board between ESP8266 12F and the sensor. The Sensor without the extra board offers two pins.
First Try: First Pin: A0 Pin of ESP Module and Second Pin: Ground of Batteries This got me some readings between 0.00 and 340 but it seemed quite unreliable and reacting slowly to changes.
A0 Pin of the ESP module to one pin and Pin4 of the ESP8266 12 F module to the other pin (the idea was that with this method I would be able to completely turn off the sensor while it's not needed and therefore increase durability of the sensor)
This got me some readings between 0.00 and 1024.
However while using
digitalWrite(PIN 4,LOW); I still got readings out of the sensor... how if theres no current flowing?
I tried the same sensor with an NodeMCU Board that contains an ESP8266 chip. I used the extra board and the analog output and got very good and reliable readings.
- What could I do to adjust the setup so that the readings with the "naked" ESP8266 module match those of the NodeMCU model.
- Why was I able to get some reading at the second try setup when digital pin 4 was turned off?
- Is there a way to use the First try method but to shutdown the sensor completely when not needed so that it doesn't draw any current?
UPDATE Thanks again for the help: Here's my solution: I connected VCC to one Pin of the Sensor and Ground via a 10 K resistor to the other Pin. Than I connected the Analog Read Pin from the ESP Module to a point between the 10 K Resistor and the Ground wire and I end up with usable reading between 0 and 1024 although I noticed that the readings reach 1024 quite soon but it is good enough for my uses.