01
Programmable Logic Controllers (PLCs): An Overview
Welcome to your first step into industrial automation. In this chapter we’ll meet the PLC — the small but mighty computer that quietly runs almost every factory, water plant, and traffic light around you. We’ll learn what’s inside it, how it thinks, and at the end we’ll look at three real systems and see how a PLC fits in.
What you’ll be able to do after this chapter
Your goals for this chapter:
- Explain what a PLC is and why factories replaced relay panels with them in the late 1960s.
- Name the four main parts inside every PLC and describe what each part does.
- Walk through the four steps of the PLC scan cycle and explain why scan time matters.
- Tell the difference between a PLC and a normal personal computer.
- Classify a PLC by size and pick the right size class for a given application.
- Identify inputs and outputs in a real industrial system (bottle filling, parking, traffic lights).
Key Concepts & Terms
What is a Programmable Logic Controller?
Let me start with a picture you already know. Imagine walking into a soft-drink bottling factory. Thousands of bottles slide down a conveyor belt. Each bottle stops under a nozzle that fills it with cola, then moves to the next station where a cap is screwed on. Down the line a label is glued, then the bottle is packed into a box. Hundreds of times every minute. All day, every day, without anyone touching a single bottle.
Who is running all of that? Not a person — a person can’t react fast enough or work for 24 hours straight. The answer is a programmable logic controller, or PLC: a small, tough industrial computer designed to control machines and processes in real time.
Figure 1.0 — Everyday PLC ApplicationsFrom the soft drink in your hand to the traffic light at the corner — chances are a PLC is somewhere in the loop.
Unlike the office computer on your desk, a PLC is built tough. It can handle electrical noise from nearby motors, vibration from heavy machinery, dust, humidity, and wide temperature swings. And it works in real time — meaning when an input changes, the PLC reacts within milliseconds, not seconds.
A Short History — Why PLCs Were Invented
Back in the 1960s, factories used relay panels to control machinery. A relay is a small electromechanical switch — flick a coil and a contact moves. To control a complex machine, hundreds of relays were wired together. It worked, but it was a nightmare for two reasons.
First, every time a car factory wanted to change to next year’s model, the entire control panel had to be torn out and rewired. Hundreds of relays, thousands of wires. It took weeks and produced lots of mistakes. Second, relays wear out — every day a few would fail and the whole production line would stop.
In 1968, an engineer named Dick Morley and his team at Bedford Associates designed a small electronic box that could replace those banks of relays. Instead of physical wiring, the control logic was stored in the box’s memory as a program. They called it the Modicon 084 — and it changed industrial automation forever.
Why this mattered so much
Now, when General Motors wanted to change the production line for next year’s car model, an engineer just opened the program on a screen, edited the logic, and downloaded it to the PLC. What used to take weeks of rewiring now took an afternoon of typing. That’s why every modern factory in the world uses PLCs — and why the relay panel is mostly a museum piece today.
Why PLCs Replaced Relay Logic — The Big Advantages
Let’s count the wins. Compared to relay panels, PLCs are:
- More reliable — they’re solid-state. No moving contacts to wear out, no coils to burn, no metal-to-metal sparks.
- More flexible — change the logic by editing software, not by rewiring.
- Much smaller — a PLC the size of a textbook can replace dozens of relays that would fill an entire wall.
- Self-diagnostic — the PLC reports its own faults. “Input module 3 has a problem.” “Battery is low.” It tells you what’s wrong.
- Networkable — PLCs talk to each other and to supervisory computers over industrial networks.
- Fast — a modern PLC scans its entire program in under one millisecond. Faster than a human blink, many times over.
- Easy to troubleshoot — the engineer watches the program execute live on a laptop screen, with energised parts highlighted in green.
A useful rule of thumb: if your control problem needs more than about half a dozen relays, a PLC will be cheaper, smaller, and easier to maintain over the equipment’s lifetime.
What’s Inside a PLC — The Four Parts
Open up any PLC — Allen-Bradley, Siemens, Mitsubishi, Schneider — and you’ll find four basic parts. The brand name on the outside changes, but the four parts inside are always there. Let’s look at them.
Figure 1.1 — Block Architecture of a PLCThe four functional sections (CPU, I/O modules, Power Supply, and Programming Device) and how they connect to field sensors and actuators.
- Power Supply — the part that gives the PLC its electricity. It takes regular plant AC voltage (120 V or 240 V) and converts it to clean low-voltage DC (usually 24 V or 5 V) that the PLC’s electronics can handle. Think of it as the PLC’s heart.
- Central Processing Unit (CPU) — the brain. Inside the CPU is a microprocessor that reads your program and decides what to do, plus memory that stores the program and the data. The CPU is what makes the PLC “think”.
- Input/Output (I/O) Section — the eyes and hands. Input modules are the eyes — they read signals from sensors, switches, and buttons. Output modules are the hands — they drive motors, valves, and lamps. The I/O section is how the PLC connects to the real world.
- Programming Device — the laptop you use to write the program. You type the ladder logic, click “download”, and the program flies into the CPU’s memory through a USB or Ethernet cable. After the download is done, the laptop can be unplugged — the PLC keeps running by itself, forever.
Easy way to remember the four parts
Think of a PLC like a tiny living thing: the Power Supply is its heart (gives it energy), the CPU is its brain (does the thinking), the I/O Section is its eyes and hands (sees the world and acts on it), and the Programming Device is its teacher (gives it instructions). Once it’s been taught, it can work alone.
Open vs. Closed Architecture
Most PLCs are proprietary — that means the hardware, software, and communication protocols all belong to one company (Allen-Bradley, Siemens, Mitsubishi, Schneider). This is called closed architecture. The advantage is that everything inside is tightly integrated and well supported by the maker. The disadvantage is that you can’t take an Allen-Bradley I/O card and plug it into a Siemens PLC — they don’t talk to each other.
An open architecture PLC, on the other hand, uses standard parts that work with other vendors’ equipment. These are rare in industry — most PLC ecosystems are closed.
Fixed I/O vs. Modular I/O
PLCs come in two physical layouts. You’ll meet both in the field, so let’s understand the difference.
Figure 1.3 — Fixed vs Modular I/OFixed I/O is one sealed package — cheap and compact, but the I/O count is locked. Modular I/O slides separate cards into a rack — flexible, expandable, and individually replaceable.
- Fixed I/O — the CPU and the I/O are sealed inside one box, with a set number of input and output points. It’s cheap, compact, and simple. The downside is you can’t add more I/O later — if you need just one more output, you have to replace the whole unit. You’ll find fixed I/O in nano and micro PLCs, often on smaller machines.
- Modular I/O — the CPU, power supply, and each I/O module are separate cards that slide into a chassis (called a rack). Need 16 more inputs? Plug in another input card. Need analog inputs for a temperature sensor? Plug in an analog card. The cards talk to the CPU through a connector at the back of the rack called the backplane. This is the standard for serious industrial work.
How a PLC Thinks — The Scan Cycle
Now here’s something important — and it confuses a lot of beginners. A PLC does not work like a normal computer program. A normal program runs from top to bottom and then stops. A PLC program runs in a loop that never stops, called the scan cycle.
The scan cycle has four steps that the PLC repeats thousands of times per second, every second, forever — until you turn it off.
Figure 1.2 — The Four-Step PLC Scan CycleRepeats continuously thousands of times per second. Total time per cycle = scan time, typically 1–10 ms.
- Read inputs — the CPU takes a “snapshot” of every input terminal. Is the START button pressed? Yes or no. Is the level sensor seeing water? Yes or no. The CPU writes all these answers into a memory table called the input image.
- Execute the program — the CPU reads your ladder program from top to bottom, one rung at a time. For each rung, it looks at the input image, decides what the output should be, and writes the result into another memory table called the output image.
- Update outputs — the CPU sends the output image to the physical output terminals, energising or de-energising motors, valves, and lamps in the real world.
- Diagnostics & communication — the PLC checks itself for problems (memory OK? watchdog OK?) and exchanges data with other devices on the network (HMIs, other PLCs, SCADA).
Why Scan Time Matters — A Quick Example
The total time for one full scan cycle is called the scan time. For a small program, it’s typically 1 to 10 milliseconds. That’s so fast you can hardly imagine it — your eye blinks in 100 ms, so the PLC can complete 10 to 100 scans during one of your blinks.
But here’s the catch. The PLC only “sees” what’s happening in the world during step 1 of each scan. If a fast event happens between two scans, the PLC may miss it entirely.
Quick thought experiment
Imagine a small part flying past a sensor in 5 ms. If your PLC’s scan time is 8 ms, the part may zoom past the sensor and disappear before the PLC ever takes its snapshot — and the PLC will swear nothing happened. That’s why for very fast events (like counting pulses from an encoder), engineers use special high-speed counter modules that work outside the regular scan cycle. We’ll meet them in Chapter 8.
Modifying the Operation
Here’s the magic trick that made PLCs unstoppable. To change a relay-based control panel, you have to physically pull out wires, add new relays, and re-wire the terminals. A small modification can take hours and is a frequent cause of mistakes and downtime.
To change a PLC-controlled system, you do this instead: open the programming software on your laptop, edit the ladder logic, click “Download”, and the new logic takes effect in the very next scan cycle. The wiring to the field devices — sensors, switches, motors, valves — usually doesn’t change at all.
This single feature — software-defined control logic — is the entire economic justification for the PLC industry. It is why every modern factory, refinery, water-treatment plant, and manufacturing line in the world runs on PLCs rather than relay panels.
PLC vs. Personal Computer — What’s the Difference?
Students often ask, “If a PLC has a CPU and memory and I/O, isn’t it just a computer? Why can’t I use my laptop instead?” Good question. The architecture is similar, but they’re designed for very different jobs. Here’s the comparison.
| Feature | PLC | Personal Computer |
|---|---|---|
| Operating environment | Industrial — heat, dust, vibration, electrical noise | Office — controlled, climate-conditioned |
| I/O design | Built-in industrial I/O (24 V DC, 120 V AC, 4–20 mA, RTD, thermocouple) | Generic ports (USB, HDMI, Ethernet) |
| Programming languages | Ladder, Function Block, Structured Text, SFC, Instruction List (IEC 61131-3) | C++, Python, Java, JavaScript, etc. |
| Execution model | Cyclic scan, deterministic | Multi-tasking, non-deterministic |
| Operating system | Real-time embedded, often proprietary | General-purpose (Windows, macOS, Linux) |
| Reliability target | 24 / 7 / 365 continuous operation | Designed for daily use |
| Repairability | Modular — swap a faulty I/O card in seconds | Usually replace whole machine or motherboard |
So a laptop in a factory would die within weeks — the dust, vibration, and electrical noise would destroy it. And it would never be reliable enough to control machinery, because Windows can pause for a few seconds while doing background tasks. In a PLC, “deterministic” means the timing is guaranteed — you always know when the output will respond.
What’s a PAC?
You might also hear the term Programmable Automation Controller (PAC). A PAC is a modern controller that combines PLC ruggedness with the multi-tasking power of a PC. PACs handle motion control, machine vision, advanced math, and database connectivity that traditional PLCs couldn’t do. The line between high-end PLCs and PACs has blurred a lot in the last decade — many controllers today are really both.
PLC Sizes — From Tiny to Huge
Not every job needs the same size of PLC. A simple irrigation timer doesn’t need the same controller as an oil refinery. So PLCs are sold in four size classes, mostly defined by their I/O count — the total number of inputs plus outputs the device can handle.
| Class | I/O Range | Typical Applications |
|---|---|---|
| Nano | < 15 I/O | Vending machines, irrigation timers, simple stand-alone equipment, training kits |
| Micro | 15 – 128 I/O | Small machines, packaging lines, single-conveyor systems, HVAC controls |
| Medium | 128 – 512 I/O | Production cells, multi-axis machines, batch process skids, small water plants |
| Large | > 512 I/O | Whole production lines, refineries, automotive assembly plants, power stations, large water-treatment facilities |
When choosing a PLC, you also look at scan speed, supported communication protocols (EtherNet/IP, Modbus, PROFINET, etc.), supported programming languages, available memory size, and price. The golden rule is simple: pick the smallest PLC that does the job. A nano running a paint plant will run out of resources, but a large PLC running a vending machine is a waste of money.
Figure 1.4 — The Spectrum of PLC SizesFrom a postcard-sized nano controlling an irrigation timer, all the way up to a large multi-rack system running an entire refinery. Match the PLC to the job.
Worked Examples
Three Real PLC Systems — Let’s See What’s Inside
Now let’s put theory into practice. We’ll look at three systems you’ve actually seen with your own eyes — a bottle filling line, a car parking gate, and a road traffic light. For each one, we’ll list the inputs (what the PLC sees), the outputs (what the PLC drives), and walk through what the PLC does step by step. We won’t write the actual ladder program yet — that’s coming in Chapter 5 — but you’ll start thinking like a PLC engineer.
The problem: A beverage factory has a conveyor belt that brings empty bottles under a filling nozzle. When a bottle arrives, the conveyor must stop, the nozzle must fill the bottle to a set level, then the conveyor must move on so the next empty bottle takes its place. We want to automate this with a PLC.
Figure 1.5 — Bottle Filling LayoutThree inputs (Start button, Position sensor, Level sensor) and two outputs (Fill valve, Conveyor motor) — a perfect job for a nano or micro PLC.
Inputs & Outputs
Inputs (PLC sees)
- X1 Position sensor — detects when bottle is under nozzle
- X2 Level sensor — detects when bottle is full
- X3 Start button — operator presses to start the line
- X4 Stop button — operator presses to stop the line
Outputs (PLC drives)
- Y1 Fill valve — opens to release liquid into bottle
- Y2 Conveyor motor — moves the belt
- Y3 Status lamp — green when running, red when stopped
What the PLC does (the control logic)
- Operator presses Start (X3). The PLC turns ON the conveyor motor (Y2). Bottles start moving.
- When a bottle reaches the filling station, the position sensor (X1) sees it. The PLC stops the conveyor (Y2 OFF) and opens the fill valve (Y1 ON).
- Liquid flows into the bottle. As soon as the level sensor (X2) detects the liquid has reached the top, the PLC closes the fill valve (Y1 OFF).
- The PLC turns the conveyor back ON (Y2 ON). The full bottle moves away, and the next empty bottle approaches.
- The cycle repeats forever — until the operator presses Stop (X4), which turns everything OFF.
The problem: A shopping mall has a parking garage with capacity for 50 cars. We want a PLC to count how many cars enter and leave, automatically open the gate when a car arrives, and switch on a “PARKING FULL” sign when capacity is reached.
Figure 1.6 — Car Parking LayoutTwo sensors at entry and exit count cars. The PLC uses an internal counter to track occupancy and turns on a “FULL” sign at capacity.
Inputs & Outputs
Inputs (PLC sees)
- X1 Entry sensor — pulses when a car enters
- X2 Exit sensor — pulses when a car leaves
- X3 Reset button — resets the counter to zero
Outputs (PLC drives)
- Y1 Entry gate motor — opens entry barrier
- Y2 Exit gate motor — opens exit barrier
- Y3 “FULL” sign — lights when capacity reached
- Y4 Numeric display — shows current car count
What the PLC does (the control logic)
- The PLC keeps an internal counter in its memory, starting at 0. This counter holds the current number of cars in the parking.
- When a car arrives at the entry, the entry sensor (X1) goes ON. The PLC increments the counter (counter = counter + 1) and opens the entry gate (Y1) for a few seconds.
- When a car leaves through the exit, the exit sensor (X2) goes ON. The PLC decrements the counter (counter = counter − 1) and opens the exit gate (Y2).
- If the counter equals 50, the PLC turns ON the FULL sign (Y3) and refuses to open the entry gate any more — no new cars can come in. As soon as a car leaves and the counter drops below 50, the FULL sign turns OFF and the entry gate works again.
- The PLC continuously sends the counter value to the numeric display (Y4), so anyone passing by can see how many cars are in the parking.
The problem: A four-way road intersection needs traffic lights. We have three lamps in each direction (Red, Yellow, Green) on the North-South road, and three on the East-West road. We want a PLC to cycle them in the proper sequence so traffic flows safely — and never both directions green at the same time (that would cause accidents).
Figure 1.7 — Traffic Light LayoutSix lamps total — three each for North-South and East-West directions — driven by the PLC through internal timers. An optional pedestrian button extends the red phase.
Inputs & Outputs
Inputs (PLC sees)
- X1 Pedestrian button — extends red phase
- X2 Manual override switch — fixed flashing yellow
- (no other inputs needed) — the cycle is purely time-based
Outputs (PLC drives)
- Y1 N-S Red lamp
- Y2 N-S Yellow lamp
- Y3 N-S Green lamp
- Y4 E-W Red lamp
- Y5 E-W Yellow lamp
- Y6 E-W Green lamp
What the PLC does (the timing sequence)
- Phase 1 — N-S green, E-W red (30 seconds). PLC turns ON Y3 (N-S Green) and Y4 (E-W Red). Cars on the North-South road can go; East-West cars wait.
- Phase 2 — N-S yellow, E-W red (5 seconds). PLC turns OFF Y3, turns ON Y2 (N-S Yellow) as a warning. E-W stays red.
- Phase 3 — N-S red, E-W green (30 seconds). PLC turns OFF Y2, turns ON Y1 (N-S Red) and Y6 (E-W Green). Now East-West cars can go.
- Phase 4 — N-S red, E-W yellow (5 seconds). PLC turns OFF Y6, turns ON Y5 (E-W Yellow) as a warning. N-S stays red.
- Cycle repeats. The PLC starts again at Phase 1 — and continues forever.
If the pedestrian button (X1) is pressed, the PLC adds an extra 10 seconds to the next “all red” period so people can cross safely.
Common Student Mistakes
Things to watch out for in this chapter:
- “A PLC is just a computer.” The architecture is similar, but the operating environment, I/O design, deterministic execution model, and real-time guarantees are completely different. A regular PC cannot replace a PLC in industrial work.
- Confusing PLC with PC. In writing, always use PLC (programmable logic controller). Many older textbooks use just “PC” — but in modern industry, “PC” almost always means personal computer.
- Ignoring scan time. A 10 ms scan time means the PLC sees the world in 10 ms snapshots. Anything happening faster than that may be missed entirely. Always check whether your fastest input is slower than the scan time.
- Assuming I/O modules are interchangeable across brands. An Allen-Bradley input module will not fit a Siemens rack, even if they look similar. PLC ecosystems are mostly closed.
- Mixing up fixed and modular I/O. Fixed = one sealed package with a set I/O count. Modular = a chassis with separate plug-in cards that can be expanded.
- Forgetting that the program runs continuously. Unlike a script that runs once and exits, a PLC program runs forever — every rung is re-evaluated every scan, thousands of times per second.
Quick Recap
The seven things to remember from Chapter 1:
- A PLC is an industrial-grade computer that replaces hardwired relay logic with software-defined control.
- Every PLC has four parts: Power Supply, CPU, I/O Section, and Programming Device.
- The PLC runs a continuous four-step scan cycle: Read Inputs → Execute Program → Update Outputs → Diagnostics & Communication.
- Scan time is typically 1–10 ms and determines the PLC’s responsiveness to fast events.
- PLCs differ from PCs in ruggedness, deterministic execution, industrial I/O, and ladder-based programming languages.
- PLC size classes — nano, micro, medium, large — are mainly defined by I/O count and chosen to match the application.
- Real systems (bottle filling, parking, traffic lights) all follow the same pattern: identify the inputs, identify the outputs, then write the control logic that links them.
Review & Self-Assessment
Chapter 1 Review Questions
Try answering each question on your own before tapping to reveal the model answer. The last three questions test the case studies — make sure you understand them.
Q1Define a programmable logic controller in your own words.+
Q2List four major advantages of PLCs over hardwired relay control.+
Q3Name the four functional sections of a PLC and state the purpose of each.+
Q4What are the four steps of the PLC scan cycle?+
Q5What is “scan time” and why does it matter for fast events?+
Q6Differentiate between fixed I/O and modular I/O.+
Q7List three ways a PLC differs from a personal computer.+
Q8A small machine has 8 inputs and 6 outputs. Which PLC size class is appropriate?+
Q9Why is optical isolation used between the field side and the CPU side of an I/O module?+
Q10In the bottle filling case study, what is the PLC’s role when the level sensor (X2) goes ON?+
Q11In the car parking case study, why does the PLC need an internal counter? What happens when the counter reaches 50?+
Q12In the traffic light case study, why is it important that the PLC never turns on both N-S Green AND E-W Green at the same time?+
Stuck on a concept or working on a PLC project?
Get one-on-one guidance from Dr Ahsan Rahman — Head of Electrical Engineering, with two decades of teaching and supervising PLC-based industrial automation projects.