A programmable logic controller (PLC) is an industrial computer designed to control manufacturing processes, machinery, and other automated systems. You enter a control program (often in ladder logic), connect sensors and actuators, and the PLC reads inputs, runs the program, and updates outputs in a continuous loop. This article explains how PLCs work, how they control machines, and what you need to know to choose and use one.
What Exactly Is a PLC?
A PLC is a ruggedized digital computer used for automation of electromechanical processes, such as control of machinery on factory assembly lines, amusement rides, or lighting fixtures. Unlike a personal computer, a PLC is designed for extended temperatures, electrical noise, vibration, and impact. The term programmable logic controller was coined in the late 1960s when General Motors sought a replacement for hard-wired relay systems. The first PLC, the Modicon 084, was built by Bedford Associates in 1968. The name stuck, and today PLCs are the standard controller in industrial automation.
PLCs are not general-purpose computers. They run one program repeatedly, have no operating system in the usual sense, and are programmed with specialized software. They are also modular: you can add input/output (I/O) cards, communication modules, and special function cards to match the machine you are controlling.
How a PLC Controls a Machine: The Scan Cycle
The core of PLC operation is the scan cycle, a three-step loop that repeats continuously:
- Read inputs: The PLC samples the state of all input terminals (sensors, switches, buttons) and stores these values in memory.
- Execute the program: The CPU runs the user program, using the input image and internal memory to compute new output states.
- Update outputs: The PLC writes the resulting states to the output terminals, which drive actuators, motors, valves, and indicators.
The time for one full cycle is the scan time, typically 5–50 ms for a small PLC. The calculator above estimates how many control cycles per second and how many I/O points you can update per second given your scan time and I/O count. For example, with a 20 ms scan and 32 I/O points, you get 50 cycles per second and 1,600 point updates per second.
Because the scan is sequential, a PLC is not a real-time system in the strict sense—outputs reflect the state of inputs from the beginning of the scan, not the exact moment the program runs. For most machine control, that delay is negligible. For high-speed applications (like a printing press), you might need a faster PLC or a dedicated motion controller.
PLC Hardware: Inputs, Outputs, CPU, and Power
A typical PLC system has four main hardware components:
- CPU (Central Processing Unit): Executes the program, stores data, and communicates with other devices. It has a non-volatile memory for the program and a volatile memory for runtime data.
- Power supply: Converts AC line power to the low-voltage DC (typically 24 V) that the CPU and I/O cards use.
- Input modules: Convert signals from sensors (limit switches, proximity sensors, thermocouples, encoders) into digital values the CPU can read. They can be digital (on/off) or analog (continuous voltage or current).
- Output modules: Convert CPU commands into signals that drive actuators (relays, contactors, solenoid valves, variable frequency drives). They can be relay, transistor, or triac types.
Most PLCs operate on 24 V DC for I/O, but some use 120 V AC for older installations. The choice of I/O type matters: relay outputs are slow but can switch AC or DC; transistor outputs are fast but DC only; triac outputs are for AC loads.
PLC Programming Languages
The most common programming language is ladder logic, which visually resembles relay circuits. It uses contacts (inputs) and coils (outputs) arranged in rungs. Ladder logic is easy for electricians to learn and is still dominant in North America.
Other IEC 61131-3 languages include:
- Function Block Diagram (FBD): Uses graphical blocks for logic, timers, and math. Good for signal processing.
- Structured Text (ST): A high-level text language similar to Pascal, used for complex algorithms.
- Instruction List (IL): A low-level text language, now less common.
- Sequential Function Chart (SFC): For state-machine type processes, like batch control.
You write the program on a PC using vendor software (e.g., Siemens TIA Portal, Rockwell Studio 5000, or open-source options like OpenPLC), then download it to the PLC via Ethernet, USB, or serial cable. The program runs from the PLC’s memory, not the PC, so the machine continues to operate even if the PC is disconnected.
How to Choose a PLC for Your Machine
Selecting a PLC involves more than just picking the cheapest model. Consider these factors:
- Number and type of I/O: Count your digital inputs (sensors, switches) and outputs (relays, contactors), and any analog signals (temperature, pressure). Add 10–20% spare for future changes.
- Processing speed: If your process has fast-moving parts, you need a PLC with a short scan time (1–5 ms). For slow processes like HVAC, a 50 ms scan is fine.
- Communication protocols: Does the PLC need to talk to a SCADA system, a VFD, or a barcode scanner? Common protocols are Modbus, Profinet, EtherNet/IP, and EtherCAT.
- Environmental rating: For washdown areas, choose a PLC with an IP67 rating. For hazardous areas, you may need intrinsically safe or explosion-proof versions.
- Programming software cost: Some vendors charge for the IDE; others bundle it. Open-source options exist but may have fewer features.
For a small machine with 20 I/O points, a nano-PLC (like a Click or a Koyo) is sufficient. For a large process with hundreds of I/O and motion control, you need a modular PLC with a backplane and remote I/O racks.
Common PLC Problems and How to Avoid Them
PLCs are reliable, but they do fail. The most common issues are:
- Power supply failure: Voltage spikes or brownouts can damage the power supply. Use surge protectors and an uninterruptible power supply (UPS) for critical systems.
- I/O card damage: Wiring mistakes (e.g., connecting 120 V AC to a 24 V DC input) can destroy a card. Always check voltage ratings before wiring.
- Memory loss: If the battery dies, the program may be lost. Replace batteries on schedule and keep a backup copy of the program.
- Noise and interference: Electromagnetic interference from motors or VFDs can cause false inputs. Use shielded cable, separate power and signal wires, and proper grounding.
- Program bugs: A logic error can cause a machine to do unexpected things. Always simulate the program before running it on the machine, and include safety interlocks.
One misconception is that a PLC is a safety device. A standard PLC is not a safety PLC. For safety functions (e-stop, light curtains), you must use a dedicated safety PLC or safety relay that meets IEC 61508 or ISO 13849. Never rely on a general-purpose PLC for personnel protection.
PLC vs. Microcontroller vs. Industrial PC
You might wonder why not just use an Arduino or a Raspberry Pi. Here is a quick comparison:
- PLC: Designed for industrial environments, has a deterministic scan time, is easy to program with ladder logic, and supports hot-swapping of I/O. Cost: $100–$5,000+.
- Microcontroller (Arduino, PIC): Cheap ($5–$50), flexible, but requires custom hardware design for I/O, no industrial certifications, and the program runs in a loop without guaranteed timing. Good for prototypes, not for production.
- Industrial PC (IPC): A rugged PC running Windows or Linux with I/O cards. More powerful, but has a non-deterministic operating system, higher cost, and more complexity. Used for vision systems, data logging, and HMI.
For most machine control, a PLC is the right balance of cost, reliability, and ease of maintenance. For a one-off hobby project, a microcontroller may be enough.
Safety and Best Practices
When working with PLCs, follow these safety rules:
- Always disconnect power before wiring or replacing I/O cards.
- Use a lockout/tagout procedure when servicing a machine.
- Include emergency stop circuits that are hard-wired (not only in the PLC program) and use safety relays.
- Set up a backup battery and store a copy of the program in a safe place.
- Test the program in simulation mode first, then on a bench with a dummy load, then on the machine with no material.
- Document your program with comments and a written description for future maintenance.
Remember that a PLC is a tool, not a magic box. The machine’s safety depends on your circuit design, wiring, and programming.
Frequently Asked Questions
What is the difference between a PLC and a relay logic system?
A relay logic system uses hard-wired relays and timers to control a machine. Changing the logic requires rewiring. A PLC replaces those relays with a program, so you can change the logic by editing software. PLCs also offer more complex functions (math, analog control, communication) and are easier to troubleshoot.
Can I use a PLC to control a home automation system?
Technically yes, but it is usually overkill. PLCs are designed for industrial environments and cost more than a smart home hub. For a hobby project, a microcontroller or a smart relay (like a Logo or Zelio) is more practical. However, if you want to learn industrial automation, using a PLC at home is a great way to practice.
What is ladder logic and why is it still used?
Ladder logic is a graphical programming language that mimics relay circuits. It is still used because electricians and technicians already understand relay diagrams, and it is easy to see the flow of power from left to right. It is also very reliable for simple on/off control. For complex math, you can mix ladder with structured text.
How long does a PLC last?
A typical PLC has a lifespan of 10–20 years, depending on the environment and maintenance. The main wear items are the battery (replace every 2–5 years), cooling fans (if any), and relay outputs (which have a limited number of operations). With proper care, a PLC can outlast the machine it controls.
Do I need a PLC to control a VFD?
No. Most variable frequency drives (VFDs) have built-in keypads and can be set to run at a fixed speed. But if you want to change speed based on sensor feedback (e.g., a conveyor that slows when products back up), a PLC can send analog signals (0–10 V or 4–20 mA) to the VFD and read status signals. That is a common PLC application.
What is a safety PLC and when do I need one?
A safety PLC is certified to meet safety standards (like IEC 61508) and has redundant processors and self-diagnostics. You need one when a failure could cause injury or death—for example, on a press brake or a robotic cell. Standard PLCs are not certified for safety functions, so always use a safety PLC or safety relay for e-stops and light curtains.
Related
Formula used
in t | Scan time | ms | 20 | 1 | 1000 in n | Number of I/O points | - | 32 | 1 | 10000 out cycle | Max cycles per second | Hz | 1000 / t | 2 out throughput | I/O updates per second | points/s | (1000 / t) * n | 0
Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.
More cards in this drawer
- Campus Tech Innovation Hubs: What They Are
- Poco C51 Airtel Prepaid Locked Variant India?
- Jenkins vs GitHub Actions: Which CI/CD Fits Your Team?
- Turn Off Backup Encryption in iTunes?
- Shared VPS Hosting: Is It Better?
- Disk Defrag Pro: What It Does and Whether You Need It