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!

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

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.


Be the First to Share


    • Made with Math Contest

      Made with Math Contest
    • Multi-Discipline Contest

      Multi-Discipline Contest
    • Robotics Contest

      Robotics Contest

    28 Discussions


    Tip 11 months ago

    wraped = wrapped

    Also, I'd love to see a graph of the collected data, maybe force moisture (pour in some water) and temperature (add hot water) in a controlled environment. If you collect the data via Arduino can graph with google sheets.


    1 year ago

    I have been looking at a similar idea, I got a load of the sensors but then read that they don't last long due to corrosion.

    My first thought was to only take a reading every few hours. But also, maybe to put them in sand... dig a small hole fill it with sand and plant them there... the sand may not have the same moisture content as the soil, but should fall and rise at the same time, so still being useful for a self watering system.


    3 years ago

    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

    8 replies

    Reply 3 years ago

    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.


    Reply 3 years ago

    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)

    Reply 3 years ago

    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.


    Reply 3 years ago

    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 :-)


    Reply 3 years ago

    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.


    Reply 3 years ago

    > 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.


    Reply 3 years ago

    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.


    3 years ago

    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

    Tecwyn Twmffat

    3 years ago

    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.

    5 replies
    Tecwyn Twmffatgravityisweak

    Reply 3 years ago

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

    acolomitchiTecwyn Twmffat

    Reply 3 years ago

    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).


    Reply 3 years ago

    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

    dagoraldTecwyn Twmffat

    Reply 3 years ago

    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

    3 years ago