I have a wemos D1 mini clone and I’m trying to use a soil moisture sensor like this: Soil Moisture sensor on Ebay
If I connect the sensor to the VCC (3.3V) and the GND to the same ground the wemos clone is getting everything works ok.
If I try to connect the VCC of the sensor to the digital pin (D2 for my example) it doesn’t work and show 0 or a number close to it…
everything else is working fine… just this part…
I checked that the sensor really gets power and it does and outputs the correct voltage on the signal pin so that is working as well.
am I doing something wrong?
int soilSensorValue = analogRead(A0);
also tried that:
//Soil Sensor Reading:
int CurrentRead = analogRead(A0);
if I do it on the first example I get the results more or less… but I can live with them…
On the second example I get nothing… always 0 or close to that.
Please help me… I’ve been trying to find the solution for the last 4 hours and got nothing.
I read somewhere that if you keep it connected all time you reduce the sensor life span… so you hook it up to a digital pin and when you want to read the moisture you put it to HIGH and read from the analog pin… and then put the digital (VCC) pin to LOW…
if you say that it is nonsense then I’ll just use it without.
That sensor expects between 3.3v and 5.5v @ between 30-50mA, so you need to hook it up directly to a 5v power source for now (EDIT use 3.3v when sensor is hooked up to ESP)… until you can understand the transistor switch solution.
@Costas Ah, yes… good point… I am still thinking in Arduino mode
@sagirokach - As stated above, uses a good 3.3v source then… the 3.3v pin on the ESP may not supply enough current on it’s own. If using an external 3.3v source, make sure it’s ground is shared with the ESP ground.