﻿ Conductivity Probe Stage 3

Disclaimer:  Flow RC cannot accept any liability for any mishaps that you may have if you attempt to copy these projects.  Please read our terms and conditions.

Arduino Conductivity Probe Stage 3

The breadboard shows the wiring and a large pink momentary switch.  The circuit is only completed when the switch is depressed..

WATER, WATER EVERYWHERE

You can see the probe immersed in a glass of water.  The probe gave  sensible values so I am relatively happy.

The Arduino code reads the analogue input and converts this to mS/m taking into account the dimensions of the electrodes

Programming the Arduino

/*

This is the Arduino sketch for the conductivity probe.

Version 1 - Initial design that report values through to the serial monitor

*/

int inputPin = A0;

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

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

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

float conductVoltage = 0.00;                  //calculated voltage from reading

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

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;                    //resistivity of fluid

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

void setup(){

Serial.begin(9600);

pinMode(inputPin, INPUT);

}

void loop(){

resistance = ((closedVoltage * resistor)/conductVoltage) - resistor;

resistivity = resistance * area / length;

conductivity = (1 / resistivity)*1000;

Serial.print(", Conductivity (milliSiemens/m) =");

Serial.println(conductivity);

delay(1000);

}

Our probe will use 2 no. washers for electrodes held apart by a C-shape piece of plastic, as shown in the  photos.  Hook-up wire has been soldered to the washers and these are connected to the Arduino to complete the circuit.  The relative positions of the 10k resistor and the analogue input line are important.

I have included a safety feature.  The circuit is completed only when the momentary switch is pressed.  This stops me leaving the probe immerse in water and switched on for an extended time.  The problem is that we are using a DC current instead of an AC current.  Passing a DC current through water creates hydrogen gas by a process known as electrolysis.  (Perhaps that should be another project?)

SO PLEASE DON’T LEAVE THE PROBE SWITCHED ON IN WATER or worse a solution of table salt.
Arduino Code

For this initial prototype our code is begins by establishing the A0 analogue pin as the input pin and then defines the other variables.  If you want to use another voltage then change the value from 5.0.

The code functions by measuring the analogue reading and then determining the voltage passing through the circuit.  The resistance caused by the water between the two electrodes (the washers) can then be determined.  The conductivity is estimated based on the equations given previously.  The code is given below and can be download from Github (Click here).

Our conductivity meter gave us an analogue reading of 765 or 15 mS/m for tap water and a reading of 892 or 34 mS/m for the salt solution.  This is based on an estimated 1cm between the electrodes with a total surface area of 0.0002m2.  The result is in the right order of magnitude for drinking water of between.