Keragi Keragi Keragi
Solutions

Reference

On this page

Wastewater treatment plant monitoring and operations

Last updated: 2026-11-24

This is a reference scenario and architecture, not a customer case. Sensor integration, gateway and AI capabilities are labeled reference; actuator control does not replace any safety system.

Bottom line: the hard part in a wastewater plant is not adding more sensors. It is deciding who sees the data, how alerts are ranked, and how work is handed over. A workable pattern is: instruments per process stage, a data logger or gateway for protocol adaptation and edge rules, and “exceedance plus context” delivered into the on-call conversation. AI summarizes and suggests; people confirm and act. PLC/SCADA keeps control and interlocks; the regulatory sampler keeps compliance upload.

1. Why monitoring plus collaboration, not another dashboard

Most plants already have a control room, PLC, SCADA and online analyzers, yet the on-call team still struggles with:

  • alarms that flash once and are never acknowledged;
  • calibration and maintenance records scattered across paper and personal chats;
  • several alerts at once with no agreed priority;
  • process, lab and maintenance teams each holding a different version of an exceedance;
  • shift handover reduced to “roughly normal”.

Keragi does not replace the control room or the regulatory system. It fills the collaboration layer after an alert: events, data, discussion, AI summary, confirmation and review stay in one thread.

2. Instrumentation by process stage

Cover the parameters that affect effluent quality and cost first, then add supporting points:

Stage Key parameters Purpose
Inlet channel flow, pH, COD, ammonia, SS, temperature Load, shock detection, chemical and energy baseline
Screens / lift station level difference, pump status, wet-well level Blockage and overflow warning
Equalization level, pH, DO Flow balancing, avoid septic conditions
Bio basin DO, ORP, pH, MLSS, temperature, nitrate/ammonia Aeration control, denitrification, sludge activity
Secondary clarifier sludge blanket, effluent SS/turbidity Sludge carry-over warning, return ratio
Tertiary / disinfection filter differential pressure, turbidity, residual chlorine Effluent stability, disinfection
Outfall flow, pH, COD, ammonia, total P/N Effluent compliance (separate system)
Sludge handling concentration, flow, moisture, level Dewatering efficiency, chemical use
Underground rooms H2S, CH4, NH3, O2 Personnel safety and ventilation interlocks

This is a reference layout. Actual points, ranges and sampling methods follow the process design, discharge permit and local rules.

3. Common sensors and interfaces

Plant instruments fall into process instruments (flow, level, pressure, temperature), online water-quality analyzers (COD, ammonia, total P/N) and electrode sensors (pH, ORP, DO, chlorine, turbidity/SS). Their outputs are not uniform:

Parameter Common principle Typical output Installation / maintenance
Flow electromagnetic, ultrasonic, open channel 4-20mA, RS485 Modbus RTU, pulse Straight-run requirements; clean open channels
Level ultrasonic, radar, hydrostatic, float 4-20mA, RS485, digital Foam/steam affects ultrasonic; keep pressure ports clear
pH glass electrode 4-20mA, RS485 Two-point calibration; fouling in high solids
ORP platinum/silver electrode 4-20mA, RS485 Watch interference when co-located with pH
Dissolved oxygen luminescent, galvanic 4-20mA, RS485 Cap lifetime; placement in aeration zones
Turbidity / SS scattered or transmitted light 4-20mA, RS485 Lens cleaning; match range to process
MLSS optical/ultrasonic 4-20mA, RS485 Depth and mixing effects
COD dichromate digestion, UV254 RS485, 4-20mA Reagents, waste handling, cycle time
Ammonia Nessler, electrode, UV RS485, 4-20mA Standards management; salinity interference
Total P/N digestion colorimetry RS485, 4-20mA Longer cycles; sample representativeness
Residual chlorine membrane electrode, colorimetric 4-20mA, RS485 Membrane replacement, flow requirement
Temperature PT100/PT1000 4-20mA, RS485 Co-locate with water-quality probes
Hazardous gas electrochemical, catalytic, IR 4-20mA, RS485, digital Explosion-proof selection; span gas calibration

Interface guidance:

  • 4-20mA suits a single point, long runs and noisy environments, but needs an IO module or logger to digitize;
  • RS485 Modbus RTU can put several instruments on one bus, but requires address, baud rate, termination and polling discipline;
  • pulse/digital inputs suit flow totals, pump status and level switches;
  • do not replace every instrument to connect a platform. Start with a gateway that accepts the existing 4-20mA/RS485 signals.

4. How sensors connect to Keragi

Keragi does not parse Modbus registers or ship instrument drivers. The real path is instrument → logger/gateway → platform API, with the gateway doing protocol adaptation and engineering-unit scaling.

The dashed node is an optional on-site display or dashboard: it reads from the Keragi gateway resource and shows key values and alerts in the duty room or workshop. It is read-only, takes no part in control and does not replace the control-room screen.

Three integration paths:

Path Data flow Fits Notes
WASM gateway resource instruments → gateway → MQTT/HTTP → server gateway → conversation sensor alerts, low-risk reporting, unattended sites gateway sits on the server side; with E2EE it only handles plaintext/bot channels
Local edge bridge instruments → trusted local host (serial/GPIO) → conversation serial instruments, reading E2EE, local interlock the bridge host is a trust boundary; harden it
Client participant gateway-class device joins with a subaccount-like identity edge gateways with secure storage device identity/attestation is still planned; manage credentials yourself

Six things the gateway must do:

  1. Poll and parse registers, data types (16/32-bit, byte order) and scaling;
  2. Convert raw values to engineering units and keep the conversion on record;
  3. Synchronize time with NTP so alerts line up with lab and handover records;
  4. Attach a quality flag: good, calibrating, fault, maintenance;
  5. Store and forward after network loss, with sequence numbers and deduplication;
  6. Report on change: exceedances immediately, normal values periodically or on deadband.

Suggested normalized fields:

Field Meaning
deviceId site/device identifier, e.g. wwtp-01-aeration-do-03
pointId measurement, e.g. do_mg_l
value / unit value and unit
ts timestamp (keep device and gateway time)
quality good / suspect / bad / maintenance
seq monotonic sequence for backfill and deduplication

4.1 Self-hosted MCP sensor access (1.2.0, read-only)

Since 1.2.0, a self-hosted agix can register a sensor MCP service so the AI reads field values directly. Boundaries first:

  • Only for self-hosted agix on the same host or network as the sensor bridge; cloud and WASM deployments have no MCP and cannot reach a user’s intranet devices.
  • It is read-only today: values and online state can be read; relays, pumps and valves cannot be switched.
  • Unconfigured parameters answer “no data” instead of inventing a reading.

Data path:

The hardware team’s simulator covers 38 Modbus-RTU device types, with water-quality devices at addresses 10–46, useful for integration testing and demos:

Parameter Device key Unit Simulated range (not full scale)
pH ph pH 6.5–8.5
ORP orp mV —
Conductivity ec µS/cm 100–2000
Turbidity turbidity NTU 0.5–50
Dissolved oxygen do mg/L 2–9
COD cod mg/L 20–300
Ammonia nh3n mg/L 0.1–20
Residual chlorine cl2 mg/L 0.05–2
Water temperature water-temp °C —
Flow flow m³/h —
Level level mm —
Sludge blanket sludge-level mm —
Screen level difference level-diff mm —
Suspended solids ss mg/L —
Total phosphorus tp mg/L —
Total nitrogen tn mg/L —
MLSS mlss mg/L 1000–6000
Filter differential pressure pressure-diff Pa —
Sludge moisture moisture % —
Methane ch4 %LEL —
Chlorophyll-a chlorophyll µg/L 1–50
Blue-green algae bga cells/mL 10⁵–2×10⁵
Salinity salinity PSU 0–35
TOC toc mg/L 1–50
Sulfide sulfide mg/L 0–2
TKN tkn mg/L 1–40

Simulated ranges are for integration and demos, not real instrument ranges, accuracy or calibration. Production still uses on-site instruments and calibration records; MCP only reads values and does not judge validity.

Once connected, the team can ask in natural language, for example “What are pH, ORP, turbidity and DO?”, “Report COD, ammonia, total P and total N”, or “What are flow and level now?”. To add parameters, configure name/addr/reg/width/scale/signed/unit in the bridge’s --config.

5. Alert levels: separate process drift from real trouble

Wastewater teams drown in alerts. Agree the rules with process and maintenance before the pilot:

Alert Typical source Suggested level Human action
Effluent COD/ammonia over limit repeatedly outfall analyzer P1 Check process and sampling, follow the response plan, record
DO persistently low/high aerobic basin DO P2 Check blowers, air flow, probe fouling
Inlet flow/level surge flow and level meters P2 Check shock load, sewer inflow, pump fault
Screen differential level rising level meters P2 Schedule raking to prevent overflow
Sludge blanket rising / turbidity up blanket and turbidity meters P1/P2 Adjust return ratio, investigate carry-over
Dosing flow deviation electromagnetic flow meter P2 Verify chemical concentration and pump
Instrument fault / calibration due instrument status P3 Schedule maintenance, not a process alert
H2S/CH4 over limit gas detectors P1 (safety) Evacuate, ventilate, follow confined-space rules

Rules need threshold + duration + hysteresis + suppression window (calibration/maintenance). A bare threshold produces so many alerts that nobody reads them.

6. What AI can do in a plant

  • Group simultaneous alerts by process stage;
  • Put past alerts, lab results and handover notes in one context and suggest a troubleshooting order;
  • Draft shift handover: what was handled, what is still open, what the next shift should watch;
  • Remind the team about calibration, reagent changes and wear parts;
  • Answer questions that span records, such as why DO has been low in one basin.

AI does not replace process judgement, compliance decisions, PLC control, safety interlocks or confined-space permits. Dosing, aeration, valves and pumps must be executed by the control system with human confirmation.

7. Relationship with regulatory systems

System Responsibility Relationship to Keragi
Regulatory online monitoring / data acquisition unit built, accepted and maintained per HJ 353/354/355/356; uploads per HJ 212 runs independently; status and alerts can be mirrored into the conversation
PLC/SCADA process control, interlocks, start/stop independent; Keragi receives events only
Keragi alert collaboration, AI summary, handover and review no compliance reporting, no validity judgement

Boundary: data validity, backfill, flags and regulatory upload belong to the qualified operator. Keragi data is for collaboration only and is not compliance evidence.

8. Security and boundaries

  • Private and group text can use optional E2EE (off by default); media, channels, AI, connectors and device data have separate boundaries.
  • Sensor data through a gateway uses plaintext/bot channels; the gateway cannot decrypt E2EE messages.
  • Give each gateway or logger its own credentials, with source-IP, rate and timeout limits; never expose management interfaces to the internet.
  • Calibration, reagent changes, explosion-proof selection and confined-space work follow site procedures.
  • Actuators need fail-safe design, emergency stop, timeout reset, permission checks and manual takeover; they do not replace PLC, SCADA, fire or safety interlocks.

9. Pilot checklist and metrics

Item Suggestion
Server one Linux x86_64 host, SQLite (HelixDB supported)
Gateway one edge gateway with Modbus RTU/4-20mA, starting with 3–5 points
Points inlet flow, pH, aerobic DO, secondary turbidity/blanket, wet-well level
Rooms on-call room plus process room; alerts to on-call, review to process
Accounts separate on-call, process, maintenance and AI service accounts, least privilege
Rules threshold, duration, hysteresis, calibration suppression
Records acknowledger, action, result, closure state

Measure:

  • time from alert to first human acknowledgement;
  • invalid/duplicate alert ratio;
  • handover summary completeness;
  • calibration and maintenance on-time rate;
  • whether exceedances have a complete timeline and review.

10. Common failure modes

  • Data without process change: a prettier dashboard, same phone calls;
  • Every alert at the same level: real problems drown;
  • Gateway transparent pass-through: register addresses scatter across the platform;
  • No suppression during calibration: every maintenance creates fake exceedances;
  • No time sync: chat timestamps do not match lab sheets;
  • Treating AI suggestions as conclusions.

Next steps

Frequently asked questions

Does this replace regulatory online monitoring or data acquisition units?

No. Regulatory monitoring, data acquisition units, HJ 212 upload and data validity rules belong to the compliance system and require qualified equipment and operations. Keragi handles alert collaboration, handover and review after the data reaches the team; it does not perform compliance reporting.

How do plant sensors connect to Keragi?

Typically a 4-20mA or RS485 Modbus RTU sensor connects to a data logger or edge gateway; the gateway polls, scales values and reports over MQTT or HTTP to Keragi's gateway resource or a local bridge. Keragi does not parse Modbus registers natively.

Can AI control aeration or dosing directly?

No, and it should not by default. Keragi can summarize alerts, suggest actions and record human confirmation; aeration, dosing and valves must be executed by PLC/SCADA and safety interlocks with manual takeover and fail-safe measures.

Is sensor data end-to-end encrypted?

Data through a gateway uses plaintext/bot channels by default and is not encrypted; the gateway cannot decrypt E2EE messages. A device acting as a client participant (a subaccount can approximate one) or a local bridge can follow the platform's optional E2EE rules.

What is the minimum pilot?

One Linux x86_64 server, one trusted on-site gateway or bridge host, three to five key sensors (inlet flow, pH, dissolved oxygen, turbidity, level), one on-call conversation, and agreed alert levels and approvers.