EC meter, how to avoid elektrolysis

Hi,

I want to create an electric conductivity meter according to the following example:

Think you can make a basic (uncalibrated) electric conductivity meter quite easilily

GND -------C B------A----[ R1 ]----- +5V

A = analog in of Arduino.
B, C = connectors to hang into the water
R1 = potmeter - should be in the same order as resistance BC with a minimum of 1K

Water between B & C will have a certain conducticity or resistance. Together with R1 it forms a voltage divider.

If BC conducts well the analog port will read a LOW value and when BC has a HIGH resistance it will read a HIGH value.

try if this suites your need

The only thing that I can't solve is how to avoid electrolysis caused by the DC current. This because the electrolysis will make my readings very inaccurate.....

Who can help me?

Use two digital pins switched in antiphase to be your "power", and an analog pin to read the
middle of the voltage divider. Switch the polarity, take a reading, switch the polarity, take another
and subtract it from 1023, now average the readings.

When not taking readings let both digital pins float so no current flows.

On average the current is now zero as you reverse polarity, and you only have current during
a measurement.

Result - significant reduction of any electrolysis or polarization I hope.

Would this work?

int inputPin = A0;
int inputPin2 = A1;

int power = 3;
int power2 = 2;


const float closedVoltage = 5.00;                //assumed value of voltage (replace with vcc)
const float closedVoltage2 = 5.00; 

const float voltageRange = closedVoltage/1024;   //Used to map the analog reading to the voltage of the circuit.
const float voltageRange2 = closedVoltage/1024;

const float resistor = 1000.00; 
const float resistor2 = 1000.00;  //size of resistor on the ground line

int conductReading = 0;
int conductReading2 = 0;  //reading from A0 pin

float conductVoltage = 0.00;
float conductVoltage2 = 0.00; //calculated voltage from reading

float resistance = 0.00;   //calculated resistance of water (ohms)
float resistance2 = 0.00;

float area = 0.0002;//area of the all four sides of the electrodes in square meters

float length = 0.01;//distance between the electrodes in meters

float resistivity = 0.0;
float resistivity2 = 0.0; //resistivity of fluid

float conductivity = 0.00;                  //calculated conductivity of water (micro-siemens/m)
float conductivity2 = 0.00;






void setup(){



 Serial.begin(9600);


 pinMode(power, OUTPUT);
 pinMode(power2, OUTPUT);

 pinMode(inputPin, INPUT);
 pinMode(inputPin, INPUT);



}



void loop(){

 digitalWrite(power, HIGH);
 digitalWrite(power2, LOW);
 delay(250);
 
 digitalWrite(power, LOW);
 digitalWrite(power2, LOW);
 delay(250);
 
 digitalWrite(power, LOW);
 digitalWrite(power2, HIGH);
 delay(250);
 
 digitalWrite(power, LOW);
 digitalWrite(power2, LOW);
 delay(250);

 conductReading = analogRead(inputPin);
 conductReading2 = analogRead(inputPin2);


 conductVoltage = conductReading * voltageRange;
 conductVoltage2 = conductReading2 * voltageRange2;

  resistance = ((closedVoltage * resistor)/conductVoltage) - resistor;
  resistance2 = ((closedVoltage2 * resistor2)/conductVoltage2) - resistor2;
 

 resistivity = resistance * area / length;
 resistivity2 = resistance2 * area / length;
 

 conductivity = (1 / resistivity)*1000;
 conductivity2 = (1 / resistivity2)*1000;
  

Serial.print(conductReading);
Serial.print(", Conductivity (milliSiemens/m) =");
Serial.println(conductivity);
delay(500);

Serial.print(conductReading2);
Serial.print(", Conductivity (switch) (milliSiemens/m) =");
Serial.println(conductivity2);
delay(500);


 //delay(1000);

 

}

My wiring is attached below:

Schermafbeelding 2015-08-25 om 18.50.06.png

Hi,

Made a second version, (previous one created a short-circuit). IS this one better?

int inputPin = A0;
int inputPin2 = A1;

int power = 3;
int power2 = 2;


const float closedVoltage = 5.00;                //assumed value of voltage (replace with vcc)
const float closedVoltage2 = 5.00; 

const float voltageRange = closedVoltage/1024;   //Used to map the analog reading to the voltage of the circuit.
const float voltageRange2 = closedVoltage/1024;

const float resistor = 1000.00; 
const float resistor2 = 1000.00;  //size of resistor on the ground line

int conductReading = 0;
int conductReading2 = 0;  //reading from A0 pin

float conductVoltage = 0.00;
float conductVoltage2 = 0.00; //calculated voltage from reading

float resistance = 0.00;   //calculated resistance of water (ohms)
float resistance2 = 0.00;

float area = 0.0002;//area of the all four sides of the electrodes in square meters

float length = 0.01;//distance between the electrodes in meters

float resistivity = 0.0;
float resistivity2 = 0.0; //resistivity of fluid

float conductivity = 0.00;                  //calculated conductivity of water (micro-siemens/m)
float conductivity2 = 0.00;






void setup(){



 Serial.begin(9600);


 pinMode(power, OUTPUT);
 pinMode(power2, OUTPUT);

 pinMode(inputPin, INPUT);
 pinMode(inputPin, INPUT);



}



void loop(){

 digitalWrite(power, HIGH);
 digitalWrite(power2, LOW);
 delay(250);
 
 digitalWrite(power, LOW);
 digitalWrite(power2, LOW);
 delay(250);
 
 digitalWrite(power, LOW);
 digitalWrite(power2, HIGH);
 delay(250);
 
 digitalWrite(power, LOW);
 digitalWrite(power2, LOW);
 delay(250);

 conductReading = analogRead(inputPin);
 conductReading2 = analogRead(inputPin2);


 conductVoltage = conductReading * voltageRange;
 conductVoltage2 = conductReading2 * voltageRange2;

  resistance = ((closedVoltage * resistor)/conductVoltage) - resistor;
  resistance2 = ((closedVoltage2 * resistor2)/conductVoltage2) - resistor2;
 

 resistivity = resistance * area / length;
 resistivity2 = resistance2 * area / length;
 

 conductivity = (1 / resistivity)*1000;
 conductivity2 = (1 / resistivity2)*1000;
  

Serial.print(conductReading2);
Serial.print(", Conductivity (milliSiemens/m) =");
Serial.println(conductivity2);
delay(500);

Serial.print(conductReading);
Serial.print(", Conductivity (switch) (milliSiemens/m) =");
Serial.println(conductivity);
delay(500);


 //delay(1000);

 

}

My wiring is attached below:

No, your circuits isn't correct. Look here:
http://gardenbot.org/howTo/soilMoisture/

Magician:
No, your circuits isn't correct. Look here:
A cheap soil moisture sensor - GardenBot

But in that case you wont switch polarity and you create electrolysis......

Take your time, read an article :

This is the new-new moisture sensor -- use this instead of the basic version below.

The main improvement to the sensor is that we need to run the current both forward and reverse. This allows us to use our cheap two-probe soil moisture sensor without electrolysis ... more or less

The electrode potential to produce hydrogen is 0.4 V.

Just keep your measurment voltage below this and electrolosys should not occour.

Might be good to run the measured voltage through an op amp to get a better range to at analog in, if you are going to be holding it to less than 0.4 V. Stainless steel or graphite electrodes would also be better than a washer.