Hi,
I just wanted to know if I'm correct.
My .ino is working on a ESP8266-12 with a 3.3V ouput and not 5V.
My sensor is showing in the air 974 and in the water around 400 when using the 3.3V.
When I try the sensor on an arduino uno, my values are correct : between 0 to 1024. I'm using there 5V.
Is it normal? Mapping the value is the right solution? 100% = 400 and 0% = 974?
Or my data will not be correct?
Thx for your all and sorry for my english !
Jonathan
The ESP-12 analog input will give you a reading of 1024+ when the input on the analog pin is above 1.06V. It shouldn't ever receive a higher voltage (3.3V may damage the port). So that's the first problem you have to deal with.
Secondly, soil moisture is measured by resistance, and as such very much dependent on the composition of the soil. It is also almost certainly not purely ohmic, so may change with voltage and the time the voltage is applied (electrolyses may take place as ions start to move around in the soil).
Hi, yes I know
I'm telling that the output values depend of my output voltage. I can't get 1024 value with the 3.3V coming from my ESP. Is that normal?
You should be getting 1024 when connecting it to a 1.1V supply. Use a voltmeter to find the actual output of the thing.
This page has a good description of the sensor. More moisture gives lower output - a value of 400 is about 0.4V, that would be about 80 on the Arduino's ADC.
By the way, in this rare case it's probably a good idea to power it directly from the microprocessor so you can switch it off when not taking measurements. You have to do that if you want it to last longer than a few weeks. Put a voltage on the probes at all times and they'll corrode very very fast.
1023 is the max, or 0x03ff. 10 bits.