# How to know the resistance of a sensor and avoid current flow through it

Dear all,

I am trying tomeasure the resistance of a Watermark moiture sensor,
We mainly have to cinsider:

A special circuit is needed to measure the electrical resistance of the Watermark sensor. DC currents
must not be allowed to flow through the wet part of the circuit, or else irreversible reactions
will occur and spoil the readings. AC excitation avoids these problems, by reversing the polarity
of the current many times per second, so that no net reaction takes place at either electrode. The
circuit must also isolate the sensor electrodes from galvanic currents in the soil environment.
Metal objects such as ground rods or pipes or tanks or other sensors that contact the soil can give
rise to underground electrical currents in relation to the electrodes of the Watermark sensor, and

I found serveral way to do it.
I am very interrested on this
http://forum.arduino.cc/index.php?topic=22250.msg167293#msg167293
but I have pain to understand

1. how work the condensator
2. What should be the value of the condensators
3. How to calculate the of Re, keeping in mind that the resistive value of the Wtermark is from 500 Ohm (Wet) to 28kOhm (dry)

If someone has other work to explain me why we do not neet to inverse the polarity, would be greate!!

Secondely, there is this emply voltage divider:
Voltage divider for Watermark
If I connect A1, I can get the Output voltage value:

``````val = analogRead(A1);
if(val<1) val=1;
Vout = val*Vin/1023;
``````

and then the watermark resistance;

``````Rwm = (R1*(Vin-Vout)/Vout) ;
``````

But as it states above, the polarity need to be inversed, then, specially if the R1 is not egal to Rwm, Vout will not be the same. That right?

Then, keeping in mind that the Watermark resistance (Rwm) will NOT change wintin 10 second (time if the measure), why Vout is not identical while we inverse the polarity?

I think, R1 should be ega at the maximum value of Rwm. In thar case, Vout will be the same, whatever, the polarity, but one will be posituf, and one negatif, but the same.

I wunder, if some one has a experince with voltage divider, keeping in mind the we need to measure and know the WATERMARK resistance (Rwm).

To calculate the Rwm (watermark resistance), we need t make the measure when D1 High/D2 Low, and make the a new measure when D1 is Low/D2 is High, and make the average. We have now the Rwn.
(Better would be to reapet is 10 time and make a new average)

How would suggest me to better us is with an Arduino?

Thank a lot

Connect D1 to 5V, D2 to ground (0V), use not rusting material for electrodes, galvanised nails, brass, stainless steel.
Voltage divider
Make your sensor, put it into soil, measure resistance, R soil = R1

Dear Ted,

I correct the title.

The problem, I am trying to check my code which should return the Rwm value
I have to watermark. One is new and fully dried. The second is new and put it into water.
I also have WATERMAK Digital reader

With the digital reader, I read 0 on the wet sensor and 199 on dried sensor.

Then with my code I am trying to get the same value which is not the case.

I did not put the sensors into soil, because I would need a box with a fully dried soil and another with a fully wet soil. I have the wet soil with is now drying, but I would need a couple of mounth to have it fully dried. As the dry soil is not ready, I can not compare

My circuit is powered with 3.3V.

Morever, if the sensor is fully wet, it's resistance should be around 500Ohm and when is fully dry, it should be around 28K. So it can be alreays egual to R1. No?

With no current flowing - no sensor will work.

Base on " should be " make R1 10k
3.3 V - are you using arduino ?
the schematic will clarify what you are doing

Hello Ted,

Here you have some interresting information

Paragraph 2 and 3.

Yes, I am using Arduino.

I do not know which is the best schema, as I wrote in my first post.

Here is a alternative

and here is a second

For now I connected
Pin 13 to D1 and Pin 12 to D2
but I do not have good result.

It the reason why I started speaking about the schema and the tread
http://forum.arduino.cc/index.php?topic=22250.msg167293#msg167293
that U do not full understand the explication of the capacitor...

Everything is described on page 12 including schematic,
This is a generator which frequency is changing , so you need arduino frequency meter program - google that,
R2/green to arduino digital pin,
They recomended -. Nonpolar ceramic capacitors

The second schematic can work for short time, then corrosion will eat the sensor.
why you make this so complicated, google - arduino moisture meter.
The sensor you chose is for scientific measurements rather than watering flowers.

Dear Tod,

The second schematic can work for short time, then corrosion will eat the sensor

I think, this is not an issue, because I am going to power it only 10sec (max) each 4 hours. No?

The sensor you chose is for scientific measurements

Yes, it waht I need. This sensor is good and not so expensive.

Any idea how can I know the value of the two C and Re?

Cheers

The link above 4.7uF, Re not sure, original 390 ohm.
The guy took peace of original circuit , not properly , in this circuit one or two C will make no difference, so what for is R1 no idea ......
The code for this schematic may have an ansver.
Dc current will help to start corosion, which will continue eat the metal after measurment.

Yes, you must use AC here for proper measurements, frequency between 1 kHz and 1 MHz, preferably >3 kHz. Below that you get electrolysis and corrosion; above that the ions can't follow fast enough. At the 3 kHz you may be able to do an analog reading before switching the direction again (at 3 kHz you have 166 µs per direction).

Capacitors: I'm using 2.2 µF for my EC probes (water conductivity) but use different measurement techniques; larger caps will work as well.

I don't know how well this will work: the moment you apply the voltage the voltage across the capacitors rise, and with it the voltage you measure at the ADC. Using large capacitors you can slow that down, but it will affect your measurement. That's probably why the suggestion is to measure both ways. Without these two caps you would have a plain resistor divider, and you could use two pins to create the AC.

Re value: as small as possible to have less effect on the soil resistance measurement but at least 250Ω to keep the current <20 mA (pin limit).

I don't see a use for the 10k resistor other than slowing down the reaction of the ADC a bit.