Skip to Content
All case studies

Success story · AAA Ucayali, Peru

The Ucayali river, every minute. One M-Duino 19R sends the level.

Level sensor, cellular link, MQTT and a web app. Solar powered.

1 mindefault send interval, and it can be changed
0 to 10 mwater column, piezometric sensor on Modbus RTU
4,358.8 m³/sbase flow on 3 June 2020, during the test at LPO
232,744.6 km²sub-basin with only one drainage station

One drainage station for 232,744.6 km² is not enough.

The station sends its level every minute.

The Autoridad Administrativa del Agua IX Ucayali (AAA Ucayali), part of the Autoridad Nacional del Agua (ANA) of Peru, built a hydrometric station with an Industrial Shields PLC. A piezometric sensor measures the river. The PLC sends the data over the cellular network to a web app, and a solar panel powers the station. The pilot is in Pucallpa, on the Ucayali river. Short version: the river level and flow reach a screen in near real time.

From the field

The station, its cabinet and its data.

Real material from the original case: the station on site, the inside of the cabinet, the web app with real readings and the installation on the river.

Hydrometric station of AAA Ucayali in Pucallpa, Peru: enclosure with louvres and a small solar panel on top, on a pole by the river
The station on site: a white enclosure with the AAA Ucayali and ANA logos and a small solar panel on top.
Inside the station cabinet: Industrial Shields PLC with an antenna, a 12 V 7 Ah battery, a DC-DC converter and wiring
Inside the cabinet: the Industrial Shields PLC with its cellular antenna (top left; the label reads GPRS/GSM Controller 19R), a 12 V 7 Ah sealed lead acid battery, a DC-DC converter module, the wiring, and a second Arduino format board whose role the case does not publish.
Web app of the Pucallpa pilot station with the ANA logo and a level chart of the Ucayali riverWeb app chart of the last 24 hours and a table with level 141.9772 m a.s.l. and flow 6,393.5 m³/s on 8 June 2020Web app cards with temperature 33.19 °C, humidity 91 %, pressure 992.31 hPa and solar and battery gauges
The web app, 8 June 2020: level 141.9772 m a.s.l. and flow 6,393.5 m³/s, temperature 33.19 °C, humidity 91 %, pressure 992.31 hPa, battery 12.18 V. Real screenshots from the case.
Pier on the Ucayali river in Pucallpa with containers and a crane, and the station on a poleConcrete pier on piles over the brown water of the Ucayali riverPiles of the pier in the Ucayali river with a cable running down to the water
Field installation on the Ucayali river in Pucallpa. The station sits on a pier above the river.

The challenge

A huge river basin. Almost no flow data.

The Ucayali sub-basin covers 232,744.6 km², and the case says it has only one drainage station. AAA Ucayali needed an automatic system that records river level and flow at the hourly level. This is the brief of the case.

01

Hourly flow data

Flow values at the hourly level for a large Amazon basin, similar to the Requena station.

02

Real time

Record the change of river level and flow at different points as it happens.

03

Off the grid

A solar panel and a battery power the station. The mains is an alternative where it exists.

04

Run by the team

The pilot lets AAA Ucayali install, operate, maintain and monitor the station itself.

Built by AAA Ucayali

AAA Ucayali built the measurement equipment. The data supports its work on water use rights, marginal strips, hydraulic works, early alerts, gauging campaigns for the Q-H curves of floods and droughts, and basin planning with GETRAM, the multi-sector work group of Ucayali.

How it works

Three loops: measure, convert, keep going.

The station measures the level and sends it, the system turns the level into a flow, and the link has to survive a remote site. The values in the panels are real where marked. The behaviour is an illustrative simulation.

Loop 1 · Measure and send

From the river bed to a phone screen

A piezometric sensor measures the water column from the river bed to the water surface, from 0 to 10 m. The PLC reads it over RS-485 with Modbus RTU and sends the data over the cellular network. In the figures of the case, an MQTT broker (EMQ) receives the messages, a Node.js MQTT client writes them into MySQL, and a web app shows them on a computer or a phone. The default send interval is 1 minute, and it can be changed.

  • Piezometric sensor: 0 to 10 m, 12 to 24 V, IP68
  • RS-485 with Modbus RTU to the PLC
  • MQTT over the cellular network, every minute by default
  • MySQL database and a web app with charts
SensorPLC 19RCellularBrokerMySQLWeb app
1 READ2 PUBLISH3 STORE4 SHOW
Web app · Pucallpa pilot station8 June 2020
River level141.9772 m a.s.l.
Flow6,393.5 m³/s
Temperature33.19 °C
Humidity91 %
Pressure992.31 hPa
Battery12.18 V
1 min

1440 messages a day

Real values from the app screenshots of 8 June 2020. The 1 minute default is from the case. The animation is illustrative.

Related: Modbus RTU master over RS-485

Loop 2 · Level to flow

A level becomes a flow with a calibration curve.

In the case, the flow comes from the level through a calibration curve Q = a·H^b. The curve comes from gauging campaigns on the river. The case publishes the Pucallpa curve, Q = 1E-71 · H^34.7575, from the gaugings of 2018 and 2019. With this curve, 141.9772 m a.s.l. gives 6,393.5 m³/s: the same pair the app shows on 8 June 2020.

  • Gauging with an ADCP M9, 16 June 2020: 5,122.84 m³/s
  • Distance across the section 671.404 m, area 5,212.816 m², max depth 20.642 m
  • Alert line on the level chart: 146.5 m a.s.l.
010k20k136140144148146.5H (m a.s.l.)Q (m³/s)
River level
Flow
State

Curve and alert line from the case. The panel only shows how a level becomes a flow. The case does not publish where the curve runs: in the PLC or on the server.

Loop 3 · Remote site

Sun for power. A cell tower for data.

A solar panel, a charge controller and a maintenance free battery power the station. The app shows the battery voltage. The case also names a limit: data reaches the web app only with cellular service. Where there is no coverage, a satellite link can be the remedy. The panel shows a typical way to keep readings during a gap.

  • Solar panel, charge controller and battery
  • Battery voltage on the web app: 12.18 V
  • No coverage: satellite link as the alternative
StationBrokerWeb appmicroSD0
Link OKNo coverageLogging locallyResend

Battery (app, 8 June 2020)12.18 V

Illustrative. The case says data arrives only with cellular service, and that a satellite link can be the alternative. It does not publish a local buffer. Store and forward is a typical way to do it.

Try link loss in the remote site telemetry simulator

Related: offline first MQTT logging with an SD card

Project pack: a fleet of remote stations with OTA updates

System architecture

How does one M-Duino 19R report a river from a pier?

One sensor wire goes down to the river bed. One PLC reads it and sends the data over the cellular network. The rest runs on servers: an MQTT broker, a Node.js client, a MySQL database and a web app. The case does not publish the interfaces of the weather and water quality sensors.

Hydrometric station on the Ucayali river, Peru, with one M-Duino 19R, MQTT and a web appField sensorsPiezometric sensor0 to 10 m · Modbus RTUWeather sensorstemperature · humidity · pressureWater qualitytemperature · EC · O2 · pHRS-485not publishedSolar panelcontroller · batteryPowerM-Duino 19Rwith cellular moduleDataCellular networkGPRSMQTTMQTT brokerEMQMQTT clientNode.jsSQL INSERTMySQLdatabaseWeb appcomputer · phoneSend interval (not published)Based on the case text and figures. Sensor interfaces for weather and water quality, and the route of the remote setting, are not published.Field sensorsWeather sensorstemperature · humidity · pressureWater qualitytemperature · EC · O2 · pHnot publishedPiezometric sensor0 to 10 m · Modbus RTURS-485M-Duino 19Rwith cellular moduleSolar panelcontrollerbatteryDataCellular networkGPRSMQTTMQTT brokerEMQMQTT clientNode.jsSQL INSERTMySQLdatabaseWeb appcomputer · phoneSend interval → M-Duino 19R: not publishedBased on the case text and figures.Not published: the interfaces of theweather and water quality sensors, andthe route of the remote setting.
Data from the stationSetting back to the stationDetail not published by the case
Signals and data
FlowBetweenTypePurpose
River levelBetweenPiezometric sensor → M-Duino 19RTypeRS-485 Modbus RTUPurposeWater column from the river bed to the surface, 0 to 10 m
WeatherBetweenSensors → stationTypeNot publishedPurposeTemperature, humidity and atmospheric pressure on the web app
Water qualityBetweenSensors → stationTypeNot publishedPurposeTemperature, EC, dissolved oxygen and pH, daily and hourly records
PowerBetweenSolar panel, controller, battery → M-Duino 19RTypeDC supplyPurposeRuns the station on site. Mains as an alternative
Data outBetweenM-Duino 19R → MQTT broker (EMQ)TypeMQTT over cellularPurposeSends the readings, every minute by default
StorageBetweenNode.js MQTT client → MySQLTypeSQL INSERTPurposeWrites each message into the database by topic
Web dataBetweenMySQL → web appTypeNot publishedPurposeLevel, flow, weather and battery on a computer or a phone
Send intervalBetweenOperator → M-Duino 19RTypeNot publishedPurposeChanges how often the station sends its data

Why it works

Why the M-Duino 19R fits this station.

Open, with no licence fees

The case uses open hardware and software. No payment for the right to use the technology. The PLC is programmed with the Arduino IDE.

Room to grow

The case values a modular solution: the specifications can be extended in the future. The M-Duino family expands up to 127 modules over I2C, up to 7,100 inputs and outputs in master and slave links.

Industrial hardware for a remote site

A DIN rail PLC designed and made for industrial use, with RS-485 for the level sensor, a cellular module for the data and a 12 to 24 Vdc supply.

Hardware used

One M-Duino 19R reads the level and sends the data.

M-Duino Ethernet PLC Arduino 19R, industrial PLC based on Arduino Mega with 17 I/O and 8 relays

M-Duino Ethernet PLC Arduino 19R

An industrial PLC built on an original Arduino Mega 2560, with 17 inputs and outputs, Ethernet, RS-485 and RS-232, for DIN rail. In this station it reads the piezometric sensor over Modbus RTU and sends the data over the cellular network.

Inputs
6: 4 analog/digital (0-10 V), 2 digital optoisolated with interrupt
Outputs
11: 8 relays, 3 analog/digital/PWM (0-10 V)
Comms
Ethernet (RJ45), RS-485, RS-232, TTL, I2C, SPI
Built in
Real time clock, microSD slot
Power supply
12 to 24 Vdc
Mounting
DIN rail TS35, IP20

The case dates from 2020 and uses an M-Duino 19R with a cellular module: the label on the PLC reads GPRS/GSM Controller 19R. The same product page now sells its current version, the M-Duino 19R+. The GPRS/GSM versions are in the M-Duino GPRS family datasheet.

Questions about this case

Who built this hydrometric station?

The Autoridad Administrativa del Agua IX Ucayali (AAA Ucayali), part of the Autoridad Nacional del Agua (ANA) of Peru. AAA Ucayali built the equipment with an Industrial Shields PLC. It tested it on 13 May 2020 at the Peruvian Navy facilities (Capitanía de Puerto de Pucallpa), sending simulated river levels over the cellular network. Then it installed the station at the LPO company for testing, with a base flow of 4,358.8 m³/s on 3 June 2020.

How does the station measure the river level?

With a piezometric sensor. It measures the water column from the river bed to the water surface, from 0 to 10 m. It runs on 12 to 24 V, has IP68 protection and talks RS-485 with Modbus RTU. The web app shows the level in metres above sea level.

How does the level become a flow?

Through a calibration curve Q = a·H^b, built from gauging campaigns. The case publishes the Pucallpa curve, Q = 1E-71 · H^34.7575, from the gaugings of 2018 and 2019. An ADCP M9 gauging on 16 June 2020 measured 5,122.84 m³/s. The case does not publish where the curve runs: in the PLC or on the server.

How do the readings reach the web app?

The PLC sends them over the cellular network. In the figures of the case, an MQTT broker (EMQ) receives them, a Node.js MQTT client writes them into MySQL with SQL INSERT statements, and a web app shows them. The default send interval is 1 minute, and it can be changed.

What happens when there is no cellular coverage?

The case says the data arrives only with cellular service, and that a satellite link can be the remedy. It does not publish a local buffer. A typical way is store and forward: the PLC keeps the readings on a microSD card, with the time from a real time clock, and sends them when the link is back. The M-Duino 19R+ has both built in. You can try it in our remote site telemetry simulator.

Which water quality parameters does the case cover?

Temperature, electrical conductivity (EC), dissolved oxygen and pH, with daily and hourly records. The individual sensors are permanently coupled to the hydrometric station. The case gives a sensor cost of about S/ 8,000 and a 1 year calibration certificate accredited by INACAL. It does not publish how these sensors connect to the PLC.

Download the success story

4-page PDF with the challenge, the logic, the architecture and the hardware. No form required.

Similar project?

Tell us your river and your sites. An engineer will answer.

Tell us what you measure (level, flow, weather, water quality), how many stations you plan, which link you have on site (cellular, satellite or radio) and where the data must go. We will tell you which controller fits and how to connect it.

  • You get an answer from our technical team
  • Sensor interfaces and I/O count for your station
  • Arduino, ESP32 or Raspberry Pi based PLCs