Currently have an Arduino Uno R3 reading a basic Moisture sensor using the code
moisture = analogRead(A2);
And originally, we could see that value being output up as far as 1023, which lines up with any tutorials on the moisture sensors with Arduino. I need that to be output as moisture percentage, so using a standard formula and a map, I was able to get a fairly accurate reading of the moisture percentage. And all was well.
We tried it yesterday again, and noticed the percentage was off. From trouble shooting, I seen that the sensor is now only maxing out at 730, down from 1023 and that's throwing off the calculation for the percentage.
The other odd thing we noticed is when we unplug the USB connection from the board to the laptop and then plug it back in, 1023 briefly appears on the output before going back to maxing out at 730 again. This happens consistently.
Anyone ever faced an issue like this? Would it be an issue with the moisture sensor itself possibly? Can't understand why it's not going up as far as 1023 anymore. Any help appreciated
It is possible the sensor was damaged, try another to validate your system. But first thing measure the voltages, they are critical I do not have a clue as to what sensor you are using or what its specifications are. Posting that would help others help you. If there is more then the sensor connected post an annotated schematic showing all connections, power, ground, and power sources. It could also be a loose wire, fairly common with a pin board.
If voltage at the Uno’s and sensor’s +V pins remain steady under all conditions then I think that should rule that first guess out.
But could you describe the application? The only moisture sensors I’ve ever used have been ‘damp detectors’, consisting of blotting paper placed under potential household leak/flood locations. All used basic circuitry, no Arduino, to detect when a resistance went from >20M ohms to say <100K and have worked reliably for decades. But if your app is soil-related that’s another, er, can of worms.