21

I have a Raspberry Pi project that has three soil moisture sensors. I take a moisture sample every minute. After about a month I started to get bad readings. On further inspection I noticed that my soil moisture sensors were corroded to the point where they were giving false moisture readings (it completely corroded the metal contact away). It corroded all the sensors equally.

Is soil moisture sensor corrosion normal? If so, how do you prevent this? Is it just a cheap sensor? What is recommended?

Soil Moisture sensor

The sensor I bought can be found here: Amazon - XCSOURCE 5pcs Soil Moisture Sensor And Automatic Watering System for Arduino TE215.

  • 4
    Some people claim that using AC to do the measurement helps too. – PlasmaHH Jun 8 '17 at 7:34
  • 3
    I have read numerous sites claiming that reading capacitance instead of resistance is the preferred method that also reduces corrosion. – user9993 Jun 8 '17 at 8:48
  • 5
    If you want your sensor to last, use an insulated sensor that measures moisture content through capacitance, which doesn't need direct electrical contact to the soil. This is a good one: vegetronix.com/Products/VH400 – Mels Jun 8 '17 at 12:36
21

If you think about what is happening you have a very hostile environment for electronics (moisture - sometimes large amounts, soil PH and electrical current induced electrolysis)

The Hookup Guide for the SparkFun Soil Moisture Sensor includes the following:

One commonly known issue with soil moisture senors is their short lifespan when exposed to a moist environment. To combat this, we’ve had the PCB coated in Gold Finishing (Electroless Nickel Immersion Gold).

Another way to extend the lifespan of your sensor is to only power it when you take a reading. Using a digital pin set to HIGH on an Arduino, for example, is an easy way to accomplish this. If you wish to power the sensor with more than a digital pin on your microcontroller can provide, you could always use a transistor.

So yes this is normal, I can't speak to the longevity of the sparkfun sensor, but the extra lifetime afforded by the "Gold Finishing", may well be worth the extra cost for your use case. As others have stated powering the sensor only when taking a reading will also increase the lifetime of the sensor. I would also question the need to take a measurement every minute. Does your soil moisture really change significantly over that short a time period?

I just saw this new method (covered in step 5) using graphite rods (pencils) to make long lasting probes.

22

Yes, this is normal for a DC drive configuration. You're effectively setting up an electrolysis experiment where the copper atoms on the positive electrode are being ionised, transported via the soil's water content across to the negative electrode where they are being deposited and returning to being copper atoms. This explains why the negative electrode looks surprisingly clean for having been buried - the top layer of atoms are recently deposited and likely very pure.

To get around this, there are a few things you can do. Gold plating is a good start, but it will need to be thick and consistent (even an atomic hole will allow access to the underlying copper and eventually this will get eroded). Most ENIG plating on PCBs is to ensure SMD pad flatness and minimise corrosion during storage - you would need a "hard gold" plating for long term use and even then eventually it will fail.

The best approach is to use an AC drive. Here, the electrodes swap from being positive to negative frequently during use. Because of this, ions that get transported and deposited in one half-cycle will be returned across and redeposited in the next half-cycle (where the polarity will be reversed). Net result is no overall electrolytic corrosion (and actually a partial self-cleaning function). Most capacitive sensing schemes are net-zero DC and so doing cap sensing as opposed to resistive sensing on the electrodes will likely help, as others have suggested.

This EE Stackexchange Q&A goes into some detail on drive schemes and a discussion of AC circuits. The way I have done it in the past is to use an astable multivibrator to drive the two electrodes with an AC waveform and then measure the DC input current to the multivibrator and calibrate that against moisture - but I am sure there are more elegant solutions out there if you Google enough.

One last point - if you're using an AC scheme, you should be powering the electrodes continuously to maintain the self-cleaning function (unpowered copper will eventually corrode in soil). With a DC scheme, powering only when needed will reduce the speed of corrosion (as electrolytic corrosion will be faster than that of unpowered copper) but it will not prevent it in the long-run.

  • 1
    Just a thought: Can't you guys use something like Titanium as the sensor metal? Ti resists corrossion even in hot brine. Or is Ti unsuitable as a sensor? – curious_cat Jun 9 '17 at 5:19
  • 3
    +1 for much more detailled explanation + very concrete tips for fixing than the accepted answer. I haven't thought it through and haven't read up on how the sensor is connected, but couldn't you hack a very simple "ACish" solution: not real AC (as in sinoid curve), just toggling the two contacts from VCC to GND and back again. Synchronous of course. The actual sensing only needs to be done when a parcitular contact is "on", of course, to make it easier. So in regards to sensing it stays DC, but in regards to electroplating the anode it switches around. – AnoE Jun 9 '17 at 11:36
  • Square wave AC as you describe, @AnoE, will work just fine. However, care must be taken to ensure that the potential to earth (real, actual earth - the earth you are putting the probe into) goes positive and negative. If the ground connection of your drive circuitry is connected to earth, the mean voltage at each electrode will be somewhere between the positive switching voltage and earth (half way if the duty cycle is 50%). One way to overcome this is AC-coupling the output drives via series capacitors - another would be using a transformer to couple the output. – stefandz Jun 9 '17 at 15:30
  • Re: Ti as a sensor, @curious_cat - sounds possible. Also sounds more costly than an AC coupled direct contact sensor or an insulated capacitive sensor as suggested by Mels under the main question. – stefandz Jun 9 '17 at 15:36
  • Truy, @stefandz, I was more thinking about potted plants anyways. :D I guess that is an implementation detail most electronic guys don't face too often. – AnoE Jun 9 '17 at 16:52
8

Yes, it's normal.

One electrode (the anode) will oxidise.

That said, it shouldn't happen so quickly. I guess you have the sensor powered constantly. That means you always enable corrosion.

What you can do it so make sure there is current running to the sensor only when you take a reading from it. This will pause corrosion in between the measurements, and make your sensors last longer.

2

This recent Preventing corrosion on YL-69 might answer your question to at least some extent I think. It reminds users of the sensor to power on the sensor only for short periods of time in order to avoid electrolysis and thus corrosion when you are running it on a constant current.

1

Sand it a bit with grain 2000 and solder a thin layer of lead-free solder onto it. Do this every few months. The stuff underneath is glassfiber, just be careful around any IC.

I'm much in favour of the idea of only powering a moisture sensor briefly, and then turning it off until its needed again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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