pH-meter for ESP8266, Raspberry Pi, Arduino

The HomeLab-pH is a circuit board for pH measurements. It is used in tandem with a computing module, usually - Raspberry Pi mini-computer, Arduino controller or ESP8266 module.

HomeLab-pH front view HomeLab-pH back view

Features

The HomeLab-pH board lacks a processor, so it has to be connected to an external CPU board to do the calculations. This site shows how to connect to and use HomeLab-pH with an Arduino controller, an ESP8266 system, or as an expansion board to a Raspberry Pi (RPi) or compatible mini-computer.

HomeLab-pH back view with a pH-sensor, a thermometer and a smartphone displaying user interface. HomeLab-pH connected with ribbon cable to a powered ESP8266

There is a more detailed description of the board capabilities to help those aimed at an integration with different types of processing boards. Note that, to do pH measurements, a combination pH-electrode and calibrating buffers have to be available in addition to a processing unit.

We prepared software packages for ESP8266, Arduino and Raspberry Pi. They are to be used for reading, controlling and calibrating the pH module, but are somewhat different in capabilities.

Isolated HomeLab-pH board

Isolated HomeLab-pH front view Isolated HomeLab-pH back view

It is somewhat tricky to measure pH in volumes where immersed appliances leak direct electric current into the liquid. Due to the very high input impedance of the pH-probes these currents, even small, may impact the measurement and result in unstable or shifted pH value. This is the case with aquariums where immersed air or water pumps, heaters and lighting leak small electric currents through their insulating shells.

Aquarium owners or hydroponics enthusiasts interested in on-line pH-measurement may benefit of the functionality added by our HomeLab isolator module. When coupled with HomeLab-pH it assists the pH measurement by effectively filtering the interfering currents of the environment.

Isolated HomeLab-pH riding RPi

HomeLab-pH back view; with Isol. Arduino Nano rainbow cable connected to HomeLab-pH.

HomeLab-Isol is a small size circuit board, which is to be mounted between the computing board (ESP8266, PRi, Arduino) and the HomeLab-pH module.

Module Specification

This is a specification of board revision 4. For earlier revisions see Rev.1.1, Rev.2 or Rev.3 .

Board

input voltage range -900 mV ÷ 2048 mV
supply voltage 3.3 to 5 V (through the VCC pin)
GPIO voltage (VCC) equal to the supplied voltage
max. supply current 25 mA
working temperature range 0 ÷ 50°C (32 ÷ 122°F)
working relative humidity range up to 90 % (non-condensing)
board dimensions, W:D 56 : 20 mm, (2.20 : 0.79 in)
overall dimensions, W:H:D 57 : 23 : 36 mm,
(2.2 : 0.91 : 1.4 in)

Digital conversion of the input voltage (pH sensor voltage)

input voltage range resolution
-900 ÷ -512 mV 0.50 mV
-512 ÷ -256 mV 0.25 mV
-256 ÷ 256 mV 0.125 mV
256 ÷ 512 mV 0.25 mV
512 ÷ 1024 mV 0.50 mV
1024 ÷ 2048 mV 1.00 mV

pH resolution based on the voltage resolution

pH resolution
at 25°C
voltage
resolution
pH 3 to pH 11 0.002 pH 0.125 mV
below pH 3 or beyond pH 11 0.005 pH 0.25 mV

Temperature sensor

response time at 90% * typical: less than 15 s; max: 20 s
inaccuracy ** not more than 0.5°C ( 0.9°F )
working range 0 ÷ 80°C (32 ÷ 176°F)
tip diameter ø 6 mm
cable length 1 m / 2.5 m ( 3 ft 3 in / 8 ft 2 in )

* Measured in stirred water with a temperature shift of 0°C - 50°C, up and down.
** Checked at room temperature against mercury thermometer with a least count of 0.1°C.

The following data concerns measurements. This data is valid when the board is used with the software provided at this site.

pH range 0 ÷ 14 pH
pH resolution 0.01 pH
pH inaccuracy * not more than 0.05 pH (temperature adjusted)
temperature resolution 0.1°C ( 0.1°F )

* Note: When using a good meter, as HomeLab-pH is, the inaccuracy of pH measurements will then be mainly affected by three factors: the quality of the pH-electrode, the precision of the calibration and the temperature difference between the measured sample and the calibration buffers. Here a general value for inaccuracy is given. It refers to measurements made with a good quality electrode, calibrated by a standard 2-point procedure. Also, the buffers inaccuracy is assumed to be not greater than 0.02 pH units and their temperature difference with the sample to be less than 5°C. If calibration buffers of ± 0.01 pH are used, the inaccuracy of the measured pH value will be even lower.

Where to Buy

box contents

You may purchase HomeLab-pH modules online at eBay or Tindie shops. It is recommended to purchase HomeLab-pH module together with isolator module.

Buy HomeLab-pH module

Purchase of a HomeLab-pH module alone includes:

If both a HomeLab-pH and an isolator module are purchased the following is included as well:

Buy the module at eBay in a bundle with HomeLab-Isol module

Buy at eBay the HomeLab-pH module alone

Buy at Tindie optionally complemented by:

Buy HomeLab-Isol module

box contents - pH

The HomeLab-Isol module comes with a mounting set (spacer/12 mm, screw/M2.5, nut).

Buy at eBay

Buy at Tindie

Accessories

Some optional accessories may not be available at the shop you are buying at. If you want one, please contact us. Do this before you make a module purchase, so we may put the accessory in the box with the purchase made at the shop. This would spare you some transport charges.

Stand for Raspberry Pi Zero.

shielded display Shielded display.

rainbow cable Rainbow cable.

splitter HomeLab Splitter boards.

Temperature sensor with longer cable (2.5 m).

Connect to ESP8266

HomeLab-pH module wired to Wemos D1 mini clone Wemos D1 mini connected to HomeLab-pH.

Wemos D1 mini and isolated HomeLab-pH via rainbow ribbon cable Wemos D1 mini connected to isolated HomeLab-pH via rainbow ribbon cable.

Wemos D1 mini and isolated HomeLab-pH via rainbow ribbon cable

HomeLab-pH module wired to NodeMCU Ver.3 NodeMCU Ver.3 connected to isolated HomeLab-pH via rainbow ribbon cable.

NodeMCU and HomeLab-pH

The wire colours in the images above correspond to the Rainbow cable colour coding for HomeLab-pH module.

NodeMCU and HomeLab-pH on a Raspberry Pi Zero Stand
HomeLab boards and NodeMCU module all mounted on a Raspberry Pi Zero Stand.

Connect to Raspberry Pi

CAUTIONAvoid to mount or dismount the HomeLab-pH board when powered. You risk to damage the meter. Always switch off the data processing unit in advance.

Mounting on Top of Raspberry Pi

HomeLab-pH mounted on RPi - front view HomeLab-pH and HomeLab-Isol mounted on RPi - front view
  1. Power OFF the Raspberry Pi.

    If an isolator module (HomeLab-Isol) is to be used as well, prepare it to be placed between the RPi and the HomeLab-pH module.HomeLab-Isol with spacers First screw tightly two of the shorter spacers through the module's mounting hole.

  2. RPi has 4 mounting holes. We need only the two of them located on the side opposite to the USB and LAN ports.HomeLab-pH spacers Fix the two supplied spacers using the screws provided and a screwdriver.

    HomeLab-pH and HomeLab-Isol spacersInstead, if a HomeLab-Isol module is prepared at point 1, mount it on the left-hand mounting hole of the RPi. Insert the pins of the first 5 rows of the RPi header into the module's JP1 female header. The longest spacer fix on the right-hand side mounting hole.

  3. Put RPi on a flat surface. With your thumbs and pointer fingers hold horizontally the HomeLab-pH board by its 4 edges so that its black socket points downwards.Holding HomeLab-pH (Try not to touch any of the soldered elements.) Lower down the board carefully so as to insert the first 5 rows of the RPi pins into the holes of the board's black socket. If the board is inserted correctly it will lie with its 2 mounting holes being just on top of the spacers.
  4. Place the remaining 2 screws through the board mounting holes and screw them into the spacers' holes. When finished check that the board is solidly mounted on the RPi.
  5. Insert the temperature sensor plug into the mini-DIN socket of the board. Please, do not apply excessive force and make sure the arrow mark on the plug is on top.
  6. Power on the Raspberry Pi. You should see the green light of the LED on the HomeLab-pH board. HomeLab-pH mounted - back view HomeLab-pH and HomeLab-Isol mounted - back view

HP-pH riding RPi ZeroMounting on Raspberry Pi Zero is even simpler as only one of the mounting holes is used. The coupling is stable despite the missing column on the far side of the pH-board.

Connecting throughout a rainbow cable

Connect to Arduino

There is a huge family of Arduino boards and their clones currently on sale. And while even some more are waiting for their next job in our drawers, most but not all controllers are suitable to read HomeLab-pH data. The meter and its companion software would meet those covering the following minimum spec:

These hardware requirements exclude from support the following Arduino boards (non-exhaustive list): Gemma, NG, Mini V3 & V4, Nano V2, Diecimila, Duemilanove (ATmega168), Fio, Esplora, Pro (3.3V).

Pictures of connected devices and diagrams of the wiring are shown below. Note that any set of 4 Arduino digital pins are suitable to connect the board's SDA, SCL, 1-wire and LED pins. The wirings shown in the diagrams are a good choice because 1.the pins are conveniently positioned for a ribbon cable connection and 2.their GPIO addresses are coded in our software (these can be altered if needed).

Wirings with a HomeLab-Isol digital isolator mounted in-between are shown separately as this module works at 5 V and requires an additional wire.

Click/tap on the images for a larger view.

CAUTION The following chapters are about wiring of Arduino controller to HomeLab-pH boards revisions 3 and 4. For previous revisions visit Rev.2 . The revision number is printed on the bottom side of the board.

Connecting Arduino to a board with no isolator

Click the images to see them larger.

HomeLab-pH connect to Arduino Nano diagram HomeLab-pH connected to Arduino Nano

HomeLab-pH pictured connected to Arduino Nano via its mail header. The scheme shows same wiring but from the bottom-side. This type of wiring is applicable for models Nano V3, Mini V05 and Micro.

HomeLab-pH connect to Arduino Uno-R3 diagram HomeLab-pH connected to Arduino Uno

Not isolated HomeLab-pH module may be connected by either of its two pin headers (the small picture top right). The image shows the module connected to an Arduino Uno by the topside male connector. The wiring scheme left show bottom side connection. The wiring is applicable also to models Mega, BT, Ethernet, Leonardo, Pro (5v) and Duemilanove (ATmega328).

HomeLab-pH connect to Arduino M0 diagram Arduino M0 pins to connect HomeLab-pH

The wiring scheme is applicable for models M0, Zero, Due and Tian. It is the quite the same as that for the Uno the only deference being module's VCC connected to Arduino 3.3 V power pin instead to 5 V.

Connecting Arduino to an isolated pH module

Note the additional wiring needed to supply 5V to the POWER pin of the HomeLab-Isol JP1 connector.

HomeLab-pH connected to Arduino Nano HomeLab-pH connected to Arduino Nano
Connecting HomeLab-pH to Arduino Nano.
HomeLab-pH connected to Arduino Nano HomeLab-pH connected to Arduino Uno
Connecting HomeLab-pH to Arduino Uno R3.
HomeLab-pH connect to Arduino M0 diagram Arduino M0 pins to connect HomeLab-pH
Connecting HomeLab-pH to Arduino M0.

CAUTION During the wiring be careful to switch off in advance the power of the controller. Pay particular attention to the HomeLab-pH power pins: GND and VCC. We recommend to connect the GND line before any other line is connected. The VCC pin should be connected to +3.3V or +5V depending on VccIO (VddIO) of the Arduino controller. Supplying voltage lower or higher than this can damage either the board or the controller. An error in wiring a digital line most probably will result only in bad communication which the software can detect.

Technical Description

This is a technical description of boards revisions 3 and 4. For earlier revisions see Rev.1.1 or Rev.2.

In this section we will give some details about the board. We hope they will be useful for those of you which intend to connect the board to a processing unit other than those supported by the software presented on this site.

Data from three sources is needed to calculate the pH value of a sample - the voltage generated by the pH-electrode, the temperature of the sample and board specific data available for retrieving from the on-board EEPROM chip. These data sources are shown on the functional block diagram below.

HomeLab-pH block diagram

The board has two sensor sockets - a BNC socket for the pH-electrode and a mini-DIN for the temperature sensor. The voltage coming from the pH-electrode is amplified and then digitized by an ADC chip. An outer processor board should read this data by setting properly the ADC chip and converting the readings to pH. As the pH values are temperature dependant some additional correction should be calculated according to the data coming from the temperature sensor.

Functional characteristics vary among the boards due to small differences between the elements used for the production. Although minute these differences do impact the final pH value when low inaccuracy of the measurement is the target. So the individual differences of each board are accounted for as we measure and put two coefficients in an on-board EEPROM chip.

Pins connectivity

In addition to pH and temperature sensor sockets the board has two input/output headers. Their pinouts generally follow the functional pattern of the Raspberry Pi header (P1). The scheme below shows how sockets and headers are interconnected.

HomeLab-pH pinout diagram

JP1 and JP2 headers

pin headers These are input/output headers of the board. Their pins are interconnected one-to-one. The difference is only physical, JP1 being female and JP2 - male header. JP1 is the input when the board is plugged onto Raspberry Pi header.

pin #1 The VCC pin. The board logic is powered through this pin from as low as 3.3 V (RPi, ESP8266) to up to 5 V (Arduino Uno).
pins #2, #4, #8 Not connected. The pins are cut short across JP1 and JP2. Although not connected to the circuit they may be utilized to transmit power or signal from the source board below the module to the eventually stacked one. This way 5 volts are supplied via pins #2 and #4 when the board rides Raspberry Pi or HomeLab-Isol module.
pins #3, #5 These are for the I2C data exchange with the board's ADC and EERPOM chips. They are used to read the output voltage of the pH-electrode.
pins #6, #9 Ground.
pin #7 This one is a part of the 1-wire data line to read a temperature sensor connected to the DIN6 socket.
pin #10 There are a button and a LED on board. The LED can be set ON/OFF through this pin. Additionally the button state may be read through it.

Temperature socket

The temperature sensor plugs is a MINI DIN6 socket. Its six pins are wired in a way to allow accommodation of different types of temperature sensors.

temperature 1-wire pinout pins #2, #4, #6
This scheme may be used to read 1-wire digital thermometers, pin #6 being the data pin. The sensor that comes with the module has its male plug wired according this type of scheme. This is the only type of temperature sensor currently supported by the software.
temperature i2c pinout pins #2, #4, #1, #3
To read I2C type of thermometers.
temperature NTC pinout pins #4, #5
NTC type of sensors may be read too. The board supports sensors with resistance in the range 20 to 200 KOhm. Pin #5 is connected to the on-board ADC to digitize the voltage from the chip.
temperature LM35 pinout pins #2, #4, #5
LM35 type of temperature sensor. To work properly connect pins #4 and #5 by a 180 Ohm resistor.

pH-Electrode Voltage Conversion

pH-electrode generated voltage is converted digitally by an ADC-chip. The digitalized voltage can be accessed by reading the output buffer of the chip. This can be done by means of I2C serial protocol. Note that the chip address is 0x49. The conversion data corresponds to differential voltage measurement between Ain0 and Ain1 channels. For detailed instructions how to get the data consult the ADS1015 data-sheet.

As stated above to achieve precise measurements the individual specifics of each HomeLab-pH board should be taken into account. We do it by measuring in the lab the board's offset and transmission. We then write the measured values in the on-board EEPROM memory. Using these values to correct the biased voltage reading from the sensor is a simple math:

voltage =
raw_voltage - offset transmission

where
voltage   is the value to be used in pH calculation and
raw_voltage   is the digitalized output voltage collected by reading the ADC chip buffer.

The module scheme and the board chips set are carefully considered and selected with the accuracy of measurement in mind. So our statistics points that almost 99% of the boards have offset = 0 and transmission = 1 (i.e.voltage = raw_voltage ). This, in practice, means that reading only the ADC buffer is sufficient. Nevertheless our software still reads the prestored EEPROM values of offset and transmission to apply the formula.

Contact us for further details.

Homelab Isolator Module

We developed the HomeLab-Isol module to assist the HomeLab-pH in giving stable and unaltered values when measuring pH in volumes with immersed electrical appliances. There the HomeLab-Isol effectively isolates both the power and the digital lines of the HomeLab-pH module. See its effectiveness in this video. The measurement was impacted by a pulse wave of 0.5Hz, 5V with 25% duty cycle.

HomeLab-Isol set HomeLab-Isol set

Isolated HomeLab-pH block schemeThis small board has a wider usage area. It is more generally applicable for isolation of data interfaces like I2C, 1-wire and SPI.

The module features 4 isolated bidirectional digital lines as well as an isolated power source. The lines are open-drain with 10K pull-up to VCC at the direct and at the isolated sides.

The module has input (JP1) and output (JP2) connectors placed opposite to each other on the direct and isolated sides respectively. Below are given the descriptions and the schemes of the connectors' pinout.

HomeLab-Isol. JP1 connector scheme. HomeLab-Isol. JP2 connector scheme.

Direct side Isolated side
HomeLab-Isol direct side HomeLab-Isol isolated side
VCC
range of +3 to +5 VDC
VCC-iso
+3.3 ± 0.1 VDC
if +5V is required as VCC, it is safe to shortcut this to 5V-iso
POWER (supply voltage)
+3.3 to +5.5 VDC
5V-iso
Depends on POWER (supply voltage) range:
in 5 - 5.5 V range: +5 ± 0.02 VDC;
in 3.3 - 5 V range: about 0.05 V below POWER (supply voltage).
IO1, IO2, IO3 and IO4
3 mA current sink capability
1000 kHz operation
with 10K pull-up to VCC
IO1-iso, IO2-iso, IO3-iso and IO4-iso
30 mA current sink capability
1000 kHz operation
with 10K pull-up to VCC-iso
Isolation power characteristics
Total output current VCC-iso + 5V-iso: 200 mA
Isolation voltage: 1000 VDC
Isolation resistance: 1000 MΩ (min)

Alternative input source for the IO4 line

As "standard" the IO4 digital line is sourced through pin 10 of the JP1 connector. This line however has an alternative input source as well. Next to JP1 there is a 2-pins header which normally is short-cut with a jumper. If an alternative to pin 10 is needed remove the jumper and connect the source as shown on the picture.

HomeLab-Isol direct side

Why this? Pin 10 is used by the HomeLab Raspberry Pi software for on-board button/LED management. However the corresponding pin of Raspberry Pi is dedicated also to serial connection. So this feature has been introduced since Rev 1.1 for applications which may need pin 10 free for other purposes.

Where to Buy HomeLab-Isol?

See here.

Rainbow Cable

This 10-wires colour coded ribbon cable is very convenient to connect HomeLab modules to a wide variety of computing units - Raspberry Pi, Arduino or ESP8266. The JP1 connector of the module is coupled to the IDC male 5x2 connector of the cable. At the other end of the cable each wire has its separate DuPont housing connector which allows for various combinations of pins to be coupled.

HomeLab-pH connected with rainbow cable Rainbow cable
Isolated HomeLab-pH connected with rainbow cable NON-isolated HomeLab-pH connected with rainbow cable

Rainbow Cable Set

Rainbow cable set. Rainbow cable with ruler.

The Rainbow Cable Set has

  • Rainbow Cable
  • Split Cable
  • 12mm M2.5 brass stand-off
  • hollow case for 5x1 Du-Pont connector
Arduino-Nano-rainbow-cable-connected The 2-wire split cable is applicable in connecting the HL-isolator VCC pin and POWER pin both to a single source. This is the case with Arduino Nano board which has only one 5V power pin available.

HomeLab Splitters

HomeLab Splitter direct insert - centre
Female-Centre
HomeLab Splitter
Female-Right
HomeLab Splitter cable connect
All-Male
HomeLab Splitter
dimensions

Female-Centre splitter

HomeLab Splitter direct insert - centre HomeLab Splitter direct insert - centre HomeLab Splitter direct insert - centre HomeLab Splitter direct insert - centre

Female-Right splitter

HomeLab Splitter direct insert - right HomeLab Splitter direct insert - right HomeLab Splitter direct insert - right HomeLab Splitter direct insert - right

All-Male splitter

HomeLab Splitter cable connect HomeLab Splitter cable connect HomeLab Splitter cable connect HomeLab Splitter cable connect

Stand for Raspberry Pi Zero

RPi stand front view

Assembling RPi Zero stand. Step 1.

A special stand is available if Raspberry Pi Zero is to be used as a computing unit. It helps holding close all the boards and comes with a cable to connect to RPi. The plates are acrylic while the pillars are from polyamide.

The set of stand elements was different before. Owners of the older set may check this page.

RPi stand elements

How to assemble the stand elements and mount the boards

The stand could be assembled by hand in five simple steps. No tools are needed though a screwdriver would be helpful. Pay attention when connecting the cable to the RPi pins header. Observe the colour of the cable wires to correspond to a picture shown below. Before starting peel off the protective layer that covers the acrylic plates.

Assembling RPi Zero stand. Step 1.
1 Stack the modules.
Assembling RPi Zero stand. Step 2.2 Mount the stacked modules and the pillars to the upper plate.
Assembling RPi Zero stand. Step 2.2 mounted
Assembling RPi Zero stand. Step 3.3 Mount the Raspberry Pi Zero on the lower plate.
Assembling RPi Zero stand. Step 4.4 Insert the cable Du-Pont connectors into the RPi header pins.
Assembling RPi Zero stand. Step 4.Observe the colour of the cable wires.
Assembling RPi Zero stand. Step 5.5 Insert the cable IDC connector into the module`s female header. Screw the pillar feets so to join the upper and lower plate assembles while inserting the side plate in between.
Assembling RPi Zero stand. Final.Stand assembled with all the boards.

Want to buy stand for Raspberri Pi Zero?

See here or contact us.