CLO2-100 with Arduino, ESP32, Raspberry Pi and Python

How to wire the ClO2-100 Chlorine Dioxide Sensor to your own microcontroller or computer and read it over RS485 Modbus RTU. The tables are the ones in the datasheet, and both code examples are run against the datasheet example frame before this page is published.

Product page Datasheet (PDF) Datasheet (Markdown) Arduino sketch (.ino) Python script (.py)

ClO2-100 Chlorine Dioxide Sensor

Connecting the CLO2-100

The probe is an RS485 device, so it needs a transceiver between it and your board. On a computer or a Raspberry Pi that is a USB to RS485 adapter. On a microcontroller it is a MAX485-type module on a hardware serial port. Power the probe from a supply within the voltage range in the table and join its ground to the ground of the transceiver.

Wire Color Function Description
Red V+ Power Supply (9-27V DC)
Black GND Power Ground
Green RS485-A Data+ (T/R+)
White RS485-B Data- (T/R-)

Python example (Raspberry Pi, Linux, macOS, Windows)

The script needs only pyserial. It builds the Modbus request itself, checks the CRC of the reply and prints one reading every five seconds. On Windows pass the COM port as the argument.

#!/usr/bin/env python3
"""Read the Agrinovo CLO2-100 over RS485 Modbus RTU.

Works on a Raspberry Pi or any computer with a USB to RS485 adapter.
Install the serial library once:  pip install pyserial
Run:  python3 clo2_100.py /dev/ttyUSB0
"""
import struct
import sys
import time

import serial

PORT = sys.argv[1] if len(sys.argv) > 1 else "/dev/ttyUSB0"
ADDRESS = 0x01  # the sensor's Modbus address


def crc16(frame: bytes) -> bytes:
    crc = 0xFFFF
    for byte in frame:
        crc ^= byte
        for _ in range(8):
            crc = (crc >> 1) ^ 0xA001 if crc & 1 else crc >> 1
    return struct.pack("<H", crc)


def read_registers(port, address, function, start, count):
    request = struct.pack(">BBHH", address, function, start, count)
    port.reset_input_buffer()
    port.write(request + crc16(request))
    reply = port.read(5 + 2 * count)
    if len(reply) >= 5 and reply[1] == function | 0x80:
        raise IOError(f"sensor returned Modbus error {reply[2]}")
    if len(reply) != 5 + 2 * count or crc16(reply[:-2]) != reply[-2:]:
        raise IOError("no valid reply from the sensor")
    return reply[3:-2]


def read_probe(port):
    data = read_registers(port, ADDRESS, 0x03, 0x0000, 10)
    return {
        "chlorine_dioxide": struct.unpack(">f", data[2:4] + data[0:2])[0],  # mg/L
        "electrode_signal": struct.unpack(">f", data[10:12] + data[8:10])[0],  # mV
        "temperature":      struct.unpack(">f", data[18:20] + data[16:18])[0],  # °C
    }


if __name__ == "__main__":
    with serial.Serial(PORT, 9600, bytesize=8, parity="N", stopbits=1, timeout=1) as port:
        while True:
            print(read_probe(port))
            time.sleep(5)

Arduino example (Uno, Mega, ESP32, ESP8266, MKR, Pico)

The sketch uses the Agrinovo library: in the Arduino IDE open Sketch > Include Library > Manage Libraries and install "Agrinovo". The library picks the serial port for your board, and the pins are listed at the top of AgrinovoDefaultPort.h. DE and RE of the transceiver go to one output pin.

// Agrinovo CLO2-100 chlorine dioxide probe
// Prints chlorine dioxide, electrode signal and temperature every 5 seconds.
//
// Sensor cable
//   Red    supply +, 9-27 V DC
//   Black  supply ground, joined to the board's ground
//   Green  RS485 A
//   White  RS485 B
//
// The board talks to the sensor through an RS485 transceiver (MAX485 or
// similar). AgrinovoDefaultPort.h lists the serial pins used on each board.
//
// https://agrinovo.io/products/sensors/aqua/ion-selective/cl02-100-chloride-dioxide-probe/

#include <Agrinovo.h>
#include <AgrinovoDefaultPort.h>

const int DE_PIN = 4;  // transceiver DE and RE, tied together

AgrinovoBus bus(AGRINOVO_PORT, DE_PIN);
AgrinovoCLO2100 probe(bus);  // Modbus address 1

void setup() {
  Serial.begin(115200);
  agrinovoPortBegin(9600);
  bus.begin();
}

void loop() {
  if (probe.read()) {
    Serial.print("Chlorine dioxide: ");
    Serial.print(probe.chlorineDioxide(), 2);
    Serial.println(" mg/L");
    Serial.print("Electrode signal: ");
    Serial.print(probe.electrodeSignal(), 2);
    Serial.println(" mV");
    Serial.print("Temperature: ");
    Serial.print(probe.temperature(), 1);
    Serial.println(" °C");
  } else {
    Serial.println(probe.errorText());
  }
  delay(5000);
}

What the examples read

Both examples send one request, function 0x03, 10 registers from 0x0000, and decode these values:

Value Unit Register Encoding
Chlorine dioxide mg/L 0x0000 32-bit float in two registers, low word first
Electrode signal mV 0x0004 32-bit float in two registers, low word first
Temperature °C 0x0008 32-bit float in two registers, low word first

Other Modbus tools

The same request works from any Modbus RTU master: pymodbus, minimalmodbus, Node-RED, LabVIEW, a PLC or a third-party data logger with a Modbus port. Use the serial settings, function code and register addresses above.

Logging without writing code

The Omni Genesis controller reads the CLO2-100 and sends the readings to the Agrinovo cloud over the cellular network, where they can be exported or read through the cloud API.

Datasheet reference

Specifications

Parameter Specification
Measurement Principle Electrochemical electrode
Chlorine Dioxide Range 0.00-20.00 mg/L
Resolution 0.01 mg/L
Accuracy ±0.1 mg/L
Temperature Range -10.0 to 110.0 °C
Temperature Resolution 0.1 °C
Temperature Accuracy ±0.5 °C
Temperature Element TH10K thermistor
Temperature Compensation Automatic / Manual
Communication RS485, Modbus-RTU
Isolation 2500 Vrms
Supply Voltage 9-27 VDC
Power Consumption ≤0.5W
Housing Material PPS
Mounting Thread M20×1.5 or G3/4

Communication Settings

Parameter Value
Protocol Modbus-RTU
Baud Rate 9600 bps (configurable)
Data Bits 8
Parity None
Stop Bits 1
Default Address 0x01

Supported baud rates: 1200, 2400, 4800, 9600, 19200 bps.

Register Map

Measurement values are available in two formats. Function 0x03 returns IEEE-754 float32 (each value spans 2 registers, transmitted low word first). Function 0x04 returns scaled 16-bit integers, each followed by a register carrying the decimal places and unit code.

Measurement Registers (Function 0x03 / 0x04 read)

Address Description Range Data Type
0x0000-0x0001 Chlorine Dioxide (ClO₂) 0.00-20.00 mg/L Float32
0x0004-0x0005 Electrode Signal -10.00 to 40.00 mV Float32
0x0008-0x0009 Temperature -10.0 to 110.0 °C Float32

Configuration Registers (Function 0x03 read / 0x06 write)

Address Description Default Range / Notes
0x0019 Calibration Status Not calibrated Bit0 = zero point, Bit1 = slope point
0x001A Electrode Offset 0.00 mg/L ±0.30 mg/L (value ×100)
0x001C Electrode Slope 100.0% 30.0-300.0% (value ×10)
0x001E Device Address 1 1-247 (255 = broadcast)
0x001F Baud Rate Code 3 (9600) 0=1200, 1=2400, 2=4800, 3=9600, 4=19200
0x0020 Temp Compensation Type 1 (auto) 0 = manual, 1 = automatic
0x0021 Temp Setpoint / Offset 25.0 °C / 0.0 °C value ×10 (see note)
0x0023 pH Compensation Switch 1 (on) 0 = off, 1 = on
0x0024 pH Compensation Value 4.00 pH 0.00-14.00 pH (value ×100)
0x002D Filter Coefficient - 1-16

Register 0x0021 holds the manual temperature setpoint when 0x0020 = manual, or the temperature offset when 0x0020 = automatic. Example: a stored value of 250 means 25.0 °C; to set 10.0 °C write 100 (0x0064).

Information Registers (Function 0x03 read, 0x06 write where applicable)

Address Description Notes
0x0040 Work Mode 0x10 = measure, 0x50 = setting, 0x60 = calibration
0x0041 Mode Parameter Mode-specific
0x0043 Calibration Control / Status Write standard value to calibrate (see Section 8)
0x0046 Software Version Read only
0x0047 Hardware Version Read only
0x0048-0x0049 Serial Number Read only

Reading Data

Read Chlorine Dioxide value (Float32 from 0x0000-0x0001)

Read 2 registers starting at 0x0000:

Request:  01 03 00 00 00 02 C4 0B
Response: 01 03 04 E7 2F 41 1F 8C D6

Decoding (word-swap example):

Received bytes E7 2F 41 1F → reorder the two 16-bit words to 41 1F E7 2F → IEEE-754 float = 9.99 mg/L

Read all measurement values

Read 10 registers from 0x0000:

Request:  01 03 00 00 00 0A C5 CD

Returns Chlorine Dioxide, Electrode Signal, and Temperature as float32 values.

Integer format (Function 0x04)

Function 0x04 returns each value as a scaled integer followed by its decimal/unit register. For example, a value of 998 with 2 decimal places represents 9.98 mg/L; a temperature value of 250 with 1 decimal place represents 25.0 °C.

Address and Baud Rate Configuration

Change Address (0x01 → 0x02)

Write the new address to register 0x001E:

01 06 00 1E 00 02 68 0D

Change Baud Rate (to 2400)

Write the baud rate code to register 0x001F:

01 06 00 1F 00 01 79 CC

Broadcast Discovery

Use address 0xFF (255) with only one device connected.

Calibration

The sensor supports two-point calibration: a slope point and a zero point. Standard solutions are used to calibrate a newly installed sensor or to re-calibrate periodically. Calibration is performed by writing to the calibration control register 0x0043 with function 0x06.

Procedure

  1. Immerse the electrode in the standard solution.
  2. Wait for the reading to stabilize.
  3. Write the calibration command to register 0x0043.
  4. Read register 0x0043 to check the result:
    • 0 = calibration successful (returned to measure mode)
    • 1 = calibrating (re-read status shortly)
    • 2 = no valid standard value received within 180s
    • 3 = signal could not stabilize or value out of range within 180s
    • 4 = electrode performance (slope or offset) out of allowed range
  5. Repeat for the second point.

Slope Point

Write the standard solution value as an integer scaled ×100. For a 5.00 mg/L standard, write 500 (0x01F4):

01 06 00 43 01 F4 78 09

Zero Point

Write the zero point code 0x0001:

01 06 00 43 00 01 B9 DE

Clear Calibration

Write 0x7FFF to register 0x0043 to clear all calibration data:

01 06 00 43 7F FF 18 6E

Factory Reset

A factory reset clears calibration data and restores temperature compensation settings to default. It requires two commands.

Enter Setting Mode

Write 0x0050 to the work mode register 0x0040:

01 06 00 40 00 50 88 22

Send Reset Command

Write 0x7FFF to the mode parameter register 0x0041:

01 06 00 41 7F FF B9 AE

The sensor restores defaults and restarts.

Revision History

Rev Date Changes
1.0 June 2026 Initial release
1.1 August 2026 Layout revision
1.2 October 2026 New layout

Contact

Agrinovo, https://agrinovo.io/products, [email protected], +972 54 688 8148 (direct / WhatsApp). Specifications subject to change without notice.

Questions about wiring or the protocol?

Tell us which board or logger you are using and what you need to measure.