Hello! Welcome to Embedic!
This website uses cookies. By using this site, you consent to the use of cookies. For more information, please take a look at our Privacy Policy.
Home > Embedded Events > PLC vs Microcontroller:What are Differences and How to Choose

PLC vs Microcontroller:What are Differences and How to Choose

Date: 30-08-2023 ClickCount: 710

The debate between Programmable Logic Controllers (PLCs) and microcontrollers is a pivotal one in the field of industrial automation and control systems.

In this article, we will delve into the distinctions between PLCs and microcontrollers, providing insights that will help you navigate their features, applications, and advantages, ultimately aiding you in choosing the most suitable technology for your specific automation requirements.

PLC vs Microcontroller

Part 1. What is PLC

Programmable logic controller (PLC for short), a digital electronic device with microprocessor, digital logic controller for automation control, control instructions can be loaded at any time in the memory storage and execution.

 

Programmable logic controller consists of an internal CPU, instruction and data memory, input and output units, power supply modules, digital and analog units modular combination of PLC can receive (input) and send (output) a variety of types of electrical or electronic signals, and use them to control or supervise almost all kinds of mechanical and electrical systems.

 

1. Hardware Structure

Programmable logic controller

Generally speaking, PLC is divided into two types: box type and module type. But their composition is the same, for the box type PLC, there is a CPU board, I / O board, display panel, memory block, power supply, etc., of course, according to the performance of the CPU is divided into a number of models, and according to the number of I / O points and a number of specifications. For modular PLCs, there are CPU modules, I/O modules, memory, power supply modules, and baseboards or racks. Regardless of the type of structure of the PLC, it belongs to the bus type open structure, and its I/O capacity can be expanded and combined according to the user's needs. the basic structure of the PLC block diagram is as follows:

 

Power supply module

 

The power supply in some PLCs, which is combined with the CPU module, and some are separate, is mainly used to provide working power for the integrated circuits of each PLC module. At the same time, some also provide 24V operating power for the input circuits. The power supply is usually 220VAC or 110VAC if it is an AC power supply, and 24V if it is a DC power supply.

 

Central Processing Unit

 

The CPU in the PLC is the core of the PLC, which receives and stores the user program and data according to the function given by the system program of the PLC, collects the state or data sent by the field input device by scanning, and stores them in the planning cache, and at the same time, diagnoses the working state of the power supply and the internal circuitry of the PLC, and the grammatical errors in the programming process. Into operation, from the user program memory to read instructions one by one, after analyzing and then according to the tasks set out in the instructions to produce the appropriate control signals to command the relevant control circuits, as with personal computers, mainly by the operator, controllers, registers and the realization of the link between them, data, control and status buses, and peripheral chips, bus interfaces and related circuits. It determines the scale of the control performed, the operating speed, the memory capacity and so on.

 

Memory

 

Memory is mainly used to store programs and data, and is an indispensable component of the PLC, which stores program instructions and data written and edited inside the PLC, and can usually be expanded by using special memory cards such as RAM or EEPROM, but the expansion capacity varies depending on the brand and model.

 

Input/Output Unit

 

PLC's external functions, mainly through a variety of input / output modules and the outside world, according to the number of I / O points to determine the module specifications and the number of I / O modules can be more or less, but the maximum number of CPU can manage the basic configuration of the ability to be limited by the maximum number of slots on the baseboard or rack. I / O module integrated PLC I / O circuit, its input buffer to reflect the state of the input signal, the output point to reflect the state of the output latch. reflect the output latch status.

 

The input unit is used to link the signaling actions of the captured input components and send the data to memory via an internal bus for processing by the CPU as part of the driver instructions.PLC Input ModulesThe architecture of the PLC system and the selection of the input module product depends on the level of the input signals that need to be monitored.

 

Variable signals from different types of sensors to be monitored and process control can cover the input signal range from ±10mV to ±10V.

 

Output unit is used to drive the interface of external loads, the main principle is processed by the CPU to write in the PLC program instructions, judgment to drive the output unit in order to control the external loads, such as indicators, electromagnetic contactors, relays, gas (oil) valves and so on.

 

PLC output modules are used in industrial environments to control brakes, air valves and motors etc. The analog output range of the PLC system includes ±5V, ±10V, 0V to 5V, 0V to 10V, 4 to 20mA, or 0 to 20mA.

 

2. PLC Internal Operation

 

Although the ladder program used by the PLC often uses many relays, timers and counters and other names, but the PLC does not physically have these hardware internally, but rather the memory and programmed to do the logic control editing, and through the output components connected to the external mechanical devices to do the physical control. Therefore, the hardware space required for the controller can be greatly reduced. In fact, the PLC executes the ladder program in a way that the program code is first read into the CPU line by line in a scanning manner and then finally executes the control operation. The whole scanning process includes three major steps, "Input Status Check", "Program Execution", and "Output Status Update", which are described as follows:

PLC Internal Operation

Step 1 "Input status check":

 

The PLC first checks the status of the switches or sensors connected to the inputs (1 or 0 for on or off) and writes their statuses to the corresponding locations Xn in the memory.

 

Step 2 "Program Execution":

 

The ladder program is loaded into the CPU line by line for operation. If the input of contact status is required for program execution, the CPU will query and retrieve it directly from the memory. The result of the output coil operation is stored in the corresponding position in the memory and is not reacted to the output terminal Yn for the time being.

 

Step 3 "Output state update":

 

Update the output status in step 2 to the PLC output contact and go back to step 1 again.

 

These three steps are called the PLC scanning cycle, and the time required for completion is called the PLC response time. If the PLC input signal time is less than this response time, there is a possibility of misinterpretation. After each program execution and before the next program execution, the output and input states will be updated once, so this operation is called "end-of-program regeneration" for the outputs and inputs.

 

Part 2. What is Microcontroller

A microcontroller is a compact integrated circuit (IC) that contains a processor (CPU), memory, and input/output peripherals. It is designed to execute specific tasks or control various devices within a system. Microcontrollers are commonly used in embedded systems, which are systems that have dedicated functions and are embedded within larger devices or products.

What is Microcontroller

How do microcontrollers work?

Microcontrollers function as integral components within systems to manage specific tasks or functions in devices. They operate through a series of steps involving data interpretation, processing, memory storage, and interaction with input/output (I/O) peripherals. Here's a breakdown of how microcontrollers work:

 

Data Interpretation:

 

  • Microcontrollers are designed for specific tasks and are embedded within devices to control those tasks.
  • They receive data from external sensors, switches, or other devices connected to their I/O pins.
  • The data received might represent information like sensor readings, user inputs, or environmental conditions.

 

Central Processor:

 

  • The microcontroller's central processing unit (CPU) is the "brain" that executes instructions. It fetches instructions from program memory.

 

Data Memory:

 

  • Microcontrollers have data memory (RAM) where they temporarily store the data received from the I/O peripherals.
  • The CPU accesses this data as needed during its processing.

 

Program Memory:

 

  • The microcontroller's program memory (ROM or Flash) stores the instructions that guide its operations.
  • These instructions are written by developers and define how the microcontroller should process data and perform actions.

 

Data Processing:

 

  • The CPU deciphers the instructions from the program memory and processes the data stored in data memory.
  • It might perform calculations, comparisons, and logic operations based on the instructions.

 

Action and I/O Interaction:

 

  • After processing the data, the microcontroller determines the appropriate action based on its programming.
  • It uses its I/O peripherals, such as digital or analog pins, to interact with the external world.
  • For instance, it might activate a motor, turn on an LED, send a signal to another device, or adjust a parameter in response to the processed data.

 

Communication and Collaboration:

 

  • In some systems, multiple microcontrollers work together to manage different tasks within the device.
  • They can communicate with each other using communication protocols (UART, SPI, I2C) to coordinate actions and share data.
  • Complex devices like cars might have multiple microcontrollers that communicate with each other and with a central control unit.

 

Feedback Loop:

 

  • Microcontrollers can also receive feedback from their actions, either through additional sensors or by monitoring their outputs.
  • This feedback can be used to adjust their operations and maintain desired states or responses.

 

Part 3. PLC VS Microcontroller: What are differences and How to Choose

Aspect

PLC

Microcontroller

Scope and Complexity

Complex automation tasks in industry

Wide range of applications, from simple to complex

I/O Handling

Many I/O ports for industrial devices

Limited I/O pins for simpler tasks

Reliability

High, with redundancy and fault tolerance

Moderate, depending on the model and usage

Environment

Rugged for industrial environments

Versatile, not necessarily ruggedized

Scalability

Easily expandable for larger systems

Limited scalability

Programming Languages

Specialized languages (e.g., ladder logic)

Various languages, including C/C++, Assembly

Software Ecosystem

Industrial-focused software platforms

Wide range of development tools and libraries

Safety Features

Built-in safety features and fail-safes

Fewer built-in safety features

Size and Cost

Larger size and higher cost

Smaller size and often lower cost

Development Flexibility

Limited hardware and software flexibility

High flexibility for customization

Development Time

Longer setup time due to complexity

Generally quicker setup and programming

 

How to Choose between PLC and microcontroller

When deciding whether to use a PLC or a microcontroller for a project, consider the following factors:

 

#1 Complexity of the Task: Choose a PLC for complex automation tasks with numerous inputs, outputs, and control requirements. Opt for a microcontroller for simpler tasks or projects with specific customization needs.

 

#2 Industrial vs. Non-Industrial Setting: If the application is in an industrial environment with rugged conditions and high reliability requirements, a PLC might be more suitable. For non-industrial settings, a microcontroller could be sufficient.

 

#3 Scalability: If the project might expand in the future, a PLC's scalability can be advantageous. Microcontrollers are better suited for smaller-scale applications.

 

#4 Budget and Size Constraints: Microcontrollers are often more cost-effective and compact, which can be crucial for projects with tight budgets or limited space.

 

#5 Programming Knowledge: Consider the programming languages and tools available for each option. If your team is more familiar with a certain language, it might influence your choice.

 

#6 Safety Requirements: If safety is a critical concern, PLCs are designed with built-in safety features that might be advantageous.

 

#7 Development Time: Microcontrollers can be quicker to set up and program, making them preferable for rapid prototyping and development.

 

Conclusion

In conclusion, the choice between a PLC and a microcontroller hinges on the specific demands of your automation project, considering factors such as complexity, scalability, customization, and control requirements.

Whether you are designing a factory automation system, developing a smart home setup, or creating a specialized control application, the choice between a PLC and a microcontroller will undoubtedly shape the efficiency, adaptability, and success of your automation endeavors.

  • MSP430F5438A Microcontroller:Datasheet,Features and Application
  • How to Control LED Lights with Microcontroller

FAQ

  • Are PLCs more expensive than microcontrollers?
  • PLCs tend to be more expensive due to their specialized industrial features and ruggedness. Microcontrollers are generally more cost-effective for non-industrial applications.
  • Which one should I choose for my project, a PLC or a microcontroller?
  • The choice depends on your project's requirements. Choose a PLC for complex industrial automation tasks with a large number of I/O points. Choose a microcontroller for smaller embedded projects where cost, size, and flexibility are important.
  • Can a microcontroller replace a PLC in industrial applications?
  • In some cases, a microcontroller can replace a PLC for simpler tasks. However, PLCs are better suited for managing complex industrial processes, handling multiple sensors and actuators, and ensuring robustness in harsh environments.
  • Can a PLC be used in non-industrial applications?
  • Yes, PLCs can be used in non-industrial applications that require automation and control, such as building automation and home security systems. However, microcontrollers are often more suitable for general embedded applications.

Author

Kristina Moyes is an experienced writer who has been working in the electronics industry for the past five years. With a deep passion for electronics and the industry as a whole, she has written numerous articles on a wide range of topics related to electronic products and their development. Kristina's knowledge and expertise in the field have earned her a reputation as a trusted and reliable source of information for readers interested in the latest advancements in electronics.

Hot Products

  • TMS320DM8168BCYGA2

    Manufacturer: Texas Instruments

    IC DGTL MEDIA PROCESSR 1031FCBGA

    Product Categories: DSP

    Lifecycle:

    RoHS:

  • C8051F520A-IM

    Manufacturer: Silicon Labs

    IC MCU 8BIT 8KB FLASH 10DFN

    Product Categories: 8bit MCU

    Lifecycle:

    RoHS:

  • TMX320C6678ACYP

    Manufacturer: Texas Instruments

    IC DSP FIX/FLOAT POINT 841FCBGA

    Product Categories: DSP

    Lifecycle:

    RoHS:

  • PIC18LF25K22-I/SO

    Manufacturer: Microchip

    IC MCU 8BIT 32KB FLASH 28SOIC

    Product Categories: 8bit MCU

    Lifecycle:

    RoHS:

Customer Comments

  • Looking forward to your comment

  • Comment

    Verification Code * 

Compare products

Compare Empty