Ph Sensor OWL2pe or BASIC Stamp interface
The pH electrode is essentially a simple single cell battery. Its voltage is directly proportional to the hydrogen ion concentration surrounding the electrode, proportional to the logarithm of the hydrogen ion concentration.
The ideal pH electrode:
But the electrode is practically never ideal:
The above values depend somewhat on the construction of the individual electrode, and its aging. That is why it is necessary to calibrate and standardize the pH monitoring and recording instrument from time to time, depending on the conditions it is subjected to. "Standardize" means to adjust the offset so that the instrument reads zero in neutral (pH 7) solution. "Calibrate" means to trim the slope of the pH/mV response to the the correct value for the electrode at that point in time. The instrument can have automatic temperature compensation, to adjust the slope in response to different calibration and working temperatures.
The kicker from the electronic standpoint is that the output
impedance of the pH electrode is extremely high. The electrode acts
like voltage source, however, there is a 10 to 100 mega ohm resistor
in series with the voltage. Any voltmeter that measures the output of
a pH electrode has to have extremely high input impedance, 1 tera ohm
or more. Even many digital multimeters, which have 10 or 20 mega ohms
of input resistance, will load down a pH electrode and give a reading
that is much lower than it should be. Also, the input bias
current of the amplifier needs to be extremely low, as 1 nanoAmp
through 100 MOhms equals 0.1 volt. That is already
equivalent to almost 2 pH units. A generic op-amp
such as the LM358 has in input bias current of about 20 nA, and is
clearly not suitable as the input stage of a pH meter. A pH
meter requires an FETor mosFET input op-amp such as the CA3140 (2
picoAmp), an LF356 (30 picoAmp) or a real champ like the LMC6081 (10
femtoAmps). Note that there are 1000 pA in a nA, and there
are 1000 fA in a pA.
It is the glass membrane of the probe that is responsible for the high resistance. It a special glass with tiny "pores" that cannot support much electrical current.
The usual approach to pH electrodes is to amplify and buffer the signal, with an FET or mosFET input operational amplifier. Luckily, there are op-amps these days that have the requisite low bias currents and high input impedance. When properly constructed with attention to the input circuit layout, it can easily achieve the necessary characteristics.
Here is the circuit of a pHx amplifier:
Notice the 10 femtoAmp typical input current for the suggested
LMC6081 operational amplifier. A femtoAmp is 10-15
Amp, and even with a 100 MOhm probe the error is insignificant.
To take advantage of the low input current, it is necessary to keep the
wiring very clean and it is best to run the wire from the center
conductor of the BNC connector direct to the input pin 3 of the op-amp,
which should be bent up in to make the connection in air, away from any
circuit board or socket.
Note, previously I showed this circuit with a CA3160 op-amp, which
is now obsolete. The CA3140 is still available and will
work wel in this circuit.
This amplifier produces 1 volt output in neutral, pH=7, buffer. Adjust RT1 to set this offset. This adjustment could also be used to set the output to 1.0 volts when the pH probe at the input is placed in neutral pH buffer.
The resistor R6 sets the gain. With 221k½ installed at R6, the overall gain will be x2, and the full scale output will be nominally 0.16 to 1.84 volts to cover the 0 to 14 pH range.
This circuit does not have a gain control. The idea is that the main calibration will be done in software. The final offset calibration can also be done in software.
Here is the first cut on how to program it on the Basic Stamp: This assumes that the output of the pH electrode is exactly 0 volts at pH7, and that it has a Nernst slope of exactly 59.16 mV per pH unit:
pHloop:
DO
GOSUB ADread ' return millivolts, mV, not shown
pH = mV ** 55405 ' stamp's way to multiply times 700/828 (see below)
pH = pH - 845 ' 845 is the 1 volt offset, times 700/828
pH = 700 - pH ' adjusts to pH 7.00 at 1 volt input, decreasing in acid
DEBUG REP "-"\pH.bit14,DEC abs (pH/100),".".DEC2 abs pH ' display with decimal point xx.xx
LOOP
This routine reads the voltage, then converts to pH units, and then prints out the pH result as XX.XX format. The display allows for a negative pH value, but that should never occur except in a super-acid, or unless something is wrong with the instrument.
The factor **55405 is the stamp's way of
approximating the fraction (7.00 pH units per 0.828 volt change
700/828), to convert from millivolts to pH. Recall 59 mV per pH
unit * gain of 2 * 7 pH units = = 0.828 volt. (math:
700/828*65536=55405)
The offset -845+700 is applied after the multiplication, because the ** operation does not work correctly on negative numbers. (The offset 845 comes from 1000 millivolts offset * 700/828 pH units per volt).
In the real world, the electrode will not have the ideal slope factor nor the ideal offset. What is more, the slope (Nernst potential) and offset will drift slowly with time as the electrode ages. Also, the pH measurement is temperature dependent. This is predictable, -0.002mV per degree C change in the slope factor.
I practice the pH electrode will have means for interactive calibration. The user first puts the sensor in neutral pH buffer and presses a button, and then puts the probe in either pH4 or pH10 buffer (depending on whether the measurements to come will tend to the acidic or the basic side), and presses a second button. The machine records the readings at those two calibration values and then computes the new slope and offset, which are applied to successive measurements. The temperature is measured too, and the temperature correction is automatically applied. All this can be done using the stamp. More on this later.
Additional considerations apply when measuring pH in real world
solutions. Often these solutions contain minerals and other chemical
species that affect the temperature dependence of pH in a manner
quite different from the theoretical Nernst value of -0.002 mV/degree
Celsius. "Cycle
Chemistry pH Measurement" is one reference that discusses these
issues. Algae and chemical agents may gradually clog the sensor
and slow down and deteriorate its response.
Another important consideration is isolation. A pH
electrode generates a small voltage at an extremely high impedance
level and is therefore subject to interference from AC fields of all
frequencies and also to DC interference from other galvanic sources in
contact with the wet medium, including other sensor probes.
A pH measurement in a beaker is one thing, where the volume of the
solution is relatively small and there is nothing external electrically
in direct contact with the solution except the pH probe.
Also it is relatively trouble free to measure pH with a hand-held
battery powered meter, even in a lake or inductrial plant, because it
is a measurement that makes contact at only one point without sneak
paths for interference. On the other hand, a lake or an
industrial system of pipes is a very effective antenna for AC or radio
frequency pickup. The pH reading may appear very unstable, the
more so if it is connected via a long wire back to a measurement
instrument that in turn is connected to the outside world via other
sensor probes, power and telephone lines and computer
cables. Furthermore a lake or industrial setting is likely
to have other metals and things in solution that create a complex
environment of small batteries and currents. Those
realities and seriously affect the operation of a probe.
Isolation may be acheived mechanically by bringing a cup of solution to
the probe via a servo mechanism or pump. Then the
measurement is equivalent to a measurement in a beaker.
Isolation may also be acheived electronically by means of an isolated
power supply and isolation amplifier. Then the measurement
is equvalent to dipping in a battery powered hand held
meter.