Measure pH, ORP, EC or salinity with an Arduino or Raspberry Pi

Quickstart: pH Measurements

The following is a step-by-step tutorial on taking a pH measurement with the μFire Isolated ISE Probe Interface for pH. Keep in mind that the sensor can read a pH probe, but it can also use a variety of other probes such as an ORP probe, chloride, or any other Ion Selective Electrode.

Hardware Setup

The sensor has three connections: the pH probe, the temperature sensor, and the I2C connections. pH Connections

The pH probe simply connects by sliding the probe's female BNC connector onto the sensor's male BNC connector and turning it until it locks into place.

The temperature sensor connects to the sensor by a small JST connector. It can only be inserted one way. It isn't required to be attached for the sensor to operate. If another source of temperature is available, that can be used instead.

The I2C connections are the standard GND/VCC/SDA/SCL wires. The easiest method is to use the included Qwiic wires:
Black = GND
Red = 3.3 / 5 V
Blue = SDA
Yellow = SCL

Connect the wires to the appropriate pins of your microcontroller. Even better if your microcontroller has a Qwiic connector.

Everything connected

Software Setup

All μFire sensors have Arduino libraries available for use.

In the Arduino IDE go to the library manager (Sketch / Include Library / Manage Libraries…) and search for Isolated ISE Probe Interface and press the install button.

Arduino IDE Library Install

The Simplest Code

Paste the code below into the Arduino IDE to verify everything is connected and functioning properly.

// include library's header file and declare a new instance
 #include <uFire_pH.h>
uFire_pH ph;

void setup()
{   
  Serial.begin(9600);
}

void loop()
{
  // `measurepH()` tells the sensor to take a reading
  ph.measurepH();

  // the measurement is held in a public class variable called pH
  Serial.print((String)"pH: " + ph.pH);
  delay(1000);
}
Adding Temperature Compensation

If the temperature sensor is attached, it's as simple as changing one line from the above code:

ph.measurepH(); to ph.measurepH(ph.measureTemp());

Keep in mind that for pH, temperature compensation is difficult to approximate. The adjustment is generally very minor and also generally can't be accurately compensated for without prior knowledge of how the specific substances to be measured react to temperature changes.

If the temperature sensor isn't attached, pass the temperature as a float value ph.measurepH(23.2);.

Calibration

To take accurate measurements, calibration is required. This article will use dual-point calibration, but a single-point calibration is available as well.

First, determine what range to measure between, the dual-points. For hydroponics, nearly all plants prefer something below a pH of 7.0. The most common pH calibration solutions are 4.0, 7.0, and 10.0, so choosing 4.0 and 7.0 as the two points is most appropriate.

BioPharm makes quality NIST traceable calibration solutions. This article will use their 4.0 and 7.0 solutions, available on Amazon.

To simplify the process, use the Shell example. It provides a REPL-like interface that allows commands to be entered into the serial terminal.

Now follow these steps:

  1. Upload the Shell example to the microcontroller: File / Examples / Isolated ISE Probe Interface / Shell.
  2. Type r to reset the device to remove any previous calibration data.
  3. Submerge the probe in the low calibration solution.
  4. Observe the values and wait for them to stabilize by typing ph. It may take a minute or more to stabilize. Don't agitate the probe by creating air bubbles in the solution, since the solution will begin to interact with the air and change.
  5. Call calibrateProbeLow to perform the low calibration by typing low 4.0.
  6. Repeat steps 3 - 4 for the high solution, then calling calibrateProbeHigh by typing high 7.0.
  7. The device will automatically begin to use the calibration data once the high and low points are determined.
Going Further

The documentation has a section about most anything possible with the device.

Questions

Don't be confused alone. If you have any questions, send an email to [email protected].