Moisture Sensing Conundrums

I’ve been playing (as you’ll know if you’ve read previous blogs here) with moisture sensing.

soil sensorIt’s easy really to do this – you just put a low voltage through a couple of bits of metal and sense the current going through. All things being equal, the more current, the wetter the soil is (we’ll not get into discussions about salt water versus distilled etc.)

The problem is corrosion – too much current and especially DC current and your soil sensors soon go pretty horrible.

CorrodedSo with that in mind, rather than make my own sensors, I went off on the web in search of sensors. The very first thing you come to on EBAY are nice looking PCB-based sensors – so you get for almost nothing, a probe to go into the soil and a little circuit board to send analog or digital signals to your IOT project. You can choose to get a digital signal controlled by a POT as to what level of conductivity turns it from 0 to 1 – OR analog – the latter seems more sensible if you happen to have an analog input – as you do with an ESP-12 for example. Well, I figured if they have the market captured in low-cost sensors as there are so many ads for this particular example, they must be using low-voltage AC generated in the chip.  I connected everything up and it all works magically –

Except that I left the sensor in the soil for 2 days on test then pulled it out – and the result you see on the right. on each side of one of the sensors there is already considerable corrosion – there’s no scopeway this would last very long.  I got the scope out….

2 inputs – one blue, one yellow. The yellow is constantly at ground (oh dear), the blue at around 1.5v here…  and if you take the sensor out of the soil, the blue goes up to 2v.  So this is simply a DC current – next stop the meter – about 100ua.

It is  the positive + part of the sensor which is corroded, the ground part looking only very marginally degraded up to now.

So on the one hand, the current is indeed very low which you might expect would keep corrosion to a minimum but what you see is what you get – I can’t see how this would last more than a month or two and I would expect reading values to change during that time. 

It would not matter if this was a one-off but this design and similar seem to have cornered the very low cost project soil sensing market – there are loads of tiny variations but all it would seem using the same circuit. I can see a use for an ATTiny85 and 2 oscillating outputs coming up.   For my next trick I need to get a couple of bits of stainless rod and something plastic to hold them together – see if that works any better.  Low-cost, simple ideas welcome.

Update: So a couple of ways around this have come to my attention. One is to minimise the current by using a port bit to power the unit and simply turn it on when needed. Let’s say every 15 minute turn it on for a second, wait, read the data, turn it off.  Another thought that came from Raphael Siebenhofer is to abandon this solution cheap as it is and adopt a slightly more costly which requires you use i2c (2 wires) and use 2 insulated wires (no metal contact with the soil) and the Texas FDC1004 chip. The TI datasheet gives some ideas including the basics of a PCB layout for a capacitive sensor.

Further Update: Between reading comments from others – and a bit of grey matter burning… it is becoming obvious that this method is actually a bit of a waste of time. In winter, when it is frozen this device could indicate that the soil is dry – and needs watering – which of course it does not.  A couple of guys referred to the little buckets that Maplin do that detect rainfall. Well, that actually makes sense  so if it’s been raining today, don’t bother with watering the plants – otherwise water them say at the turn of dusk and the turn of dawn… but if it is COLD (temperature sensor), say below 3c, perhaps also don’t bother? Thoughts?


52 thoughts on “Moisture Sensing Conundrums

  1. torntrousers, that’s certainly very interesting feedback, did you coat the probes on your unit with anything? It looks from the photo as though they are tin plated or covered in solder maybe. The ones on the site you posted look like bare copper. Price wise they are a real bargain.

  2. Merry Christmas! And an update on the one from the approach from this comment from back in May – Its still going fine, pulled it up just now and gave the sensor a wipe and this is what it looks like – – so over 7 months and just some slight blemishes. Those sensor can cost as little as US 34 cents –

    1. torntrousers, is the sensor still working !? Need to build one and its seems that your solution its interesting.

  3. This looks very similar to the capacitive soil moisture sensor made by Catnip Electronics and available on Tindie for $13. I have a few of the Catnip sensors and can vouch for the quality of build. If the DFR one is as good then it represents good value for money at $7.90.

  4. Google “Using capacitance sensors to monitor soil moisture” for a UC Davis presentation that can provide insight into your question. As for my applications; they are for short term monitoring (8-12 weeks) of potted plants (2-10gal). Any drift due to organic matter is negligible in terms of maintaining a quantitative threshold for hydration. In lay terms, I only need to know “roughly” which end of the wet/dry spectrum the sensor is at. I imagine calibration might be necessary over longer periods of time, but have never tested this. Hope it helps!

  5. What you need is a “capacitive” moisture sensor. Using the resistive method you are actually measuring the salinity of the soil more than you are the water content. With capacitive sensing you are essentially measuring the magnetic field of the water. The sensors are bit more complex to construct, but this info can be pieced together online. Hope it helps!

    Note: regardless of the metal used, using the resistive method, through electro-migration, will poison your soil! Don’t do it! Throw out those cheep ebay sensor immediately if you plan to consume any of the plants you are monitoring. Resistive sensing in soil is useless, it is a novelty!

    1. Yup. Already came to that conclusion SLM- thank for the feedback – completely agree.

    2. SLM, I suspect that with capacitive measuring you may get a growing error over time by measuring water in the roots of the plant and not the water in the soil. Do you have any experience with that?

    1. Ok that puce simian beat me to the spokes idea… but yes you can get actual stainless spokes.

      1. Pete,

        Spokes – Yup, the canals and river beds of Tokyo are lined with shiny, stainless-steel spokes attached to shapeless clumps of iron oxide.

        Ice – The frozen problem doesn’t worry us too much here. By the time the soil has frozen, the well pump has already started its 3-month, deep-frozen hibernation (over-current sensing is a great thing, we don’t really want the motor windings trying to melt all of that ice on their own).

        This must be shaping up to be one of your most commented posts ever, isn’t it?


        1. Guiness Book of records for the most replies to a subject:-) Probably not but I do hope it has saved others from going down the wrong path…. (no jokes about garden paths with plants please).

  6. A more direct approach would be like Adafruit’s SHT10. It is a humidity sensor in a sinter metal housing that you bury deep into the soil. The sensor measures air humidity inside the porous housing that protects it from liquid water. Obviously a solid way and a real outdoor sensor – but $50 for each sensor would not be ESP8266ish.

    Well… The housing looks exactly like a pneumatic silencer and the best cheap air humidity sensor (the DHT22 or AM2302) starts at 2.40 €. I have not yet cut one open but the board inside looks like 11x11x4 mm. That is slightly more than the 8 mm width of the SHT10 sensor but not much. The SHT10 body is D14x50 mm, so a G3/8 silencer (D17 mm) might work. We will need the stainless steel version because bronze/brass would corrode and damage the roots of the plants.
    I just found a sinter plastic version for 3.50 €. Not as cool but we are at 6 € now. Much better – if it works.
    Any comments welcome.

    1. Just keep firing ideas…Stainless Steel straight to the A/D convertor sounds nice but I can’t think of anyone who happens to sell short lengths of stainless rod completely with useful spacers 🙂

      1. Here is a good overview of the different shapes of silencers.
        For the most professional look I would go for the SSL type. Thread and hexagonal area are useless but I could not find a stainless steel version without. Weld wires to the sensor and use a conical plastic plug to position it inside the filter. When the sensor starts drifting after a few years just pull it out and replace it.
        The cheapest SSL type I could find is 10 €. I will try a PSE type first.

        1. Update: The PCB from a disassembled DHT22 sensor is larger than expected. It covers the entire width of the sensor and has quite a few components on its underside. Board is 14x18x6 mm.
          My sample of a PSE type silencer arrived. The wall is much thinner than expected and it looks like a complete DHT22 may fit in.

  7. Pete, I love your blog.
    If you want an out-of-the-box solution go for chirp!’s little brother. A capacitive sensor board with I²C for $12. Miceuz has done another great job there. Here is his writup how it works.

    1. (Okay so HTML links in comments work but they are not underlined. Move mouse over brother and Here. Sorry, could not resist 🙂

    2. That’s really great Chris – thanks for the link – that looks like it will do the job.

  8. Hi Peter, I’ve made some tests with capacitive PCB design shown in link. It works fine for few days 🙂 . I met another problem with it… I cover it with few type of lacquer. Every test fails in a few days. Moisture penetrates in lacquer. The only type I didn’t test is polyurethane lacquer and epoxy lacquer… Now I turned back to resistive design. I alternate DC current from 2 pins, when no measurements are performed sensor is off. The problem is that range is too small. This leads to other characteristics. In this case reference voltage must be used instead of using supply voltage as reference. Also reading depends on temperature. Generally I didn’t find a solution, yet. I’ll try again with CAP sensing (polyurethane lacquer as cover) and continue to watch what is happening with resistive sensor.

    1. Have you tried engine or barbeque enamel? I was thinking that was what I used, But I have allot of rattle cans on the shelf, and I don’t remember now. *Insert Sad Face* I know it wasn’t just “paint”, I remember that much for sure. Hope it helps.

    2. I had this same problem. I plan to coat the sensors with polyester resin in my next experiment.

      So far I tried: epoxi resin, nail lacquer, paint markers. None of these worked.

  9. Hi

    Tipping bucket available as spare on UK ebay eBay item number:291353631134

    I have seen them at lower price but cannot find them a the moment.



    1. Actually the cheapest I’ve found are from the website of Maplin here

      Problem is they don’t ship outside UK/Ireland(I’m from Greece), and even if they do, shipping will be too high. Peter, being in the UK, might find this solution cheap and reliable though.

      Cheapest solution is 3d printing your own(the remaining electronics are simple; it’s just a reed switch and all you do is count how many times the bucket tips) but I don’t have access to a 3d printer myself.

    2. Not exactly sure how you’d use a tipping bucked to measure soil moisture content…..

      1. Not saying that you can measure soil moisture with this, but after discussing this issue with agriculturists they told me that unless they are specific plants that need an exact amount of soil moisture 24/7 and short bursts of water, this approach is too much of a hassle.

        The usual watering of 1-2 times per day for some specific time per plant type is the best approach for most plants we have in our houses’ gardens(flowers, bushes, trees). To make it “smart” though and adjust watering time according to weather conditions, you can use a tipping bucket to know how much it has rained in the past 24 hours for example. Add in your calculation formula data from a barometer or internet weather data if it’s going to rain in the next few hours, and perhaps also take temperature data into account, and you can modify the watering time of the plants according to their needs.

        1. Right- I see what you mean now.. well, that seems as good a way as any – a combination of rainfall and temperature would give a fair indication – you would need to use temperature – and thinking about it – the sensing solution has a MAJOR flaw – it won’t tell you if it is icy! So heavy rainfall could suggest you don’t bother – and temperature could also indicate you don’t bother – failing that twice a day.. yes that makes a lot of sense.

  10. Let’s try that again….

    As always, it depends on what you want to do… pot plants will be different to an installation for an orchard (and I favour the latter). What I was thinking of recently was using a two pieces of what we used to call “chocolate-block” or “barrier-block” wire connectors (used to be available all over the place, but I never see them nowadays) to hold the probes at a set distance apart, with a ~5cm chunk of normal, plastic hosepipe as an additional support-cum-level-setter, between them. The top block serves double duty as a separator and as the wire connector for the probes (then comes your chunk of hosepipe), while the bottom block works only as a separator. I still haven’t found any good, reasonably long, cheap stainless steel to use as probes, though. Any suggestions?

    The chocolate block connectors -are- available on ebay:-

    What I’d like to do is use long probes (maybe 25~30cm) with the top 2/3rds insulated with heat-shrink, so that I can get a reasonable idea of the root moisture level for fruit trees.


    1. I think your idea is good, John – but also an idea that came in from Google+ – completely different and slightly more convoluted but utterly free from corrosion – see the update at the end of the blog. A Texas capacitive i2c chip… all good stuff.

  11. you won’t be able to solve the corrosion problem. check out the vh400 from vegetronix. it is quite expensive, but has no wear.

    1. Nice solution Martin – but possibly way too expensive for many. See update to the blog, a Texas chip that might do it – wonder if anyone has a completed project using this?

  12. Peter, I have done some work with moisture sensors and had similar experience to yours. I bought some stainless steel rods about 2.00 mm diameter off Ebay. I used a chocolate block electrical connector to provide a cheap spacer / holder and means of achieving a connection. I guess you could use copper or brass rods too. I used an AC circuit based on a 7555 circuit which I found on the net. I never took the project to the stage of linking it to an Arduino or ESP8266. I got results acceptable for my needs on the ‘scope though. The chocolate block connectors allow you to experiment with the distance between the rods. I set mine to about 10 mm apart.

    1. Thanks Bob – I too was thinking Stainless steel and turning the thing on and off as needed. I think that is likely to be the short term solution if I can find stainless rods here in Spain.

  13. Stainless steel screws driven through Trex (plastic deck boards) sounds like the ticket.

  14. Assuming the corrosion is caused by the electrochemical reaction with the minerals in the soil, isn’t it possible to switch off the sensor when you’re not measuring? I suppose you don’t need to sample the moisture level on a second or even minute scale? I am curious whether it would help if you would measure, say every 10/15minutes, by turing the sensor on, let it settle for a few seconds, measure and then turn off again.

  15. Hi Peter, i like reading your blog, thanks, so thought i’d comment…
    Coincidentally I’ve just been looking soil moisture monitoring too, and have one of those cheapo sensors. Still experimenting with the best setup but presently i’ve started using just the sensor bit that sticks in the soil and not the board that comes with it, instead connecting the sensor directly to GND and the analog pin on an ESP8266, with a 1Meg resistor in parallel with the sensor and a 2Meg resistor from the analog pin to GPIO4. Then before the analogRead set GPIO4 high, and then low again after the read. That uses just a microamp or so when active, which is only briefly once per day with the ESP sleeping the rest of the day, so i hope that should minimise corrosion. I have the ESP sending the reading to FRED (which i read about from your blog) with a flow that logs the reading and also looks at the sensor value and sends a tweet if it gets too dry, or an email to me if it doesn’t get a reading every day.

    1. Let me (well, everyone in here) know how you get on with corrosion over time with that – sound like a plan.

  16. I’ve been following your blog for a while quietly now, but it’s the first time I’m posting. I’ve been looking into this to make a smart arduino irrigation system a while ago, and from what I’ve seen all resistive sensors(aka two prongs into the soil) have this issue and are practically useless. There are capacitance moisture sensors that seem to work better(and other far more expensive) like this one:

    After speaking with a couple of agriculturists though, unless we are talking about indoors irrigation systems that need a specific level of soil moisture all the time(like tomatoes in a greenhouse), let’s say for example watering your outdoor flowers and trees in your house, it’s just better to use a weather station of some sort as your “smart” component. A barometer should provide enough info if it’s going to rain in the next few hours(or just internet weather data) and a water tipping bucket should give you a good estimate of how much it has rained in the past 24 hours(or as much as you want to log), do the calculations and see how your watering time should be adjusted. Only problem is I can’t find a cheap tipping bucket to buy online and the easiest solution is 3d printing one yourself.

    1. Making your own tipping bucket is VERY easy. I made one for me… I can send you pictures… It takes me 2- hours…

Comments are closed.