Delivered remotely for a business based in Auckland, New Zealand. Names withheld by agreement.
Project Overview
Managing distributed water infrastructure across rural catchments and municipal pump stations around Auckland means contending with mismatched programmable logic controllers, patchy cellular coverage, and field technicians who need reliable telemetry on a phone while standing beside a wet well. Traditional SCADA packages lock operators to fixed control-room desktops or demand costly engineering hours every time a site swaps a level transducer or adds a bore pump. We built a configurable edge PLC monitoring, automation, and field operations platform combining Python edge gateways, Socket.IO real-time streaming, a React and Tailwind web dashboard, and a React Native mobile application powered by shared TypeScript and Redux state layers.
Business Bottleneck
Field crews faced two persistent problems: hardware heterogeneity and blind spots during backhaul dropouts. Because pump stations had been upgraded piecemeal across years, register layouts, scaling formulas, and fault bits varied widely from site to site. Hardcoding mobile screens for a single PLC template broke the moment a technician commissioned a new valve actuator. At the same time, telemetry bridges that streamed values purely in memory lost hours of reservoir trend history whenever cellular links flapped during storms—leaving engineers blind to pump-cycling faults that occurred mid-outage.
Architectural Strategy
We pushed protocol adaptation and outage resilience to the edge while keeping UI rendering completely schema-driven. Lightweight Python gateways sit beside site PLCs, translating Modbus registers into normalized tag payloads using versioned JSON schemas and buffering unsent intervals inside local SQLite storage. Live readings and supervisory commands flow over authenticated Socket.IO channels into normalized Redux stores shared conceptually between the React web console and the React Native field app.
Core Capabilities
- Configurable Tag & Widget Schemas: Engineers map PLC register addresses, engineering units, hysteresis bands, and dashboard tiles (tank gauges, pump state switches, pressure trends) dynamically via configuration.
- Store-and-Forward Edge Buffering: Python gateways persist timestamped telemetry locally in SQLite during cellular outages and replay backlogs automatically upon reconnection.
- Interlocked Pump & Valve Control: Two-phase command execution validates operator permissions, hardware permissive bits, and timeout boundaries before confirming state transitions.
- Unified Web & Field Experience: Control-room staff use a Tailwind-styled React console while roaming technicians use a cross-platform React Native app backed by identical TypeScript telemetry models.
- Deadbanded Alarm Engine: Separates transient sensor noise from genuine high-level overflows, dry-run pump trips, and gateway heartbeat losses.
Technical Architecture
Flow: Site PLCs (Modbus/Serial) <-> Python Edge Gateway (SQLite Ring Buffer) <-> Socket.IO Telemetry & Command Relay <-> Redux + TypeScript Clients (React / Tailwind Web & React Native Mobile)
At each water station, the Python edge daemon runs an asynchronous polling loop driven by the site's active tag manifest. Raw register integers pass through configured linear scaling and deadband filters; any reading exceeding its delta threshold or sampling interval writes immediately to a local SQLite WAL buffer and queues for emission over a persistent TLS-secured Socket.IO connection.
When an operator toggles a pump setpoint from either the React console or React Native app, the client dispatches an optimistic commandPending Redux action carrying a correlation UUID and timeout deadline. The Socket.IO server authenticates the operator's site-control role and forwards the directive to the target gateway. The Python gateway checks local safety permissives, writes the coil or register, reads back the PLC confirmation register, and emits a matching command-acknowledgement event back through Socket.IO so all connected dashboards reconcile cleanly.
Technology Stack
| Category | Technology detail |
|---|---|
| Edge gateway runtime | Python asynchronous daemon polling industrial PLCs over Modbus/TCP and serial |
| Edge outage buffer | SQLite write-ahead log ring buffer storing unsent telemetry during backhaul drops |
| Real-time transport | Socket.IO bidirectional namespaces for live telemetry, alarms, and control acks |
| Web operator console | React with TypeScript and Tailwind CSS for responsive control-room views |
| Field mobile client | React Native cross-platform iOS and Android app for on-site technicians |
| Client state layer | Redux Toolkit normalized store synchronizing site topology, alarms, and tag streams |
| Configuration engine | Schema-driven register-to-widget mapping enabling zero-code site onboarding |
| Shared domain types | Strict TypeScript contracts shared across web console and mobile client |
| Control safety layer | Two-phase command-verify lifecycle with interlock checks and operator audit trail |
Engineering Trade-offs & Solutions
| Architectural Dilemma | Chosen Solution & Rationale |
|---|---|
| Hardcoded SCADA screens vs. schema-driven UI | Custom screens per station create maintenance debt with every sensor retrofit. Defining telemetry panels as declarative tag-to-widget manifests lets field engineers onboard varied PLC hardware without touching React or React Native codebases. |
| In-memory streaming vs. SQLite edge persistence | Volatile queues lose critical pump-fault history during rural cellular blackouts. Writing every polled interval to a bounded SQLite ring buffer guarantees chronological backfill when backhaul returns without exhausting edge flash storage. |
| Optimistic UI toggles vs. read-back confirmation | Flipping a pump icon immediately on tap misleads operators if a command drops or a PLC interlock rejects it. Keeping switches in a spinner-locked pending state until the gateway returns a verified PLC read-back prevents dangerous false assumptions. |
| Raw register polling vs. edge deadbanding | Streaming unchanged analog levels every second saturates rural cellular plans and floods Redux reducers. Edge deadbanding transmits steady state quietly while propagating rapid pressure spikes or tank trips instantaneously. |
Security & Reliability
Edge gateways authenticate using site-specific credentials over TLS, while operator control actions require explicit role authorization scoped to assigned water zones. If a Socket.IO link drops mid-command, expired directives fail safe without leaving partial state, and local PLC ladder logic remains the ultimate guardian over physical tank high-high cutouts and pump dry-run protection. Every setpoint change, alarm acknowledgement, and schema edit records the acting user, timestamp, and before/after values for utility compliance audits.
Performance & Scale
Normalized Redux slices partition telemetry by siteId and tagId, allowing React and React Native views to subscribe granularly to visible cards without re-rendering inactive stations during multi-site alarm bursts. On reconnection after an outage, gateways drip-feed historical SQLite backlogs on a lower-priority stream so live alarm notifications and operator commands remain responsive in real time.
Operational Outcomes
Utility engineers gained the flexibility to commission diverse pump stations and reservoir sensors through configuration rather than bespoke app releases. Field technicians carried the same live visibility and interlocked control capability into remote pump sheds that control-room staff saw on Tailwind web dashboards, while continuous edge buffering eliminated telemetry gaps after regional network interruptions.