# EC Probe, short-circuit?

Hi,

I'm developing an EC probe for Arduino to measure the conductivity of water. I created this code and wiring to do the task and still avoid electrolysis (by switching polarity's). Only question is: Would this create a short-circuit, and would it 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

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);

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(", Conductivity (milliSiemens/m) =");
Serial.println(conductivity);
delay(500);

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

//delay(1000);

}
``````

My wiring is attached below:

I don't understand the 4 wires to your electrodes and the ground connections. It DOES look like you've shorted the I/O outputs to ground.

If you want to reverse direction, current can flow safely from one output to another as long as there's resistance to limit the current. This is called a "bridge circuit". That means there should be no direct ground connection to the load. The "ground" is created by whichever I/O pin is low at the moment.

Hi,

Thank you, changed it, removed the grounds, would this avoid a short-circuit?

``````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

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);

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(", Conductivity (milliSiemens/m) =");
Serial.println(conductivity2);
delay(500);