Chapter Goal: By the end of this chapter, you will understand what a PLC is, why it was invented, its essential hardware components, how it processes information, and be able to interpret a fundamental ladder logic program.
Before the PLC, industrial control was achieved through massive, complex cabinets filled with electromechanical relays, timers, and counters. This was known as relay logic.
The Old Way: Relay Logic Panels
Function: Logic was determined by physical wiring. To create an "AND" condition (e.g., a machine only starts if a guard is closed AND a button is pressed), relays were wired in series. For an "OR" condition, they were wired in parallel.
Major Drawbacks:
Inflexibility: Changing the machine's operation required physically re-wiring the panel. This was incredibly time-consuming, expensive, and introduced a high risk of errors. 😩
High Cost & Bulk: The panels were physically large, consumed a lot of power, and the cost of hundreds of individual components, wires, and labor was substantial.
Difficult Troubleshooting: A single failed relay could shut down a whole process. Finding that one faulty component in a sea of identical-looking wires was a maintenance nightmare.
The Solution: The Programmable Logic Controller (PLC)
Introduced in the late 1960s, the PLC was a revolutionary concept. It's a ruggedized industrial computer that replaces the physical wiring of relay panels with software-based logic.
The core idea is simple: the logic is a program. To change how the machine works, you simply edit the program and download it to the PLC. This shift from hardware-based logic to software-based logic is the single most important concept to understand. ✅
A PLC isn't a single block but a modular system. This allows it to be customized for any application, from small machines to entire factory floors.
1. The CPU (Central Processing Unit) - The Brain 🧠
This is the core of the PLC. It's a microprocessor that continuously runs the user program, performs mathematical calculations, and manages all other modules. The "power" of a PLC (e.g., Siemens S7-1500, Allen-Bradley ControlLogix) is largely defined by its CPU's speed and memory.
2. Memory
Program Memory: Stores the application logic created by the user (e.g., the ladder diagram). This memory is non-volatile, meaning it retains the program even if power is lost.
Data Memory: Acts as the PLC's "scratchpad." It stores the current status of all inputs and outputs, the values of timers and counters, and other variables created in the program. This memory is typically volatile.
3. The Power Supply
This module connects to the main plant power (e.g., 230V AC) and converts it to the stable, low-voltage DC power (almost always 24V DC) that the CPU and I/O modules need to operate safely.
4. I/O (Input/Output) Modules - The Senses and Hands 🙌
The I/O modules are the PLC's connection to the physical world.
Input Modules: These are the PLC's "senses." They receive signals from field devices and convert them into a format the CPU can understand (a logical 1 or 0).
Examples of Input Devices: Pushbuttons, selector switches, proximity sensors, photoelectric sensors, limit switches.
Output Modules: These are the PLC's "hands." They take commands from the CPU and send out an electrical signal to control devices in the field.
Examples of Output Devices: Indicator lights, motor contactors, solenoid valves, alarms.
A PLC doesn't monitor everything at once in real-time. It operates in a very fast, continuous loop called the scan cycle. This deterministic process ensures predictable and reliable operation.
Step 1: Read Inputs
The PLC takes a "snapshot" of the status of every single input terminal and stores this data in its memory. For the duration of this scan, the PLC will only use this snapshot; it will not look at the physical inputs again until the next cycle.
Step 2: Execute Program
The CPU starts at the first line (rung) of the program and executes the logic, working its way to the end. It uses the input data from the snapshot (Step 1) to solve the logic and determine the required state of the outputs. These results are stored in a separate area of memory.
Step 3: Update Outputs
After the entire program has been executed, the PLC takes the output results from memory and updates the physical output terminals, turning lights, motors, etc., on or off.
Step 4: Housekeeping (Communications)
In this final step, the PLC performs internal diagnostics and manages communication tasks, such as talking to a programming laptop or an HMI screen.
This entire cycle then repeats. The time it takes to complete one full loop is the Scan Time, typically measured in milliseconds (ms). A fast scan time is crucial for high-speed applications.
The most common PLC programming language is Ladder Logic (LD) because it visually resembles the relay logic schematics it replaced.
Structure:
Rails: The two vertical lines represent the power conductors.
Rungs: The horizontal lines are the individual lines of logic. Each rung must be a complete logical statement.
Basic Components:
--| |-- Normally Open (NO) Contact: Represents an input. This instruction is TRUE if the corresponding input bit in memory is a 1 (ON). Think of it as asking the question, "Is the start button pressed?"
--|/|-- Normally Closed (NC) Contact: Also represents an input. This instruction is TRUE if the corresponding input bit in memory is a 0 (OFF). Think of it as asking, "Is the emergency stop NOT pressed?"
--( )-- Output Coil: Represents an output. If the combination of contacts on the rung results in a TRUE logical state, the coil is energized, and the corresponding output bit is set to 1 (ON).
This is the most fundamental circuit in PLC programming. It allows a momentary button press to start a process that stays running until another button is pressed.
Inputs Needed: A "Start" pushbutton (NO), a "Stop" pushbutton (NC).
Output Needed: A motor contactor.
The Ladder Logic Rung:
Start_PB Stop_PB Motor
--| |-----------|/|--------------------( )--
| Motor |
`------| |------'
How it Works:
Start: When the operator momentarily presses the Start_PB, the --| |-- contact becomes true. Since the Stop_PB is not being pressed, its --|/|-- contact is also true. This creates a logical path to the Motor coil, turning it ON.
Latch/Seal-In: As soon as the Motor output turns ON, the Motor --| |-- contact (which is in parallel with the Start_PB) also becomes true. This creates an alternative path for the logic.
Running: When the operator releases the Start_PB, its contact becomes false. However, the logic remains true through the now-active Motor contact. The motor is "latched" or "sealed in."
Stop: When the operator presses the Stop_PB, its --|/|-- contact becomes false, breaking the logical path. The Motor coil de-energizes, turning the motor OFF and opening the Motor contact, resetting the circuit