

Raspberry Pi, a card-sized computer designed for computer programming education for students, is only the size of a credit card. Based on an open Linux system, Raspberry Pi allows free development in programming languages such as C/C++, Python, Javascript, etc., providing an excellent learning and testing platform for numerous programming enthusiasts. With the help of open-source software and hardware resources, it has become possible for us to quickly realize IEC61131-3 standard edge computing PLC products.
Before formally introducing how to implement Raspberry Pi edge computing PLC, we need to look at the background of the concept of edge computing PLC.In the era of Industry 4.0, the boundary between traditional control technology OT (Operation Technology) and information technology IT (Information Technology) is becoming increasingly blurred. Currently, in the field of industrial automation, if we want to combine traditional PLC controllers with IT systems, we have to rely heavily on gateway products, which may be an unavoidable choice at this stage.
However, the complexity of the system architecture greatly increases the latency of industrial data and reduces the efficiency of big data collection, thus limiting the accuracy of future industrial big data analysis. Meanwhile, all the original industrial data will be collected and analyzed by cloud platform servers. As factory applications become increasingly complex, the computing power limitations of the cloud platform and the bloated databases will pose significant challenges for future industrial intelligence.
Therefore, we need to simplify the system design in the era of Industry 4.0 as much as possible, requiring a new type of PLC product that can integrate OT and IT technologies, capable of processing industrial field OT data at high speed, while also supporting open interaction with IT systems and possessing certain computational capabilities to preprocess a large amount of industrial field OT data, delivering only the data required by the cloud platform, rather than completing all data processing functions on the cloud platform. This is the ideal edge computing PLC we have in mind.
To achieve this goal, in addition to powerful data processing capabilities and large-capacity storage hardware support,the software must simultaneously support open OT and IT platforms, such as: IEC61131-3 programming, PLCopen MC motion control, EtherCAT, CANopen, Modbus, and other traditional OT technologies, as well as open IoT programming platforms like Node-RED, local embedded databases, OPC-UA, MQTT, and other IT technologies.
As the protagonist of today, Raspberry Pi is an excellent hardware platform, while PC-based solutions based on the x86 architecture will open another door for us. In this part of the article, we will focus on analyzing the key technical points for implementing edge computing PLC with Raspberry Pi.
Stable and reliable hardware is the foundation of industrial controllers. Even with strong support from the open-source community’s software and hardware resources, the standard Raspberry Pi (including the latest Raspberry Pi 3B/3B+/4B) products are not designed for industrial-grade applications, but only suitable for experiments, learning, and testing, making them unsuitable for use in complex environments with high reliability requirements in industrial fields. In response to industrial-grade product applications, the Raspberry Pi official community has released the latest Raspberry Pi 3B+ Compute Module core board (hereinafter referred to as the Raspberry Pi CM core board), which can connect to expansion board signals through the DDR2 SODIMM interface and can be used for industrial-grade controller product design:
Here we have also organized some preliminary technical parameters of the Raspberry Pi 3B+ Compute Module core board:
Processor:Broadcom BCM2837B0, Cortex-A53 (ARMv8) 64-bit SoC @ 1.2GHz
RAM Storage:1GB LPDDR2 SDRAM
Flash Storage:8GB/16GB/32GB eMMC Flash
Operating Temperature Range:-25℃ – 80℃
Hardware Certification:
Electromagnetic Compatibility Directive (EMC) 2014/30/EU
Restriction of Hazardous Substances (RoHS) Directive 2011/65/EU
Maintenance Cutoff Date:January 2026
From the overall hardware specifications, the Raspberry Pi CM core board maintains a relatively high specification in hardware design, with high processor performance, large storage space, low cost, and compliance with industrial-grade temperature and hardware certification requirements. Additionally, its hardware design schematic is completely open, thusPLC products based on the Raspberry Pi CM core board can achieve extremely high computing performance and large storage space.
However, after comprehensive analysis, we believe thatthe Raspberry Pi CM core board processor still has a relatively low number of peripheral interfaces for industrial control applications, for example, the UART peripherals for implementing industrial controller RS232/RS485/RS422 interfaces are only 2, and there is no CAN bus interface. Ethernet must be expanded through USB interface chips, which greatly limits network interaction real-time performance. For some fast-speed fieldbus applications, it will pose significant challenges: such as EtherCAT, which is mainly limited by the bandwidth of the internal USB-to-Ethernet interface chip of the module and the real-time performance of the USB chip processing Ethernet packets.
Of course, we need to give industrial controller products developed based on the Raspberry Pi CM core board a suitable positioning to fully leverage its hardware characteristics. Typically, traditional industrial controllers use processors with lower clock frequencies and very limited memory space. Therefore, for the Raspberry Pi CM industrial controller, it shouldleverage its high-performance computing and large storage capacity features, transferring the computations and data storage that traditional industrial control required to be done in the cloud to the Raspberry Pi CM industrial controller based on needs. This is the concept of edge computing PLC we introduced earlier, and it can also communicate with other industrial controllers or sensors through industrial fieldbus and communication protocols, such as: Modbus, CANopen, EtherCAT, OPC-UA, etc.
Regarding the hardware section, one last point needs to be particularly noted: the Raspberry Pi CM core board processor generates considerable heat, so appropriate heat dissipation measures must be taken. Similarly, its power consumption is relatively high, making it unsuitable for some low-power or heat-sensitive application scenarios.
Raspberry Pi provides a standard open-source Linux system Raspbian (a Debian-based distribution) support. However, when standard Linux is used for industrial control systems, we can never avoid a topic:Real-Time Performance.
Do Industrial Controllers Really Need Real-Time Performance? This is a common question when developing industrial controller products. The definition of real-time performance is the system’s response capability within a specified time, where the “specified time” does not have a clear definition, thus the requirements for real-time performance are closely related to actual field applications.
For example: when using a mobile phone, if we click on an interface, the phone’s response may be fast or slow, and our user experience will be different. This is an embodiment of real-time performance.
The longer an Android system phone is used, the slower its response speed becomes, leading to lower real-time performance, while an iPhone’s real-time performance is significantly higher than that of an Android phone, thus providing a smoother experience. Therefore, we do have requirements for the real-time performance of mobile phones. However, the requirements for real-time performance in everyday applications are not high, and even if there are occasional timeouts, they will not cause severe consequences; at most, the experience will be slightly worse. This is the concept ofsoft real-time.
In the field of industrial automation, controllers have some small goals; some industrial application scenarios require very high standards, needing to process external signals immediately upon receipt and output signals, usually using PLC interrupt subprograms for processing. In scenarios where requirements are not as high, a specified cycle can usually be used: reading I/O signals -> logical processing -> outputting I/O signals, typically achieving precise PLC program execution cycle periods of 1-500ms depending on the application scenario, as shown in the following diagram:
Whether it is triggering an external signal interrupt to immediately execute PLC program logic or accurately timing to achieve precise 1-200ms cycle periods for executing PLC program logic, the real-time performance of the Linux operating system on Raspberry Pi is a critical factor. Real-time performance is closely related to the timing accuracy of the operating system, interrupt response time, task switching time, and other factors, all of which must have strict determinism to be consideredhard real-time.
Here we explain the requirements for real-time performance and PLC cycle periods in different application scenarios through the following examples:
-
Motion Control Scenario
The controller processes data from the EtherCAT bus and the PLC system typically needs to process bus data within 50us of receiving it to achieve stable 1ms cycle periods for sending position commands to the driver.
-
Factory Automation Scenario
Real-time data in intelligent manufacturing factories needs to achieve stable periodic data communication within 4-32ms.
-
Process Control Scenario
In process control application scenarios (such as water treatment, oil and gas, chemical, power, etc.), the control cycle is typically in the range of 100-500ms.
However, regardless of the scenario, industrial controllers, as the core brain of industrial automation, must not experience any occasional exceedances of real-time performance requirements, as this would pose great risks to the entire complex industrial field. This is the concept of hard real-time and one of the sources of instability in some domestic brand industrial controllers (before developing industrial controller products, the selection of the operating system can refer to similar overseas controller products, opting for stable and reliable real-time operating systems, such as: FreeRTOS, embOS, Keil RTX, RT-Thread, uCOSIII, VxWorks, QNX, RTX64, INtime, etc. If Linux systems are necessarily used, it is advised to use RTAI and Xenomai for motion control products rather than the PREEMPT-RT real-time kernel patch. We can share more about real-time operating systems and Linux real-time kernel extensions in future articles).
Therefore, for engineers and product managers developing industrial controllers, it is essential not to have a complacent mindset;it is crucial to select a stable and reliable real-time operating system (RTOS) as the foundational platform for industrial controllers, unless the actual application requirements only necessitate soft real-time, where issues with system real-time performance will not lead to significant field problems. For example, in smart building commercial applications, a slight delay in the responsiveness of lights, fans, and air conditioning switches may be preferable to immediate responsiveness, but occasional exceedances of design specifications will not cause any issues, making soft real-time requirements acceptable in such scenarios.
Returning to the topic of Raspberry Pi, the traditional Linux system Raspbian supported by Raspberry Pi does not provide any hard real-time support. Therefore,when using the Raspberry Pi CM core board to implement industrial controllers, it is necessary to upgrade and modify the standard Linux to improve its real-time performance. Thus, we have upgraded the standard Raspberry Pi Linux system, integrating the PREEMPT-RT real-time kernel patch, controlling the standard response delay of the Raspberry Pi fromuncertain to<120us (determined through the cyclictest tool under full processor load).
The determinism mentioned here is a condition for achieving hard real-time performance; as long as the complete determinism of this response can be ensured, it can be considered as achieving hard real-time, although the requirements for hard real-time performance vary across different scenarios and should be analyzed based on specific application contexts.
Thus, we conclude the discussion on the Raspberry Pi hardware and foundational Linux operating system:
1. After PREEMPT-RT real-time optimization, Raspberry Pi can achieve <120us hard real-time response requirements, suitable for general factory automation, process control, smart buildings, and other applications with less stringent hard real-time requirements.
2. Due to the high power consumption and heat generation of the processor, it should be used cautiously in low-capacity battery-powered applications (AGV carts with large battery capacities still have lower power consumption compared to x86 solutions, making them suitable), and in scenarios where heat generation of the controller has explosion-proof requirements (such as coal mines, oil and gas field controllers, etc.).
3. Since the Raspberry Pi CM core board needs to expand the Ethernet interface through USB, the stability and determinism of industrial Ethernet fieldbus (such as EtherCAT) need to be further considered to prevent occasional failure risks in the field.
In the previous two parts, we focused on analyzing the advantages and disadvantages of Raspberry Pi CM core board applications in industrial scenarios. In this part, we will officially introduce the software platforms for implementing edge computing PLC, namely the IEC61131-3 standard LogicLab and the open IoT development platform Node-RED.
Since 1968, when General Motors (GM) proposed the need to replace relay control devices and the following year when Digital Equipment Corporation developed the first programmable logic controller (PLC), PLC products have undergone over 20 years of development, giving rise to numerous programming styles, technologies, and products. Different PLC manufacturers have their interpretations of PLCs, each with its technical implementations and increasingly diverse programming syntax, creating significant challenges for users switching between different manufacturers’ PLC products.
In 1993, amidst the fierce competition in the PLC market, the IEC61131-3 standard (initially named IEC1131-3 and later renamed IEC61131-3, hereinafter referred to as the IEC61131-3 standard) was finally established. The International Electrotechnical Commission (IEC) gathered the mainstream PLC programming standards in the market and formulated the IEC61131-3 standard to unify PLC programming syntax (five mainstream PLC programming languages including Function Block Diagram (FBD), Ladder Diagram (LD), Structured Text (ST), Sequential Function Chart (SFC), and Instruction List (IL)), as well as a general PLC architecture model (configuration, resource, multitasking, variable, address, program, function, function block, function/function block encapsulation, and code reuse concepts).
Today marks nearly thirty years since the birth of the IEC61131-3 standard. PLC products have undergone a long period of development and transformation. In the last decade, well-known companies in the industry, such as Siemens, Mitsubishi, Omron, Schneider, and Rockwell, have gradually begun to support the IEC61131-3 programming system and system model. In Europe, the IEC61131-3 standard is the gateway for PLC programming; almost every PLC engineer starts learning from the FBD, LD, and ST languages in the IEC61131-3 standard, while in our country, we are lagging far behind. We will not delve deeper into this here; we will share more in future articles. However, regardless of the circumstances, the IEC61131-3 standard is undoubtedly the long-term direction for the future development of industrial automation control systems.
Having discussed the history and recent developments of the IEC61131-3 standard, we now face a choice regarding specific Raspberry Pi edge computing PLC products: completely self-develop IEC61131-3 programming software and controller products OR collaborate with a professional team to conduct secondary development based on mature software technology?
Why should small and medium-sized enterprises choose mature IEC61131-3 technology partners instead of self-developing foundational platforms?
First, we still focus on the IEC61131-3 standard controller platform technology. Nearly thirty years have passed since the birth of the IEC61131-3 standard. Leading PLC controller companies in Europe, the United States, and Japan began investing heavily in the research and development of controller platform software and hardware products that comply with the IEC61131-3 standard long ago, while domestic companies started relatively late. Due to the fragmentation of the industrial automation market and the small size of individual segments, excellent companies in these industrial automation niches find it challenging to invest large amounts of capital in the research and development of foundational IEC61131-3 platforms. Based on our experience over the past decade, if we aim to develop self-competitive PLC systems that cover small, medium, and large-scale applications, the research and development investment could range from several million to over a hundred million RMB, and achieving product planning, research and development, market promotion, and a certain level of influence could take 5-20 years. This poses a significant challenge for many leading companies in the domestic industrial automation niche.
Many enterprises need to self-develop IEC61131-3 compliant controller products, but the investment required for self-development is enormous. Therefore, over the past two decades in Europe and America, specialized companies have emerged to provide PLC software solutions that realize IEC61131-3 standard controllers for these small and medium-sized enterprises. Here, I would like to introduce my strategic partner, AXEL S.r.l. from Italy. Founded twenty years ago, AXEL S.r.l. began developing high-performance PLC programming software and runtime for servo drive and inverter manufacturers on very limited processor platforms, with available memory resources typically measured in KB, while running high-speed algorithms, leading to extremely limited free processor resources. Therefore, AXEL’s PLC code compiler and runtime were designed with a focus on low resources, high performance, and strong scalability.
We have been working hard in the field of industrial automation IEC61131-3 software platforms for ten years. Although this is just a fleeting moment in the overall PLC development history, leveraging the past decade’s accumulation of IEC61131-3 standards, field buses, motion control, various processor platforms, real-time operating systems, etc., and deeply integrating and cooperating with AXEL, we will continue to provide domestic enterprises with stable, efficient, and open PLC system-level solutions that closely meet customer needs.
By now, everyone should understand how to position the future development route for self-developing IEC61131-3 standard PLC products. From the current industrial automation market landscape, most PLC control systems are dominated by leading companies from Europe, Japan, and the United States. Therefore, for leading companies in various industrial automation niche sectors, it is crucial to ensure that control system hardware products are fully self-developed, while collaborating with excellent software technology partners both domestically and internationally to realize the IEC61131-3 platform and system, gradually moving towards self-development, which may be a more prudent route.
I believe that collaborating with us in development is the fastest, most stable, and lowest-risk route. We currently provide standardIEC61131-3 standard LogicLab programming tools, including support for five standard programming languages (FBD, LD, ST, SFC, and IL) and a real-time multitasking architecture, as well as rich debugging tools and features (real-time monitoring of online variables, including forcing, software oscilloscopes, breakpoints, and single-step debugging, etc.). The LogicLab programming tool can be OEM branded and further extended for open customization. Additionally, it supports Modbus, CANopen, EtherCAT, and other field buses, as well as HMI and motion control solutions:
Based on the standard Raspberry Pi hardware platform, using the LogicLab system allows for the expansion of I/O control of industrial signals, as shown in the diagram below:
It can also configure the Modbus bus for inter-station access between PLCs, and in the future, we will also add support for CANopen protocol and custom protocol I/O module drivers for the Raspberry Pi CAN bus expansion board.
Through the openLogicLab Runtime CSDK, developers can integrate anyLinux C language-based functions or algorithms as plugins into the IEC61131-3 application system, including standard Raspberry Pi I/O expansion, access to peripherals via UART, SPI, I2C interfaces, and various C language applications running on Linux:
Additionally, for industrial IoT applications, the Node-RED platform will further enhance the openness of the controller, improving data processing and communication capabilities. Node-RED is an open-source IoT development platform led byIBM, developed based on Node.JS. Using a web browser, data flows can be configured through drag-and-drop, parameter settings, program encryption, debugging, and downloading, etc. With such an excellent platform, why should we reinvent the wheel?
On the Raspberry Pi Linux platform, LogicLab has already supported seamless data exchange with Node-RED. LogicLab and Node-RED exchange data through the LLSymbol remote access component, with higher efficiency and timeliness in inter-process communication data access. Therefore, this architecture better supports the future edge computing PLC’s demand for data timeliness.
In this part, we have detailed the concept, hardware, system, and control software for quickly developing edge computing PLC with Raspberry Pi. As one of the best open-source community products in recent years, the powerful community resources of Raspberry Pi can significantly reduce product R&D investment. Leveraging our experience with Raspberry Pi and real-time Linux systems, we can quickly develop IEC61131-3 standard industrial controller products suitable for industrial application scenarios. We have also prepared a resource package for everyone, including a pre-integrated real-time Linux image based on Raspberry Pi 3B/3B+,integrating the Linux PREEMPT-RT real-time kernel patch, LogicLab SoftPLC runtime system, and Node-RED IoT development platform, making it easier for system installation and testing. Everyone can quickly install the real-time Linux kernel + PLC system + Node-RED environment and practice IEC61131-3 and Node-RED programming.
(Copyright notice: This article is an exclusive piece by the “Industrial Control Baijia Talk” WeChat public account. For reprints, please contact this WeChat public account for authorization. For submissions, please contact WeChat ID: QQ1721078)
Author’s Profile
Bao Rui, CTO and co-founder of Yikong Technology, previously worked at KW-Software in Germany for 10 years, focusing on IEC61131-3 software solution development, technical support, and market promotion. He has in-depth research and experience in IEC61131-3 standards, industrial controller products, field bus development and application, system architecture, foundational platform technology, and more.
Complete question bank for the 2022 Electrical Engineering Junior Exam (includes answers)
Three must-have tools for electrical engineers, easily accessible with WeChat!
【Collection】 The “path” for a ten-year veteran electrician, the secret to earning over ten thousand a month!
Which of the five major electrical drafting software (CAD, Eplan, CADe_simu…) do you pick?
Latest electrical version CAD drawing software, with super detailed installation tutorial!
Latest electrical drawing software EPLAN, with super detailed installation tutorial!
Common issues using S7-200 SMART programming software for beginners (includes download links)
Super comprehensive electrical calculation EXCEL spreadsheet, automatically generated! No need to ask for electrical calculations!
Bluetooth headsets, electrical/PLC introductory books as gifts? Come and claim your electrical gifts!
PLC programming basics: Ladder diagrams and control circuits (includes 1164 practical cases for Mitsubishi PLC)
Still can’t understand electrical diagrams? Take away the basics of electrician’s diagram reading and simulation software to quickly get started!
12 free electrical video courses, 10GB of software/e-books, and 30 days of free electrical live courses are available!
