ORP-100 con Arduino, ESP32, Raspberry Pi y Python

Cómo conectar ORP-100 Sonda digital de ORP - RS485, compensación automática de temperatura a su propio microcontrolador o computadora y obtener lecturas por RS485 Modbus RTU. Las tablas son las de la ficha técnica, y los dos ejemplos de código se ejecutan contra la trama de ejemplo de la ficha técnica antes de publicar esta página.

Página del producto Ficha técnica (PDF) Ficha técnica (Markdown) Sketch de Arduino (.ino) Script de Python (.py)

ORP-100 Sonda digital de ORP - RS485, compensación automática de temperatura

Conexión de ORP-100

La sonda es un dispositivo RS485, por lo que necesita un transceptor entre ella y su placa. En una computadora o una Raspberry Pi es un adaptador USB a RS485. En un microcontrolador es un módulo tipo MAX485 en un puerto serial por hardware. Alimente la sonda con una fuente dentro del rango de tensión de la tabla y conecte su tierra a la tierra del transceptor.

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

Ejemplo en Python (Raspberry Pi, Linux, macOS, Windows)

El script solo necesita pyserial. Arma la solicitud Modbus por sí mismo, verifica el CRC de la respuesta e imprime una lectura cada cinco segundos. En Windows, pase el puerto COM como argumento.

#!/usr/bin/env python3
"""Read the Agrinovo ORP-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 orp_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, 1)
    return {
        "orp": struct.unpack(">h", data[0:2])[0],  # mV
    }


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)

Ejemplo para Arduino (Uno, Mega, ESP32, ESP8266, MKR, Pico)

El sketch usa la biblioteca Agrinovo: en el Arduino IDE abra Sketch > Include Library > Manage Libraries e instale "Agrinovo". La biblioteca elige el puerto serial según la placa, y los pines están al inicio de AgrinovoDefaultPort.h. DE y RE del transceptor van a un mismo pin de salida.

// Agrinovo ORP-100 ORP probe
// Prints ORP every 5 seconds.
//
// Sensor cable
//   Red     supply +, 12-24 V DC
//   Black   supply ground, joined to the board's ground
//   Yellow  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/orp/orp-100-probe/

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

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

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

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

void loop() {
  if (probe.read()) {
    Serial.print("ORP: ");
    Serial.print(probe.orp(), 0);
    Serial.println(" mV");
  } else {
    Serial.println(probe.errorText());
  }
  delay(5000);
}

Qué leen los ejemplos

Ambos ejemplos envían una sola solicitud, función 0x03, 1 registros desde 0x0000, y decodifican estos valores:

Valor Unidad Registro Codificación
ORP mV 0x0000 Entero de 16 bits con signo, con factor de escala

Otras herramientas Modbus

La misma solicitud funciona desde cualquier maestro Modbus RTU: pymodbus, minimalmodbus, Node-RED, LabVIEW, un PLC o un registrador de datos de terceros con puerto Modbus. Use la configuración serial, el código de función y las direcciones de registro indicados arriba.

Registro de datos sin escribir código

El controlador Omni Genesis lee ORP-100 y envía las lecturas a la nube de Agrinovo por la red celular, donde se pueden exportar o leer mediante la API de la nube.

Referencia de la ficha técnica

Specifications

Parameter Specification
Measurement Range -1999 to +1999 mV
Resolution 1 mV
Accuracy ±3 mV
Stability ≤2 mV / 24 hours
Power Consumption ≤0.5W
Supply Voltage 12-24 VDC
Operating Temp 0 to 60°C
Operating Humidity ≤85% RH
Protection IP68
Dimensions Ø28 mm × 160 mm
Mounting Thread 3/4 inch NPT, front and rear

Communication Settings

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

Register Map

Measurement Registers (Function 0x03)

Address Description Scaling
0x0000 ORP Value (mV) Direct (signed 16-bit)

Configuration Registers (Function 0x06)

Address Description Notes
0x000A Calibration Offset Signed offset in mV
0x0050 Slave Address 0x01 to 0xFE

Reading ORP Value

Read 1 register from 0x0000:

Request:  01 03 00 00 00 01 84 0A
Response: 01 03 02 02 AE 38 98

Decoding:

Hex Decimal Result
0x02AE 686 686 mV

Negative values use two’s complement. For example, 0xFF9C = -100 mV.

Single-Point Calibration

ORP uses single-point offset calibration via register 0x000A.

Procedure

  1. Prepare an ORP standard solution (e.g. +220 mV)
  2. Clean the electrode with distilled water
  3. Immerse in the standard solution and wait for stabilization
  4. Read the current sensor value
  5. Calculate the offset: offset = standard - reading
  6. Write the offset to register 0x000A

Example

If the standard is +220 mV and the sensor reads +200 mV, the offset is +20:

01 06 00 0A 00 14 A9 C7

If the sensor reads +240 mV, the offset is -20 (0xFFEC in two’s complement):

01 06 00 0A FF EC E9 B5

Address Configuration

Change Address (0x01 → 0x02)

01 06 00 50 00 02 08 1A

Broadcast Discovery

Use address 0xFE with only one device connected.

Revision History

Rev Date Changes
1.0 June 2026 Initial release
1.1 August 2026 Two-page layout; CRC values added to calibration and address examples
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.

¿Preguntas sobre el cableado o el protocolo?

Cuéntenos qué placa o registrador usa y qué necesita medir.