Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PIC based electrolyte conductivity sensor

Status
Not open for further replies.

Mosaic

Well-Known Member
I was looking at this design to supply the 16f886 PIC T0CK with a pulse train which can be converted to an EC value.

https://emesystems.com/OL2mhos.htm

But, afaik water conductivity may not behave linearly. So i am not sure how to do calibration.
I have a handheld EC meter that when scoped uses ac pulses which vary in frequency based on conductivity to produce a result. I used a 20K pot on the probes to simulate conductivity and the excel data is attached. (Change the txt extension to XLSX)

HM Digital TDS-EZ TDS is the reference meter for the data.

For creating my own probes, I also tried sampling with 308 s/s, 1/16" welding filler rod in the same dimensions as the meter probes (1 cm exposed @ 1cm gap), attached via alligator clips to the reference meter probes and there is a difference of about 1000 ppm between the two. Probably some different ionization going on so that's another complexity.

Any advice anyone?

Also I could use a bit of advice on converting the incoming T0CK pulse train to a usable number on the PIC. I am basing the system on a 4ms interrupt cycle @ 1MHZ PIC Fosc.
 
Last edited:
I guess this topic is a complex one for the forum, no comments at all.

But on the brighter side, the 555 circuit (sans the 390 ohm) linked does a decent job. I am getting linearity up to about 3.2EC (mS/cm) with a gradient of about 128/500 mS/cm per Khz. Then it starts curving. A 'best fit' gradient of 256/500 mS/cm gives reasonable results from 3.2 to about 5.5 EC after which I would need to do another gradient'best fit' but the 0.2 to 5.5 range is my range of interest.

I've been playing with the integer math to simplify the calcs to within 2byte integers. Basically it comes down to sampling Tmr0 counter every 10mS which basically rounds the freq to hundred Hz accuracy. Eg. 1250 Hz becomes a count of 12, 9500Hz = 95 etc. Some oversampling maybe worthwhile.
 
water conductivity may not behave linearly
Linearly as a function of what? Temperature? Solvent concentration? ....?
Calibration would normally be done by getting reference measurements at a number of fixed points along the temperature/concentration etc scale. Subsequent mesurements would yield values by interpolation.
 
I'm not an expert in this field but I'll put my 2 pence in.

Firstly I wouldnt use gas welding rods, esp 308, there is still ferritic metal in 308 its a fairly low grade, and there might be other compounds, fluxes anti oxidisers etc, you'd be better getting a couple of stainless electrodes for a liquid level device as spare parts.
You probably allready know that you'd need ac on the probes, using 2 outputs of the pic and aletrnating between 01 and 10 for the samples, to avoid electrolytic action from eating the probes.

As I remember water has a non linear curve between 2 millsiemens and 4 millisiemens, I know that from testing chiller water for inhibitor treatment on cooling towers.
I think the best way round the linearity issue is to make up some known solutions and take readings, then code the system to interpolate.
 
Last edited:
Thx Dr. pepper.

I am more or less doing exactly that. So far the results indicate that, with some innovative scaling error corrections, I have a sub 1% error in the range 0.2 thru 3.2mS. After 3.2 I derive a second best fit line with a new gradient to achieve sub 1% error up to around 7 mS, after that errors accumulate again and need a 3rd best fit straight line. However I am not interested in higher readings so I'll stop there.

On the matter of AC, the 555 circuit i linked (I use modified component values) to does the ac drive and produces the frequency determined by the liquid EC which I sample with T0CK at an 8msec interval to use no more than 16 bit integer calcs.

Perhaps I can spec a higher grade filler rod for the app. Testing for a few months should establish corrosion issues. The liquid is hydroponic, so pH from 5.0 min thru around 7 and EC of 0 thru 5.0. Not particularly aggressive. Hopefully the AC will null out the electrolysis. BTW the probes are capacitively isolated from DC, to avoid stray galvanics.
 
Last edited:
For completeness, I am updating this thread.

It turns out that my final build of the 555 AC oscillator using a 7555 and SMD parts has changed the frequency response of the circuit by quite a bit, so I moved away from the attempt to linearize with a best fit straight line and developed a lookup table for the area of interest.

Here is the lookup table, note that the 'probe' is a pair of 308 stainless steel rods (1/16" dia) with about 1cm gap and 1cm exposed, rounded tips. I mounted the rods on the inside of standard 1/2" CPVC pipe to maintain spacing.

Interpolated mS
EC Khz 8ms T0CK
0.1 1.5 12
0.2 2.4 19
0.3 3.3 26
0.4 4.2 33
0.5 5.0 40
0.6 5.8 46
0.7 6.5 52
0.8 7.4 58
0.9 8.1 65
1 8.9 71
1.1 9.4 75
1.2 10.0 79
1.3 10.5 84
1.4 11.1 88
1.5 11.6 92
1.6 12.0 96
1.7 12.4 99
1.8 12.8 102
1.9 13.2 105
2 13.6 108
2.1 14.0 112
2.2 14.3 114
2.3 14.5 116
2.4 14.8 118
2.5 15.0 120
2.6 15.3 122
2.7 15.5 124
2.8 15.8 126
2.9 16.0 128
3 16.3 130
3.1 16.5 131
3.2 16.6 132
3.3 16.8 134
3.4 16.9 135
3.5 17.1 136
3.6 17.3 138
3.7 17.5 139
3.8 17.6 141
3.9 17.8 142
4 18.0 144
4.1 18.2 145
4.2 18.4 147
4.3 18.6 148
4.4 18.8 150
4.5 19.0 152
4.6 19.2 153
4.7 19.4 155
4.8 19.6 156
4.9 19.8 158
5 20.0 160
5.1 20.1 160
5.2 20.2 161
5.3 20.2 161
5.4 20.3 162
5.5 20.4 163
5.6 20.5 163
5.7 20.6 164
5.8 20.7 165
5.9 20.7 165
6 20.8 166
6.1 20.9 166
6.2 20.9 167
6.3 20.9 167
6.4 21.0 167
6.5 21.0 168
6.6 21.1 168
6.7 21.1 168
6.8 21.1 169
6.9 21.2 169
7 21.2 169
7.1 21.2 169
7.2 21.3 170
7.3 21.3 170
7.4 21.3 170
7.5 21.4 171
 
Last edited:
Can I use your table?, I fancy when I've time building a permanently installed conductivity meter in our coolant tank here at work.
 
I shared it for everyone!

BTW, you'll note that resolution falls off as u pass around 5mS. If u want better resolution in the higher ranges you'll have to increase the T0CK sampling time from 8mSec.
 
To maintain treatment n our cooling water id be looking at 4ms so that'd do the trick anways, making up z test solution like you wuuld be the best way to work it.
 
Status
Not open for further replies.

Latest threads

Back
Top