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 struggling with connectivity and IT challenges — not to mention the latency involved when data has to travel?
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:
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.
- Join us on October 30th to discuss these challenges and more with Arduino and Blues Wireless.
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:
- Reduced Bandwidth: Inference happens locally, so only the results are transmitted, reducing the amount of data sent over networks.
- Lower Latency: Edge AI minimizes network delays, as data doesn’t need to travel to distant servers for processing.
- Energy Efficiency: Edge devices avoid the overhead of cloud infrastructure, making them more power-efficient.
- Increased Reliability: Devices continue to function without internet connectivity, which is crucial for remote or critical applications.
- 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.
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
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.
The Opta has 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.
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:
- Industrial-grade reliability: Built for industrial environments
- Connectivity (Optional): Onboard Ethernet, Wi-Fi, and BLE for connectivity as required. Expandable to Blues Wireless for Arduino Opta
- Ease of use: Supports standard PLC programming languages and Arduino IDE 2
- Edge AI-ready: Now enhanced with Edge Impulse for on-device inference
(Get more information on the Arduino Opta PLC)
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.
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.
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.
Industrial environments demand robust and reliable systems. With the Arduino Opta PLC now supported by Edge Impulse, developers can:
- Quickly deploy advanced GMM and K-means anomaly detection algorithms: Implement advanced machine learning models to monitor equipment and processes in real-time. (Gaussian Mixture Model (GMM) K-means)
- Reduce downtime: Predict maintenance needs before failures occur, and as they happen in as little as 19ms to ensure operational efficiency
- Stay ahead of the competition: Bring innovative products to market faster with reduced development cycles
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.
Join us on October 30th for an in-depth discussion on the contents of this blog and secure transmission of data with Edge Impulse, Arduino, and Blues Wireless here.