HOMELAB-pH

The HomeLab-pH is a circuit board for pH measurements. It is used in tandem with a Raspberry Pi mini-computer or an Arduino controller.

HomeLab-pH front view HomeLab-pH front 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 or as an expansion board to a Raspberry Pi (RPi) or compatible mini-computer.

HomeLab-pH back view with smartphone displaying user interface. HomeLab-pH connected with ribbon cable to a powered Arduino Nano

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.

Aquarium owners or hydroponics enthusiasts interested in on-line pH-measurement may check the added functionality by our HomeLab isolator module. When used with the HomeLab-pH module it filters the interfering currents originating from immersed pumps and temperature regulators.

For reading, controlling and calibrating the pH module we prepared various software packages to be used with Arduino controller or with Raspberry Pi and its compatibles. Evidently the packages are somewhat different in their capabilities.

Specification

This is a specification of board revision 2. For earlier revisions see here.

Board

input voltage range -1500 mV ÷ 1500 mV
supply voltage 5 V
GPIO voltage (VCC) 3.3 to 5 V
max. supply current 25 mA
working temperature range 0 ÷ 50°C (32 ÷ 122°F)
working relative humidity range up to 90 % (non-condensing)
dimensions, W:H:D 56 : 23 : 20 mm,
(2.20 : 0.91 : 0.79 in)

Digital conversion inaccuracy of the input voltage (pH sensor voltage)

input voltage range inaccuracy
-1500 ÷ -1024 mV less than 1.00 mV
-1024 ÷ -512 mV less than 0.50 mV
-512 ÷ -256 mV less than 0.25 mV
-256 ÷ 256 mV less than 0.13 mV
256 ÷ 512 mV less than 0.25 mV
512 ÷ 1024 mV less than 0.50 mV
1024 ÷ 1500 mV less than 1.00 mV

Temperature sensor

response time at 90% max 25 s (typical 15 s, water, stirred)
inaccuracy not more than 0.5°C ( 0.9°F )
working range 0 ÷ 80°C (32 ÷ 176°F)
tip diameter ø 6 mm
cable length about 1 m ( 3'3" )

The following data concerns measurements. This data is valid when the board is used with the software provided at our 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 as low as 0.03 pH.

Mounting on Top of a Raspberry Pi Mini-computer

HomeLab-pH mounted on RPi - back view HomeLab-pH mounted on RPi - front view

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.

Please, follow strictly the directions below.

  1. Power OFF the Raspberry Pi.
  2. RPi has 4 mounting holes.HomeLab-pH spacers We use only two of them to mount the HomeLab-pH board. Fix the two supplied spacers to the RPi board mounting holes located on the side opposite to its USB and LAN ports. To do this use the screws provided and a screwdriver.
  3. Put RPi on a flat surface.
  4. 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 (see 2).
  5. 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.
  6. 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.
  7. HomeLab-pH mounted - back view HomeLab-pH mounted - top viewPower on the Raspberry Pi. You should see the green light of the LED on the HomeLab-pH board.

Connecting to an Arduino Controller

This chapter is about wiring HomeLab-pH board revision 2 to Arduino controller. The previous, 1.1, revision of the board would work with a limited set of Arduinos like M0, Zero, Due or Tian.

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).

Our Arduino software to control the HomeLab-pH board is free to download and use. Flash the software into the controller's memory in Arduino IDE environment. This IDE is also free and can be downloaded from their site.

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).

Wiring type A1

The A1 type wiring is applicable for models Uno, Uno WiFi, Mega, Mega 2560, Mega ADK, BT, Ethernet, Leonardo, Leonardo ETH, Pro (5v) and Duemilanove (ATmega328).

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

Wiring type A2

The A2 type wiring is applicable for models Nano V3, Mini V05 and Micro.

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

Wiring type B1

The B1 type wiring is suitable for models M0, M0 Pro, Zero, Zero Pro, Due and Tian. This is the only type of wiring applicable for HomeLab-pH board rev.1.1 (the VCC connection there is redundant as pin #1 is not connected).

HomeLab-pH connect to Arduino M0 diagram Arduino M0 pins to connect HomeLab-pH
Wiring type B1.

CAUTION During the wiring be careful to switch off in advance the power of the controller. Pay particular attention to the power pins: GND, Vcc and +5V. 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 board revision 2. For earlier revisions see here.

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 two board specific coefficients 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 digitalized 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. So the individual differences of each board are accounted for by two coefficients written in the EEPROM chip.

Pinout

The pinout scheme of the header to couple the CPU board is shown below. 2 of the 10 pins are not connected (NC). The rest follow the pins pattern of the Raspberry Pi header (P1).

HomeLab-pH pinout diagram

pin #1 The VCC pin. The board logic can be powered from as low as 3.3 V (RPi) to up to 5 V (Arduino Uno).
pin #2 This is the power supply pin. The board is powered with 5V DC.
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.
pin #7 This one is for reading the digital temperature sensor by means of 1-wire protocol.
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 can be read.

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 for precise measurements the individual HomeLab-pH board specifics should be taken into account. This is possible by applying simple formula to the digitalized output voltage.

voltage =
raw_voltage - offset transmission

where
voltage   is the value to be used in pH calculation,
raw_voltage   is the output voltage collected by reading the ADC chip buffer and
offset and transmission   are coefficients.

We measured the offset and transmission of each board and put the values in the on-board EEPROM memory. They may be accessed by means of the I2C protocol. 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.

HomeLab-Isol set HomeLab-Isol sides view

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 (supply voltage)
POWER (supply voltage)
+5 VDC
5V-iso (supply voltage)
+5 ± 0.2 VDC
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.