Do you have any sort of series scaling resistor in the circuit? My guess is that the current limited USB supply acts a bit like a constant current source. If the wall supply is not as well regulated and has a much lower source impedance the reading would be jumpy. A series resistor would calm that down considerably and a capacitor across the two pins would provide some hardware averaging. The other type of soil moisture gauge that is common uses two different metal pins, such as copper and iron, with no excitation voltage. The electrochemical potential between the two drives a current through the soil. You would need a high-value resistor, ie 1M, at the espruino end to convert the current to a voltage. I think your two pins with a series resistor and parallel capacitor would actually work better; it has the advantage you can shut it off when not in use.
© Espruino, powered by microcosm.
Report a problem