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?