AnyLeaf

Lab-grade digital pH circuit

For Arduino, Raspberry Pi, embedded

Accurate

Easy to use

Affordable

Buy with pH probe for $60

Buy without probe for $25

Example uses: laboratory, hydroponics, aquarium, brewing

Available with or without included lab-grade pH probe. Connects directly to your device (eg Arduino, Raspberry Pi, or embedded) - no other parts required. Libraries and code samples are available for Python, Arduino/C++, and Rust. They provide easy setup, readings, and calibration. Or, go as low-level as you’d like.

The probe is a double-junction glass electrode, and is suitable for continuous immersion.

Beyond pH

Includes temperature compensation, with built in sensor. Can be used with other ion-selective electrodes, like potassium- or nitrate-selective electrodes, and Oxidation Reduction Potential (ORP) probes. The drivers have full support for the ORP functionality, including calibration.

This module can be used with any pH probe using a coaxial BNC connection. The I2C interface can send data to any microcontroler which supports this protocol.

Operating voltage: 2 - 5V

We provide high-level drivers to make it easy to get started

The drivers include Kalman filtering. This allows for accurate, stable measurements, even when paired with old or inexpensive sensors.

Fully tested on Arduino, Raspberry Pi, and STM32F3

Output pins are labeled on the board, as follows:

Arduino wiring

Raspberry Pi wiring

Installing drivers

Arduino: From the Arduino IDE: SketchInclude LibraryManage Libraries → select anyleaf

C++: Download Anyleaf.cpp and Anyleaf.h from the C++ Github link below, and place them in your project directory

Python: Run pip3 install anyleaf, and pip3 install filterpy

Rust: Add anyleaf="^0.1.6" to the dependencies section in Cargo.toml

Example code, and driver source

A miminal Arduino example

#include <Anyleaf.h>

PhSensor ph_sensor;

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

    ph_sensor = PhSensor();

    ph_sensor.calibrate_all(
        CalPt(0., 7., 25.), CalPt(0.18, 4., 25.)
    );
}

void loop(void) {
    Serial.print("pH: "); Serial.println(ph_sensor.read());

    delay(1000);
}

A miminal Raspberry Pi Python example

import time
import board
import busio
from anyleaf import PhSensor, CalPt, OnBoard

def main():
    i2c = busio.I2C(board.SCL, board.SDA)
    delay = 1  # Time between measurements, in seconds
    ph_sensor = PhSensor(i2c, delay)

    ph_sensor.calibrate_all(
        CalPt(0., 7., 25.), CalPt(0.18, 4., 25.)
    )

    while True:
        print(f"pH: {ph_sensor.read(OnBoard())}")

        time.sleep(delay)


if __name__ == "__main__":
    main()

Datasheet

Regular calibration is required for accurate measurements. The official drivers support 2 or 3 point calibration. 2 point is sufficient for hydroponics, aquarium, or brewing use. 3 points, or 2 carefully chosen points are required for sufficient accuracy for lab use.

Specifications:

Specifications pertaining to the pH probe only: