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

How to wire the DO-100 Fluorescent Dissolved Oxygen 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)

DO-100 Fluorescent Dissolved Oxygen Sensor

Connecting the DO-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 (12-24V DC)
Black GND Power Ground
Yellow RS485-A Data+
Green RS485-B Data-

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 DO-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 do_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 probe'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"probe returned Modbus error {reply[2]}")
    if len(reply) != 5 + 2 * count or crc16(reply[:-2]) != reply[-2:]:
        raise IOError("no valid reply from the probe")
    return reply[3:-2]


def read_probe(port):
    data = read_registers(port, ADDRESS, 0x03, 0x0000, 4)
    return {
        "do_mg_l":       struct.unpack(">H", data[0:2])[0] / 10 ** struct.unpack(">H", data[2:4])[0],
        "temperature_c": struct.unpack(">H", data[4:6])[0] / 10 ** struct.unpack(">H", data[6:8])[0],
    }


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 (ESP32, Mega and other boards with a second serial port)

The sketch uses no library. On an ESP32 it uses Serial2 on the pins set at the top; on AVR boards it uses Serial1. DE and RE of the transceiver go to one output pin.

// Agrinovo DO-100 over RS485 Modbus RTU.
// For a board with a spare hardware serial port (ESP32, Mega, Leonardo, Due)
// and a MAX485-type transceiver. Power the probe from its own supply, as the
// wiring table says, and join the grounds.

const uint8_t ADDRESS = 0x01;  // the probe's Modbus address
const int DE_PIN = 4;          // transceiver DE and RE tied together
const int RX_PIN = 16;         // ESP32 only
const int TX_PIN = 17;         // ESP32 only

#if defined(ESP32)
#define RS485 Serial2
#else
#define RS485 Serial1
#endif

uint16_t crc16(const uint8_t *frame, size_t length) {
  uint16_t crc = 0xFFFF;
  for (size_t i = 0; i < length; i++) {
    crc ^= frame[i];
    for (int bit = 0; bit < 8; bit++) {
      crc = (crc & 1) ? (crc >> 1) ^ 0xA001 : crc >> 1;
    }
  }
  return crc;
}

uint16_t word16(const uint8_t *b) {
  return ((uint16_t)b[0] << 8) | b[1];
}

// Reads `count` registers into `data`. Returns false when the probe does not
// answer or the checksum is wrong.
bool readRegisters(uint8_t function, uint16_t start, uint16_t count, uint8_t *data) {
  uint8_t request[8] = {ADDRESS, function, (uint8_t)(start >> 8), (uint8_t)start,
                        (uint8_t)(count >> 8), (uint8_t)count, 0, 0};
  uint16_t crc = crc16(request, 6);
  request[6] = crc & 0xFF;
  request[7] = crc >> 8;

  while (RS485.available()) RS485.read();
  digitalWrite(DE_PIN, HIGH);
  RS485.write(request, 8);
  RS485.flush();
  digitalWrite(DE_PIN, LOW);

  uint8_t reply[5 + 2 * 16];
  size_t expected = 5 + 2 * count;
  if (RS485.readBytes(reply, expected) != expected) return false;
  uint16_t received = reply[expected - 2] | ((uint16_t)reply[expected - 1] << 8);
  if (reply[1] != function || crc16(reply, expected - 2) != received) return false;
  memcpy(data, reply + 3, 2 * count);
  return true;
}

void setup() {
  Serial.begin(115200);
  pinMode(DE_PIN, OUTPUT);
  digitalWrite(DE_PIN, LOW);
#if defined(ESP32)
  RS485.begin(9600, SERIAL_8N1, RX_PIN, TX_PIN);
#else
  RS485.begin(9600);
#endif
  RS485.setTimeout(1000);
}

void loop() {
  uint8_t data[2 * 4];
  if (!readRegisters(0x03, 0x0000, 4, data)) {
    Serial.println("no reply");
    delay(5000);
    return;
  }
  Serial.print("do_mg_l=");
  Serial.print(word16(data + 0) / pow(10, word16(data + 2)), 2);
  Serial.print(" temperature_c=");
  Serial.print(word16(data + 4) / pow(10, word16(data + 6)), 2);
  Serial.println();
  delay(5000);
}

What the examples read

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

Value Unit Register Encoding
do_mg_l mg/L 0x0000 16-bit integer, followed by a register holding the number of decimals
temperature_c °C 0x0002 16-bit integer, followed by a register holding the number of decimals

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 DO-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
DO Range 0 to 20 mg/L
Saturation Range 0 to 200%
Temperature Range 0 to 50°C
Accuracy ±2% of range
Repeatability ±1%
Response Time (t90) ~60 seconds
Protection Rating IP68

Compensation

Type Method
Temperature Automatic
Pressure Manual input (default: 101.3 kPa)
Salinity PSU input (optional)

Electrical Characteristics

Parameter Specification
Supply Voltage 12-24 VDC
Power Consumption ≤0.5W
Operating Temp 0 to 50°C
Operating Humidity ≤85% RH

Communication Settings

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

CRC16: Standard Modbus (polynomial 0xA001, init 0xFFFF), low byte first.

Register Map

Measurement Registers (Function 0x03)

Address Description Data Type Scaling
0x0000 DO + Temp (Integer) 4 × int16 See decoding
0x0004 DO Saturation (Integer) 2 × int16 See decoding
0x0006 DO + Temp (Float) 2 × float32 Big-endian
0x000A DO Saturation (Float) float32 Big-endian

Configuration Registers (Function 0x06)

Address Description Range/Notes
0x1000 Zero Calibration Write 0 to auto-calc
0x1004 Slope Calibration Write 0 to auto-calc
0x1008 Zero Offset (Manual) Value × 1000 (signed)
0x1009 Slope (Manual) Value × 1000
0x1020 Salinity Compensation PSU × 10 (0 to 500)
0x2002 Slave Address 1 to 127
0x2064 Atmospheric Pressure kPa × 100

Reading Data

Read 4 registers from 0x0000:

Request:  01 03 00 00 00 04 44 09
Response: 01 03 08 03 64 00 02 08 CC 00 02 CA 5A
Register Hex Decimal Decimals Result
DO Value 0x0364 868 2 8.68 mg/L
Temp Value 0x08CC 2252 2 22.52°C

Formula: Value = Raw / (10 ^ Decimals)

Float Mode

Read 4 registers from 0x0006 (big-endian float32):

Value Bytes Result
DO 41 0A E1 48 8.68 mg/L
Temperature 41 B4 28 F6 22.52°C

Calibration

Zero Calibration (Auto)

Place probe in zero-oxygen water, wait for stability:

01 06 10 00 00 00 8D 0A

Slope Calibration (Auto)

Place probe in air-saturated DO environment:

01 06 10 04 00 00 CC CB

Address Configuration

Read Current Address (Broadcast 0xFF)

Use 0xFF as address, read register 0x2002:

Request:  FF 03 20 02 00 01 3B D4
Response: FF 03 02 00 03 D1 91

Response data 00 03 = current address is 0x03.

Set New Address

Write to register 0x2002 (function 0x06). Example: change from 0x01 to 0x19:

Request:  01 06 20 02 00 19 E2 00
Response: 01 06 20 02 00 19 E2 00

Power cycle sensor after address change.

Maintenance

  • Calibration interval depends on the water type and the amount of biofouling and algae. Under normal conditions, calibrate every 6-8 months.
  • Clean the membrane cap regularly between calibrations.
  • The membrane cap is replaceable, typically after 2+ years of use.

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.