DO-110 עם Arduino, ESP32, Raspberry Pi ו-Python

איך מחברים את DO-110 חיישן חמצן מומס פלואורסצנטי (טיטניום) למיקרו-בקר או למחשב שלכם וקוראים ממנו ב-RS485 Modbus RTU. הטבלאות הן אלה שבדף הנתונים, ושתי דוגמאות הקוד מורצות מול מסגרת הדוגמה שבדף הנתונים לפני שהעמוד מתפרסם.

עמוד המוצר דף נתונים (PDF) דף נתונים (Markdown) סקיצת Arduino (.ino) סקריפט Python (.py)

DO-110 חיישן חמצן מומס פלואורסצנטי (טיטניום)

חיבור ה-DO-110

החיישן הוא התקן RS485, ולכן צריך משדר-מקלט בינו לבין הלוח שלכם. במחשב או ב-Raspberry Pi זה מתאם USB ל-RS485. במיקרו-בקר זה מודול מסוג MAX485 על יציאה טורית חומרתית. הזינו את החיישן מספק שנמצא בטווח המתח שבטבלה, וחברו את האדמה שלו לאדמה של המשדר-מקלט.

Wire Color Function Description
Black V- Power Ground (12-24V DC-)
Red V+ Power Supply (12-24V DC+)
Yellow/White RS485-A Data+
Green RS485-B Data-

Note: If your RS485 transceiver labels A/B opposite, swap the connections.

דוגמת Python (Raspberry Pi, Linux, macOS, Windows)

הסקריפט צריך רק את pyserial. הוא בונה בעצמו את בקשת ה-Modbus, בודק את ה-CRC של התשובה ומדפיס קריאה אחת כל חמש שניות. ב-Windows העבירו את יציאת ה-COM כארגומנט.

#!/usr/bin/env python3
"""Read the Agrinovo DO-110 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_110.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, 4)
    return {
        "dissolved_oxygen": struct.unpack("<f", data[0:4])[0],  # mg/L
        "temperature":      struct.unpack("<f", data[4:8])[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 (Uno, Mega, ESP32, ESP8266, MKR, Pico)

הסקיצה משתמשת בספריית Agrinovo: ב-Arduino IDE פתחו את Sketch > Include Library > Manage Libraries והתקינו את "Agrinovo". הספרייה בוחרת את היציאה הטורית לפי הלוח, והפינים רשומים בראש הקובץ AgrinovoDefaultPort.h. DE ו-RE של המשדר-מקלט מתחברים לפין יציאה אחד.

// Agrinovo DO-110 dissolved oxygen probe
// Prints dissolved oxygen and temperature every 5 seconds.
//
// Sensor cable
//   Red              supply +, 12-24 V DC
//   Black            supply ground, joined to the board's ground
//   Yellow or white  RS485 A
//   Green            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/do/do-110-titanium-probe/

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

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

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

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

void loop() {
  if (probe.read()) {
    Serial.print("Dissolved oxygen: ");
    Serial.print(probe.dissolvedOxygen(), 2);
    Serial.println(" mg/L");
    Serial.print("Temperature: ");
    Serial.print(probe.temperature(), 2);
    Serial.println(" °C");
  } else {
    Serial.println(probe.errorText());
  }
  delay(5000);
}

מה הדוגמאות קוראות

שתי הדוגמאות שולחות בקשה אחת, פונקציה 0x03, 4 רגיסטרים החל מ-0x0000, ומפענחות את הערכים האלה:

ערך יחידה רגיסטר קידוד
Dissolved oxygen mg/L 0x0000 float של 32 סיביות, הבית הפחות משמעותי ראשון
Temperature °C 0x0002 float של 32 סיביות, הבית הפחות משמעותי ראשון

כלי Modbus אחרים

אותה בקשה עובדת מכל מאסטר Modbus RTU: pymodbus, minimalmodbus, Node-RED, LabVIEW, בקר מתוכנת (PLC) או דאטה לוגר של צד שלישי עם יציאת Modbus. השתמשו בהגדרות התקשורת הטורית, בקוד הפונקציה ובכתובות הרגיסטרים שלמעלה.

איסוף נתונים בלי לכתוב קוד

בקר Omni Genesis קורא את ה-DO-110 ושולח את הקריאות לענן Agrinovo ברשת הסלולרית, ומשם אפשר לייצא אותן או לקרוא אותן דרך ה-API של הענן.

מתוך דף הנתונים

Specifications

Parameter Specification
DO Range 0 to 20 mg/L
Temperature Range 0 to 50°C
Protection Rating IP68
Supply Voltage 12-24 VDC

Compensation

Type Method
Temperature Automatic
Salinity Manual input (ppt)
Pressure Manual input (kPa)

Communication Settings

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

Register Map

Data Encoding

DO and Temperature values are float32 in little-endian byte order.

Measurement Registers (Function 0x03)

Address Registers Description
0x0000 4 DO (float32) + Temperature (float32)
0x000A 2 Production Serial Number
0x0010 1 Slave Address (via 0xFF request)
0x0011 2 Field Calibration Parameter
0x0062 1 Salinity (ppt, integer)

Configuration Registers (Function 0x10)

Address Description Notes
0x0010 Set Slave Address Range: 1 to 247
0x0011 Field Calibration Pressure in 0.01 kPa
0x0021 Cancel Field Calibration Write 0x1400
0x0062 Set Salinity Value in ppt

Reading Data

Read DO + Temperature (Float)

Read 4 registers from 0x0000:

Request:  01 03 00 00 00 04 44 09
Response: 01 03 08 48 E1 0A 41 F6 28 B4 41 59 5A

Decoding (Little-endian float32):

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

Address Configuration

Read Current Address (Using 0xFF)

Request:  FF 03 00 10 00 01 90 11
Response: FF 03 02 03 00 91 60

Response shows current address = 0x03

Set New Address

Write to 0x0010 using function 0x10:

01 10 00 10 00 01 02 14 00 AB C0

Calibration

Field Calibration (Pressure)

Place probe in air-saturated DO, wait for stability. Write pressure to 0x0011.

Pressure: kPa × 100 (e.g., 101.33 kPa = 10133 = 0x2795)

01 10 00 11 00 01 02 95 27 8A 5B

Cancel Field Calibration

Write 0x1400 to register 0x0021:

01 10 00 21 00 01 02 14 00 AF E1

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.

שאלות על החיווט או על הפרוטוקול?

ספרו לנו באיזה לוח או דאטה לוגר אתם משתמשים ומה צריך למדוד.