I have been trying to get accurate readings using the grow moisture sensors without the Grow hat using an esp32s2 (QTpy ESP32s2). I have had luck with my circuitpython script running and giving me consistent readings from a couple of other 3-pin moisture sensors that I had lying around, but when I use the Grow sensors, it get very inconsistent readings which is pretty useless. I bought six of them and have tried another from the batch and get the same results. I know I have the pins correct and I’ve tried it with 3v, 5v, with a pull-up resistor and without. I can’t figure out what is wrong.
My calibration script is as follows:
import board
import busio
from analogio import AnalogIn
import time
Create an analog input on pin SDA
moisture_sensor = AnalogIn(board.A0)
create a list to hold the calibration values
calibration_values =
take 5 readings of the sensor in dry soil
print(“Place sensor in dry soil and press enter.”)
input()
for i in range(5):
reading = moisture_sensor.value
calibration_values.append(reading)
print(“Calibration reading”, i+1, “:”, reading)
take 5 readings of the sensor in wet soil
print(“Place sensor in wet soil and press enter.”)
input()
for i in range(5):
reading = moisture_sensor.value
calibration_values.append(reading)
print(“Calibration reading”, i+5, “:”, reading)
Thanks for you reply. I couldn’t get that function to work in circuitpython but the readout consistently bounces from high to low with the grow sensor but works as expected with other sensors: