Soil moisture sensor has digital and analog data output (https://www.aliexpress.com/item/Free-sh ... 85387.html).
I have used simple code to just read value, test sensor:
Code: Select all
import machine
adc = machine.ADC(machine.Pin(36))
print(adc.read())
I couldn't find the cause, so i thought of using another pin on ESP32. Changed code first to use Pin(39), which is one below on the board . Just ran the code to see what value will it give prior I move physical wire from Pin36 to Pin39 to see the value prior I connect sensor there. Was expecting either error code or zero value. To my surprise I got value of around 2000 returned. So i did several attempts to read value while touching sensor with fingers, or putting sensor into water, this time value was changing. It was around 700 in water (not total sensor was submerged), value come back to around 2000 once I pulled it out of the water.
What is going on here? Why can't I read value on Pin36, like intended?