I have an Arduino Uno and a moisture sensor (looks like a YL-69 clone) submerged in water. I need to read the sensor's (analog) value every 3 min or so. The problem is: the sensor is always powered by the Arduino (GND and VCC), i.e. the current passes through it at all times. Because of this, one of the sensor's electrodes (presumably containing copper) grows a cyan residue. I'd like to NOT supply any power to the sensor except for the brief moment when I need to read the value. How can I do this?

EDIT: I've just noticed a related question (link below). The user decided to intermittently power the sensor via a digital pin, rather than VCC. Is this reasonable?

Does a moisture sensor need warm-up time?

4 Answers 4


If your sensor draws less than 40mA to operate, then you can safely "power" it from an GPIO pin.

The related question also asks how long the sensor must be powered in order to get a stable reading. For a sensor such as this one, it appears to be a simple resistive voltage divider, with the moisture sensor itself providing one leg of the divider circuit. The active component appears to be a comparator to provide a digital HIGH/LOW output as an alternative to the analog output.

Most schematics show a capacitor between ground and the voltage divider output, presumably to reduce noise. You need to allow for this capacitor to charge up and become stable before you take a reading. The time for this depends somewhat on the value of that capacitor and the supply voltage you are using.

Safe to assume, however, that a wait time of 1 second is more than enough.


I built a project very similar to this last winter to monitor moisture levels in the soil of plants that I was keeping over winter in my basement. I used GPIO pins to power the sensors similar to what jose can u c described above and performed testing to determine the minimum on time to get readings. I found that 150ms was enough to get stable readings in soils varying from completely saturated and with standing water to very dry (plant leaves starting to show signs of drying out).


Here are other anti-corrosion measures for moisture sensors I found:

A moisture sensor with gold-plated electrodes: https://www.dfrobot.com/product-599.html#.UhflOL-N_H0

Replacing metal electrodes with graphite: http://tuxgraphics.org/electronics/200908/eth-flower-watering.shtml

Capacitive (i.e. not resisitive) moisture sensor: https://www.amazon.com/DFROBOT-Gravity-Capacitive-Corrosion-Resistant/dp/B01GHY0N4K/ref=cm_cr_arp_d_product_top?ie=UTF8

Non-corrosive high quality sensor ($$$): https://www.vegetronix.com/Products/VH400/


I use in my project the fully waterproof sensor SMT50 (see http://www.truebner.de/en/smt50). It is specified from 3.3V to 30V power supply with a current of around 3 mA, so that should be possible to supply it from a GPIO. Please not that the GPIO output voltage decreases with current (see AVR datasheet pin driver strength).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.