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.
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.
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.
Hourly flow data
Flow values at the hourly level for a large Amazon basin, similar to the Requena station.
Real time
Record the change of river level and flow at different points as it happens.
Off the grid
A solar panel and a battery power the station. The mains is an alternative where it exists.
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.
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
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.
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.
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.
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
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
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.
| Flow | Between | Type | Purpose |
|---|---|---|---|
| River level | BetweenPiezometric sensor → M-Duino 19R | TypeRS-485 Modbus RTU | PurposeWater column from the river bed to the surface, 0 to 10 m |
| Weather | BetweenSensors → station | TypeNot published | PurposeTemperature, humidity and atmospheric pressure on the web app |
| Water quality | BetweenSensors → station | TypeNot published | PurposeTemperature, EC, dissolved oxygen and pH, daily and hourly records |
| Power | BetweenSolar panel, controller, battery → M-Duino 19R | TypeDC supply | PurposeRuns the station on site. Mains as an alternative |
| Data out | BetweenM-Duino 19R → MQTT broker (EMQ) | TypeMQTT over cellular | PurposeSends the readings, every minute by default |
| Storage | BetweenNode.js MQTT client → MySQL | TypeSQL INSERT | PurposeWrites each message into the database by topic |
| Web data | BetweenMySQL → web app | TypeNot published | PurposeLevel, flow, weather and battery on a computer or a phone |
| Send interval | BetweenOperator → M-Duino 19R | TypeNot published | PurposeChanges 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
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