An electrical PLC (Programmable Logic Controller) is a ruggedized industrial computer that uses a continuous scan cycle to read physical input sensors, execute a user-programmed logic sequence, and update physical output actuators. In a real installation, it replaces dozens of hardwired electromechanical relays, counters, and timers with a single processor, transforming a rigid, physically wired control panel into a flexible, software-defined circuit that can be modified via a laptop without pulling a single new wire.
The Core Architecture and the Scan Cycle
Unlike a standard desktop PC that runs an operating system and manages multiple asynchronous background tasks, a PLC is built for deterministic, real-time control. The hardware consists of three main components: a power supply (typically converting 120V AC or 24V DC to internal logic levels), a Central Processing Unit (CPU), and Input/Output (I/O) modules.
The magic of a PLC lies in its scan cycle, a continuous loop that executes in milliseconds. Think of it like a line cook in a busy kitchen: they check the ticket rail for new orders (Read Inputs), cook the meals according to the recipes (Execute Program), and hand the finished plates to the expeditor (Update Outputs), repeating this loop hundreds of times a second without stopping.
- Read Inputs: The CPU checks the voltage state of all physical input terminals and updates an internal memory area called the Input Image Table.
- Execute Program: The CPU evaluates the user logic (often written in Ladder Logic, defined by the IEC 61131-3 standard) from top to bottom, using the Input Image Table rather than reading live terminals. This prevents logic glitches if a sensor changes state mid-scan.
- Update Outputs: The CPU transfers the results from the Output Image Table to the physical output terminals, energizing or de-energizing connected loads.
- Housekeeping: The CPU performs internal diagnostics, checks communication ports, and resets the watchdog timer before starting the loop again.
Worked Example: Sizing and Timing a Motor Starter Circuit
To understand how theory translates to the bench, let us look at a real-world wiring and timing scenario using a popular entry-level industrial controller: the Siemens SIMATIC S7-1200 CPU 1214C DC/DC/DC.
1. Output Current Sinking Calculation
You need to wire eight 24V DC pneumatic solenoid valves to the CPU's transistor digital outputs. Each solenoid coil draws 350 mA when energized. The S7-1200 CPU 1214C features 10 transistor outputs rated for 0.5 A per channel, but the common terminal for the output group is rated for a maximum of 4 A.
- Per-channel check: 350 mA is well below the 0.5 A (500 mA) per-channel limit. You can safely wire one solenoid per output channel.
- Common terminal check: If all 8 solenoids energize simultaneously, the total current returning through the common terminal is 8 × 0.35 A = 2.8 A.
- Verdict: 2.8 A is safely below the 4 A common limit. No interposing relays are required for current isolation, saving panel space and cost.
2. Scan Time Calculation
The S7-1200 has a typical instruction execution time of 0.08 µs per bit. If your ladder logic program contains 2,500 boolean instructions (contacts and coils):
- Program execution: 2,500 × 0.08 µs = 200 µs (0.20 ms)
- I/O Image Table update overhead: ~0.15 ms
- Total Scan Time: 0.35 ms
A 0.35 ms scan time means the PLC can react to a high-speed sensor and trigger an output in less than half a millisecond, which is critical for high-speed packaging or bottling lines.
Where You Meet This in Practice
You will rarely find a PLC controlling a simple residential circuit; they are the backbone of commercial and industrial automation. Here is where they earn their keep:
- Conveyor Interlocking: In a packaging plant, a PLC ensures that Conveyor Belt B cannot start until Belt A is running, preventing product pile-ups. It reads zero-speed switches and photoelectric sensors to make this decision.
- VFD Integration: In HVAC systems, PLCs communicate with Variable Frequency Drives (VFDs) over industrial networks like Modbus TCP or EtherNet/IP to ramp fan speeds up or down based on duct static pressure readings.
- Lead-Lag Pump Sequencing: In municipal water lift stations, a PLC alternates which of the two submersible pumps runs (the "lead") based on runtime hours, ensuring even wear and triggering the second pump (the "lag") if the wet well level rises too fast.
What People Commonly Confuse It With
A frequent mistake among hobbyists and junior engineers is assuming a microcontroller (like an Arduino) or a PAC (Programmable Automation Controller) is the same thing as a PLC. While they all process logic, their operating environments and determinism are vastly different.
| Feature | Industrial PLC (e.g., Allen-Bradley Micro850) | Microcontroller (e.g., Arduino Mega 2560) | PAC (e.g., Beckhoff CX Series) |
|---|---|---|---|
| Environment | DIN-rail mounted, 24V DC logic, high EMI immunity, -20 to 60°C | Breadboard/PCB, 5V/3.3V logic, low EMI immunity, 0 to 50°C | DIN-rail/Panel, integrates PC-grade processing with I/O |
| Programming | IEC 61131-3 (Ladder, FBD, Structured Text) | C/C++ (Arduino IDE), MicroPython | IEC 61131-3 + high-level OS tasks (C++, C#) |
| Determinism | Strict scan cycle; outputs update at exact intervals | Interrupt-driven; background tasks can delay I/O updates | Highly deterministic, often using real-time OS (RTOS) |
| Typical Cost | $300 - $1,500+ (CPU only) | $15 - $45 | $1,500 - $5,000+ |
Frequently Asked Questions
What is the difference between a PLC and a relay control panel?
A relay control panel uses physical electromechanical relays, timers, and hardwired connections to create logic (e.g., wiring a relay contact in series to create an "AND" gate). If the machine sequence changes, an electrician must physically rewire the panel. A PLC replaces those physical wires with software logic. To change the sequence, you simply plug in a laptop, modify the ladder logic, and download it to the CPU. The physical I/O wiring to the sensors and contactors remains untouched.
Can a PLC handle high-voltage AC loads directly?
No. The internal switching components of a PLC (transistors for DC, triacs for AC) are typically rated for low current, usually between 0.5 A and 2 A maximum per channel, and rarely handle voltages above 120V AC or 24V DC. To control a 480V AC, 15 HP motor, the PLC output must wire to the coil of an interposing relay or a motor contactor. The PLC switches the low-power coil, and the heavy-duty contacts of the contactor switch the high-voltage motor load.
Why do PLCs use ladder logic instead of standard text programming?
Ladder logic was invented in the 1970s specifically to look like the electrical relay schematics that plant electricians and maintenance technicians already knew how to read. Instead of forcing maintenance staff to learn C++ or Python to troubleshoot a broken machine, ladder logic uses visual symbols (normally open contacts, coils, timers) that map directly to physical electrical components. This ensures that the people who actually fix the machine on the factory floor can read and debug the code.
What happens to a PLC output if the CPU crashes during a scan?
PLCs are equipped with a hardware watchdog timer. During the housekeeping phase of every scan cycle, the CPU resets this timer. If the CPU crashes, enters an infinite loop, or suffers a hardware fault, it fails to reset the timer. When the watchdog timer expires (typically set between 100 ms and 500 ms), the PLC's hardware circuit immediately overrides the CPU and forces all physical outputs to a predefined "safe state" (usually de-energized/OFF), preventing runaway machinery or safety hazards.






