soil moisture circuit

I found a couple threads on this topic and I am trying to use this one as a reference. http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1241791578

I'm very much a beginner to circuitry although I did manage to get 1wire temperature sensing working without frying my arduino 8)

Here is my circuit. Does this look correct? I'm just nervous about frying something because the diagrams all show the voltage regulator, but I don't need that component.

Thanks for any help or advice!

soil moisture_schem.png

In comparing your circuit to OWL2c and conductivity, which I believe you used as inspiration there is at least one discrepancy, pin 4 on the 555 should be connected to 3.3V

Also, since that circuit is designed to provide a frequency output, not an analog signal, you really shouldn't try reading it using an analog pin, which will give you only two readings; 3.3v and 0 depending upon where in the pulse it measures. You need to hook this to a digital pin and use a frequency measurement technique (http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1260952660)

Also the description for that circuit is incorrect when it says that the technique is using AC current to measure the resistance; it is using pulsed DC, which is not the same. Pulsed DC, like AC, has a frequency, but the direction of current flow is constance, where with an AC signal, the direction of current flow changes.

An Analog pin can measure (if defined as analog in the definitions in the sketch... any voltage between 4.88 mV to 5V... it is a common technique to "Average" a pulse train to make an analog voltage that represents the "Average" DC value of said pulse train or if you will stream or input. for example look at "analogWrite" A PWM signal "Averaged" to an analog value. There are several issues with the schematic as drawn. Pin 4 (Reset) as mentioned must be tied high and Pin 5(Control) should go to ground through a 10 nF capacitor although the schematic doesn't do that... the data sheets ALL mention that pin and it's uses. Soil moisture Must be measured with an AC signal to prevent polarization of the electrodes. Dc will appear to work... but what of the composition of the soil and what else is there that is conductive as well, are the measurements going to reflect the moisture of the soil or the other conductive chemicals that might be present as well. I spent 5 years designing and manufacturing soil conductivity measurement devices. Successfully. The main issue is that the implementation as drawn will not work and the OP apparently doesn't have the knowledge yet to make it right so let's concentrate on fixing that first. randomworth... first why would you say that you don't need a specific part? what is going to take it's place? usually a designer specifies parts for a reason, do you know more that the other person about his apparently working device? My point is not to embarrass you but rather to get you to focus on a set of specifications first... how is the device to be used? as a plug-in to your Arduino? A stand alone device, is it for you or someone else and how is it going to be used? are the electrodes going to be permanently in the soil or are you going to build a probe. No project work better that it's plan and you don't seem to have formulated that yet. So lets begin by Formalizing what it is that you want to do and how the device must operate. Do you want a relative moisture meter, you can buy one for $5 or $6 dollars. Do you want an accurate one that will return conductivity in Millisiemens (can't remember the spelling) and if so over what range?
You need to supply some more information besides an incorrect copy of an incorrect drawing.

Doc

Thanks wanderson! I was confused why it said AC but didn't seem to switch the direction. At least that is cleared up! Also thanks for showing me towards the frequency measurement technique. Very helpful!

Docedison, good points. I have no idea what I am doing :). I am glad to have you chime in with your experience in the very topic I am trying to do.

I am trying to measure soil moisture with the arduino. Actually I want to measure many things, but I'm taking it one step at a time. The temperature sensor part was much simpler and only took a few hours to work through. This is much more difficult (at least for me!). I would prefer to use AC for the reasons you mention, and was under the incorrect impression about the other circuit.

I should be able to build the "sensor" fairly well utilizing stainless steel strips spaced evenly, set in sand, inside of of an old sediment filter for an reverse osmosis filter, sealing the ends with plaster of paris and pvc.

The reason I don't think I need the voltage regulator (right term?) is that the arduino can put out 3.3v which I thought was the goal of the part I cut out. I certainly do not know more than the designer of the original circuit, which is why I posted here. I am not embarrassed at all, I am very knowledgeable on certain topics, this is not one of them :). Got to start somewhere.

I do have a high level plan, but do not understand all the requirements so it's hard to be detailed:

An arduino that can measure 4 sources of soil moisture, switch 4 mains relays, switch 6 soleniods, see positions of 3 different switches, and measure the temperature of 7 different locations. This will all be communicated via the wifi shield I have to my web server. I have successfully gotten the temperature sensor portion to work and have switched relays as well. I do not want to spend $60+ dollars on a circuit to measure one soil moisture sensor + $30 for a sensor.

I plan on building each of the small "sections" on a breadboard, than combining them onto a pcb board. Each of the sensors, switches, and relays should be able to be plugged in to ports of some kind so that I can easily remove them if I am moving the arduino to a new location.

Very long term, I would like to be able to understand some of the conductivity measuring circuits I have seen for measuring the conductivity of salt water. For now, that is a pipe dream.

Docedison:
An Analog pin can measure (if defined as analog in the definitions in the sketch... any voltage between 4.88 mV to 5V... it is a common technique to "Average" a pulse train to make an analog voltage that represents the "Average" DC value of said pulse train or if you will stream or input. for example look at "analogWrite" A PWM signal "Averaged" to an analog value. There are several issues with the schematic as drawn. Pin 4 (Reset) as mentioned must be tied high and Pin 5(Control) should go to ground through a 10 nF capacitor although the schematic doesn't do that... the data sheets ALL mention that pin and it's uses. Soil moisture Must be measured with an AC signal to prevent polarization of the electrodes. Dc will appear to work... but what of the composition of the soil and what else is there that is conductive as well, are the measurements going to reflect the moisture of the soil or the other conductive chemicals that might be present as well. I spent 5 years designing and manufacturing soil conductivity measurement devices. Successfully. The main issue is that the implementation as drawn will not work and the OP apparently doesn't have the knowledge yet to make it right so let's concentrate on fixing that first. randomworth... first why would you say that you don't need a specific part? what is going to take it's place? usually a designer specifies parts for a reason, do you know more that the other person about his apparently working device? My point is not to embarrass you but rather to get you to focus on a set of specifications first... how is the device to be used? as a plug-in to your Arduino? A stand alone device, is it for you or someone else and how is it going to be used? are the electrodes going to be permanently in the soil or are you going to build a probe. No project work better that it's plan and you don't seem to have formulated that yet. So lets begin by Formalizing what it is that you want to do and how the device must operate. Do you want a relative moisture meter, you can buy one for $5 or $6 dollars. Do you want an accurate one that will return conductivity in Millisiemens (can't remember the spelling) and if so over what range?
You need to supply some more information besides an incorrect copy of an incorrect drawing.

Doc

The specific part he didn't used was a dc regulator ic, which droped the supply voltage to 3v, since he is using the 3.3v supply from the mega he doesn't need that to implement that circuit. Other than the one missing connection his circuit was a valid implementation of the reference circuit he mentioned. I have no idea if that circuit would work for this purpose; however, the reference text for that circuit was clearly wrong when it claimed that circuit was producing an AC resistance measurement.

no it will work and well too the pulses are averaged into a dc voltage with a capacitor and measured that way. As I said the real difficulty is the other stuff like salt and alkaline / acidic soils that change the conductivity. I built an instrument that in effect could measure the actual volume of water and report it. My complaint about the diagram was unfortunate. I think that if you wish to be a programmer or an engineer that neatness is a primary requirement as it imposes order in thinking. I was particularly upset when I had to go back to confirm an unmarked sensor. Diagrams should be neat and orderly and Properly labeled so that anyone else can make sense of it. Perhaps I was too short with the young man but an improperly posed question is a difficult thing to answer intelligently.

Doc

Jack Christensen, that kit looks really cool but I'm hoping to do a bit more in the long run and it doesn't look easily expandable. However, it does have links to the schematic which I will try to learn from.

Docedison, I understand your complaints. I am not sure how to get a neater diagram with fitzing, perhaps I should use a different tool. I can however work on labeling better.

Wanderson, I will correct the errors you pointed out and give it a try! Thanks for the help!

With the differences in alkaline/acidic soils. Could I not calibrate in the software which baseline measurement to expect for "needs water" and "does not need water". These may or may not be the same as dry vs wet.

Pulsed DC should also cause corrosion though correct? If I have to replace the sensors every 2-3 years that is fine, but if I'm replacing them every month that is a no go.

randomworth:
Jack Christensen, that kit looks really cool but I'm hoping to do a bit more in the long run and it doesn't look easily expandable. However, it does have links to the schematic which I will try to learn from.
...
Pulsed DC should also cause corrosion though correct? If I have to replace the sensors every 2-3 years that is fine, but if I'm replacing them every month that is a no go.

Agree on the expandability. I like the sensing circuit, maybe something similar would work. I haven't looked at the Botanicalls software, but the sensing voltage would only have to be turned on maybe once every few minutes, and then only for a few milliseconds. Current through the probes would be very small. If stainless steel were used for the probes, I'd be surprised if they didn't last quite a few years.

Rather than using software to create diagrams, go old school and use pencil and paper, then just scan or take a digital photo...

The interesting thing about the sparkfun approach is that it shows how to perform the function without using the 555, since the arduino can provide the pulsed dc. They have schematic and source code available, so you could use that to learn how to implement circuit yourself.

While the comments by Docedian are valid, you have to decide if you are doing this for the outcome (you just want the measurements) or the process (you want to learn how to do this yourself). If the former, you would be better off purchasing commercial sensors since you will not be able to build something for less that would last and perform well. If the latter, than while hints as to what will fail and why are useful, making mistakes yourself and learning from them are key to understanding. So use pulsed DC and then watch and see how the signal degrades over time and understand why... If the signal degrades quickly, then of course the technique isn't very useable, but if the signal remains of a useful quality for months, then maybe replacing the probe becomes more reasonable. And as time goes by, you can learn how to implement better techniques.

Just decide if the journey or the destination are more important!

Walt

First I want to clear up a misconception. Pulsed DC when passed through a capacitor is AC. The coupling capacitor(s) removes the DC component which is the DC Reference to ground. If you connect a resistor to ground from the output of the resistor you have current flow... ground referenced as long as the signal Changes Value. If the voltage stops changing value, current stops flowing. Without the capacitor current would flow regardless, the only requirement being that the voltage be non zero. If you tied the capacitor to a voltage divider current would flow only when the current through the capacitor is changing in value or polarity and the measurement point would be offset by the voltage present at the voltage divider connection point. AC by any definition. Your device WILL measure soil conductivity and thus the amount of water present. What it cannot do is measure the volume of water present. What this means is that all measurements are relative to them selves not to others unless the soil has the same characteristics in terms of composition of organics and dissolved salts. The instruments I designed did measure the volume of water present. Electrodes placed permanently have 2 main issues, First the electrodes must be of similar size and non reactive, aluminium will not work well as first it will form a skin of non conductive aluminium oxide film similar to anodizing and since it is chemically active it will deteriorate quicker in some more acidic or alkaline soils causing a drift in the measured value. Second and most important there is a soil compaction effect that causes the soil to loose physical contact with the electrodes after a while and this causes an amount of measurement drift that varies from soil to soil composition. My comments about the quality of your drawings wasn't a criticism of your ability to use a specific tool or not, it was that you left details out that were important to the measurements. Last for now is that the 555 is used to produce a variable frequency signal that is integrated with a capacitor to remove the dc component and leave the average value of the AC behind thus we are converting the resistance measurements to reactance measurements and then measuring the change in reactance by averaging or integrating the change in frequency of the 555 by the soil probes. in short the value of a capacitor is changed by the value of a series resistor (soil resistance) and this change is converted by the 555 into a variable frequency and that frequency change is integrated into a dc value with a capacitor. The resultant dc value is measured and represented as soil conductivity. The 555 is a required non trivial component that is not easily replicated in software. I do hope this rather unusually long winded explanation helps. I apologize but there are several difficult topics that are very hard to explain simply.

Doc

Jack, good point about the probes. They will be stainless and I would like to only measuring once every so often (15 minutes-ish). Hopefully that will reduce the amount of corrosion to negligible levels.

Wanderson, drawing on paper does seem much easier! Although at my rate, I will go through erasers very quickly! My goal is more about the journey and learning than buying sensors off the shelf. Plus, if I can learn and understand, I can customize to my specific needs. However, every journey needs a destination even it is never realized :).

I also see your point about just trying things out. My biggest fear is burning out my poor arduino! I have an uno now, so I can use that as a trial before I get the mega, but I'd still rather not destroy something out of ignorance.

Docedison, I must admit, the first third of your comment has sent me scouring through google and wikipedia to learn what a coupling capacitors are, what a voltage dividing current is, and how everything is related. My hope is that by surrounding the sensors with sand, I can limit the soil compaction effects somewhat. I'm not positive that the sand will transfer the moisture levels of the soil properly though, but only experimentation will tell. Your explanation of the 555 purpose is very helpful as well.

Docedison:
... 555 into a variable frequency and that frequency change is integrated into a dc value with a capacitor. The resultant dc value is measured and represented as soil conductivity. The 555 is a required non trivial component that is not easily replicated in software. I do hope this rather unusually long winded explanation helps. I apologize but there are several difficult topics that are very hard to explain simply.

Doc

Just a clarification, if you read the page cited with the original circuit, the 555 is not being used to produce a dc value (integration with a cap), but the original basic stamp code is actually directly measuring the frequency produced by the 555.

Thanks! The parts are on order, hopefully all goes well :slight_smile: