# Circuit for measuring conductivity

#### juicemode

Joined Oct 23, 2017
11
New the the forum and very new to basic electronics. Im looking for any guidance in regard to a circuit I would like to build to measure conductivity. The hardware I have is a Colepalmer 19500-20 conductivity probe with built in ATC via a 10kohm thermistor and an Arduino board.

I do not need very high accuracy but I would like to utilize the basic linear compensation of 2%/degree C
the probe is loop powered by 24v and outputs a 4-20mA signal.
It has a total of 5 wires, two for the thermistor, two for the conductivity and one shield.

Is there a way I can make a stable conversion for the output into a voltage that my Arduino could read and apply the temperature compensation to?

Thank you in advance for any assistance in my project.

#### MrChips

Joined Oct 2, 2009
19,928
I assume that you are measuring conductivity of a liquid.
What is the liquid?

#### juicemode

Joined Oct 23, 2017
11
Yes I am sorry, its a geothermal water source I have developed a membrane technology to filter.

#### juicemode

Joined Oct 23, 2017
11
I am thinking I will need some sort of op amp or transimpedance amplifier but how to build, but or integrate one is for the moment beyond me.

#### MrAl

Joined Jun 17, 2014
6,972
Hi,

A pseudo linear measurement can be had by placing a resistor in series of the same value as the thermistor when the thermistor is at the center of the range of temperatures to be measured. Thus if you have a thermistor that is 10k at 25 deg C and the center of your range is 25 C then that's it. If your center temperature is 35 deg C and the thermistor measures 8k at that temperature then you set the fixed resistor to 8k instead.

That is somewhat linear, but if you need it more linear you can correct it in code in the micro controller. It's not that hard to do.

#### juicemode

Joined Oct 23, 2017
11
MrAI,

Thank you! I have the 10kohm thermistor up and running using the method you described. Do you have any suggestions on converting the 4-20mA signal driven by the 24v power supply into a voltage readable by my Mega? Im stumped on the wiring.

#### MrChips

Joined Oct 2, 2009
19,928
I have measured conductivity and temperature of karst cave water using basically the same technique.
You are measuring resistance for both conductivity and temperature. You can do this with a simple capacitor placed across two input/output pins of any microcontroller. No additional ADC is required. You are essentially creating your own ADC using a simple capacitor in parallel with a resisto and the timer of the MCU..

#### BR-549

Joined Sep 22, 2013
4,938
"You are measuring resistance for both conductivity and temperature. You can do this with a simple capacitor placed across two input/output pins of any microcontroller. No additional ADC is required. You are essentially creating your own ADC using a simple capacitor in parallel with a resisto and the timer of the MCU.."

Can you stretch that out some.

#### wayneh

Joined Sep 9, 2010
16,162
MrAI,

Thank you! I have the 10kohm thermistor up and running using the method you described. Do you have any suggestions on converting the 4-20mA signal driven by the 24v power supply into a voltage readable by my Mega? Im stumped on the wiring.
All you need is a resistor inside the 4-20mA loop. By Ohm's law the voltage across that resistor will be proportional to the current being driven through it, ∆V = I•R. You already know that I = 0.02A at the maximum 20mA. What voltage is the maximum that the Arduino can accept? Use that for ∆V. Calculate the proper value of R.

Is the 24V power supply isolated from the power supply of your Arduino? If they are, then the low side of the resistor can be tied to Arduino ground. If the power supplies share ground, the Arduino will still see a voltage at 4mA and a different voltage at 20mA. The resistor value may need to be adjusted to keep the maximum voltage in range for the Arduino.

#### MrAl

Joined Jun 17, 2014
6,972
MrAI,

Thank you! I have the 10kohm thermistor up and running using the method you described. Do you have any suggestions on converting the 4-20mA signal driven by the 24v power supply into a voltage readable by my Mega? Im stumped on the wiring.
Hi,

Well basically you could use a resistor to convert the 4 to 20ma signal into a voltage acceptable by the ADC of the Arduino. Once you do that, you measure the thermistor voltage, then figure out how to combine that with the current to voltage measurement so that it compensates by your required amount of 2 percent. That would mean adding (or subtracting) some percentage of the thermistor reading to/from the current to voltage measurement.
The right value to use would be based on some base line measurements or assumptions. For example, if you have your voltage centered at 2.5v (assuming a 5v system) then you subtract 2.5v first (in code) and then multiply by the percentage needed, which would depend on your thermistor.
For example if your thermistor voltage goes up by 0.5v for say 5 degrees C then you know you have about +0.1v per degree C, and if your current to voltage voltage reading goes up by +0.02v per degree C then you have to subtract 0.2 times the thermistor voltage reading. So you have two readings Vth and Vcv and the compensated value Vc will be:
Vc=Vcv-(Vth-2.5)*0.2

and since you have to select a value for the current to voltage resistor Rcv you'll have:
Vc=i*Rcv-(Vth-2.5)*0.2

and you can simplify that if you want to.

That should get your started, but your actual values will be different most likely.
If you post your thermistor data we can look at this more closely. If the accuracy is not good enough then a simplified curve fit could be done for the thermistor.

BTW, if your thermistor is the NTC type then it would normally go in the top position of the voltage divider, but you can put it in the bottom position if you just change the code.

Also, the +5v power supply on the Arduino may not be that accurate so you may want to use a reference diode to bias the thermistor and the ADC reference too. It depends partly on what accuracy you are after.

Last edited:

#### juicemode

Joined Oct 23, 2017
11

#### juicemode

Joined Oct 23, 2017
11
I have measured conductivity and temperature of karst cave water using basically the same technique.
You are measuring resistance for both conductivity and temperature. You can do this with a simple capacitor placed across two input/output pins of any microcontroller. No additional ADC is required. You are essentially creating your own ADC using a simple capacitor in parallel with a resisto and the timer of the MCU..

#### juicemode

Joined Oct 23, 2017
11
As far as wiring goes, for conductivity I have a white and and black wire, also in sensor wiring I have a clear shield wire. Do i connect my 24v across the white wire and the clear for loop power and use the black to the resistor?

#### wayneh

Joined Sep 9, 2010
16,162
As far as wiring goes, for conductivity I have a white and and black wire, also in sensor wiring I have a clear shield wire. Do i connect my 24v across the white wire and the clear for loop power and use the black to the resistor?
You need a pinout. We could guess but that’s all it would be.

#### MrChips

Joined Oct 2, 2009
19,928
For conductivity in water, you need to reverse the current using an AC signal. DC will cause electrolysis.
For temperature, it is not as important to use AC.

Here is my circuit:

Here is how the RC oscillator on an MCU works.

D0 = output LOW
D1 = output HIGH, charge C to Vcc.

Switch D1 to input. C begins to discharge through R. When the digital input at D1 switches to LOW, trigger an interrupt on change and tally the interrupt count.

Do the reverse cycle, i.e.
D1 = output LOW
D0 = output HIGH, charge C to reverse polarity.

Repeat the whole process.
While all of this is happening, have a timer module run for a fixed length of time. When the timer module times out, the interrupt count is your ADC value which is linear with R.

You can run the timer as long as you wish to get the desired number of ADC bits.

#### juicemode

Joined Oct 23, 2017
11
Gosh I had no idea I needed a AC power supply but after some research I understand why.

As for the the rest of your post it goes way over my head. I might be posting in the wrong section.
I really want to lean and understand how to make this work so I will try to tackle your circuit in parts by doing further research. I really do appreciate all that have chimed in to help me.

#### juicemode

Joined Oct 23, 2017
11
I have no documentation on my sensor as cole palmer is really bad about disclosing who the rebranded their stuff from originally but I do know this.

five wires
black and white are for the conductivity electrode
red and green are for the 10kohm thermistor
and the fifth wire is clear and I think its called the shield, and I am not exactly sure what its used for

#### juicemode

Joined Oct 23, 2017
11
Ideally I would like to buy a breakout board or two if necessary to build my sensor transmitter. One op-amp and an RC oscillator to convert my 24v to AC current. Do you think a transimpeadance amplifier would work best to translate current to voltage in a stable way? Also what should I look for when shopping for an RC oscillator?