I’ve been playing (as you’ll know if you’ve read previous blogs here) with moisture sensing.
It’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.
So 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 way 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. http://www.ti.com/lit/ds/symlink/fdc1004.pdf
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?
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.
Merry Christmas! And an update on the one from the approach from this comment from back in May – https://tech.scargill.net/moisture-sensing-conundrums/#comment-2516. Its still going fine, pulled it up just now and gave the sensor a wipe and this is what it looks like – http://s11.postimg.org/6eujzz0ub/Soil.jpg – so over 7 months and just some slight blemishes. Those sensor can cost as little as US 34 cents – http://www.aliexpress.com/item/Soil-Hygrometer-Humidity-Detection-Module-Moisture-Water-Sensor-for-Arduino-CA1T/32345244861.html
torntrousers, is the sensor still working !? Need to build one and its seems that your solution its interesting.
Still working fine. Just pulled it up and gave the probe a wipe to take this photo – https://s32.postimg.org/m3by68sud/IMAG0359.jpg – there is some blemishing around the end but its still looking mostly shiny and fine.
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.
Just spotted this, people – reasonable price and if what they claim is true, should last.. capacitive sensor.
http://www.dfrobot.com/index.php?route=product/product&path=48&product_id=1385&sort=p.date_added&order=DESC&utm_medium=email&utm_campaign=The+Most+Powerful+Bluetooth+Arduino+Board+…&utm_source=YMLP&utm_term=image+152#.Vnw2ehWLSUl
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!
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!
Yup. Already came to that conclusion SLM- thank for the feedback – completely agree.
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?
My colleague Dominic Bramley uses node red and forecast.io to warn of impending rainfall – I believe that you can get very localised data about the amount too. http://dombramley.com/weather-prediction-with-node-red-forecast-io-and-a-raspberry-pi/
Hmm, didn’t think of that approach Tony.
Homemade ss soil probes: Stainless steel bicycle-wheel spokes, some blocks cut from a cheap IKEA polyethylene cutting board, drill the blocks for the spokes, and finally a two-terminal section of barrier strip (http://www.narva.com.au/sitebuilder/products/medium/943/terminal-strips.png) to connect wires to the probes.
Ok that puce simian beat me to the spokes idea… but yes you can get actual stainless spokes.
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?
-John-
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).
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.
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 🙂
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.
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.
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.
(Okay so HTML links in comments work but they are not underlined. Move mouse over brother and Here. Sorry, could not resist 🙂
That’s really great Chris – thanks for the link – that looks like it will do the job.
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.
Do keep us informed…
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.
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.
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.
Regards
Ian
Actually the cheapest I’ve found are from the website of Maplin here http://www.maplin.co.uk/p/maplin-replacement-rain-gauge-for-n25frn96fyn96gy-n77nf
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.
Not exactly sure how you’d use a tipping bucked to measure soil moisture content…..
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.
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.
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:-
http://www.ebay.com/itm/10A-Terminal-Block-12-Position-Barrier-Wire-Connector-Type-H-hv2n-/271323634735
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.
-John-
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.
Bicycle spokes!
They’re never stainless are they?
http://www.ebay.com/itm/10A-Terminal-Block-12-Position-Barrier-Wire-Connector-Type-H-hv2n-/271323634735
you won’t be able to solve the corrosion problem. check out the vh400 from vegetronix. it is quite expensive, but has no wear.
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?
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.
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.
I have the same result. Sorry, i should have told you that :<
No worries – alternatives are springing up all over the place as you can see.
Stainless steel screws driven through Trex (plastic deck boards) sounds like the ticket.
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.
Yes indeed.
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.
Let me (well, everyone in here) know how you get on with corrosion over time with that – sound like a plan.
Well as long as two weeks in and its still working … 🙂 I just pulled the sensor out to have a look and it still looks as pristine as they day it went in. The readings are going to here http://data.sparkfun.com/streams/YGXmrJENxoUpgONG3x3m – i watered a little on the 17th and a lot on the 26th.
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: http://zerocharactersleft.blogspot.com/2011/11/pcb-as-capacitive-soil-moisture-sensor.html
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.
Now this is more like it – the link http://zerocharactersleft.blogspot.com.es/2011/11/pcb-as-capacitive-soil-moisture-sensor.html has some good stuff in it.
Making your own tipping bucket is VERY easy. I made one for me… I can send you pictures… It takes me 2- hours…