Microcontrollers Versus PLC’s: A Detailed Comparison
Introduction to Microcontrollers
As open-source electronic prototyping platforms such as Arduino, BeagleBone, and Raspberry Pi continue to widen the realm of possibilities for digital device and interactive object development, there’s more interest than ever before in microcontrollers and their related components.
Yet, this industry is so nuanced that it’s easy to confuse microcontrollers with their larger-scale counterparts, Programmable Logic Controllers (PLCs). Similar in nature but stronger in capacity, PLCs offer myriad of benefits and uses in their own right.
Today, we’re delving into the difference between microcontrollers and PLCs. We’ll explain what each system does and who uses it to help differentiate the unique characteristics of each.
Ready to learn more? Let’s get started!
What is a Microcontroller?
Let’s begin on the smaller side of the equation. In short, a microcontroller is a computer. However, it’s different than the laptop or personal computer you’re used to, though all computers share the same features:
- A Central Processing Unit (CPU)
- Program-loading capabilities (e.g. Desktop computers load browsers from the hard disk)
- Random-Access Memory (RAM) to store variables
- Input and output devices to facilitate communication (e.g. keyboard, mouse, printer, a monitor)
One main difference? Those larger versions are “general purpose computers.” They’re capable of running thousands of programs and are useful for a variety of purposes. On the other hand, a microcontroller is more specialized and does one thing well.
Characteristics of a Microcontroller
Not sure if a device in question is a microcontroller or another kind of computer? Let’s take a look at a few characteristics that set it apart.
A microcontroller embeds inside another device. They help control the device’s actions or features. For that reason, you may hear people refer to a microcontroller as an “embedded microcontroller.”
Microcontrollers are only dedicated to one certain task, designed to run one specific program. As opposed to RAM, this program remains in Read-Only Memory (ROM), where it does not change.
A general purpose computer, which stays plugged into a wall socket, will use around 50 watts of electricity. A microcontroller will only use around 50 milliwatts.
Dedicated Input/Output Device
A microcontroller will have a dedicated input device and in most cases, an output device (such as an LCD or LED display).
In addition, the microcontroller will accept input from the device that it’s controlling and sends signals to other components within it to help control it.
Take the microcontroller within a television, for example. It accepts input from the remote control and then displays the output on the television screen. Inside, the controller controls the speaker system, channel selector, and picture tube electronics such as brightness.
Or, consider a microwave oven. The oven’s controller accepts input from a keypad and displays output on an LCD display. In addition, it controls the relay that manages on/off power for the microwave’s generator.
Economical and Small
A microcontroller won’t break the bank. In most cases, users seek out the smallest and most affordable one that can get the job done.
Many microcontrollers can withstand high heats and rougher conditions than general purpose computers can handle.
For instance, the microcontroller that manages your car’s engine has to hold up against extreme temperatures that range from below freezing in Alaska to over 100 degrees Fahrenheit in Nevada.
While this scenario requires a ruggedized microcontroller, not all require this characteristic. The microcontroller embedded in a Blu-ray Disc player, for instance, has no need for ruggedization.
Microcontrollers in Manufacturing
As microcontrollers are so cost-effective and include such a wide variety of accessory components, their uses have become more mainstream. For years, their use centered on the maker world, including automation clubs and personal robot builders. Yet, as they expand in functionality, manufacturers are considering using them in industrial applications, as well.
Is this a wise move? Are the two the same? Next, let’s take a look at what sets a PLC apart from a microcontroller.
What is a PLC?
Now that we’ve covered the basics of a microcontroller, let’s compare it to a PLC.
The most basic definition? A PLC is a larger-scale microcontroller. It’s an industrial digital computer that’s ruggedized and adapted to facilitate tough manufacturing processes.
Its most common applications include:
- Assembly lines
- Robotic and machine learning devices
- Any function that requires high-reliability control or process fault diagnosis
How does it work?
A PLC accepts information from connected sensors and input devices. Then, it processes that data and creates outputs based on preset parameters. Depending on the exact setup, a PLC can even monitor and record run-time data, analyzing machine line productivity or operating temperature, for example.
Characteristics of a PLC
What sets a PLC apart from a microcontroller, larger-scale industrial PLC or any other industrial control solution? Let’s take a look at a few key characteristics.
A PLC includes a CPU that stores and processes program data. Yet, it relies on input and output modules to connect it to the rest of the machine. These I/O modules send information to the CPU, triggering certain results.
The PLC I/O controls can be analog or digital. Inputs can range from sensors and switches to meters, and outputs include relays, valves, drives, and lights. One advantage that PLCs offer is that users can customize their I/Os to meet configuration requirements for their application.
Human Machine Interface
When humans want to interact with a PLC in real-time, they rely on a Human Machine Interface (HMI) to do so. These can range in scale from a simple display with a keypad and text to a smart, touchscreen panel akin to modern consumer electronics.
While I/O devices are a start, the PLC may also need to connect to different kinds of systems. For instance, a user may need to export recorded application data from the PLC and send it to a Supervisory Control and Data Acquisition (SCADA) system.
To facilitate this function, most PLCs include multiple ports and communication protocols to ensure that the device can communicate with other systems.
Comparing Microcontrollers and PLCs: A Scenario
While there may be some applications in which a microcontroller can do a similar job as a PLC, users should consider each scenario to determine which system is best.
For the purpose of this paper, let’s use a common industrial application to illustrate the point. Say, for instance, a user wanted to perform a small automated task.
He wants to use a few sensors and an actuator to provide the output. He also needs a reporting function to “speak” to a larger control system. What’s needed is a basic operating program.
A small PLC will work, in this case. Yet, is it the smartest and most economical decision? What about an open-source, board-level microcontroller? If you’re in a similar dispute, here are a few factors to consider.
Once you know your required number of inputs and outputs, check to see if the microcontroller in question includes the required number of I/Os.
Keep in mind that the type of I/Os matter. You may be able to find a microcontroller with the right number of discrete and analog I/Os, but they may not be the correct type for your application.
In some cases, you can convert them to match your needs.
Take a 4-20 mA current loop, for instance. A user may be able to convert this to a 0-5 V voltage loop in a cinch. Yet, if the PLC includes a more specific type, such as an analog output with pulse-width modulation (PWM), you’ll be harder-pressed to convert it to anything, though you can purchase a signal converter to facilitate the process.
This is where a PLC can shine.
Designed to work with industrial sensors, most will offer a wider range of I/O choices. This cuts down on the need for external conversion. In addition, most PLCs will build in isolation for I/O points, which can help protect those devices and circuits.
Mounting and Housing
Most microcontrollers look like a naked board with pins available for connections. This can make mounting and housing more difficult, as the user will need to provide his own power and make terminals if he wants to connect an external device.
Operating Systems and Watchdogs
A microcontroller may be less expensive, but users get what they pay for. Their bare-bones nature means that the user will be responsible for coding everything but the simplest capabilities.
In most cases, this is fine, because most microcontrollers operate within common programming environments, such as Linux and C.
A PLC also requires simple application writing, though there is more going on inside that neither the programmer nor the user sees. Housekeeping programs and watchdogs help monitor the systems and equipment to ensure protection and data integrity.
Take the for/next loop within a PLC, for instance. If there’s an issue with it and the program gets stuck, it could hinder performance and pose a safety concern.
The software watchdog will kick in and begin to time each scan of the program. If one scan doesn’t finish in the allotted time, it will bark. This faults the PLC and places it into safe mode while notifying the user.
At the same time, there are hardware watchdogs that monitor the devices that connect to the PLC. As the PLC shakes hands with its I/O modules or external devices (such as switches, sensors, or actuators), the watchdog counts each scan as it occurs.
If any scan count starts to lag, it signals an issue with the PLC. In most cases, this will trigger the system into safe mode and alert the user.
Can you add this functionality onto a microcontroller? The short answer is “yes” although it isn’t easy. Users would have to write these programs from scratch or reuse existing software modules, neither of which is a simple step. From there, the user would also need to test and verify the software for the given application, which is also laborious.
Specific Industrial Conditions to Consider
What about specific industrial conditions? Are PLCs better able to withstand rugged requirements than microcontrollers? Here are a few environments to compare.
Shock and Vibration
A PLC is capable of withstanding the strong amounts of both shock and vibration common to warehouse environments. A microcontroller may work too, though it will require special mounting and connection considerations designed to hold up to this abuse.
In some environments, equipment is around vapors and fumes that can corrode wiring and other components.
Most PLCs include coatings that cut down on the amount of bare, exposed metal on their boards. Likewise, their wires include corrosion-resistant materials.
In almost every industrial environment, you’ll find systems that create electronic noise, along with magnetic fields. Can the equipment withstand it? An inexpensive microcontroller could go into fault mode or lose its program if the interference is significant enough.
Yet, a PLC has a better level of protection. It can stand standard electronic noise without issue.
Most microcontrollers operate best in a benign, temperature-controlled environment, though certain ruggedized ones can withstand lower or higher ranges.
However, as long as they choose the right components, users can install a PLC in an outdoor enclosure that’s subjected to extreme temperatures without concern.
Industry Standards for Testing
Unsure how to test for each of the above characteristics? The International Electrotechnical Commission (IEC) and Underwriters Laboratories (UL) include standards to go by. Each PLC system will include documentation that lists the tests completed and the methodology used.
Most microcontrollers don’t undergo such extensive testing, which can make it more difficult to know their capabilities. There are also differences between generic boards and brand-specific ones.
Understanding Microcontrollers vs PLCs in Your Application
Depending on your use case scenario, budget and program expectations, you may be able to use either a microcontroller or a PLC.
Remember that while microcontrollers offer costs savings, they’re more limited in nature than PLCs. This means if you’re looking for a system to go into a larger industrial network, it may not be up to the task. However, it could be perfect for DIY projects and other teaching tools that aren’t as complicated.
Want more information on industrial controls? That’s why we’re here.
We’re the global leader in this industry and offer a wide range of products to fit your needs. From motor controls to relays, you’ll find it in our online shop.
Contact us for more information and let us help you power up your next project.
The content provided in this white paper is intended solely for general information purposes and is provided with the understanding that the authors and publishers are not herein engaged in rendering engineering or other professional advice or services. The practice of engineering is driven by site-specific circumstances unique to each project. Consequently, any use of this information should be done only in consultation with a qualified and licensed professional who can take into account all relevant factors and desired outcomes. The information in this white paper was posted with reasonable care and attention. However, it is possible that some information in these white papers is incomplete, incorrect, or inapplicable to particular circumstances or conditions. We do not accept liability for direct or indirect losses resulting from using, relying or acting upon information in this white paper.