Stopping Leaks Before They Stop Production

How AI inference at the edge prevented mining tailings leaks

In Peru’s mining regions, tailings pipelines carry a slurry of water, crushed rock, and trace chemicals from processing plants to distant storage ponds. When a pipeline leaks, production stops instantly and costs spike, often $10,000 to $15,000 lost every half hour, plus cleanup and environmental risk.

New national regulations now require continuous monitoring of these pipelines to prevent spills and document safe operation. Mines must prove they can detect leaks in real time, not just react after the damage is done.

Across the country, operators began searching for practical ways to meet the new standards without replacing their existing control systems. For one remote site, where pipelines run for kilometers through steep mountain terrain, the goal was simple but urgent: stop leaks before they stop production. 

Pipelines in Peru's mining regions
 

Who is PK Soluciones?

The mining company turned to PK Soluciones, a Lima-based engineering and integration firm specializing in industrial automation, instrumentation, and IIoT systems. Founded in 2016, PK Soluciones has built a reputation for solving complex control and communication challenges across the mining, cement, and metals industries.

PK’s team of control engineers and data scientists are experienced in the harsh, remote conditions typical of Peru’s mining regions. That mix of expertise made PK the natural choice to design a real-time leak detection system for the company’s tailings pipelines.
 

The Challenge

The new regulation required continuous, verifiable monitoring of every tailings pipeline, but most mines just weren’t equipped for it. Existing systems could show pump status or flow, but not detect leaks in real time or pinpoint their location. Operators had to stop the process and inspect the line whenever they suspected a problem—an expensive and disruptive routine.

“If pressure dropped, the only option was to shut down and start walking,” says Luis Lazo, automation engineer at PK Soluciones. “Every minute offline cost thousands, and finding the leak could take hours.”
 

Finding the Signal in the Pressure


For PK, the answer started with pressure. Changes in pressure along a pipeline can reveal leaks long before they’re visible in the field. A small drop between two points might indicate a developing crack; a sharp drop could mean a rupture. By measuring pressure at several points along each line, operators could not only confirm a leak but also locate where it was happening.

“Pressure tells you the truth faster than anything else in the system,” says Lazo. “It reacts instantly—the first sign that something’s wrong—so it became the foundation for our monitoring strategy.”


Measuring pipeline pressure is the foundation of PK's monitoring strategy.
 


Building Intelligence at the Edge


Once PK decided to use pressure as the key indicator, the next challenge was turning that data into clear, actionable information for operators. The system needed to collect readings from multiple points along each pipeline, compare them instantly, and highlight any segment behaving abnormally—all without relying on cloud servers or fragile network links.

“Our goal was edge analysis,” says Mario Hernández, PK’s data scientist. “The controller should detect pressure changes on its own, without relying on a cloud connection.”

PK designed a distributed architecture: compact control panels positioned along the pipeline, each gathering data from nearby pressure transmitters and forwarding it to a main control node at the pumping station. The system would need to support both wired and wireless sensors, survive harsh outdoor conditions, and tie into existing drives and instrumentation, without unnecessary complexity.

 

The Right Platform for the Job


To meet those requirements, PK needed a controller that could think for itself, rugged enough for the mine site, yet flexible enough to run analytics and modern control software side by side. After testing a few alternatives, the team found what they were looking for in Opto 22’s groov EPIC® (Edge Programmable Industrial Controller).

“We wanted everything in one place—control, visualization, and analytics,” says Lazo. “groov EPIC gave us that without extra PCs or middleware, and it could handle every protocol we needed right out of the box.”

Installed at the main pumping station, groov EPIC serves as the system’s central node, polling pressure transmitters along the pipelines through a mix of wired and wireless links. The controller uses CODESYS®, an IEC 61131-3 PLC programming platform with built-in drivers that communicate with Modbus®/TCP gateways and EtherNet/IP™ variable frequency drives, gathering real-time data for local processing.

Selected tags are also logged to the site’s OSIsoft® PI historian, giving engineers a continuous record of pipeline conditions for analysis and reporting.


PK Soluciones chose Opto 22's groov EPIC as the center of their solution.
 
While CODESYS manages the control logic and I/O, Node-RED, a free flowchart-based IoT development platform included with the groov EPIC, handles data manipulation and short-term trending. Operators access live dashboards through groov View (an HMI development and runtime tool, also included), which displays pressure by segment, calculates differences between measurement points, and raises alarms when patterns suggest a developing leak.

Using Node-RED, CODESYS, and an AI program running on the groov EPIC enabled advanced pressure monitoring for the miles of pipeline.

 

Teaching the System to Think


With the control and visualization in place, PK saw an opportunity to take the project further. The team wanted the system not only to report pressure changes, but also to understand them—to distinguish between normal transients and the earliest signs of a leak.

Because groov EPIC runs a secure Linux® operating system, PK could install and run their own software directly on the controller. Hernández developed a lightweight AI (artificial intelligence) model using Python 3.4 to analyze recent pressure data and identify subtle patterns that traditional thresholds might miss.

“Running inference locally on the EPIC means we don’t depend on an internet link or a remote server,” Hernández explains. “If something starts to change, the controller reacts immediately.”

This edge-based analysis helps reduce false alarms and gives operators an early warning when conditions begin to drift, often before a visible leak or pressure loss occurs.

 

Inside the System


Each of the two tailings pipelines is divided into four monitoring points. At the far end near the deposition area, wired pressure transmitters send continuous readings to the control network. Upstream, where terrain makes cabling difficult, Yokogawa® wireless transmitters expose data through field gateways using Modbus/TCP.

At the pumping station, the groov EPIC polls all transmitters once per second, calculates pressure differences between each pair of sensors, and detects anomalies. Node-RED builds short-term trends operators can view in real time, while OSIsoft PI logs long-term data for compliance and performance analysis.

The Python inference model runs directly on groov EPIC's Yocto Linux environment, analyzing the last several minutes of pressure data to spot early leak signatures. If a segment’s pressure delta or anomaly score exceeds its threshold, the controller triggers alarms in groov View and energizes a beacon in the pump control room. Operators can immediately see which pipeline and segment are affected.

The system also communicates with the plant’s PowerFlex® 755 variable-frequency drives over EtherNet/IP. Drive status, motor current, and speed appear on the same dashboard, helping engineers correlate pump behavior with pressure changes.

Taking pipeline measurements
 

Validating pipeline measurements
 


Results in the Field

Since installation, the monitoring system has changed how the site manages its pipelines. Operators no longer react to sudden failures—they monitor live pressure profiles for each segment and see deviations developing in real time.

“Before, we had to stop production and walk the entire line,” says Lazo. “Now we can locate the problem area immediately and plan a targeted response without interrupting the process.”

The mine reports that unplanned shutdowns due to leaks have been eliminated, and maintenance teams now spend less time troubleshooting and more time preventing issues. Each avoided stoppage saves between $10,000 and $15,000 per half hour of downtime, often more than the cost of the entire monitoring system. In addition, the system has helped the mine remain in environmental compliance, eliminating fines and penalties associated with leaks and regulatory violations.

Archived data in OSIsoft PI also provides a detailed record of pipeline behavior under different conditions, helping refine maintenance schedules and improve pump performance.

“It’s no longer just about leak detection,” adds Hernández. “We’re starting to see how pressure patterns change with flow, temperature, and pump speed. That insight helps us run the whole system more efficiently.”

A 3D model of a pressure measurement tool on the pipeline from the AI inference model software PK Soluciones runs on the groov EPIC Linux OS
 

Expanding the Approach


Encouraged by the results, PK Soluciones is exploring how the same architecture can improve visibility in other parts of the mining process, from crushing and flotation to filtration and water recovery.

“The pressure-monitoring project showed that you don’t need a complex SCADA system to gain intelligence,” says Luis Lazo. “You can start small, build at the edge, and grow from there.”

 

About PK Soluciones


PK Soluciones, an IoT-certified OptoPartner, has over a decade of experience in industrial automation. Based in Lima, Peru, PK Soluciones is a leading strategic partner in industrial transformation for Latin America. Focusing on the capture of untapped data, they apply cutting-edge technology to turn that data into profitable decisions for their clients across various industries.

For more information, please visit: https://pksoluciones.com

Download case study pdf
   
   
   

Featured Product: groov EPIC

groov RIOQuestions? Contact an Opto 22 engineer.

 

Order now!

 

Have an application you'd like to share? 

Would you like to feature your own success in a case study? Share your story with us.