A simple pH-meter with USB interface based on LPC1343
To check water quality in a swimming pool, I needed a pH and ORP meter. A simple and cheap one,
no need for lab-type accuracy. So I decided to build one, and since Aliexpress offers pH electrode
together with a pre-amplifier module cheaply, I decided not to develop a new board for it, but to
connect this module to a
previously developed board with LPC1343,
which offers 3 ADC channels, together
with USB or Ethernet interface.
See here for
PDF schematics and a complete
Kicad design of this board.
The chinese preamplifier modules is PH4502C and its schematics (possibly some resistor values might change) I found on the net

.
For theory of pH and ORP measurements see this
article.
To interface the preamplifier with the ADC channel 3 on the board, I did populate resistor divisors by 18k and 33k resistors and tuned the trimmer
on the modules to achieve voltage at the BNC shell 1.00V over GND. The voltage gain of the module was 3x, with the aforementioned offset
to measure negative potentials.
I did not employ the thermistor from the module, rather used an independent DS18B20 sensor for temperature measurement.
The open-source GPLv3 licensed code for the phmeter is in the file phmeter.c in the tar archive
arm_lpc111x.tar.gz.
MCU type, frequency, pll multiple, and USB VID and PID must be set in the Makefile to compile it.
The device can be powered from battery with output at the display, or, when connected via USB, it is USB-powered and
acts as a virtual serial port /dev/ttyACMx at the hosts and prints measurement results in ASCII.
To calibrate the pHmeter, four calibration constants have to be determined. First offset and slope of millivolt measurements,
using a lab power supply and reference (low impedance) voltmeter. Then, the standard calibration of offset and slope for acid and alkali range of the pH electrode
is done using buffer solutions with pH=7, 4, and 10.
I have implemented a combined calibration for both acid and alkali range, with two different slopes,
which are non-linearly interpolated in the range of pH 4-10. When both slopes are equal (ideal electrode),
it falls back to single slope interpolation. It is thus able to cover a wider range of pH without the need
for recalibration and thus a bit compensates for the poor properties of the cheap electrode from aliexpress,
which is far from ideal in the alkali range.
The calibration is menu-driven and the offsets are determined when the user moves the readout towards the expected one using green and red buttons and stored in eeprom.
My Electronics page
My hobby page
My main page with e-mail contact
TOP of my family pages