Martin's corner on the web

DIY soil moisture sensor project

I have been working on a small DIY soil moisture sensor project the last couple days, mostly inspired by the gardenbot project. The idea is to add it to my greenhouse monitoring project. I chose to make my own sensor because it is quite easy to do, but if you prefer to buy a readily made one, there are relatively cheap ones Ebay and SeeedStudio. The schematic of such sensor is quite basic:

I wanted to hook the moisture sensor to the TinySensor’s 2.5mm jack so that I can take use of the on-board voltage divider, plus it is easy to connect/disconnect whenever necessary. So I looked on the schematic to find out how to configure the voltage divider so that I can achieve the above schematic, it takes a small trick to do it: I don’t place the components that are crossed over with red mark:

And finally time to put the sensor together and the two resistors. I will share a trick that I have on the TinySensors: I solder small headers instead of the resistors so that I can plug the resistors in, instead of soldering. This allows me for flexible prototyping and quickly switching projects. Note the 1Mohm between the burden resistor and the ground:

I could tin the copper rods for better corrosion protection, copper will oxidize really quick.

The software part is nothing special, just averaging ten analog readings. You get near 1023 when you dip the sensor in water and 0 when it is out in the dry. all the in-between range is some level of moisture, experimenting with the readings on relatively dry and ready for watering soil is necessary. Also, GardenBot’s site suggest flipping the voltage to cancel out electrolysis, but I decided this is so cheap to build that not worth the extra effort.

Interesting project, I actually planned to hook up an avocado tree that we have to Tweet when it wants watering, but didn’t have enough time to complete the project because I am overwhelmed with other project ideas and so little time to materialize them.

 

 

 

4 thoughts on “DIY soil moisture sensor project

  1. Marcel

    Just reading your post on the soil moisture sensor. You mention the corroding of copper in soil. That sounds almost logical but I’m a bit puzzled by claims that amateur radio operators make when they speak of earth rods (being solid copper or a copper tube) and their preferred use. Apparently, pure copper doesn’t corrode but goes a bit darker and that’s it. Sure, the copper on roofs goes green after a while but that’s due to carbon dioxide and moisture in the air. I also heard of perforated copper pipes in the ground with salt crystals slowly ‘oozing out’ to increase the contact with the surrounding soil. It’s probably not what you want for testing soil moisture but nowhere could I find anything apparent about the negative conductivity effects of copper in the ground. Have you been able to measure a drop in performance afer the copper wires have corroded a bit? It is a pleasure reading your ‘electronic adventures’ as I’m a keen avr hobbyist myself and have many projects lined up that I want to get started with, remote sensors being one of them. Keep up the good work! 🙂

    1. admin Post author

      Thanks for your comments, I only had the sensor run for few weeks and then needed the TinySensor that it was attached for something else. For that period, one of the rods was indeed darker, but nothing else. Anyway, it took 5 minutes to build and if it would last a year, then it is worth it. I picked copper as it was easiest to solder the wires on, but you can use non-corroding metal and simply use double ended screw terminals to make connection between the wires and the rods.

      1. Marcel

        Scavenging perfectly good working projects eh? Do it myself all the time! Hahaha… 😉 Yeah, I would definitely go for ground stakes that don’t corrode AND aren’t too difficult to electrically attach a wire too. Especially in moist / outdoor environments even screw-on techniques aren’t my favourite solution. I’m interested in building a similar project as yours above some day as I will be moving to a new property soon and would like to know the soil conditions before making a desicion on what kind of ground / earthing system to put in. Anyways, thanks for the feedback and good luck with your further projects.

  2. Pingback: Soil moisture sensing revisited | Martin's corner on the web