Notifications
Clear all

What I found out about soil sensors

16 Posts
6 Users
9 Likes
11.3 K Views
Altoidian
(@altoidian)
Member
Joined: 5 years ago
Posts: 11
Topic starter  

This year I thought it would be fun to try Arduino gardening...well, specifically, Arduino controlled the watering of my potted plants- just a few tomatoes and a few pepper plants.

So, I set up a simple Arduino program in XOD to detect soil moisture and when the readings were low, send a signal to a valve,  add a little water, close the valve. Wait a few minutes for the water to absorb into the soil, then read, if still low, add a little water, and so on, until the system reaches a happy balance and - presto, plants could call for water as they required it. Fresh salad all summer long! Simple, right?

No- not simple. I really banged my head on why I could not get decent, consistent soil moisture readings. The problem is with the nature of soil moisture. It is not just moisture. It is pretty strange how chemically and electrically complex soil moisture really is.

The cheapest way to build a moisture sensor is with a conductivity sensor. the principle is that dry soil is non-conductive and moist soil is conductive. You can do this merely by driving two copper nails (pieces of 2-millimeter wire about 125 mm long)  a set distance apart, say about 100 mm, and taking an analog voltage reading - I used a 10k resistor for one half voltage divider and let the two electrodes pick up the resistance in the soil. the wetter the soil, the lower the resistance. But, these readings were inconsistent. And I wanted to know why.

If you want to be more scientific, you can buy some Arduino compatible analog moisture sensors. You can purchase sets of five resistance-type moisture sensors on Amazon - about 5 ea for $8.00

(HONG111 5pcs TE215 Dual Mode High Sensitivity Soil Moisture Sensor)

Well, we all know plants call for five things - soil, moisture, CO2, fertilizer, and sunlight. Fertilizer is mainly made of salts- and salt and water create an electrolyte. The fertilizer was causing my readings to be erratic by allowing more electrons to pass through the water. As the fertilizer was used up by the plant, the soil became less conductive and water sensors gave me less correct readings. BUT! When I tested again to compensate for the electrolytic nature of fertilizer, I started getting even stranger readings...sometimes, depending on where I placed my electrodes, I was getting spikes of one volt or more! Where was that coming from? I broke out my meter and to my surprise, I found that the soil itself was generating current! The soil was acting like a battery! I never dreamed that was even possible. It is, after all, the very ground we depend on for grounding! It should be inert...zero voltage. But, when you measure in millivolts, you would be amazed at how much voltage the soil actually generates. Current sensing sensors are not accurate! There is too much current zipping around in the soil beneath our feet- and particularly in soil contained in plastic tubs!

The trick is, if you want accurate moisture sensing in your garden, you will have to do it by not coming in direct contact with the conductive, electrolyte-filled, battery we call moist soil! Measure the soil moisture without touching the moist soil??

I ultimately discovered more expensive capacitance type moisture sensors:

(on Amazon - DFROBOT Gravity: Analog Capacitive Soil Moisture Sensor- Corrosion Resistant)

They do a reasonably good job of indicating how dense (wet) the soil is and they are heavily insulated! Great!...But, capacitance sensors depend on density around them. If the soil is clay/sand, or sand/ loam or a spongy aerated mass that later breaks down and becomes denser as time goes by, they can also get erratic readings. But, they are much more stable and consistent than the resistance sensors- and shamefully more expensive. Oh, yes- and they do not dissolve in the soil as resistance sensors do (rather quickly, I should add- something to do with electrolysis- Whod'a guessed it?)

I then went to work designing my own non-contact sensors- Ugh! It wasn't pretty; I came up with several  sensors that use different "No touch the wetness" strategies. And, I have even applied for a patent on one. But, now I have had to come to the conclusion that the state of the art of accurate soil moisture sensing is in dire need of great improvement. Like the proverbial 'mousetrap', build a better one and the world will beat a path to your door! Yes, even the government would come to buy it!

If anyone would like to join in a discussion on this rather surprisingly complex problem of accurately sensing soil moisture, I would love to hear your thoughts. And I will share the knowledge I have gained from researching the problem.

This topic was modified 5 years ago 2 times by Altoidian

   
EuanJuan and hstaam reacted
Quote
logwagon
(@logwagon)
Member
Joined: 5 years ago
Posts: 14
 

@Altoidian. Just spitballin' but if there existed a semi-permeable membrane that would allow water to pass but not electrolytes and other dissolved solids it would be possible to... wait it takes electrolytes to conduct electricity.  Mmm.  Let me think on this.

Maybe not measuring the moisture directly as you said.

Plumb the water inlet to the some midpoint in the soil of the pot.  Cover the pot with a seal (cellophane) with the plant poking out through a hole.  Put the humidity sensor inside.  After some 'debugging' you should find the sweet spot and set the pump to cycle on as you described in your original XOD sketch.  

You might not need to cover the whole pot.  Perhaps an inverted cone/bowl with the humidity sensor inside sitting on or buried slightly beneath the top of the soil.

I'll let you know if I have any more brilliant ideas.

J

 


   
Altoidian reacted
ReplyQuote
(@twobits)
Member
Joined: 5 years ago
Posts: 113
 

I can't recall the source right now but I remember reading someone doing some interesting experiments around DIY Vineyard Automation in a web series.

After trying all sorts of expensive soil sensors he ended up doing something remarkably simple like potting one end of a nail in a bit of cement and the measuring resistivity. He then planned on replacing the sensors every year due to corrosion. 


   
Altoidian reacted
ReplyQuote
Altoidian
(@altoidian)
Member
Joined: 5 years ago
Posts: 11
Topic starter  

A few decades ago, I happened to have the experience of working with some retired scientists from Sandia Labs in New Mexico who were working on developing an exotic water purification system. They hired me as a marketing consultant for their device. One of their biggest problems in perfecting the point-of-water contact with their electrodes (which actually produced the beginning process of the purifier) was a condition they called "dissolution". Basically, it was the electrolytic decomposition of the electrodes - but, they found the only metal that withstood the process without decomposition was titanium! They had ample access to titanium scraps and cut their own electrodes to function without any corrosion or decomposition at all. So, I tried that in my own simple analog sensors for moisture detection in soil and it worked as well. But, a pair of titanium rods 4 mm x 150 were okay for experimentation but a bit expensive for general use. However, I later switched to stainless steel screws. There is a little problem with corrosion at the interface with the attachment point of the conductor cable to the controller from the SS screw probes being dissimilar metal (copper), but I solved that with some silicone coating and never had any trouble with detectable corrosion on those electrodes.  They lasted over this growing season, though. My original cheap Amazon resistance sensors corroded to nothing in a few days!

Using the cheap resistive sensors from Amazon, I tried recoating the pcb traces on brand new sensors with silver solder and they worked well resisting corrosion but tended to develop a kind of black insulative oxide coating which changed the input significantly in just a few days.

The SS screws did not cause any problems...neither did the titanium.

This post was modified 5 years ago by Altoidian

   
jscottbee reacted
ReplyQuote
jscottbee
(@jscottbee)
Member
Joined: 5 years ago
Posts: 107
 

A nice work-a-around @altoidian.


   
ReplyQuote
(@twobits)
Member
Joined: 5 years ago
Posts: 113
 

Nice, please keep us posted on your progress.

I would like to add moisture sensors to my home irrigation system. My knowledge is pretty limited... I would like to avoid getting into trouble when I over water the flower bed on the north side of the house (which causes root rot) and underwater the beds between the driveway and the retaining wall on the south side of the house which get beaten by the sun this time of year. 


   
ReplyQuote
byron
(@byron)
No Title
Joined: 5 years ago
Posts: 1121
 

@altoidain An automated irrigation system is defiantly on my list of future projects.  The little research I did on this subject indicated that the typical cheap soil moisture sensors just don't last for long and I knew I would have to do some more digging on this issues.  I hope to follow your findings on this project in due course so I  much appreciate your contributions.


   
ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 5 years ago
Posts: 1669
 
Posted by: Altoidian

This year I thought it would be fun to try Arduino gardening...well, specifically, Arduino controlled the watering of my potted plants- just a few tomatoes and a few pepper plants.

I have no clue how well this might work, but my first thoughts for this came from the fact that you are using potted plants.    I also have no clue if this will work, but I know from experience gardening with potted plants that I could tell by simply lifting up the pot.  If the pot is heavy, it's got plenty of water.  If the pot is light water it! ? 

I think this could even be made more precise if the plants are potted in a medium that is very light when dry. This way when it become damp with water the weight change would be more dramatic.

So my attempt to solve this water content problem would be to turn to weighing the pots and using the change in weight to determine when they need to be watered.    This might be easiest to implement if the pots are hanging from something.  The hanging mechanism could then be designed to serve as a balance scale.   One one side of the balance you have a weight that represents the correct weight of a properly watered pot.  On the other side is the plant itself.  Then you only need to sense how far off the balance is.

This type of watering system would of course need to be monitored and updated as the plants grow as the plants themselves would represent extra weight. 

As I say, these are just my first thoughts after reading how difficult it is to try to measure the actual moister content of the soil directly.  I would turn to maybe looking into trying to weight the pots to check for the heavy water content.  Also, as I suggested above, going this route would be helped by using the lightest growing medium possible when dry and also the lightest possible pots as well.  This would provide the greatest difference between the weight of a moist pot versus a dry pot.

This doesn't address the soil sensor issue.  But it might address the issue of how to more easily sense the water content of a pot.

Just a brainstorming suggestion for whatever it might be worth.

DroneBot Workshop Robotics Engineer
James


   
Altoidian reacted
ReplyQuote
byron
(@byron)
No Title
Joined: 5 years ago
Posts: 1121
 

Folowing @Robo Pi thoughts I contribute my thoughts on this when I found that soil moisture meters had issues.  I was thinking to go for a simple short timed watering system complemented by using an easy draining planting medium so that any excess water does not lead to water-logging.   Where I live we get very varied weather so watering of the Toms may be from nothing to several times per day when its horribly hot.  I was thinking of controlling the timed watering with an rpi thats linked to a weather station.  The watering will be according to weather data recorded for the previous hours.  Also it will need to inject a suitable liquid feed every week during the watering process.

But I'm following the soil moisture measuring with interest.


   
Altoidian reacted
ReplyQuote
Altoidian
(@altoidian)
Member
Joined: 5 years ago
Posts: 11
Topic starter  

Yes, logwagon, I actually thought of something similar to your idea- which I find very interesting, using a humidity sensor. But, the trouble is with a viable, non-clogable membrane. I bought some DHT-22 and 11 sensors for this build, but was sidetracked to other experiments before getting it worked completely.- I guessed the soil over time would penetrate the sensor and destroy it. So I placed on in an air-tight plastic pill bottle, trapping air to stop the soil and moisture from reaching the sensor, but wide open on the bottom exposing it to the soil moisture and placed it about 5" down below soil surface. But as soon as the soil was uniformly moist, it quickly read 100% humidity. I could not calibrate it to reflect accurate soil moisture levels. It seemed to go to an "all or nothing" reading. That said, I do believe such an instrument would be workable with more testing and calibration. I thought of an above-ground sensor that had a permeable "J" tube passing through the soil with a slow pressure vent fan slowly pulling sample moist air through the tube and delivering it to the instrument. This method would allow a relatively simple array of tubes and valves to selectively pull separate samples from various places and give moisture readings. The idea I had was to be something like, "purge", then select sample source, then open source valve, pull through a set-slug of air from the "J" tube, read humitiyt, close the valve, purge and so on...   repeat ing for the next sample. I suspect such an instrument sketch would have to make allowance for ambient air humidity and temperature media passing through the source test location "J" tube, but, most certainly it has serious promise.

The nice thing about soil moisture measuring is, it can be done at longer intervals- such as once every half-hour, or even longer. Ideal soil moisture for plants quickly becomes a routine, almost leisurely affair. After all, most farms work on simple timed watering, which seems to be sufficiently successful. I have even suspected plants need a kind of variable root/soil moisture experience since that is how they have evolved in nature. My goal was to create a system in which the plant could call for moisture as it needed it. My guess is, such a system has eluded the very best researchers. The old, "farmer's finger in the dirt" sensor seems to work better than anything.


   
ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 5 years ago
Posts: 1669
 
Posted by: Altoidian

My goal was to create a system in which the plant could call for moisture as it needed it. My guess is, such a system has eluded the very best researchers. The old, "farmer's finger in the dirt" sensor seems to work better than anything.

Keeping the actual "goal" in mind is key.

Is the goal to create an electronic soil moisture sensor that measures the water content of soil? If so then that may very well be an extremely difficult problem to solve.

But if the goal is to simply have plants call for water when they need it, other methods may work far better. Like the method I suggested above for potted plants. Being potted allows for the possibility of weighing the container.

You also wouldn't need an expensive scale that reports the weight in grams or whatever. All you need is a very primitive balance rig with a long pointer. Then just detect where the pointer is located.

Water Detector

Sometimes people get lost in a solution that wasn't the original goal.  ? 

Don't want to fall into that trap.

DroneBot Workshop Robotics Engineer
James


   
Altoidian reacted
ReplyQuote
logwagon
(@logwagon)
Member
Joined: 5 years ago
Posts: 14
 

@Altoidian Maybe measure the resistance or current or other such thing on the plant itself.  A probe in the soil and one an inch or three up the stalk may give usable readings.


   
Altoidian reacted
ReplyQuote
Altoidian
(@altoidian)
Member
Joined: 5 years ago
Posts: 11
Topic starter  

Ooo. Logwagon. Fantastic idea. Now we must find out how that could be measured. I like this a lot.

Idea: I worked in the oil filed many years ago and we had a device that was called a "densiometer"- it used radioactive cesium to measure the density of a pipe full of wet cement and would read out an instant conversion of lbs per cubic foot. Now, I know we do not want to get involved in that radioactive stuff. But, other things can non-destructively measure density (wet stuff is heavier than dry stuff- right?). So, the hunt is on now for the way to do this. Sounds promising.


   
ReplyQuote
Altoidian
(@altoidian)
Member
Joined: 5 years ago
Posts: 11
Topic starter  

RoboPi. A friend of mine suggested such a strategy and I thought of a pressure mat that uses a variable resistor that decreases resistance according to the weight placed on it. Set the pot on the device, read the weight, set the plan in motion.  I think there is a conductive foam rubber that does this which is used in continuous inventory systems. I do not know where to get it or how expensive it might be, though. I do not know how to differentiate the increasing weight of the growing plant from the changing weight of the water in the container. Since the weight of the plant would increase much slower than the wetting/drying weight of the water, some sort of algorithm could be figured out. Offhand, I can't think of a way to do this.


   
ReplyQuote
Altoidian
(@altoidian)
Member
Joined: 5 years ago
Posts: 11
Topic starter  

Great post- ...Perhaps I am trying to eliminate the human element too much. I actually did not think of manually adjusting the scale to compensate for the increasing weight of the plant (and fruit in case of fruiting plants). Also, as plants increase in size and volume, they require more water- a lot more. Sensing plant weight as the growing season progresses would be a requirement for adjusting the watering amount. So, we may be a long way from fully autonomous robotic gardening.


   
ReplyQuote
Page 1 / 2