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

Quickstart: EC Measurements

The following is a step-by-step tutorial on taking an EC measurement with the μFire Isolated EC Probe Interface.

Hardware Setup

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

The EC 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 EC Probe Interface and press the install button.

Arduino IDE Library Install

Getting Something to Measure

The sensor has been developed for use in hydroponic systems. The range is approximately 0.5 - 20 mS/cm. Tap water is (hopefully) well under 0.5 mS/cm, so it will not be measurable, -1 will be displayed, indicating an error. Adding some salt to tap water is the simplest way to see actual measurements. The more salt, the higher the measurement.

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_EC.h>
uFire_EC ec;

void setup()

void loop()
  // `measureEC()` tells the sensor to take a reading

  // the measurement is held in a public class variable called mS
  Serial.print((String)"mS/cm: " + ec.mS);
Adding Temperature Compensation

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

ec.measureEC(); to ec.measureEC(ec.measureTemp());

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

The sensor is configured by default to adjust the measurements to 25 C.


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 hydroponic applications, measuring somewhere in the range of 0.7 to 2.0 mS/cm is appropriate. Some plants might go significantly higher than 2.0 mS/cm like tomatoes, so choose something appropriate for the range of expected measurements.

BioPharm makes quality NIST traceable calibration solutions. This article will use their 0.7 and 2.0 mS/cm 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 EC 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 ec.
  5. Call calibrateProbeLow to perform the low calibration by typing low 0.7.
  6. Repeat steps 3 - 4 for the high solution, then calling calibrateProbeHigh by typing high 2.0.
  7. The device will automatically begin to use the calibration data once the high and low points are determined.
Common Problems
  1. -1 as a return value indicates there was an error in the measurement. It nearly always means the measurement is out of range. Other causes might be incorrect wiring.
Going Further

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


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