AI for Industrial Control Systems: Bringing Edge AI to PLCs

Today, we will showcase how to run any model generated with Edge Impulse on a PLC (Programmable Logic Controller). In this blog, we focus on anomaly detection for the Arduino Opta PLC, which enables industrial automation developers to harness the power of machine learning directly on existing industrial equipment.

Challenges for industrial automation

Are you an industrial automation engineer tasked with implementing predictive maintenance for condition monitoring on a PLC-controlled machine but struggle with connectivity and IT challenges, not to mention the latency involved when data has to travel?

Industrial machines cost hundreds of thousands of dollars to design, and downtime is costly for production lines. Privacy and IP concerns aside, connectivity is not always an option. With on-device machine learning, engineers can integrate algorithms to alert operators to previously observed conditions or anomalous patterns. With Edge Impulse, you can run AI directly on your existing PLC-controlled machines, harnessing domain knowledge without involving complex networking. Where they happen at the edge of the network:

Cloud computing vs. edge computing

It is worth stating that with Edge Impulse, you can develop the existing IP you own or design from concept to bespoke tailored solutions for any industrial need.

Benefits of edge AI

Running machine learning models on edge devices, such as industrial computers, IIoT devices, or PLCs, offers several advantages over cloud-based approaches:

Improved Data Privacy: Sensitive data remains local, reducing the risk of interception during transmission

The benefits of edge AI can be summarized by the acronym BLERP: bandwidth, latency, energy efficiency, reliability, and privacy. Read on to learn more about edge AI.

A quick PLC primer

PLCs are specialized industrial computers widely used for automating processes such as controlling machinery, assembly lines, and other industrial systems. They are built to withstand harsh environments, such as extreme temperatures, moisture, and electrical noise, making them ideal for real-time control in rugged conditions. Engineers and technicians in manufacturing, energy, and logistics industries rely on PLCs for their ease of programming, durability, modular capabilities, uptime (running for years without failure), and ability to directly interface with industrial sensors and actuators for precise control.

Modern PLC

Unlike traditional microcontrollers, PLCs are designed for real-time industrial applications and programming languages like ladder logic. Due to their limited processing power, these controllers have not been traditionally associated with AI, but the advent of edge AI is opening them to a multitude of new applications, like inference directly on the device combined with advanced digital signal processing.

About the Arduino Opta PLC

Arduino Opta PLC (Programmable Logic Controller)

The Arduino Opta PLC is a micro-PLC designed with PLC engineers in mind, supporting standard languages including Ladder Logic Diagram (LD) and Function Block Diagram (FBD). Developed in partnership with Finder — a leader in mission-critical electromechanical and electronic components — the Opta PLC combines durability, reliability, and security with Arduino's signature flexibility and ease of deployment.

Flash Partitioning & Core Targeting: edge AI-ready

The Opta has a dual core which can be partitioned to run a portion as a C++ application and the rest as LD, making it pretty unique, in that you can run the Edge AI component on device, where other varieties need to run on a MCU-GPU or even industrial-PC as the edge AI device, on the PLC's transmitted data.

Again not all PLCs are created equally, and in this regard we can consider ones that have a portionable compute that can also run C++ or other applications as truly edge AI-ready, in that they can run inference on device rather than integrated.

Ladder Logic with Anomaly Detection

Traditional ladder logic can be combined with C++ edge AI applications by defining rungs that can share data with global variables on-device.

Key features:

Get more information on the Arduino Opta PLC here.

Getting started with edge AI for PLCs

Edge Impulse provides a seamless platform for developing and deploying machine learning models on edge devices. With its intuitive user-friendly interface and advanced tools, developers can quickly train, optimize, and deploy AI models directly onto edge devices like the Opta PLC.

Edge Impulse's intuitive user-friendly interface

To showcase how easy it is to integrate Edge Impulse with the Arduino Opta PLC, we've created a reproducible tutorial to walk through a practical example using the Arduino DIN Celsius board, that comes with the PLC starter kit, to build a dataset, as well as a motor to demonstrate that this setup can be used interchangeably with any analogue or digital input signal.

Arduino Opta PLC Starter Kit

This tutorial illustrates how to set up a temperature-controlled system or motor control system that we will use to collect data, and deploy a trained machine-learning model. Anomalies in motor function or temperature control system can then be used for fault detection and prediction through anomaly detection and classification on a PLC in real-time.

Anomaly detection for proactive insights at the source

Anomaly detection is a machine learning technique that uses clustering algorithms to identify unusual patterns in data, making it ideal for monitoring industrial processes and equipment. By training a model to recognize normal behavior, you can detect deviations that may indicate faults or malfunctions. For example, points outside the highlighted area in our motor power use case will trigger an anomaly score, that score can be used programmatically to shut down a machine in as little as 19ms.

Motor Power — Gaussian Mixture Model (GMM)

Industrial environments demand robust and reliable systems. With the Arduino Opta PLC now supported by Edge Impulse, developers can:

By deploying advanced anomaly detection models such as GMM and K-means directly on PLCs, manufacturers can gain proactive insights. This proactive approach allows you to anticipate issues, reduce downtime, and ensure operational efficiency, putting you in control of your industrial processes.

Anomaly detection is an excellent place to start, but why stop there? If you are already working with computer vision, machine learning, or digital signal processing, why not go further? With our embedded engineers' getting started documentation and 5 Rising Trends for AI Adoption in Manufacturing (download now), you can design and deploy custom DSP and machine learning algorithms tailored to your industrial needs.

Watch our in-depth discussion on PLCs and the secure transmission of data with Edge Impulse, Arduino, and Blues Wireless here.

Comments

Subscribe

Are you interested in bringing machine learning intelligence to your devices? We're happy to help.

Subscribe to our newsletter