Can a Raspberry Pi Challenge a PLC?
Single-board consumer microcontrollers are popular with hobbyists, but how do they stand up to industrial PLCs for more advanced process control applications?
Many readers expressed considerable interest in a previous Control Design article comparing an Arduino microcontroller with a programmable logic controller (PLC) for basic flow control. This led author Doug Reneker to consider how a Raspberry Pi microcontroller would fare against a PLC for more advanced model-based control, where the microcontroller might have an edge. The findings are found in the March 2020 issue of Control in an article titled Model-Based Control: Raspberry Pi vs Programmable Logic Controllers. Here’s a summary, click on the link above for the full text.
Single-board microcontrollers such as the Arduino and the Raspberry Pi, are extremely inexpensive and very capable, making them foundational for those in the “maker” community creating various do-it-yourself applications as a hobby. This insight led us to design an industrial-type project which could be implemented by both a Raspberry Pi and a PLC to find out the benefits and challenges with each.
Modelling the Process
For this comparison, we assembled a small water heater process. Instead of using simple on-off control like a home water heater, or even PID-based control like an industrial process would use, we decided on an advanced scheme of model-based control. The logic would monitor two inputs, flow and incoming temperature, to anticipate and therefore control heating and provide the desired output flow temperature.
The output temperature was monitored to determine performance but was not part of the control loop. While not completely practical for a “real world” application, this design provided a system with two independent input variables, tunable parameters, and one controlled output—typical of many model-based industrial control implementations.
Building the Test System
The piping and instrumentation were relatively straightforward. An Emerson Rosemount flow meter provided a 4-20mA signal, and temperatures sensors were 100-ohm platinum resistance temperature detectors (RTDs). Water flow was a single pass through the heater. For powering the resistive heater element, a zero-voltage switching solid-state TRIAC relay was used. When properly coordinated, each controller would be able to control the output to be on or off for each AC cycle.
PLC vs Raspberry Pi
The PLC was AutomationDirect’s CLICK platform, with an Ethernet-capable controller, analog and RTD input modules, and a power supply. This hardware literally clicks together in a compact package and is ready to connect with the field signals directly.
The Raspberry Pi was a Model B v1.2, which is effectively a tiny personal computer with on-board wired Ethernet and micro-SD port. However, the available I/O boards for the Raspberry Pi did not use industrial-standard signal levels, which meant a small printed circuit wiring board had to be created for handling signal conversion.
The CLICK PLC and Raspberry Pi provide two radically different programming environments.
Like most PLCs, the CLICK is configured using traditional ladder logic that executes by evaluating conditions and commanding actions, continuously performing scans which reliably and deterministically execute every few milliseconds.
Raspberry Pi controllers can be programmed in many languages, but Python was chosen for simplicity. However, this wide-open flexibility also means the user must carefully configure all code to perform in a reliable and timely manner.
In operation, both controllers were able to maintain a specified outlet temperature. The CLICK PLC performed in a consistent and stable manner. However, the Raspberry Pi was observed to activate the output in a more irregular fashion. It is believed that with additional investigation and programming effort, noise filtering and timing could improve the Raspberry Pi operation to a level needed for a production system.
For this test, the CLICK PLC was the clear winner with easy installation, straightforward programming, and consistent behavior. The Raspberry Pi was much more capable in many ways not applicable to this application, but was difficult to connect with field signals, used a multi-tasking operating system not ideal for deterministic applications, and lacked an industrial form factor.
A detailed cost analysis wasn’t performed, but deployed in quantity the consumer Raspberry Pi would be cheaper than a commercial PLC. However, a cost evaluation would need to consider the additional engineering and fabrication effort required, and the additional parts purchased, particularly the external printed circuit board.
Other than the physical layout, what makes PLCs so well suited for industrial automation? Here are some built-in PLC features:
- Hardware watchdogs confirm basic functionality, and act if there is trouble
- Industrial packaging is built for extremes of environmental conditions
- UL508 listing makes them suitable for control panels subject to inspection and/or requiring certification to standards
Our investigation found that commercially available industrialized products cost more than systems created from consumer electronics controllers, but include significant mission-specific hardware and software benefits. Do-it-yourself options can be cost-effective but require considerable attention to properly integrate hardware and software.
On a related note, AutomationDirect has listened to users looking to reliably incorporate open-source for industrial projects. They have recently introduced the ProductivityOpen, which is an industrialized Arduino-compatible controller which can use Arduino shields and PLC-type I/O, offering interested users the best of both worlds.
The range of automation platform options is the greatest it has ever been, but it means users must research thoroughly and choose carefully to obtain the best result for their application.