Introduction: An Improved Moisture Sensor

Hello everyone
This is my first instructable hope you like it.

English is not my first language please help me improve if you notice grammar mistakes.

I needed a soil moisture sensor but the ones I can buy are not very resistant nor high quiality looking, at least not for what I intended so I decided to make an improvement because originally also I needed to measure temperature on the exact same spot where the moisture probe was going to be placed.

So... why not both in the same probe?

Tried to search something similar to my idea without succes, so it is time to build it!

Step 1: Materials

Well, altough I said this kind of sensors were ugly the module sensor still works pretty fine so we will use one of them:

Pricing in US DLS, most of the items bought from AliExpress

1 Moisture sensor - Less than 1$

1 DS18b20 Water resistant probe - 2$

3 m. of 4 lines cable - 2$

An unused garden solar lamp - 2$ If you already have the stainless steel pipe that serves as a base for the solar lamp, thats all you need I bought mine form Walmart, otherwise you should consider buy stainless steel pipe.

5 centimeters long of stainless steel round bar (I used 4.5 mm in diameter) - 10$ for 3 meters


GX12 type connector of 4 pin - 2$

Step 2: Cut

First we need to cut the stainless steel pipe from the solar lamp to the desired lenght, in my case I used one pipe for two sensors so cut in half resulting in 67 mm long.

The other thing we need to cut is the stainless steel bar (the one 4.5 mm in diameter) 50 mm long

I used a moto tool with cut disc for the Pipe.

Step 3: Dissasemble the DS18b20 Probe Sensor

Lets disassemble the Temp probe, but we need to be careful because I have encountered that some of this waterproff probes aside from the plastic that's between the metal and the plastic to keep the together they add Epoxy inside the metal probe to keep the DS18b20 inside and isolated, these cant be used for our goal.

Use some cutter knife to remove the plastic and the sensor will come out smothly, just be careful not to cut yourself.

Step 4: Make Some Notch

We need some way to use the pieces of metal that we already have as electrodes for our probe so we will adapt them, simply make a cut with the moto tool in the metallic bar near the end of it, just be carefull not to cut trough.

For the Temperature probe we will use the one obtained from the DS18b20 water proff probe.

In this case we will only cut half way trough.

See the photos.

Step 5: 3D Print a Guide

I printed the guide for both electrodes to fit inside the pipe, the file is atached if it helps.

Insert both electrodes from the end we previously made the cuts into the 3D printed part.

It should fit with the help of a few hammer hits.

The result should look like the ones in the pictures.

Everything should fit nicely.

Step 6: Put Everything Togheter

Solder everything as shown

The electrodes should be connected with wire around the one solid (the one that is only metal) make a ring of wire around the round cut we did, then solder it like if it was a ring, the more thigh the better connection and less failure. The tin solder should fill all the space left in the notch where the wire is wraped.

Do the same for the electrode that fits the DS18b20, but instead of wrapping it around, get the wire trough the notch we cut.

The red wire of the DS18b20 to the VCC of the module

The black wire of the DS18b20 to the GND of the module

Make sure the DS18b20 is isolated before siliding it inside.

Isolate everything and make it fit inside the stainless steel pipe.

Step 7: Almost Done

There is still some work left

I will fill the inside of the pipe with epoxy resin.

You can test it via arduino, I attached some example you can use in Arduino.



acolomitchi (author)2016-06-07

A suggestion: keep an eye on the electrodes for longer terms (months most probably)

Stainless steel as it may be, passing a current through them will still result in corrosion over time - you are actually measuring the resistance of an electrolytic cell at small voltages/currents with dilute electrolytes. Supplementary, any salts resulting from that corrosion and leaching into the soil are bound modify the resistance of the soil.

Maybe using some graphite bars (central electrodes of a D battery?) would alleviate the effects?
Granted, you'd still have minute changes resulted from the ions from the soil salts recombining in less soluble/mobile forms (e.g. trace amounts of chlorine will degas over time and probably replaced by a heavier - less mobile, higher resistance - bicarbonate ion).

Anyhow, the effects are hard to quantify - they may be small enough to fall under the variability given by the watering itself - washing away some salts, adding others, migration/concentration of some salts in the upper level due to capillarity and evaporation, etc.

Some other biotic factors may fool with the measurement: plant roots growing between your electrodes, colonies of bacteria which may be favoured by the (even occasional) electrical activity (see Geobacter - they'd love some ferric ions to reduce; granted, geobacter is mostly anaerobic, but there may be others, bio-remediation is reality), etc

Polymorph (author)acolomitchi2016-07-02

Graphite is a great idea. Corrosion will still happen, but the corrosion is simply CO2 and won't coat the electrodes. And it won't poison the soil with metals.

acolomitchi (author)Polymorph2016-07-02
You can even "paint" yourself the electrodes on a plastic (a PVC pipe is much cheaper than stainless steel and easier to handle).
I've done it with a suspension of graphite powder in a  solution of polystyrene in xylene - the result is a conductive layer. (just search "conductive ink" on youtube and watch the clips having Robert Murray-Smith as the author)

The downsides:
  • - it's hard to control the resistance of the "painted" electrodes themselves - thus from the start each "probe" will need it's own calibration. Not a big issue given that this would need to be done anyway due to the soil variability
  • - I can say nothing about the stability of the electrodes/resistance over time - I'm not worried about corrosion, but I'd keep an eye on mechanical stuff (abrasion mostly, cracks due to bending)
dagorald (author)acolomitchi2016-06-07

Thanks for the suggestion, indeed, graphite electrodes would decrease electrolityc corrosion, I will try them soon, and also test their resistance to impacts and rough use. Initially I used the stainless steel because it is the most used material for the probes commercially available. The biotic factor is something I must investigate further, thanks for the suggestion.

diy_bloke (author)dagorald2016-06-10

Galvanized steel (for as far as that is different from stainless steel) is also often used.
As acolomitchi suggests using the graphite probes of a battery is a possibility, but I havent come across some of those lately.
Nevertheless just using steel probes is a quick and easy way of measuring soil moisture (actually you are measuring soluble ions) and I have used it a long time. Just do intermittent measurements and switch off the current to the probes in between will last you a long time.
But for the health purists: when the metal of your probe is eventually eaten away.... guess where it is. Might not be so bad for the iron, but the chrome and nickel are also gone :-)

Polymorph (author)diy_bloke2016-07-02

Galvanized steel is only used by hobbyists, as far as I can tell.

It is coated with zinc, which is to act like the zinc sacrificial anode on a boat. So when it gets wet, galvanic corrosion eats away the zinc before rusting the iron. But galvanized metal is not meant to be placed in constant contact with moisture or dirt, the zinc will get eaten away very quickly, then the iron rusts.

And the zinc oxide is a bit toxic.

diy_bloke (author)Polymorph2016-07-02

thats exactly why i am not using it

acolomitchi (author)dagorald2016-06-07

> I used the stainless steel because it is the

> most used material for the probes commercially available.

Most probes commercially available using stainless steel would have a pH-meter incorporated (I suspect their measurement logic compensate for the pH to get a more accurate moisture measurement) or other methods to compensate (buffer) the pH variation.

Since your doesn't, I think the main use case you have in mind falls into the "irrigation based on relative moisture variations over time in the same place" (as opposed to the "portable probe: stick into the ground, read the humidity, move on and take the probe with you" scenario). Even more so as your choice was to hack a low cost moisture sensor.
My personal experience with the same toy-sensors you hacked tells me the
are unreliable even when used in the "irrigation" scenario (or I didn't manage to handle it properly) and totally unusable in the "portable" one.

If you, however, wanted a "portable humidity probe", be aware that the soil resistivity is dependent on heaps of other factors beyond the water content (salinity, compactness, temperature). May be a good research project if you have time to do it.
Here's a link to one of the articles I read a while ago while trying to solve a problem of mine

Best of luck.

dagorald (author)acolomitchi2016-06-08

I have seen some probes that got three electrodes, to be used as comparative points, but adding a pH compensation it is a great idea! thanks for the idea and the article, I will develop it in the near future.

diy_bloke (author)2016-07-02

Just one more question. You are using the Analog output of the board. I was always under the impression that that output was in fact directly connected to the sensor making the board obsolete, but i could be wrong

acolomitchi (author)2016-06-12

Some had found that the resistivity varies over the day-night cycle because of the temperature.

As your probe has temperature reading, I'm curious if you experienced the same.

Tecwyn Twmffat (author)2016-06-08

Looks very similar to my recent project on instructables: search DIY soil moisture'. The probe is accurate, but the power needs to be pulsed for 50ms once every hour or so to prevent corrosion.


Interesting. I didn't realize you could prevent corrosion by pulsing the power.


To actually stop the corrosion the polarity could be reversed on each pulse. Now that WOULD be an improvement !


Not quite - it will slow it further down, but no warranty that an ion that left your probe is the same ion that will return once that the polarity is reversed; more mobile species might present in the soil (say, one Ni ion leave, a sodium comes back).

diy_bloke (author)gravityisweak2016-06-10

there are various ways. pulsing the power does lessen corrosion because there isnt current 24/7. Could also use a timer yo do a quick measurement say every 10 minutes, or every hour. Big difference between a current that goes 24/7 or one that goes say 6 times a fraction of a second.
If you don't want corrosion, take a capacitive probe. I and others have published those on instructables

dagorald (author)Tecwyn Twmffat2016-06-08

Indeed! they look quite similar, in fact I've just arrived home from pouring resin into my probes and checked this message and your instructable. Well you know what they say: Great minds think alike! :-)

Tecwyn Twmffat (author)2016-06-08

diy_bloke (author)Tecwyn Twmffat2016-06-10

I love yr name, obviously you are welsh. How to pronounce yr last name?

Tecwyn Twmffat (author)diy_bloke2016-06-10

It's pronounced 'Tum (as in tumult) - fat', and is welsh for 'funnel'. I myself am not welsh - more of a Euro-mongrel cross breed ie English, Irish, French etc. Must try and find your capacitance probe project now ......

diy_bloke (author)Tecwyn Twmffat2016-06-10

tnx for the explanation. You will find it here

deki (author)2016-06-07

any ideas on how to make the probes pointed to go into difficult soil?

ranjeevm (author)deki2016-06-07

Use a dremel to make a point sharper and ruggedize the top so that you are able to gently hammer the top. Just remember that hard soil can be loosened by watering over extended periods of time and no amount of ruggedization will help you if you are trying to put the sensor through rocks.

dagorald (author)deki2016-06-07

Well yes, for the solid electrode it only has to be cut longer and then using a metal lathe could be achieved a durable and pointy end, as for the Ds18b20 electrode I would probably solder via MIG with stainless steel wire some points at the end of the electrode to extend it, then again using a metal lathe to make it pointy. In both cases the electrodes will be soil piercing and resistant to rust.

seamster (author)2016-06-07

Very nicely done! This is a great first instructable. Can't wait to see what you make next! :)

dagorald (author)seamster2016-06-07

Thank you!