ข้ามไปยังเนื้อหา

PHEC 5-in-1 sensor — Modbus reference (extracted from vendor manuals)

Source: extracted 2026-11-10 from the two vendor PDFs (originals stay in iCloud Downloads): PHEC五合一传感器 V1.0.docx.pdf (35 p, primary — register map §15–16) and Guide Rail Water Quality Sensor Five-in-One Instruction Manual.docx.pdf (12 p, English, same family). Wiring diagrams are images — see terminal labels on the devices + assembly-guide.md.

Item Value
Product PHEC 5-in-1 rail-mount transmitter (C45 rail), pH + EC + Temp + TDS + Salinity
Electrodes pH (G3/4”, IP68, NTC10K temp comp), EC 2-pole (cell 0.1 / 1.0 / 10.0 cm⁻¹)
Power 9–24 VDC isolated (works ≥6 V), ~25–35 mA
Bus RS485 Modbus-RTU (+ optional 4–20 mA), default address 0x01
Serial defaults 9600, 8N1 (no parity)
Ranges pH 0–14 (±0.02–0.03) · EC per cell: 200 / 2 000 / 20 000 µS/cm · TDS 0–100/1 000/10 000 ppm · Sal 0–130/1 300/13 000 ppm · Temp 0–60 °C
First use note soak electrode in water, use the next day (accuracy)
Install notes mount in bypass with flow-control valve, vertical, outlet above inlet (avoid bubbles)
Addr Hex PLC R/W Meaning Scaling
0 0x0000 40001 R pH value ÷ 100 (2 dp, 0–14)
1 0x0001 40002 R EC (µS/cm) per cell constant — 1.0 cell: raw = µS/cm (1 dp-class resolution)
2 0x0002 40003 R Temperature (°C) value ÷ 10 (1 dp, two’s complement for negatives)
3 0x0003 40004 R TDS (ppm) per cell constant
4 0x0004 40005 R Salinity (ppm) per cell constant
48 0x0030 40049 R/W Device address (1–253, default 1) —
49 0x0031 40050 R/W Baud (0x4800/0x9600/0x1920/0x5760/0x1152) default 9600
50 0x0032 40051 R/W Parity 0 none / 1 odd / 2 even default none
51 0x0033 40052 R/W Auto-report interval (s), 0 = off (sensor pushes frames on RS485) default off
106 0x006A 40107 R/W pH calibration point: 1=4.00, 2=6.86, 3=9.18 —
127 0x007F 40128 R/W EC calibration —

Read all 5 values (poll): 01 03 00 00 00 05 85 C9 → reply 01 03 0A [pH×100] [EC] [T×10] [TDS] [SAL] (5 × 16-bit BE) + CRC16

Find a lost address (broadcast): query FE 03 00 30 00 01 90 0A → reply contains the address. Broadcast 0xFE works with only one slave on the bus.

Change address 1→2: 01 06 00 30 00 02 08 04 (echo = success).

Comms verified working (after fixing swapped A/B at the bench): Modbus TCP to USR :8899 (multi-host mode on), unit 1, fc03. Real readings pulled repeatedly: pH 9.58–9.65 (electrode dry — expected), Temp 28.2–28.7 °C (true ambient), EC/TDS/SAL = 0 (electrode in air — physically correct). Values stable across reads.

Empirical findings NOT in the manual:

  1. count=16 → EXC1 (rejected). count=8 → never answered. count=5 works. The sensor only reliably serves small reads — production must poll with count ≤ 5.
  2. “Dead windows”: the bus goes silent for minutes at a time (up to 5+ min observed), then answers again — consistent with the sensor’s internal measurement cycle occupying its UART. Request pacing ≥ 10–15 s + retry.
  3. A USR web-reboot does NOT revive the bus (sensor keeps its 12 V). A full power cycle (sensor included) reliably revives it — the fix that worked twice at the bench. Production implication: needs a stale-data watchdog; consider a switchable outlet for remote recovery.
  4. USR DR164 multi-host polling (its own 10 s poll) coexists with master reads during live windows; correlation with dead windows is inconclusive — the windows persisted regardless of framing/mode.

Full 0–159 register sweep: not completed — both retry sweeps landed entirely inside dead windows (0/160 twice, then post-reboot hunt failed). Registers 0x0000–0x0004 are verified live; the rest remain per-manual only. Re-run the sweep right after a full power cycle when the window is open (script pattern: probe every 3 s until first reply → burst 32 × count-5 reads).

modbus:
- name: water_quality_1
type: tcp
host: <USR_IP> # after moving it to the destination Wi-Fi
port: 8899
timeout: 5
retries: 3 # dead-window tolerant
sensors:
- name: wq1_ph
address: 0
input_type: holding
scale: 0.01
precision: "2"
unit_of_measurement: pH
scan_interval: 30 # slow poll — windows + sensor pacing
- name: wq1_ec # address 1, µS/cm (scale 1)
- name: wq1_temp # address 2, scale 0.1, °C
- name: wq1_tds # address 3, ppm
- name: wq1_salinity # address 4, ppm

Plus a Node-RED/template watchdog: no fresh value > 5 min → alert (and note the recovery action = power-cycle the box).

Unit 2 (10.10.11.250): bus dead in BOTH A/B orientations, all unit IDs 1–16 + broadcast, across reboots — USR side verified identical/correct. Pending owner’s multimeter check (12 V at V+/V−, wires on RS485 terminals); if both pass ⇒ sensor DOA — claim/replace before customer delivery.

The sensor is RS485-only — any IP access goes through the USR-DR164/162 gateway (its web UI is what’s running at http://10.10.10.128/ on the bench LAN during testing — not the OBH 194.1.x network).

# Path How Best for
1 Modbus TCP gateway USR in Modbus-TCP↔RTU mode → HA modbus integration polls 10.10.10.128:502 (prod: OBH IP), registers 0x0000–0x0004 ทดสอบ/production ที่ HA อ่านเอง — ง่ายและตรง
2 MQTT USR MQTT mode + built-in Modbus poll → publish JSON to broker (prod: Mosquitto 194.1.0.1:1883) → HA MQTT sensors (RUGON pattern) production ใน OBH — สอดคล้องสถาปัตยกรรมเดิม
3 TCP transparent + Node-RED raw socket ↔ RS485; Node-RED builds/parses RTU frames ต้องการ logic พิเศษ (เช่น รวม cal/คำนวณก่อน publish)
4 HTTP scrape of the USR web page poll http://…/ ทดสอบเท่านั้น

Bonus: sensor register 0x0033 can make the sensor itself push every N s (auto-report), so option 3 could be push-style instead of polled.

Before production: move the USR onto the destination Wi-Fi (OBHIoT → 194.1.1.x) — 10.10.10.x is bench-only; then apply the same broker/ACL pattern as other site devices.