Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Thread

soil moisture sensor

soil moisture sensor

2007-10-18 by Teo

Hello,

I would like to develop a sistem based on Atmel to measure the moisture 
level of soil. Can you recommend me, please, one good and cheap sensor ?

I would also like to communicate via USB.

Re: [AVR-Chat] soil moisture sensor

2007-10-18 by Thomas Keller

Generally speaking, moisture measurement in soil is accomplished 
thro0ugh the use of resistance
measurement.  A pair of probes is stuck into the soil, and the 
resistance is measured.  IKn a digital
approach,  an empirically determined lookup table is then used to 
convert the resistance to a moisture
percentage measurement.  I built a lumber moisture meter about 30 years 
ago, but it used an analog
meter movement, anbd was calibrated by borrowing a commercial lumber 
moisture meter and making
comparative measurements on a wide range of lumber.  Worked fine.

   As for your USB, the EASIEST approach would be to look up FTDIChip, 
and use one of their
serial <-> USB converter chips.  Alternatively, you could check 
www.atmel.com for applications
notes on implementing USB on either a USB enabled AVR (relatively 
expensive) or on a regular
AVR (inexpensive, but restricted to 12 Mbps speeds.

Teo wrote:
Show quoted textHide quoted text
>
> Hello,
>
> I would like to develop a sistem based on Atmel to measure the moisture
> level of soil. Can you recommend me, please, one good and cheap sensor ?
>
> I would also like to communicate via USB.
>
> __
> .
>
>

Re: [AVR-Chat] soil moisture sensor

2007-10-18 by Ralph Hilton

On Thu, 18 Oct 2007 12:27:59 -0500  you (Thomas Keller <tjkeller1@alltel.net>)
wrote:

I was wondering how a simple resistance measurement could differentiate between
a moist soil with low nutrient content and a drier soil containing a lot of
soluble nutrients.

>   Generally speaking, moisture measurement in soil is accomplished 
>thro0ugh the use of resistance
>measurement.  A pair of probes is stuck into the soil, and the 
>resistance is measured.  IKn a digital
>approach,  an empirically determined lookup table is then used to 
>convert the resistance to a moisture
>percentage measurement.  I built a lumber moisture meter about 30 years 
>ago, but it used an analog
>meter movement, anbd was calibrated by borrowing a commercial lumber 
>moisture meter and making
>comparative measurements on a wide range of lumber.  Worked fine.
>
>   As for your USB, the EASIEST approach would be to look up FTDIChip, 
>and use one of their
>serial <-> USB converter chips.  Alternatively, you could check 
>www.atmel.com for applications
>notes on implementing USB on either a USB enabled AVR (relatively 
>expensive) or on a regular
>AVR (inexpensive, but restricted to 12 Mbps speeds.
>
>Teo wrote:
>>
>> Hello,
>>
>> I would like to develop a sistem based on Atmel to measure the moisture
>> level of soil. Can you recommend me, please, one good and cheap sensor ?
>>
>> I would also like to communicate via USB.
>>
>> __
>> .
>>
>>  
>
>
>
> 
>Yahoo! Groups Links
>
>
>

--
Ralph Hilton
http://www.ralphhilton.org
C-Meter: http://www.cmeter.org
FZAOINT http://www.fzaoint.net

Re: soil moisture sensor

2007-10-18 by Graham Davies

--- In AVR-Chat@yahoogroups.com, "Teo" <teodorstv@...> wrote:

> I would like to develop a sistem
> based on Atmel to measure the moisture 
> level of soil. Can you recommend me,
> please, one good and cheap sensor ?

Use Google to look up "soil moisture sensor". To make your own, 
fasten wires to two small stainless-steel machine screws (with 
washers and nuts) and embed them in a small block of gypsum (plaster 
of Paris). The gypsum will absorb water or dry out with the soil and 
the resistance between the screws will vary accordingly.

(If you're the person that asked the same question on the ZiLOG 
Z8Encore! group, then you might as well know that I'm the same person 
that posted the above answer over there.)

> I would also like to communicate via USB.

As other posters have noted, using an FTDI USB to serial converter 
chip is going to be the easiest way to go.

Graham.

Re: [AVR-Chat] soil moisture sensor

2007-10-18 by Thomas Keller

Basicly, the resistance of soil is based on moisture content, because it 
is the moisture
that provides the conductivity from particle to particle, not the 
mineral or other
dry content of the soil.


avrFreak

Ralph Hilton wrote:
Show quoted textHide quoted text
>
> On Thu, 18 Oct 2007 12:27:59 -0500 you (Thomas Keller 
> <tjkeller1@alltel.net <mailto:tjkeller1%40alltel.net>>)
> wrote:
>
> I was wondering how a simple resistance measurement could 
> differentiate between
> a moist soil with low nutrient content and a drier soil containing a 
> lot of
> soluble nutrients.
>

Re: [AVR-Chat] soil moisture sensor

2007-10-18 by Ralph Hilton

On Thu, 18 Oct 2007 16:16:18 -0500  you (Thomas Keller <tjkeller1@alltel.net>)
wrote:

>Basicly, the resistance of soil is based on moisture content, because it 
>is the moisture
>that provides the conductivity from particle to particle, not the 
>mineral or other
>dry content of the soil.
>

I'd suggest testing it in practice. It doesn't work that way. Pure distilled
water has a very low conductivity. The dissolved salts in the water bring about
the conductivity. That's the principle on which a TDS meter is based. (total
dissolved solids).

>avrFreak
>
>Ralph Hilton wrote:
>>
>> On Thu, 18 Oct 2007 12:27:59 -0500 you (Thomas Keller 
>> <tjkeller1@alltel.net <mailto:tjkeller1%40alltel.net>>)
>> wrote:
>>
>> I was wondering how a simple resistance measurement could 
>> differentiate between
>> a moist soil with low nutrient content and a drier soil containing a 
>> lot of
>> soluble nutrients.
>>

--
Ralph Hilton
http://www.ralphhilton.org
C-Meter: http://www.cmeter.org
FZAOINT http://www.fzaoint.net

Re: [AVR-Chat] soil moisture sensor

2007-10-18 by Thomas Keller

Show me soil with pure, distilled water in it.

Look, I am just telling you what will work.  There is no way for a simple
test unit with a probe to tell the difference between water or high metallic
content in the soil.  I can tell you that dry soil, regardless of 
mineral makeup
will have a MUCH higher resistance than wet soil.

Ralph Hilton wrote:
Show quoted textHide quoted text
>
> On Thu, 18 Oct 2007 16:16:18 -0500 you (Thomas Keller 
> <tjkeller1@alltel.net <mailto:tjkeller1%40alltel.net>>)
> wrote:
>
> >Basicly, the resistance of soil is based on moisture content, because it
> >is the moisture
> >that provides the conductivity from particle to particle, not the
> >mineral or other
> >dry content of the soil.
> >
>
> I'd suggest testing it in practice. It doesn't work that way. Pure 
> distilled
> water has a very low conductivity. The dissolved salts in the water 
> bring about
> the conductivity. That's the principle on which a TDS meter is based. 
> (total
> dissolved solids).
>
> >avrFreak
> >
> >Ralph Hilton wrote:
> >>
> >> On Thu, 18 Oct 2007 12:27:59 -0500 you (Thomas Keller
> >> <tjkeller1@alltel.net <mailto:tjkeller1%40alltel.net> 
> <mailto:tjkeller1%40alltel.net>>)
> >> wrote:
> >>
> >> I was wondering how a simple resistance measurement could
> >> differentiate between
> >> a moist soil with low nutrient content and a drier soil containing a
> >> lot of
> >> soluble nutrients.
> >>
>
> --
> Ralph Hilton
> http://www.ralphhilton.org <http://www.ralphhilton.org>
> C-Meter: http://www.cmeter.org <http://www.cmeter.org>
> FZAOINT http://www.fzaoint.net <http://www.fzaoint.net>
>
>

Re: [AVR-Chat] Re: soil moisture sensor

2007-10-18 by Jim Wagner

On Thu, 18 Oct 2007 23:15:06 -0000
 "Graham Davies" <Yahoo37849@ecrostech.com> wrote:
> --- In AVR-Chat@yahoogroups.com, "Teo" <teodorstv@...>
> wrote:
> 
> > I would like to develop a sistem
> > based on Atmel to measure the moisture 
> > level of soil. Can you recommend me,
> > please, one good and cheap sensor ?
> 
> Use Google to look up "soil moisture sensor". To make
> your own, 
> fasten wires to two small stainless-steel machine screws
> (with 
> washers and nuts) and embed them in a small block of
> gypsum (plaster 
> of Paris). The gypsum will absorb water or dry out with
> the soil and 
> the resistance between the screws will vary accordingly.
> 
> (If you're the person that asked the same question on the
> ZiLOG 
> Z8Encore! group, then you might as well know that I'm the
> same person 
> that posted the above answer over there.)
> 
> > I would also like to communicate via USB.
> 
> As other posters have noted, using an FTDI USB to serial
> converter 
> chip is going to be the easiest way to go.
> 
> Graham.
> 
> 
Soil resistnce depends on a lot of things. Mineral and ion
content are strong factors. But, a simple resistance
measurement won't tell you anything about what is causing
the observed resistance. That said, there are inexpensive
"soil moisture gauges". The ones I have tried have never
been very consistent over even a few months and I never
bothered to open one up to see how they are supposed to
work. The ones I have seen are for potted plants but you
add fertilizer and the reading changes, if I recall.

Gypsum blocks have been used for soil mosture sensing for a
number of years. They are fine for short term but soil ions
diffuse into the gypsum and upset the "calibration".
Typically, a few months in temperate dry-season conditions
is about max.

The best commercial soil moisture devices consist of a
probe with a porus ceramic tip. The probe is partially
filled with water, then it is sealed. there is a vacuum
gauge to measure how much water has been pulled out of the
probe through the porus tip because of dry soil. When the
soil is more moist, water is pulled back into the probe due
to the relative vacuum.  I am quite sure that one could use
a semiconductor pressure/vacuum gauge in this application.
It is simple apparatus except for the probe tip.

Jim Wagner
Oregon Research Electronics, Consulting Division
Tangent, Oregon, USA
---------------------------------------------------------------
The Think Different Store
http://www.thinkdifferentstore.com/
For All Your Mac Gear
---------------------------------------------------------------

Re: [AVR-Chat] soil moisture sensor

2007-10-19 by Zack Widup

I haven't spoken out about this yet but I thought I'd throw in a few 
words.  I work for a geotechnical engineering firm that has a soils 
testing lab. I spend quite a bit of time doing all sorts of soil and rock 
tests, including moisture contents.

I never saw it mentioned exactly why the electronic means of measuring 
soil moisture content was needed or what kind of accuracy was desired. 
But I can tell you this - there are so many different kinds of soils which 
all have different characteristics and read differently that you just 
can't do it with much accuracy.

I've worked with silts, clays, silty clays, clayey silts, clays with 
little to some sand, etc. - I've seen everything you will find on the 
Burmister and Unified Soil Classification charts.  I once had the idea 
that we might be able to measure moisture content electronically.  After 
spending some time at it, I concluded it wouldn't work.  If it did, ASTM 
would have a techniquue outlined for it.  They don't.

You might be able to calibrate ONE sample of ONE type of soil for 
electronic moisture content measurement, but take some soils from a few 
feet away and it will be dfferent. The only way to accurately get a 
measurement of moistuire content is to apply the ASTM standards, which 
involve weighing the soil with moisture, baking the water out of it and 
reweighing.

I hate to be the bearer of bad news but I do this profesionally and I've 
been there, done that.

Zack
Show quoted textHide quoted text
On Thu, 18 Oct 2007, Thomas Keller wrote:

> Show me soil with pure, distilled water in it.
>
> Look, I am just telling you what will work.  There is no way for a simple
> test unit with a probe to tell the difference between water or high metallic
> content in the soil.  I can tell you that dry soil, regardless of
> mineral makeup
> will have a MUCH higher resistance than wet soil.
>
> Ralph Hilton wrote:
>>
>> On Thu, 18 Oct 2007 16:16:18 -0500 you (Thomas Keller
>> <tjkeller1@alltel.net <mailto:tjkeller1%40alltel.net>>)
>> wrote:
>>
>>> Basicly, the resistance of soil is based on moisture content, because it
>>> is the moisture
>>> that provides the conductivity from particle to particle, not the
>>> mineral or other
>>> dry content of the soil.
>>>
>>
>> I'd suggest testing it in practice. It doesn't work that way. Pure
>> distilled
>> water has a very low conductivity. The dissolved salts in the water
>> bring about
>> the conductivity. That's the principle on which a TDS meter is based.
>> (total
>> dissolved solids).
>>
>>> avrFreak
>>>
>>> Ralph Hilton wrote:
>>>>
>>>> On Thu, 18 Oct 2007 12:27:59 -0500 you (Thomas Keller
>>>> <tjkeller1@alltel.net <mailto:tjkeller1%40alltel.net>
>> <mailto:tjkeller1%40alltel.net>>)
>>>> wrote:
>>>>
>>>> I was wondering how a simple resistance measurement could
>>>> differentiate between
>>>> a moist soil with low nutrient content and a drier soil containing a
>>>> lot of
>>>> soluble nutrients.
>>>>
>>
>> --
>> Ralph Hilton
>> http://www.ralphhilton.org <http://www.ralphhilton.org>
>> C-Meter: http://www.cmeter.org <http://www.cmeter.org>
>> FZAOINT http://www.fzaoint.net <http://www.fzaoint.net>
>>
>>
>
>

Re: [AVR-Chat] soil moisture sensor

2007-10-19 by Sandu Teo

Hello again,
   
   
  For my project,  I need low accuracy. 
  I just want to know when my little apple tree or plants that I have  in the house need water.
  Just one type of soil.
   
   FTDI USB to serial converter  sounds very cool.
  


Zack Widup <w9sz@prairienet.org> wrote:
          
I haven't spoken out about this yet but I thought I'd throw in a few 
words. I work for a geotechnical engineering firm that has a soils 
testing lab. I spend quite a bit of time doing all sorts of soil and rock 
tests, including moisture contents.

I never saw it mentioned exactly why the electronic means of measuring 
soil moisture content was needed or what kind of accuracy was desired. 
But I can tell you this - there are so many different kinds of soils which 
all have different characteristics and read differently that you just 
can't do it with much accuracy.

I've worked with silts, clays, silty clays, clayey silts, clays with 
little to some sand, etc. - I've seen everything you will find on the 
Burmister and Unified Soil Classification charts. I once had the idea 
that we might be able to measure moisture content electronically. After 
spending some time at it, I concluded it wouldn't work. If it did, ASTM 
would have a techniquue outlined for it. They don't.

You might be able to calibrate ONE sample of ONE type of soil for 
electronic moisture content measurement, but take some soils from a few 
feet away and it will be dfferent. The only way to accurately get a 
measurement of moistuire content is to apply the ASTM standards, which 
involve weighing the soil with moisture, baking the water out of it and 
reweighing.

I hate to be the bearer of bad news but I do this profesionally and I've 
been there, done that.

Zack

On Thu, 18 Oct 2007, Thomas Keller wrote:

> Show me soil with pure, distilled water in it.
>
> Look, I am just telling you what will work. There is no way for a simple
> test unit with a probe to tell the difference between water or high metallic
> content in the soil. I can tell you that dry soil, regardless of
> mineral makeup
> will have a MUCH higher resistance than wet soil.
>
> Ralph Hilton wrote:
>>
>> On Thu, 18 Oct 2007 16:16:18 -0500 you (Thomas Keller
>> <tjkeller1@alltel.net <mailto:tjkeller1%40alltel.net>>)
>> wrote:
>>
>>> Basicly, the resistance of soil is based on moisture content, because it
>>> is the moisture
>>> that provides the conductivity from particle to particle, not the
>>> mineral or other
>>> dry content of the soil.
>>>
>>
>> I'd suggest testing it in practice. It doesn't work that way. Pure
>> distilled
>> water has a very low conductivity. The dissolved salts in the water
>> bring about
>> the conductivity. That's the principle on which a TDS meter is based.
>> (total
>> dissolved solids).
>>
>>> avrFreak
>>>
>>> Ralph Hilton wrote:
>>>>
>>>> On Thu, 18 Oct 2007 12:27:59 -0500 you (Thomas Keller
>>>> <tjkeller1@alltel.net <mailto:tjkeller1%40alltel.net>
>> <mailto:tjkeller1%40alltel.net>>)
>>>> wrote:
>>>>
>>>> I was wondering how a simple resistance measurement could
>>>> differentiate between
>>>> a moist soil with low nutrient content and a drier soil containing a
>>>> lot of
>>>> soluble nutrients.
>>>>
>>
>> --
>> Ralph Hilton
>> http://www.ralphhilton.org <http://www.ralphhilton.org>
>> C-Meter: http://www.cmeter.org <http://www.cmeter.org>
>> FZAOINT http://www.fzaoint.net <http://www.fzaoint.net>
>>
>>
>
>


                         

 __________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

[Non-text portions of this message have been removed]

Re: soil moisture sensor

2007-10-19 by Graham Davies

--- In AVR-Chat@yahoogroups.com, Sandu Teo <teodorstv@...> wrote:
 
> For my project, I need low accuracy. 

That's what I figured. So, are we done here? Do you have what you want 
from us? I think it's clear you need corrosion proof contacts, such as 
stainless steel. I'm suggesting you embed them in gypsum to separate 
them to some degree from the soil itself. We all agree this will meet 
your need for low accuracy.  Are you OK with this, because I don't 
think we're going to come up with anything cheaper (another of your 
requirements).

See also http://www.circuitcellar.com/fi2003/F2002.htm
and http://www.circuitcellar.com/renesas2005m16c/winners/1566.htm

Graham.

Re: soil moisture sensor

2007-10-19 by fjch100

Some Geophisics Theory:
 
Some time ago one scientist called Archie found:
 
F = Ro/Rw 

F= Rock formation factor
Ro=Rock Resistivity
Rw= Resistivity of fluid in the rock
 
also F =        a   
           -----------
                  b
                P
 
where: a = 0.65 for sandstone or 0.81 for limestone
           b = 2 for sandstone  or 2.15 for limestone
           P = Rock Porosity
 
in summary: the rock resistivity depend on the fluid in the rock 
porosous space .
 
Then if you want, you can "Calibrate" your meter with a water 
saturated rock and the same rock dried, and measured the water 
resistivity.
 
this procedure is used in Oil Logging Services for more the 50 
years...
 
 
sorry for my bad english...
 
 








--- In AVR-Chat@yahoogroups.com, Sandu Teo <teodorstv@...> wrote:
>
> Hello again,
>    
>    
>   For my project,  I need low accuracy. 
>   I just want to know when my little apple tree or plants that I 
have  in the house need water.
>   Just one type of soil.
>    
>    FTDI USB to serial converter  sounds very cool.
>   
> 
> 
> Zack Widup <w9sz@...> wrote:
>           
> I haven't spoken out about this yet but I thought I'd throw in a 
few 
> words. I work for a geotechnical engineering firm that has a soils 
> testing lab. I spend quite a bit of time doing all sorts of soil 
and rock 
> tests, including moisture contents.
> 
> I never saw it mentioned exactly why the electronic means of 
measuring 
> soil moisture content was needed or what kind of accuracy was 
desired. 
> But I can tell you this - there are so many different kinds of 
soils which 
> all have different characteristics and read differently that you 
just 
> can't do it with much accuracy.
> 
> I've worked with silts, clays, silty clays, clayey silts, clays 
with 
> little to some sand, etc. - I've seen everything you will find on 
the 
> Burmister and Unified Soil Classification charts. I once had the 
idea 
> that we might be able to measure moisture content electronically. 
After 
> spending some time at it, I concluded it wouldn't work. If it did, 
ASTM 
> would have a techniquue outlined for it. They don't.
> 
> You might be able to calibrate ONE sample of ONE type of soil for 
> electronic moisture content measurement, but take some soils from a 
few 
> feet away and it will be dfferent. The only way to accurately get a 
> measurement of moistuire content is to apply the ASTM standards, 
which 
> involve weighing the soil with moisture, baking the water out of it 
and 
> reweighing.
> 
> I hate to be the bearer of bad news but I do this profesionally and 
I've 
> been there, done that.
> 
> Zack
> 
> On Thu, 18 Oct 2007, Thomas Keller wrote:
> 
> > Show me soil with pure, distilled water in it.
> >
> > Look, I am just telling you what will work. There is no way for a 
simple
> > test unit with a probe to tell the difference between water or 
high metallic
> > content in the soil. I can tell you that dry soil, regardless of
> > mineral makeup
> > will have a MUCH higher resistance than wet soil.
> >
> > Ralph Hilton wrote:
> >>
> >> On Thu, 18 Oct 2007 16:16:18 -0500 you (Thomas Keller
> >> <tjkeller1@... <mailto:tjkeller1%40alltel.net>>)
> >> wrote:
> >>
> >>> Basicly, the resistance of soil is based on moisture content, 
because it
> >>> is the moisture
> >>> that provides the conductivity from particle to particle, not 
the
> >>> mineral or other
> >>> dry content of the soil.
> >>>
> >>
> >> I'd suggest testing it in practice. It doesn't work that way. 
Pure
> >> distilled
> >> water has a very low conductivity. The dissolved salts in the 
water
> >> bring about
> >> the conductivity. That's the principle on which a TDS meter is 
based.
> >> (total
> >> dissolved solids).
> >>
> >>> avrFreak
> >>>
> >>> Ralph Hilton wrote:
> >>>>
> >>>> On Thu, 18 Oct 2007 12:27:59 -0500 you (Thomas Keller
> >>>> <tjkeller1@... <mailto:tjkeller1%40alltel.net>
> >> <mailto:tjkeller1%40alltel.net>>)
> >>>> wrote:
> >>>>
> >>>> I was wondering how a simple resistance measurement could
> >>>> differentiate between
> >>>> a moist soil with low nutrient content and a drier soil 
containing a
Show quoted textHide quoted text
> >>>> lot of
> >>>> soluble nutrients.
> >>>>
> >>
> >> --
> >> Ralph Hilton
> >> http://www.ralphhilton.org <http://www.ralphhilton.org>
> >> C-Meter: http://www.cmeter.org <http://www.cmeter.org>
> >> FZAOINT http://www.fzaoint.net <http://www.fzaoint.net>
> >>
> >>
> >
> >
> 
> 
>                          
> 
>  __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
> 
> [Non-text portions of this message have been removed]
>

Re: [AVR-Chat] soil moisture sensor

2007-10-20 by Robert Adsett

At 10:41 PM 10/18/2007 -0500, Zack Widup wrote:

>I haven't spoken out about this yet but I thought I'd throw in a few
>words.  I work for a geotechnical engineering firm that has a soils
>testing lab. I spend quite a bit of time doing all sorts of soil and rock
>tests, including moisture contents.
>
>I never saw it mentioned exactly why the electronic means of measuring
>soil moisture content was needed or what kind of accuracy was desired.
>But I can tell you this - there are so many different kinds of soils which
>all have different characteristics and read differently that you just
>can't do it with much accuracy.
>
>I've worked with silts, clays, silty clays, clayey silts, clays with
>little to some sand, etc. - I've seen everything you will find on the
>Burmister and Unified Soil Classification charts.  I once had the idea
>that we might be able to measure moisture content electronically.  After
>spending some time at it, I concluded it wouldn't work.  If it did, ASTM
>would have a techniquue outlined for it.  They don't.

Which raises a question, for me at least.  Could you usefully measure a 
different parameter.  Maybe how easily water can be extracted from the 
soil.  That might be more important for plants than the absolute moisture 
level in any case.  Hmm, some sort of highly concentrated solution inside a 
permeable membrane and measure the dilution?

Robert

http://www.aeolusdevelopment.com/

 From the Divided by a Common Language File (Edited to protect the guilty)
ME - "I'd like to get Price and delivery for connector Part # XXXXX"
Dist./Rep - "$X.XX Lead time 37 days"
ME - "Anything we can do about lead time?  37 days seems a bit high."
Dist./Rep - "that is the lead time given because our stock is live.... we 
currently have stock."

Re: [AVR-Chat] soil moisture sensor

2007-10-20 by Ken Holt

I suppose Zack would have mentioned it - I would think
that dielectric (capacitance) would be the best bet for a single 
parameter to measure.
Two flat parallel plates (INSULATED) for a probe.

Ken


Robert Adsett wrote:
Show quoted textHide quoted text
> At 10:41 PM 10/18/2007 -0500, Zack Widup wrote:
>
> >I haven't spoken out about this yet but I thought I'd throw in a few
> >words. I work for a geotechnical engineering firm that has a soils
> >testing lab. I spend quite a bit of time doing all sorts of soil and rock
> >tests, including moisture contents.
> >
> >I never saw it mentioned exactly why the electronic means of measuring
> >soil moisture content was needed or what kind of accuracy was desired.
> >But I can tell you this - there are so many different kinds of soils 
> which
> >all have different characteristics and read differently that you just
> >can't do it with much accuracy.
> >
> >I've worked with silts, clays, silty clays, clayey silts, clays with
> >little to some sand, etc. - I've seen everything you will find on the
> >Burmister and Unified Soil Classification charts. I once had the idea
> >that we might be able to measure moisture content electronically. After
> >spending some time at it, I concluded it wouldn't work. If it did, ASTM
> >would have a techniquue outlined for it. They don't.
>
> Which raises a question, for me at least. Could you usefully measure a
> different parameter. Maybe how easily water can be extracted from the
> soil. That might be more important for plants than the absolute moisture
> level in any case. Hmm, some sort of highly concentrated solution 
> inside a
> permeable membrane and measure the dilution?
>
> Robert
>
> http://www.aeolusde velopment. com/ <http://www.aeolusdevelopment.com/>
>
> >From the Divided by a Common Language File (Edited to protect the guilty)
> ME - "I'd like to get Price and delivery for connector Part # XXXXX"
> Dist./Rep - "$X.XX Lead time 37 days"
> ME - "Anything we can do about lead time? 37 days seems a bit high."
> Dist./Rep - "that is the lead time given because our stock is live.... we
> currently have stock."
>
>

Re: soil moisture sensor

2007-10-20 by ldevriesau

Hi all,

I have often had students have a go at this with little success 
because they want to do it "cheaply" with "little effort".

One suggestion I had for them was to, attempt to measure the 
Q ( quality factor ) or D(dissipation fact which is the inverse of Q)
using some AC technique to avoid any polarization effect.

alternativily , measuring the Tau ( RC timeconstant) might do it.  
This might be achieved by applying a square wave to the sensors 
(capacitor) and measuring the resultant charge after a few 
milliseconds.

Lee de Vries 

In theory, there is no difference between theory and practice
but, in practice, there is."
or its corrolary
"In theory, practice is simple."

Help: volatile variable versus volatile array for ISR access

2007-11-03 by Cat C

Hi,

I have this group of variables that I'm updating inside an ISR.

It works fine if I declare like this:
volatile uint8_t iCh1 = 0, iCh2 = 0, iCh3 = 0, iCh4 = 0, iCh5 = 0, iCh6 = 0;

but not if I change them to an array like this:

volatile uint8_t iCh[6] = {0, 0, 0, 0, 0, 0};

I'm thinking that maybe in the second case somehow only the pointer becomes 
volatile, but... what can I do?

Thanks,

Cat

_________________________________________________________________
Send a smile, make someone laugh, have some fun! Check out 
freemessengeremoticons.ca

Re: [AVR-Chat] Help: volatile variable versus volatile array for ISR access

2007-11-03 by Robert Adsett

At 07:26 PM 11/2/2007 -0700, Cat C wrote:
>Hi,
>
>I have this group of variables that I'm updating inside an ISR.
>
>It works fine if I declare like this:
>volatile uint8_t iCh1 = 0, iCh2 = 0, iCh3 = 0, iCh4 = 0, iCh5 = 0, iCh6 = 0;
>
>but not if I change them to an array like this:
>
>volatile uint8_t iCh[6] = {0, 0, 0, 0, 0, 0};
>
>I'm thinking that maybe in the second case somehow only the pointer becomes
>volatile, but... what can I do?

There is no pointer here only an array.  They are not the same thing.

 From cdecl

cdecl> explain volatile int iCh[6]
declare iCh as array 6 of volatile int

Can you post a little more code and an explanation of what behaviour you're 
seeing?  Maybe you're thinking volatile means something other than it 
actually does.

Robert





>Thanks,
>
>Cat
>
>_________________________________________________________________
>Send a smile, make someone laugh, have some fun! Check out
>freemessengeremoticons.ca
>
>
>
>
>Yahoo! Groups Links
>
>
>

"C is known as a language that gives you enough rope to shoot yourself in
the foot."  -- David Brown in comp.arch.embedded
http://www.aeolusdevelopment.com/

Re: Help: volatile variable versus volatile array for ISR access

2007-11-03 by Graham Davies

--- In AVR-Chat@yahoogroups.com, "Cat C" <catalin_cluj@...> wrote:

> ... It works fine if I declare like this:
> volatile uint8_t iCh1 = 0, iCh2 = 0, ...
> but not if I change them to an array ... 
> volatile uint8_t iCh[6] = {0, 0, 0, 0, 0, 0};
> ... what can I do?

Try building up the type using consecutive typedefs.  Start by creating 
a type for a volatile variant of uint8_t, perhaps:
typedef volatile uint8_t vuint8_t;
and then define an array of those:
vuint8_t iCh[6] = {0, 0, 0, 0, 0, 0};

At least this way you can be sure that volatile "sticks" to the right 
part of the type.  Maybe report back if this makes a difference?

Graham.

RE: [AVR-Chat] Re: Help: volatile variable versus volatile array for ISR access

2007-11-03 by Cat C

Thank you all, here's my status:

I tried in the makefile:
ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS) -fvolatile

but the compiler doesn't like it, it looks like I don't know how to add a 
flag :-(

I tried:
uint8_t volatile ipCh[6] = {0, 0, 0, 0, 0, 0};
no dice.

I tried:
typedef volatile uint8_t vuint8_t;
volatile vuint8_t iCh[6] = {0, 0, 0, 0, 0, 0};
nope

I do have to make sure I'm not braking something else when I'm changing from 
independent variables to array...

Cat

_________________________________________________________________
Send a smile, make someone laugh, have some fun! Check out 
freemessengeremoticons.ca

Re: [AVR-Chat] Help: volatile variable versus volatile array for ISR access

2007-11-03 by Robert Adsett

At 01:21 AM 11/3/2007 -0600, Cat wrote:
>Hi Robert,
>I didn't say there's any pointer.

You did actually "I'm thinking that maybe in the second case somehow only 
the pointer becomes
volatile"

>Except maybe that the name of an array is a pointer.

No it isn't.  That was my point.  The name of an array is not a pointer it 
is an array.  the types are different.  In some circumstances it gets 
converted to a pointer but it is not a pointer.  Just like a char is not a 
long even though in some circumstances it gets converted to a long.

That's also why I quoted the cdecl output, it shows the underlying type 
quite clearly.

>I only use "volatile" to make a variable modifiable from an ISR.
>And it works, except for arrays.

Either there is a compiler bug, or more likely you are expecting a 
behaviour volatile just doesn't guarantee.

Can you narrow it down a bit and show us a extract of code that exhibits 
the problem?  Maybe we can help a little better with additional information.


Robert

"C is known as a language that gives you enough rope to shoot yourself in
the foot."  -- David Brown in comp.arch.embedded
http://www.aeolusdevelopment.com/

Re: [AVR-Chat] Help: volatile variable versus volatile array for ISR access

2007-11-03 by Cat C

Hi,

Here's some lines from the array ISR that doesn't work:

ISR(SIG_COMPARATOR)//When the Analog Input toggles
{
uint8_t ipChanNo = 0;
uint8_t iCount = TCNT0 - 9;//So we always get it quickly and adjusted
TCNT0 = 0;			//Clear Timer
if (bit_is_set(TIFR, TOV0) && bit_is_clear(ACSR, ACO))	//If we have overflow 
and input went HI
  {				//We started the first positive pulse after LO SYNC
	sbi(TIFR, TOV0);	//Clear overflow Flag TOV0 by writing logic 1
	RemoteDecoderStatusCurrent = SyncReceived;
	return;
  }
switch (RemoteDecoderStatusCurrent)
  {
case SyncReceived:
...
case CountingCh1://
	if (bit_is_clear(ACSR, ACO))
	{
		iCh[1] = iCount ; 	//THIS LINE!!!!
		ipChanNo++;
		RemoteDecoderStatusCurrent = FinishedCh1;
	}
	else RemoteDecoderStatusCurrent = StatusERROR;
	break;
//Blah Blah
  }
}

In main() I just keep looping reading iCh1 or iCh[1] and turn on an LED if 
greater than a value

If I change the line marked "THIS LINE" to iCh1 = iCount ; ipChanNo++;

Sorry about the formatting, it doesn't keep when pasted, I had to adjust 
manually...

_________________________________________________________________
Former Police Officer Paul Gillespie�s TAKE BACK THE INTERNET tips and 
tricks, watch the video now  http://safety.sympatico.msn.ca/

Re: [AVR-Chat] Help: volatile variable versus volatile array for ISR access

2007-11-03 by Robert Adsett

At 01:37 PM 11/3/2007 -0700, Cat C wrote:
>Hi,
>
>Here's some lines from the array ISR that doesn't work:
>
>ISR(SIG_COMPARATOR)//When the Analog Input toggles
>{
>uint8_t ipChanNo = 0;
>uint8_t iCount = TCNT0 - 9;//So we always get it quickly and adjusted
>TCNT0 = 0;                      //Clear Timer
>if (bit_is_set(TIFR, TOV0) && bit_is_clear(ACSR, ACO))  //If we have overflow
>and input went HI
>   {                             //We started the first positive pulse 
> after LO SYNC
>         sbi(TIFR, TOV0);        //Clear overflow Flag TOV0 by writing logic 1
>         RemoteDecoderStatusCurrent = SyncReceived;
>         return;
>   }
>switch (RemoteDecoderStatusCurrent)
>   {
>case SyncReceived:
>...
>case CountingCh1://
>         if (bit_is_clear(ACSR, ACO))
>         {
>                 iCh[1] = iCount ;       //THIS LINE!!!!
>                 ipChanNo++;
>                 RemoteDecoderStatusCurrent = FinishedCh1;
>         }
>         else RemoteDecoderStatusCurrent = StatusERROR;
>         break;
>//Blah Blah
>   }
>}
>
>In main() I just keep looping reading iCh1 or iCh[1] and turn on an LED if
>greater than a value
>
>If I change the line marked "THIS LINE" to iCh1 = iCount ; ipChanNo++;


What happens in either case?

Does anything other than the ISR change iCH?


>Sorry about the formatting, it doesn't keep when pasted, I had to adjust
>manually...


Not much to do about that I think.

Robert

Another sign of the end of civilization, our technical magazines are 
getting chatty
 From an EETimes product descriptions 2006/08/09
".... systems that can sample gobs of inputs simultaneously"
Now just what is the technical definition for gobs again?
http://www.aeolusdevelopment.com/

Re: [AVR-Chat] Help: volatile variable versus volatile array for ISR access

2007-11-04 by Cat C

It does enter the ISR (tested by turning on LED inside ISR), but when I use 
it in the main it doesn't change.

The ISR reads a remote control receiver, so I can turn the LED on/of by 
moving a joystick on the TX.

_________________________________________________________________
Send a smile, make someone laugh, have some fun! Check out 
freemessengeremoticons.ca

Re: [AVR-Chat] Help: volatile variable versus volatile array for ISR access

2007-11-04 by Robert Adsett

At 05:49 PM 11/3/2007 -0700, Cat C wrote:
>Only ISR changes iChn3 or iChn[3]

OK,

What happens differently when you use the two forms?
Can the ISR be re-entered while running?

Robert

http://www.aeolusdevelopment.com/

 From the Divided by a Common Language File (Edited to protect the guilty)
ME - "I'd like to get Price and delivery for connector Part # XXXXX"
Dist./Rep - "$X.XX Lead time 37 days"
ME - "Anything we can do about lead time?  37 days seems a bit high."
Dist./Rep - "that is the lead time given because our stock is live.... we 
currently have stock."

Re: [AVR-Chat] Help: volatile variable versus volatile array for ISR access

2007-11-04 by Robert Adsett

At 06:45 PM 11/3/2007 -0700, Cat C wrote:
>It does enter the ISR (tested by turning on LED inside ISR), but when I use
>it in the main it doesn't change.

You mis-understood.

When the ISR is running, can it be re-entered (presumably by another 
interrupt)?

When you use what in main what doesn't change?

Also how is the behaviour different when you use ch1 as opposed to ch[1]?

Right now this sounds more like an issue in main rather than the ISR but 
it's rather difficult to tell.  It could be a heisenbug.

Robert

http://www.aeolusdevelopment.com/

 From the Divided by a Common Language File (Edited to protect the guilty)
ME - "I'd like to get Price and delivery for connector Part # XXXXX"
Dist./Rep - "$X.XX Lead time 37 days"
ME - "Anything we can do about lead time?  37 days seems a bit high."
Dist./Rep - "that is the lead time given because our stock is live.... we 
currently have stock."

Re: [AVR-Chat] Help: volatile variable versus volatile array for ISR access

2007-11-04 by Cat C

Hi Robert,

When I use independent variables, the LED turns on when I move the joystick.
When I use the array, it doesn't.
Nothing else is different.

Thanks,

Cat

_________________________________________________________________
Send a smile, make someone laugh, have some fun! Check out 
freemessengeremoticons.ca

RE: [AVR-Chat] Re: Help: volatile variable versus volatile array for ISR access

2007-11-04 by Cat C

FIXED!
I upgraded my winavr (including gcc, to 4.1.2) and now MY ARRAY GETS UPDATED 
INSIDE THE ISR!

Thanks many lots.
There could be things to learn here, but there are so many exceptions :-(

Cat

_________________________________________________________________
Send a smile, make someone laugh, have some fun! Check out 
freemessengeremoticons.ca

RE: [AVR-Chat] Re: Help: volatile variable versus volatile array for ISR access

2007-11-05 by Robert Adsett

At 10:33 PM 11/3/2007 -0700, Cat C wrote:
>FIXED!
>I upgraded my winavr (including gcc, to 4.1.2) and now MY ARRAY GETS UPDATED
>INSIDE THE ISR!
>
>Thanks many lots.
>There could be things to learn here, but there are so many exceptions :-(

Glad you got it to work Cat.  I'd still be worried myself though. Just 
because the change made it work doesn't mean the previous version of the 
compiler was wrong.

Things that work just because I find very worrying.

Robert

Another sign of the end of civilization, our technical magazines are 
getting chatty
 From an EETimes product descriptions 2006/08/09
".... systems that can sample gobs of inputs simultaneously"
Now just what is the technical definition for gobs again?
http://www.aeolusdevelopment.com/

RE: [AVR-Chat] Re: Help: volatile variable versus volatile array for ISR access

2007-11-05 by Cat C

Thanks Robert,

That's true, but I think it's also true that as things are upgraded, things 
and bugs get fixed...

The (maybe) worse thing is (and I think I have a case) when something ONLY 
works with an older tool... I think that's why I downgraded in the first 
place...

Thanks again for your help, everybody

Cat

_________________________________________________________________
Send a smile, make someone laugh, have some fun! Check out 
freemessengeremoticons.ca

RE: [AVR-Chat] Re: Help: volatile variable versus volatile array for ISR access

2007-11-05 by Robert Adsett

At 07:37 PM 11/4/2007 -0700, Cat C wrote:
>That's true, but I think it's also true that as things are upgraded, things
>and bugs get fixed...

Or just change.  The trouble I have is you appear to have no way of telling 
whether the change in behaviour is the result of a bug fix,  a modified 
library function or just different code generation.

I've seen my share of compiler bugs (one compiler I used, I was always 
using a beta because I kept hitting bugs in the release compiler) but more 
often when suspicion was cast on the compiler the source was at fault.

OTOH I don't use architecture specific compiler extensions like inline 
assembly and interrupt qualifiers if I can avoid it (and with a decent 
compiler you can) simply because I've found them to be too unreliable to be 
relied upon.

One compiler had the behaviour that if ragged as re-entrant made all the 
local variables static!  Some one had decided that re-entrant meant that 
the routine would never be called more than once in a call chain (or from 
multiple threads).


>The (maybe) worse thing is (and I think I have a case) when something ONLY
>works with an older tool... I think that's why I downgraded in the first
>place...

I've seen that on occasion, rarely on a compiler (except perhaps for 
architecture extensions), usually it was traceable back relying on 
unspecified compiler behaviour.  Occasionally on a vendors decision to 
change how a utility worked.  After all why should the command line 
arguments remain the same between versions?

>Thanks again for your help, everybody

Your welcome, although I don't think we did much other than ask endless 
questions.

Robert

http://www.aeolusdevelopment.com/

 From the Divided by a Common Language File (Edited to protect the guilty)
ME - "I'd like to get Price and delivery for connector Part # XXXXX"
Dist./Rep - "$X.XX Lead time 37 days"
ME - "Anything we can do about lead time?  37 days seems a bit high."
Dist./Rep - "that is the lead time given because our stock is live.... we 
currently have stock."

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.