PDA

View Full Version : Ion-specifc electrode array: control ALL water parameters


Foxy Brown
06/12/2010, 08:59 AM
Hi all, I've been working slowly on a long term project to build a system to measure water parameters, and to link the measurement to a computer controlled dosing rig. The trick is: I don't want to just measure pH, or ORP but EVERYTHING. Before I start, I do hold graduate degrees in both chemistry and engineering, so I know a thing or two on the subject. It's mostly practical fish-keeping experience I lack the most, as I'm still relatively new.

Here's the idea: We ALL need to measure some basic parameters, and there are others we would all like.

Good: pH, ORP, Salinity (conductivity) Alk (CO3), Hardness (Ca)
Better: Good + NH4, PO4, Mg
Best: Better + Trace elements (I, Sr, etc.)

You can measure all of these with ion-specific electrodes BUT there are usually errors. These errors are due to cross-sensitivity (NH3 with K or NO3 with Cl for example) That tends to limit the accuracy.

What I've been working on is, to pair-up these electrodes so that each pair would measure both the desired ion and its interfering partner. So here's how you start:

First you make a reference electrode (Ag wire coated in AgCl - very easy to make). Then add ORP electrode (Gold or platinum wire) and measure the voltage between the 2 electrodes to have ORP. Same thing for a glass pH electrode. Conductivity is also easy and all 3 above are commercially available.

Now for the ion-specific electrodes, you coat a silver wire with a special solution of PVC containing a few additives (called ionophores - also commercially available), and you measure the voltage vs the REF electrode. You must measure them in pairs though and you can use a simple equation to calculate the concentration of BOTH. The pairs are: (Mg + Ca, NH4 + K, NO3 + I, PO3 + SO4) and then add 1 for HCO3.

Sounds like alot of electrodes yes, but they are only tiny coated wires and when done, you can control ALL water parameters. Conductivity = dose DI water / concentrated salt solution, pH = dose HBO3/NaB4O7 or H2SO4/Na2SO4, ORP = dose ascorbic acid (Vitamin C) / ozone, Mg = dose MgSO4, Ca = dose CaCl2, Alk = dose NaHCO3, NO3 or PO4 = turn on a reactor (Zeolite/GFO) or dose vodka if you prefer, etc... you get the idea.

The interface is easy, you just need to build some FET-input instrumentation amplifiers (easy), hook them to the ADCs of a microcontroller or PLC (very easy), do a bit of programming (less easy but not hard) and use it to turn on dosing pumps. The last step is calibrating everything, which is not a bad as it sounds.

Anyone got any comments or feel like helping out? What I could really use is someone with a good tank to test it on (don't hook-up the pumps, because I don't want to mess with anyone's system), just see if it gets the diagnosis right, and gives the correct response. That, and maybe someone with more programming experience than I have.

jim.l
06/12/2010, 09:40 AM
You're way beyond my knowledge with this, but you may want to post this in the reef chemistry forum. Several regulars there are knowledgeable in this area.

Foxy Brown
06/12/2010, 10:37 AM
Will do, thanks... It's basically a DIY project, but you're right - it's a bit chemistry heavy.

BeanAnimal
06/12/2010, 11:56 AM
The interface is easy, you just need to build some FET-input instrumentation amplifiers (easy), hook them to the ADCs of a microcontroller or PLC (very easy), do a bit of programming (less easy but not hard) and use it to turn on dosing pumps. The last step is calibrating everything, which is not a bad as it sounds.

Not quite that easy. You need to drive the probes with a buffered AC sine wave, change the current to voltage and scale it (non-inverting amp) and then pass that signal to the precision amp (instrumentation amp).

You will also need a digital switch or multiplexer, as the probes will interact with each other. You will want to only drive one probe at a time.

The amplitude stability if the sine wave is critical, as errors in amplitude lead to RMS voltage error and that leads to measurement error. I am working on (two) sine wave drivers right now. The first is based on the Wien bridge oscillator and the second on a 555 timer with an 8th order butterworth lowpass filter. I just got the parts needed for both circuits but have not had a chance to breadboard them and look at them on the scope.

The project is part of my RO/DI automation system and designed to read some HM Digital TDS sensors. The circuit should be fairly easy to adapt to just about any instrumentation project.
http://www.beananimal.com/projects/automated-rodi-water-filtration-system.aspx

Foxy Brown
06/12/2010, 12:58 PM
TDS sensors work on a very different principle from ISEs, though yes, the best way for TDS is an AC driven 4-probe setup (though inductance-based can also be quite good). The problem with TDS is polarization build-up, but ISEs are voltametric, not coulometric (amperometric) so the problems are different (but there still are some).

The trouble with ISEs is they have very high impedance, so you run into problems with drift. Fortunately, this was solved decades back for pH probes which have the same problem, and more recently for ISFET systems. The other trouble is that most cheap ISEs do not have an internal filling solution, which makes them thermodynamically ill-defined. I plan to conquer that using a hydrogel layer between the wire and the PVC layer, but that's not the point.

Let me know if you run into trouble with your TDS system, I'll be glad to help if I can.

Foxy Brown
06/12/2010, 01:23 PM
Bean, you may keep in ming that a square-wave AC drive will also work, and is much easier to do with good precision.

Foxy Brown
06/12/2010, 01:31 PM
Oh yeah, one more quick one... You don't need to PRODUCE your current all that precicely, you just need to MEASURE the current you did get precicely. ;) Then you just use the two measurements in your calculation... That way you don't make assumptions about how much current your occilator actually puts out (which is dependent on conductivty anyway).

Mr..Tang
06/12/2010, 04:48 PM
I live this idea! I'm no engineer or chemist but can be the test pig.

Foxy Brown
06/12/2010, 06:38 PM
I'm glad to have at least one person who likes it... I'm having a hard time in the Chemistry section. All valid comments of course, but I'm very stubborn about making things work... and if it did, it would solve a lot of problems.

BeanAnimal
06/12/2010, 06:57 PM
TDS sensors work on a very different principle from ISEs, though yes, the best way for TDS is an AC driven 4-probe setup (though inductance-based can also be quite good). The problem with TDS is polarization build-up, but ISEs are voltametric, not coulometric (amperometric) so the problems are different (but there still are some). Yes certainly the operating principle is different with regard to the chemistry, but in both cases we are reading the current through a high impedence probe :)


Let me know if you run into trouble with your TDS system, I'll be glad to help if I can. It should be fairly straight forward. The circuit behaves as expected in the simulator with both the Wien bridge. I can't simulate the 555 based oscillator because there is no model for an 8th order butterworth and I am too busy (lazy) to build one or cascade a bunch of 2nd order filters to simulate the IC. I will toss it on a breadboard when I get a chance later in the week.

I am not sure what to use for temp compensation. I may use Dallas 1-wire because they are so easy to interface. The TDS probes have built in thermistors, but I am struggling to get my head wrapped around developing the steinhart-hart code needed to accurately read them.

BeanAnimal
06/12/2010, 07:11 PM
Oh yeah, one more quick one... You don't need to PRODUCE your current all that precicely, you just need to MEASURE the current you did get precicely. ;) Then you just use the two measurements in your calculation... That way you don't make assumptions about how much current your occilator actually puts out (which is dependent on conductivty anyway).

I plan to mess with sine, square and triangle waves, just to see the differences. I need to have an accurate amplitude because I don't have the resources to measure both the input and the response, the MCU is doing a LOT already :)

The current from the oscillator will be buffered with an opamp stage, so it should be fairly stable. I will let you know how things go :)

Foxy Brown
06/12/2010, 07:20 PM
I also have alot of experience with thermocouples, and there are some specialty ICs that make interfacing them a breeze. I think your probably on the right track with the 1-wire though, unless space is too tight.

laverda
06/12/2010, 11:43 PM
Very interesting project. I doubt many people would be able to set this sort of thing up considering how much trouble some people have with just calibrating a PH probe. If you need another test tank let me know.

drclifton
06/12/2010, 11:50 PM
Heck I'd be in on this! sounds fun

Foxy Brown
06/13/2010, 08:11 AM
I'd plan on setting up the calibration to be fairly simple by making the hard parts invisible and have the controller do all the hard math and such.

Foxy Brown
06/13/2010, 11:23 AM
Everyone should have a look in the Chemistry forum, since there's a lot going on over there. http://www.reefcentral.com/forums/showthread.php?p=17235851&posted=1#post17235851