GE / IP FANUC Series 90/30 In Stock
The topic ‘Raspberry Pi vs. PLC’ has been an all-time favorite of the DIY and industrial automation community. In this article, we’ll be discussing each one, what they can do, what each has to offer, and contrast them according to their capabilities to better understand which one we should select for a particular application.
PLC stands for Programmable Logic Controller, a special purpose computer specifically designed to work in industrial environments where reliability is key. They are designed with extreme conditions in mind such that they can withstand harsh environmental conditions present in industrial environments like heat, humidity, and vibration. They replace traditional hard-wired relay logic circuits and provide even greater control over the system. PLCs find their applications in many industries including automotive, food processing, mining, and power generation and distribution.
Programmable logic controllers originated in the 1960s in the automotive industry in the US by Dick Morley, one of the ‘fathers’ of PLC. It is said that Modicon and Allen-Bradley were the pioneers of PLCs. As of today, Siemens, Allen-Bradley (now Rockwell Automation), Keyence, Mitsubishi, ABB, and Delta have become highly popular names in the industrial automation industry.
PLCs, as their name suggests, are programmable. This means that they can run a set of instructions or commands we embed into them, repeatedly and predictably. In simple terms, PLCs use inputs to obtain the current state of physical parameters, process them according to rules given in the program, and perform a specific task. They are almost always used to automate tasks that need to be repeated continuously, or perform a set of tasks that needs to be done in a specific sequence, within a specific time. PLCs can run only one program at a time.
The general architecture of a PLC consists of 5 main blocks: the power supply, CPU, input block, output block and program/data memory.
These automation workhorses work with supply voltages from 12VDC to 24VDC; 24VDC being most common. The CPU reads data from input modules such as button states, switch positions, and sensor readings to process the data according to the given instructions stored in program memory. Sometimes the CPU stores certain information in data memory or non-volatile memory to ensure they’re not lost when powered off. The CPU then manipulates the outputs such as relay control signals and indicators to provide necessary outputs based on the decisions taken.
This process is called a ‘scan cycle’ where the PLC’s CPU performs the following sequence repeatedly:
The scan cycle is measured in milliseconds, the time is taken by the CPU to perform one scan cycle end-to-end. PLCs cannot process information that changes during a particular scan cycle if they are not available in the next cycle.
PLC-based systems can be easily extended using additional I/O modules, communication modules, and processing modules to expand their capabilities. Modern-day automation systems can have thousands of I/Os distributed across a large area, connected through a local network.
From a technological perspective, a PLC is yet another microcontroller-based device that has been designed to withstand challenging environmental factors. To program them, there are five most popular PLC programming languages: ladder logic, structured text, function block diagrams, sequential flow charts, and instruction lists.
Ladder logic is one the most popular PLC programming languages which resemble the traditional relay logic circuits where contacts and coils are involved, with the addition of more complex components like timers, counters, and interrupts. The figure to the right shows the common latching circuit implemented in ladder logic.
Functional block diagrams (FBD) and sequential flow charts (SFC) also belong to the category of graphical languages, where instruction lists and structured text belong to the traditional text-based programming paradigm.
While the basic concepts of PLC programming are common to all PLC manufacturers such as basic instructions, the similarities end there as different peripherals, their addressing, memory, and I/O mapping and special instructions change from manufacturer to manufacturer and even different models from the same vendor. Therefore, PLC programs are most often not directly interchangeable but can be implemented in a different model with careful design.
PLC manufacturers often provide simulation tools to simulate the actual functionality of the complete PLC to test the developed programs before deploying them. This can save both time and labor.
Single Board computers (a.k.a SBC) have been recently gaining momentum in the DIY community and the industry due to their versatility. A single-board computer, by definition, is a complete computer that’s been built onto a single circuit board. It contains all the necessary parts for a computer to function, the processor, memory, I/O peripherals, and other peripherals.
Raspberry Pi is one such single-board computer, developed by the Raspberry Pi Foundation. This is a complete computer built into a single circuit board that has all the components of a functioning computer; RAM, CPU, wireless connectivity, USB input, HDMI display output, and even removable or non-removable storage options. Raspberry Pi’s are powered by Broadcom BCM series System-on-Chip processors.
The Raspberry Pi Foundation has released three main series of their single-board computer: Raspberry Pi, Raspberry Pi Pico, and Raspberry Pi Zero. The first generation Pi (Model B) was released in 2012 followed by the cheaper version, Model A. In the following years, they released multiple iterations of the Raspberry Pi, the most recent one being the Raspberry Pi 4 Model B. It is the most powerful Pi to date, and has the following features:
The Raspberry Zero is a stripped-down version of the standard Raspberry Pi. It has an ultra-low form factor with a very small footprint and has less RAM and fewer ports. It is better suited for compact applications.
Raspberry Pi’s, despite being computers, have something typical desktop or laptop computers do not have; GPIO pins. GPIO stands for General Purpose Input Output pins. This means that external devices such as relays, LEDs, and various types of sensors such as proximity sensors can be connected with the Raspberry Pi.
A raspberry pi, unlike a PLC, has a multitude of peripherals built into its circuit board. This includes an Ethernet port, a set of USB ports, a pin header for the GPIO pin break out, an HDMI connector for connecting an external monitor, and even a CSI camera interface for connecting a serial camera module.
In the Raspberry Pi 4, the processor functions at a maximum clock speed of 1.5GHz. This means that the Raspberry Pi can perform 1.5 billion calculations per second. This means that a Raspberry Pi is undoubtedly faster than any PLC. However, there’s much more than just speed to consider when selecting a controller for an application.
Before we discuss how a Raspberry Pi can be programmed, let’s first try to understand the difference between a typical microcontroller and a microprocessor. A microcontroller is an all-in-one integrated device that has RAM, ROM and everything else built into it. There can be only one program running on a microcontroller at any given time. PLCs are built using microcontrollers in most cases.
Microprocessors, however, are decentralized devices. For instance, the BCM2711 chip on a Raspberry Pi 4 is a microprocessor. It needs external devices such as RAM, ROM, and other peripherals to form a computer.
Also, microprocessors are more advanced than microcontrollers. They need sophisticated software to organize and manage the resources and processes as well as all of the hardware peripherals connected to it. Microcontrollers, on the other hand, are relatively simple devices with comparably very low computing power. Hence they do not need dedicated software to manage the resources; they only need a small piece of code (unlike a full-fledged operating system) and they repeatedly execute the code when powered on.
Due to this reason, microprocessor-based systems like single-board computers require a special piece of management software, the Operating System (OS). For instance, Raspberry Pi 4 supports multiple flavors of Linux, Ubuntu, and even Windows 10. We design our programs to run within this operating system, and not stand-alone like PLCs.
With the OS running in the background, the Raspberry Pi can work as a computer, and computer programs can be developed to perform any task that can be done by a computer. With the GPIOs also being available, it is almost always possible to replace a PLC-based control system with a Raspberry Pi.
To program a Raspberry Pi to perform a certain task, we can use any programming language that supports the SBC. This includes some of the most popular programming languages such as Python, C/C++, and Java as well.
Since Raspberry Pis are integrated computers, they can be very useful to perform functions such as running applications connected to the internet, taking pictures/videos, and performing image processing on the captured media and even tasks like machine learning to some extent. As they also have a set of GPIO, we can program them to control external applications like motors, bulbs, and other loads.
Therefore, it may sound like the best of both worlds to use a Raspberry Pi in place of a PLC. However, the truth is, Raspberry Pi’s and other SBCs need to go a long way to even think of replacing PLCs and it is highly unlikely that it will happen any time soon. Let’s see why.
As we discussed earlier, PLCs are very special purpose devices that are meant to automate industrial processes. We know that in many cases, industrial automation and process control requires very high standards, starting from reliability, maintenance requirements to functional and operational safety.
During their design and testing phases, PLC manufacturers subject the controllers to very rigorous testing; both hardware and software. This includes extreme temperatures, humidity, vibration, and sometimes even radiation. Also, there are dozens of industry standards PLCs should be compliant in order to be deployed in safety-critical environments. For example, the SIL (Safety Integrity Level) compliance can be taken. There are 4 levels in SIL, SIL-1 through 4. SIL-4 implies that the device compliant is the most dependable. This means that the probability for the particular device to fail is extremely lower for a given period of time. Also, for safety-critical systems, PLC manufacturers have also designed safety PLCs, which can act as secondary backup controllers to ensure the operational safety of the automated process.
Furthermore, PLCs are based on microcontrollers, and they do not have dedicated operating systems running on them. Therefore, the overhead caused by an operating system is eliminated in PLCs. This means that PLCs are faster in terms of program execution, even though they lag behind in terms of the number of calculations they can perform per second.
PLCs also consist of advanced peripherals such as high-speed hardware counters, timers and interrupts to perform much better in time-critical tasks. For example, interfacing an incremental rotary encoder with a PLC can be done easily through the high-speed counter and interrupts. This releases the software overhead from the controller. A Raspberry Pi, however, would require precision timing and polling to read the encoder data. Even so, with the processing overhead by the operating system, a Raspberry Pi is very likely to miss encoder pulses.
With the recent development of distributed and remote control concepts, PLCs are not just limited to a single control cabinet anymore. Using the concept of distributed I/O, multiple controllers can be placed at different points in a plant and can form a complete automation network, forming a SCADA (Supervisory Control and Data Acquisition) system. On the other hand, remote I/O allows the controllers to be placed at a single location and the I/O cards to be distributed remotely to control the different stages of a process.
On top of all these, the most important fact is the integration. PLC manufacturers have developed, tested their own proprietary and sometimes open protocols to connect every device through a common network. Since the protocols, devices, and everything else is designed, manufactured, and tested under strict standards and compliance to regulations, customers can directly use the components to design and implement their industrial automation systems and expect them to be highly reliable and dependable.
Raspberry Pis, on the other hand, are more general-purpose single board computers. They are not specially designed to withstand harsh environmental conditions like heat, humidity, and vibration. However, they possess greater capabilities such as faster processing speeds and multi-tasking. This is due to the use of much more advanced operating systems and multi-core processors they are built upon.
Raspberry Pis are capable of performing high-performance computing tasks such as machine learning inference and image processing. They are a complete system, built for educational purposes. We also find them in commercial applications such as kiosks and gaming emulators. Raspberry Pis provide a great platform for DIY enthusiasts and students to explore, hack and learn the workings behind them. They can handle much more complex and resource-heavy tasks than their PLC counterparts, at the cost of reliability. For example, we can program a Raspberry Pi to control a high complexity robotic arm and perform high-level functions. But at the same time, we should also expect it to malfunction at some point or another due to the SBC not having the reliability a PLC has to offer.
Therefore, despite being physically and technologically advanced, Raspberry Pi’s are not suitable for safety, functional, or operationally critical applications as they cannot offer the reliability of a PLC. On the other hand, a PLC cannot match the performance and capabilities of a single board computer. For instance, a PLC will never be able to process real-time image/video feeds.
Unfortunately, there is no verdict for the Raspberry Pi vs. PLC battle. Both are equally capable in their realms, and there’s only so much that is common between the two platforms. If you need an extremely reliable and safe control system you can depend upon, you may choose a PLC. If your primary objective is to get the maximum computing performance and a cost-effective approach to your solution, the Raspberry Pi might be a better approach. However, generic computers like Raspberry Pi’s will never be able to match the reliability of programmable logic controllers. In that case, PLCs will have the advantage to be the best-fit candidate.
Industrial automation applications that require the highest degree of safety and reliability often seek the support of programmable logic controllers. PLCs are designed to perform in challenging environments with utmost reliability. For more computationally demanding applications such as high-volume data processing tasks where reliability is not paramount, single board computers have the potential to be a good, cost-effective solution. For more information or to discuss which equipment might be best for your application, please visit our website here, or contact us at firstname.lastname@example.org or 1-919-535-3180.
PDF Electric & Supply Inc. sells new, new surplus and refurbished products which are sourced through independent channels. All warranties and support, if applicable, are with PDF Electric & Supply Inc. and not the manufacturer. PDF Electric & Supply Inc. is not an authorized distributor or representative for the listed manufacturers and makes no representations as to any quality control performed by any listed manufacturer on the products. The products listed on this website may vary as to their country of origin; the accessories, and other items included with the product; and the language used on the packaging, the parts, and any related instructions or printed material related to the products. This website is not sanctioned or approved by any manufacturer or tradename listed. Designated trademarks, brand names and brands appearing herein are the property of their respective owners.