PLC Book Part I — Foundations Chapter 2
Chapter 2 Part I · Foundations of PLC Systems Beginner ⏱ 40 min read ✦ 4 Worked Examples

02

PLC Hardware Components

In Chapter 1 we met the PLC and learned what its four parts are. Now we open it up and look inside. We’ll see how I/O modules talk to sensors and motors, what makes a discrete signal different from an analog one, what kinds of memory the CPU uses, and how operators interact with the whole system through an HMI screen. Four worked examples at the end will let you put the theory into practice.

What you’ll be able to do after this chapter

Your goals for this chapter:

  • Tell the difference between discrete and analog I/O signals and pick the right module for a given field device.
  • Describe the role of common special I/O modules (high-speed counters, motion, RTD, communication).
  • Read a manufacturer’s I/O specification sheet and check whether a module fits your sensor or actuator.
  • Explain what’s inside the CPU and how memory is organised (program file, data file, I/O image tables).
  • Distinguish RAM, ROM, EPROM, EEPROM, and flash — and know which one stores what.
  • Describe what an HMI is and what makes a good operator screen.
  • Pick the right modules and estimate memory size for a small real-world project.

Key Concepts & Terms

I/O sectionDiscrete I/OAnalog I/OSourcing SinkingSpecial I/ORTD moduleHigh-speed counter I/O specificationsSourcing/sinkingOptical isolation CPURAM · ROMEPROM · EEPROM · Flash Volatile vs non-volatileProgram fileData file I/O image tableProgramming terminalData loggingHMI
Section 2.1

The I/O Section — How the PLC Talks to the World

Imagine a PLC sitting alone on a shelf. It has a brain (the CPU), it has memory, it has power. But without anything plugged into it, it can’t see anything happening in the factory, and it can’t do anything in the factory. It’s just a box.

The I/O section is what fixes that. It’s the bridge between the PLC’s electronic world (low-voltage DC, 5 V or 24 V) and the factory’s electrical world (240 V AC motors, 24 V DC sensors, 4–20 mA temperature transmitters, and so on).

THE I/O MODULE FAMILY Pick the modules that match your field devices, and slot them into the rack. Backplane bus — connects all modules to the CPU PSU Power Supply 240 V AC → 24 V DC CPU 🧠 The Brain RUN FLT DI Discrete Input Buttons Switches Sensors AI Analog Input Temperature Pressure Flow DO Discrete Output Motors Solenoids Lamps AO Analog Output VFD speed Control valves Setpoints SPECIAL Special / Comm High-speed Motion · RTD Ethernet ⇡ from sensors ⇡ from transmitters ⇣ to actuators ⇣ to drives

Figure 2.0 — The I/O Module FamilyEach module type handles one kind of signal. The CPU is the brain, but the I/O modules do all the talking to the outside world.

The I/O section sits between the CPU and the field devices, and it does three jobs:

  • Signal conditioning — a 240 V AC signal from a motor contactor is too dangerous to feed directly to a 5 V CPU. The input module steps it down. An analog 4–20 mA signal from a temperature transmitter has to be converted to a digital number the CPU can read.
  • Optical isolation — a small electronic component called an optocoupler separates the field side electrically from the CPU side. There’s no copper connection between them — only a beam of light through a tiny LED. This protects the CPU from voltage spikes, ground loops, and electrical noise.
  • Indication — every modern I/O module has a small LED for each input or output point. When the LED is lit, you know the signal is active. This is a huge help when troubleshooting in a noisy factory.

Think of I/O modules as translators

The CPU speaks one language: clean low-voltage digital. The factory speaks a hundred different ones — 24 V DC, 240 V AC, 4–20 mA, thermocouple millivolts, encoder pulses. The I/O modules are translators. Each module knows one specific factory language and converts it into the CPU’s language (or vice versa for outputs).

Section 2.2

Discrete I/O Modules — On / Off Signals

The simplest kind of signal is one that is either ON or OFF — nothing in between. A pushbutton is pressed or not pressed. A limit switch is tripped or not tripped. A motor is running or stopped. A lamp is lit or dark. We call these discrete signals (some textbooks call them digital signals — same thing).

A discrete input module reads ON/OFF signals from the factory. A typical card has 8, 16, or 32 input points. Each point is a separate channel that handles one field device. Common voltage ratings:

  • 24 V DC — the most common in modern industry. Used with proximity sensors, photoelectric sensors, and 24 V pushbuttons.
  • 120 V AC and 240 V AC — used in older plants and where the field wiring already runs at AC line voltage.
  • 5 V DC (TTL) — used for very fast signals from high-speed encoders and electronic counters.

A discrete output module drives ON/OFF loads — solenoid valves, pilot lamps, motor contactors, alarm bells. Output modules come in three flavours, each with its own personality:

  • Relay output — a tiny mechanical relay inside the module. Can switch AC or DC, isolates the load from the PLC, but slow (5–10 ms) and wears out after millions of operations.
  • Transistor output (DC) — solid-state, very fast (less than 1 ms), no moving parts. Limited to DC loads only.
  • Triac output (AC) — solid-state, fast, AC-only.

Sourcing vs Sinking — A Word of Caution

Beginners often get confused by the terms sourcing and sinking. They describe how the field device is wired with respect to current flow:

  • Sourcing input/output — the device provides current (it’s the source). Common in PNP-style sensors.
  • Sinking input/output — the device absorbs current (it’s the sink). Common in NPN-style sensors.

If you connect a PNP sensor to a sinking-only input module, nothing will work — and you’ll be hunting the bug for hours. Always check the module’s “polarity” specification before wiring. Many modern modules are bidirectional and accept either type, but never assume.

Section 2.3

Analog I/O Modules — Continuous Signals

Not everything in the world is just ON or OFF. The temperature inside a furnace varies continuously from room temperature to 1200 °C. A tank’s water level moves smoothly from 0 to 100 cm. A motor’s speed can be anywhere from zero to maximum RPM. These are analog signals — they take any value within a range.

DISCRETE vs ANALOG SIGNALS Two completely different types of signal — and they need different I/O modules. DISCRETE (ON/OFF) Two states only: 0 or 1 ON OFF time → Examples: Pushbutton · Limit switch · Proximity sensor · Lamp · Motor ANALOG (CONTINUOUS) Any value in a range 100% 0% time → Examples: Temperature · Pressure · Flow · Tank level · VFD speed

Figure 2.1 — Discrete vs Analog SignalsDiscrete signals are like a light switch (on/off only). Analog signals are like a dimmer (any value in between).

An analog input module reads continuous signals from sensors and transmitters. It contains an analog-to-digital converter (ADC) that samples the signal hundreds of times per second and converts it to a digital number that the CPU can use. The most common analog signal standards are:

  • 4–20 mA current loop — the industry standard for long cable runs (up to 1 km). Robust against electrical noise.
  • 0–10 V DC — common for short cable runs in clean electrical environments.
  • ±10 V DC — bipolar signals (positive and negative).
  • RTD / Thermocouple — direct millivolt signals from temperature sensors.

An analog output module works the opposite way. It contains a digital-to-analog converter (DAC) that takes a digital number from the CPU and produces a smooth analog signal — typically 4–20 mA or 0–10 V — to drive a control valve, a variable-speed drive, or a chart recorder.

Resolution — How “Smooth” is the Conversion?

Analog modules have a specification called resolution, measured in bits. A 12-bit module divides its full range into 4,096 steps; a 16-bit module divides it into 65,536 steps. A 16-bit module reading 0 to 100 °C can detect a change of about 0.0015 °C — far more precise than most sensors actually deliver. For most jobs, 12-bit resolution is plenty.

Section 2.4

Special I/O Modules

Beyond plain discrete and analog cards, manufacturers sell a whole family of special I/O modules for jobs the regular cards can’t handle. You’ll meet many of these as you progress, but here are the most common:

  • High-speed counter (HSC) modules — count pulses faster than the PLC’s scan cycle (up to 1 MHz). Used with optical encoders to measure position and rotational speed.
  • Motion control modules — drive servo motors with precise position, velocity, and acceleration profiles. Essential for CNC machines and robotic arms.
  • RTD and thermocouple modules — dedicated to reading temperature sensors directly, with built-in linearisation and cold-junction compensation.
  • Weighing modules — read load cells (typically tiny millivolt signals) for batching, dosing, and tank-content measurement.
  • Communication modules — talk to other PLCs, HMIs, drives, and SCADA systems over Ethernet/IP, Modbus, PROFIBUS, DeviceNet, and so on.
  • Stepper motor modules — generate the precise pulse trains needed to drive stepper motors.
  • BASIC / scripting modules — run custom code (BASIC or C) for tasks the ladder language struggles with, such as complex math or string processing.

The general rule: if your application has a special requirement that doesn’t fit “read this voltage” or “drive this load”, there’s probably a special module for it. Open the manufacturer’s catalogue and look — you’ll usually find one.

Section 2.5

Reading I/O Specifications

Every I/O module ships with a specification sheet — a few pages of numbers that tell you exactly what the module can and can’t do. Reading this sheet correctly is one of the most important habits an automation engineer can develop. Here are the key items to look for:

SpecificationWhat it meansWhy you should care
Number of pointsHow many channels on the card (e.g. 8, 16, 32)Decides how many devices one module can handle
Voltage ratingWhat voltage the module accepts (24 V DC, 120 V AC, etc.)Must match the field device’s voltage exactly
Voltage rangeAcceptable variation (e.g. 22–26 V DC)Real-world supplies aren’t perfectly stable
Input currentHow much current the module draws per pointAffects field power supply sizing
Response timeHow fast the module reacts to a signal changeCritical for fast-moving parts and high-speed counts
Isolation voltageVoltage the optical isolator can withstandHigher = more protection for the CPU
Leakage currentCurrent that flows even when the output is OFFTiny, but can falsely trigger sensitive loads
Operating temperatureRange the module works reliably inMatters for outdoor or hot-process panels
Polarity (DC modules)Sourcing, sinking, or bothMust match your sensor type — easy to get wrong

A common saying in industry is: “the sensor and the module must speak the same language.” If the sensor is a 24 V DC PNP-type with a 5 ms response, the module must accept 24 V DC, support sourcing inputs, and respond in less than 5 ms. We’ll work an example of this in the worked examples section.

Section 2.6

The Central Processing Unit (CPU)

The CPU is the brain of the PLC. We met it briefly in Chapter 1, but now let’s see what’s inside.

The CPU module contains three main parts:

  1. Microprocessor — a digital chip that does the actual thinking. Modern PLCs use 32-bit or 64-bit processors clocked at hundreds of megahertz — fast enough to scan a 1000-rung program in under a millisecond.
  2. Memory — storage for the user program, the data, and the operating system. We’ll look at memory in detail in Section 2.7.
  3. System bus (backplane) — the high-speed channel that lets the CPU talk to the I/O modules and the power supply. Think of it as the spine of the rack.

On the front of a CPU module you’ll typically find:

  • Status LEDs — at minimum, RUN (program executing), FAULT (error), and BAT (battery low). Some CPUs add Communication, Force, and I/O Force indicators.
  • A mode key or switch — with positions like RUN, PROG, and REM (remote). RUN tells the CPU to execute the user program. PROG stops execution so you can edit. REM lets the programming software switch modes remotely over the network.
  • Communication ports — at least one Ethernet port on modern CPUs, often a USB port for direct connection of the programming laptop, and sometimes an RS-232 or RS-485 port for legacy devices.
  • A memory card slot — for an SD card or proprietary memory module. The user program can be backed up to this card and restored after a failure — saving hours of recovery time.

Watchdog Timer — The Safety Net

Inside every CPU there’s a small hardware timer called the watchdog. It must be “petted” by the user program every few milliseconds, otherwise it bites — meaning the CPU resets itself and turns off all outputs. The watchdog catches situations where the program gets stuck in an infinite loop or the scan time grows too long. It’s the safety net that prevents a single bug from leaving the machine running uncontrolled.

Section 2.7

Memory Design and Types

The PLC’s memory holds three things: the operating system (the firmware that runs the PLC itself), the user program (your ladder logic), and the data (timer values, counter values, I/O image tables, internal bits, math results). The CPU keeps these areas neatly separated.

INSIDE THE CPU MEMORY Memory is divided into two big areas — the system memory and the user (application) memory. SYSTEM MEMORY (firmware) Set by the manufacturer. You can’t change it. ▸ Operating System Boots the CPU, runs the scan cycle, handles diagnostics, exchanges data. ▸ Driver Routines Talks to each I/O module, handles communication ports. ▸ Instruction Set / Lookup Tables How to execute every instruction (XIC, XIO, OTE, TON, CTU, ADD…). USER MEMORY (application) This is where your program and data live. ▸ Program File Your ladder logic, function blocks, subroutines, structured text. ▸ Data Files Timer values, counter values, internal bits, integers, floats. ▸ I/O Image Tables Snapshot of every input and output, refreshed every scan cycle. The size of user memory is the spec to look at when sizing a PLC for your project.

Figure 2.2 — PLC Memory MapSystem memory holds the firmware that runs the PLC itself. User memory holds your program and data — this is the part that matters when sizing a project.

Memory Types — RAM, ROM, EPROM, EEPROM, Flash

You’ll meet five different physical memory types when working with PLCs. The big distinction is between volatile memory (loses its contents when power is removed) and non-volatile memory (keeps its contents forever).

TypeVolatile?Writable?Typical use in a PLC
RAM (Random Access Memory)Yes (needs battery)Yes, fastWorking memory for the running program; data files
ROM (Read-Only Memory)NoNo (factory only)Boot loader, fixed firmware
EPROM (Erasable PROM)NoYes, but slow + UV needed to eraseOlder PLCs — backup of user program
EEPROM (Electrically Erasable PROM)NoYes, electrically erasedModern PLCs — stores user program permanently
FlashNoYes, fast bulk eraseModern firmware, memory cards, removable backups

A useful mental picture

Imagine the PLC’s memory is like a desk. RAM is the working surface — fast, but everything gets wiped clean when you leave the room. EEPROM/Flash is the locked filing cabinet — slower to access, but everything stays exactly where you left it, even after a power cut. Modern PLCs keep the master copy of your program in EEPROM/Flash, then load it into RAM at power-up so it can run quickly.

How Memory Size is Measured

PLC memory is usually quoted in kilowords (kW) or kilobytes (kB). One word in older PLCs was 16 bits (2 bytes); modern PLCs use 32-bit words (4 bytes). A small PLC might have 8 kB of user memory; a large one, 32 MB or more. We’ll work an example of memory sizing in the worked examples section.

Section 2.8

Programming Terminals

The programming terminal is the device you use to write, download, and monitor the user program. Today it’s almost always a laptop running the manufacturer’s programming software — RSLogix 5000 / Studio 5000 for Allen-Bradley, TIA Portal for Siemens, GX Works for Mitsubishi, and so on.

The laptop connects to the PLC over Ethernet (most common today) or USB. From the laptop you can:

  • Edit the ladder logic on screen, with auto-completion, syntax checking, and instruction help.
  • Download the program to the PLC’s memory in seconds.
  • Monitor the program live — energised contacts and rungs are highlighted in green, so you can see exactly which logic is active right now.
  • Force inputs and outputs for testing — but be careful, this is for commissioning only.
  • Upload the program from the PLC back to the laptop (a backup) before any change.
  • Save and version the program as a file on disk, so you can keep a history of changes.

In the past, before laptops were common, engineers used handheld programmers — small dedicated devices with a keypad and a tiny screen. They still exist for quick on-site adjustments, but for any serious work, a laptop with proper software is faster, clearer, and more reliable.

Section 2.9

Data Recording (Data Logging)

Modern industry runs on data. Quality engineers want to know the temperature of every batch. Maintenance wants to spot the bearing that’s about to fail. Compliance wants a record of every alarm for the last six months. So PLCs need to record data, not just react to it.

There are three common ways to log data from a PLC:

  • Internal data file — the PLC stores values in its own memory or on a memory card. Simple, but limited by capacity, and you have to retrieve the file later.
  • SCADA / historian — a separate computer running historian software (like Wonderware or AVEVA) connects to the PLC over Ethernet and pulls data continuously. The standard for big plants.
  • Cloud / IIoT — a relatively new approach where the PLC sends data through a gateway to a cloud service (AWS IoT, Azure IoT, Siemens MindSphere). Operators view dashboards on their phone, and machine-learning algorithms predict failures.

What you choose depends on how much data, how often, and who needs to see it. For a small machine, the internal data file is fine. For a refinery, you’ll want a proper historian. We’ll come back to this in Chapter 14 when we look at SCADA in detail.

Section 2.10

Human-Machine Interface (HMI)

A PLC by itself has no screen. It just blinks a few status LEDs. So how does the operator on the factory floor see what’s happening, change a setpoint, or acknowledge an alarm? Through a Human-Machine Interface (HMI) — a colour touchscreen mounted on the control panel.

The HMI is a small computer running a special graphical program. It connects to the PLC over Ethernet and continuously asks the PLC, “What’s the value of N7:0? Is bit B3:0/2 ON?” The HMI then displays the answers as numbers, bars, lights, and trend graphs that the operator can understand at a glance.

A good HMI screen always answers four questions:

  1. Is the system running, stopped, or in fault? A clear status banner at the top.
  2. What are the current key values? Tank levels, motor speeds, batch counts — shown big and clear.
  3. Are there any active alarms? A flashing red banner if yes, with a clear way to acknowledge.
  4. How can the operator interact? Start/stop buttons, mode selectors, setpoint entry, alarm reset.

The “shipping container” rule

An old industry rule says: “a good HMI screen could be understood by a new operator looking through the window of a passing shipping container.” If the screen is too cluttered, too small, or hides important information behind menus, you’ve designed it wrong. We’ll design an HMI screen for our bottle filling line in Worked Example 4.

Worked Examples

Four Real Hardware Decisions Engineers Make Every Day

Now let’s apply what you’ve learned. We’ll work through four hardware-planning problems — choosing modules for a tank system, sizing memory for a project, checking specs against a sensor, and sketching an HMI screen. These are the sort of questions you’ll see in exams, in job interviews, and on the first day of your first PLC project.

1

Example 1 · I/O Selection

Picking the Right Modules for a Heating Tank

Hardware Sizing

The problem: A small chemical company wants to automate a water-heating tank. They give you the list of field devices below, and ask, “Which I/O modules do we need to buy?”

Field devices:

  • Start button (24 V DC)
  • Stop button (24 V DC)
  • High-level float switch (24 V DC)
  • Low-level float switch (24 V DC)
  • Emergency stop button (24 V DC)
  • Temperature sensor — PT100, with 4–20 mA transmitter
  • Pressure sensor — 4–20 mA transmitter
  • Heater — 240 V AC, switched by a contactor
  • Drain solenoid valve — 24 V DC
  • “Running” lamp — 24 V DC
  • “Fault” lamp — 24 V DC
  • Control valve — needs a 4–20 mA setpoint signal

Step 1 — Classify each device

The first job is always to classify each field device. Is it discrete or analog? Is it an input or an output? What voltage?

Inputs (5 discrete + 2 analog)

  • DI 24 V DC: Start, Stop, E-stop, High level, Low level → 5 points
  • AI 4–20 mA: Temperature, Pressure → 2 points

Outputs (3 DC + 1 AC + 1 analog)

  • DO 24 V DC: Drain valve, Run lamp, Fault lamp → 3 points
  • DO 240 V AC: Heater contactor → 1 point
  • AO 4–20 mA: Control valve → 1 point

Step 2 — Pick the modules

Now we go to the manufacturer’s catalogue and pick standard modules that cover what we need. The trick is buy slightly more than you need so the system can grow later. A common rule: leave at least 20% of each module type as spare.

module shopping list
// inputs 1× DI module · 8 points · 24 V DC → uses 5 of 8 (3 spare) 1× AI module · 4 channels · 4-20 mA → uses 2 of 4 (2 spare) // outputs 1× DO module · 8 points · 24 V DC → uses 3 of 8 (5 spare) 1× DO module · 4 points · 240 V AC relay → uses 1 of 4 (3 spare) 1× AO module · 2 channels · 4-20 mA → uses 1 of 2 (1 spare) // total slots in the rack: 5 I/O modules + CPU + PSU = 7 slots needed

Step 3 — Pick the rack and CPU

A 10-slot rack is a comfortable choice — it gives 7 used slots plus 3 spare slots for future expansion. For a small system like this with about 13 I/O points, a nano or small micro PLC is plenty. Allen-Bradley MicroLogix 1400, Siemens S7-1200, or Mitsubishi FX5U would all be reasonable picks.

What we learned: Hardware selection always follows the same three steps: (1) classify each device, (2) count by type and voltage, and (3) pick standard modules with 20–30% spare capacity. Don’t get tricked by mixing AC and DC outputs on one module — most output modules support only one voltage type.
2

Example 2 · Memory Sizing

Will the Program Fit? — A Memory Calculation

CPU Sizing

The problem: Your small project has about 100 ladder rungs, and uses these instructions and data:

  • 100 rungs, each averaging 3 instructions per rung (some have 1, some have 5)
  • 10 timers (TON or TOF)
  • 5 counters (CTU or CTD)
  • 50 internal relays (boolean memory bits)
  • 20 integer registers for math and storage
  • 10 floating-point registers for analog values

You’re choosing between two PLC models: Model A has 8 kB of user memory; Model B has 32 kB. Will Model A fit? Show the calculation.

Step 1 — Estimate program memory

A typical instruction takes about 2 words (4 bytes) in modern PLC memory. With 100 rungs × 3 instructions = 300 instructions:

program memory
program memory ≈ 300 instructions × 4 bytes = 1,200 bytes ≈ 1.2 kB

Step 2 — Estimate data memory

Each timer or counter typically takes 3 words (12 bytes) — preset, accumulated value, and control bits. Each integer register is 1 word (4 bytes). Each float is 2 words (8 bytes). Internal bits are stored 32 to a word.

data memory
timers 10 × 12 bytes = 120 bytes counters 5 × 12 bytes = 60 bytes internal bits ⌈50/32⌉ × 4 = 8 bytes integers 20 × 4 bytes = 80 bytes floats 10 × 8 bytes = 80 bytes ──────── total data = 348 bytes ≈ 0.35 kB

Step 3 — Add overhead and conclude

The PLC also reserves memory for the I/O image table and operating-system overhead — typically about 1–2 kB.

total memory required
program ≈ 1.2 kB data ≈ 0.4 kB I/O image + OS ≈ 1.5 kB ────── ≈ 3.1 kB verdict: Model A (8 kB) fits comfortably, with ~5 kB free for future growth.

Model A is the right choice — it has plenty of headroom for the program to grow, but it’s much cheaper than Model B. Going for the bigger PLC “just to be safe” wastes money. Sizing memory properly is a real engineering skill.

The rule of thumb: aim to fill no more than 50–70% of user memory with your initial program. That leaves room for additions over the equipment’s 15–20 year life. Bigger isn’t always better — it’s just more expensive.
3

Example 3 · Spec Sheet

Does This Module Match the Sensor?

Compatibility Check

The problem: You’ve inherited a project from another engineer. The spec sheet for the discrete input module they ordered is below, and the proximity sensor on the field side is also below. Will they work together? If not, what’s wrong?

Input module specs

  • Voltage: 24 V DC nominal (range 22–26 V)
  • Polarity: sourcing inputs only
  • Response time: 8 ms typical
  • Number of points: 16
  • Isolation: 1500 V AC
  • Operating temp: 0 to +55 °C

Proximity sensor specs

  • Type: NPN open-collector (sinking output)
  • Supply voltage: 10–30 V DC
  • Output current: max 100 mA
  • Response time: 3 ms
  • Operating temp: −25 to +70 °C

Step 1 — Check each spec one by one

  1. Voltage: Sensor accepts 10–30 V DC. Module is 24 V DC. ✓ Match.
  2. Polarity: Sensor is NPN (sinking). Module accepts sourcing inputs only. ✗ MISMATCH!
  3. Response time: Sensor reacts in 3 ms; module accepts 8 ms. ✓ Match — module is the slower one, but that’s fine for the input side.
  4. Temperature: Both work in the 0–55 °C range. ✓ Match.

Step 2 — Diagnose and recommend

The polarity mismatch is the killer. An NPN sensor pulls current from the input down to ground; a sourcing input expects current to flow up from a positive source. Wired together, the input will never see a high signal — the sensor will appear permanently OFF, no matter what’s in front of it.

three options to fix the problem
Option A: change the sensor to a PNP (sourcing) type. Option B: change the input module to one that accepts sinking inputs (or both types). Option C: add an interposing relay between the NPN sensor and the input — works, but adds cost, wiring, and another point of failure. // best practice: Option A or B. Avoid Option C.
The lesson: always check every spec line by line. Voltage compatibility is obvious; polarity (sourcing/sinking) is the most common silent mistake — you can wire everything correctly and still have a system that “doesn’t work” because of one spec mismatch.
4

Example 4 · HMI Design

Designing an HMI Screen for the Bottle Filling Line

Operator Interface

The problem: Remember the bottle filling line from Chapter 1? Now imagine the operator standing in front of it. They need a touchscreen that shows what the system is doing, lets them start and stop it, and warns them about problems. Let’s design the main HMI screen.

From Chapter 1 we listed the inputs and outputs:

  • Inputs: Position sensor, Level sensor, Start, Stop
  • Outputs: Fill valve, Conveyor motor, Status lamp

An operator standing at the screen needs to know four things at all times: what’s the system doing, how much have we made, are there any alarms, and how do I control it?

SAMPLE HMI SCREEN — BOTTLE FILLING LINE ● SYSTEM RUNNING 14:32:08 PROCESS VIEW TANK VALVE OPEN M RUN PRODUCTION STATS BOTTLES TODAY 1,247 RATE / MIN 42 CYCLE TIME 1.4 s UPTIME 98.4% START STOP ALARMS (0) SETTINGS

Figure 2.3 — Sample HMI ScreenA clean operator interface with status banner, live process view, key production stats, and four large buttons (Start, Stop, Alarms, Settings). Touch-friendly and readable at a glance.

What every region of the screen does

  1. Status banner (top, full-width). One single colour answers the question “what’s the machine doing?” — green = running, red = fault, yellow = stopped. The current time is on the right so operators have a timestamp for any incident they note down.
  2. Process view (left panel). A simple cartoon of the actual machine, with parts that change colour or move when their state changes. The valve symbol turns green when the PLC’s Y1 output is ON. The motor circle turns red when Y2 is ON. This visual feedback tells the operator what is happening, not just that something is happening.
  3. KPI tiles (right panel). The numbers management cares about — total bottles produced today, current rate per minute, cycle time, uptime percentage. Big fonts, monospace numbers so the digits don’t dance around as values change.
  4. Action buttons (bottom). Four large, clearly-labelled buttons: Start (green), Stop (red), Alarms (yellow), Settings (blue). Each button is at least 80×120 pixels so a finger in a glove can hit it reliably. The Alarms button shows the current count — “Alarms (0)” if all is well, “Alarms (3)” if there are three to acknowledge.
The HMI design rule: if the operator has to read the screen to know what’s happening, you’ve designed it wrong. The status colours, animations, and big numbers should let them see what’s happening from across the room. Reading is reserved for diagnostic detail screens.

Common Student Mistakes

Things to watch out for in this chapter:

  • Confusing discrete with analog. A pushbutton is discrete (pressed / not pressed). A pressure sensor reading 4–20 mA is analog (any value in between). They need different module types — they are not interchangeable.
  • Mixing AC and DC on the same output module. Most output modules are either AC or DC, not both. A 240 V AC contactor cannot share a module with a 24 V DC solenoid.
  • Ignoring sourcing/sinking polarity. An NPN sensor on a sourcing-only input will silently fail. Always check the polarity spec — it’s the most common cause of “the system doesn’t work” calls.
  • Buying the biggest PLC “to be safe”. A bigger PLC isn’t always better — it’s just more expensive. Size memory and I/O for the project, with 20–30% spare for growth, and stop there.
  • Forgetting that RAM needs a battery. Older PLCs lose their program if the backup battery dies during a power cut. Always keep the program backed up to EEPROM, Flash, or a memory card.
  • Cluttering the HMI screen. An HMI is not a software dashboard. Every element competes for the operator’s attention — fewer, bigger, clearer is always better.
  • Confusing “data logging” with “data display”. Showing a value on the HMI is not logging — it has to actually be saved somewhere (memory card, historian, cloud) to count as logged.

Quick Recap

The eight things to remember from Chapter 2:

  • The I/O section is the bridge between the CPU and the field, doing signal conditioning, optical isolation, and indication.
  • Discrete I/O handles ON/OFF signals (buttons, switches, lamps); analog I/O handles continuous signals (temperature, pressure, level).
  • Output modules come in three types: relay (slow, switches AC or DC), transistor (fast, DC only), and triac (fast, AC only).
  • I/O specs always include: voltage, points, response time, isolation, polarity, and operating temperature — and they must match the field device.
  • The CPU contains a microprocessor, memory, and the system bus, plus a watchdog timer that protects against runaway programs.
  • PLC memory is split between system memory (firmware, fixed) and user memory (program + data, what we size for our project).
  • Memory types: RAM (volatile, fast), EEPROM/Flash (non-volatile, holds the program forever).
  • The HMI is the operator’s window into the system — a good screen is readable across a room, not just up close.

Review & Self-Assessment

Chapter 2 Review Questions

Try answering each question on your own before tapping to reveal the model answer. The last four questions test the worked examples — make sure you can do those calculations.

Q1What three jobs does the I/O section perform?+
(1) Signal conditioning — converts factory voltages and currents into clean signals the CPU can read; (2) Optical isolation — electrically separates the field side from the CPU side, protecting the CPU from voltage spikes and noise; (3) Indication — uses LEDs on each point so technicians can see signal states during troubleshooting.
Q2Define discrete and analog signals, and give two examples of each.+
Discrete signals have only two states (ON/OFF, 0/1). Examples: pushbutton pressed/released, limit switch tripped/not tripped, lamp on/off. Analog signals take any value in a continuous range. Examples: temperature reading from a PT100, pressure from a 4–20 mA transmitter, tank level from an ultrasonic sensor.
Q3Compare relay, transistor, and triac discrete output modules.+
Relay outputs use a tiny mechanical relay — they switch AC or DC, isolate the load, but are slow (5–10 ms) and wear out. Transistor outputs are solid-state, very fast (<1 ms), no moving parts, but DC only. Triac outputs are solid-state, fast, AC only. Choose based on your load (AC vs DC) and required switching speed.
Q4What is the difference between sourcing and sinking inputs?+
A sourcing field device provides current (it sources current to the input). A sinking device absorbs current (it sinks current from the input). PNP sensors are typically sourcing; NPN sensors are typically sinking. The input module’s polarity must match the sensor type, otherwise the input will not register correctly.
Q5What does “resolution” mean for an analog module, and why does it matter?+
Resolution is the number of bits the analog-to-digital converter uses, which determines how finely the analog range is divided. A 12-bit module divides its range into 4,096 steps; a 16-bit module into 65,536 steps. Higher resolution = more precise readings. For most jobs, 12-bit is plenty; high-precision applications (laboratory, weighing) may need 16-bit.
Q6List three types of special I/O modules and what they do.+
Any three of: High-speed counter (counts pulses faster than the scan time, used with encoders); Motion control (drives servo motors with position/velocity profiles); RTD/thermocouple (reads temperature sensors directly with linearisation); Weighing (reads load cells); Communication (talks to other PLCs/HMIs over Ethernet, Modbus, etc.); Stepper motor (generates pulse trains).
Q7What does a watchdog timer do inside the CPU?+
The watchdog is a hardware timer that must be reset by the user program every few milliseconds. If the program fails to reset it (because of an infinite loop or a runaway scan), the watchdog “bites” — the CPU automatically resets and turns OFF all outputs. It’s the safety net that prevents bugs from leaving the machine running uncontrolled.
Q8Distinguish volatile from non-volatile memory and give an example of each.+
Volatile memory loses its contents when power is removed (unless backed up by a battery). Example: RAM. Non-volatile memory keeps its contents indefinitely without power. Examples: ROM, EPROM, EEPROM, and Flash. Modern PLCs typically run from RAM (fast) but back up the program to EEPROM/Flash (permanent).
Q9Example 1 — A system has 6 discrete inputs at 24 V DC, 3 analog inputs at 4–20 mA, and 4 discrete outputs at 24 V DC. List the modules you would order.+
Following the same approach as Worked Example 1: 1× DI module with 8 points 24 V DC (6 used, 2 spare); 1× AI module with 4 channels 4–20 mA (3 used, 1 spare); 1× DO module with 8 points 24 V DC (4 used, 4 spare). Total: 3 I/O modules, plus CPU and PSU = 5 slots needed.
Q10Example 2 — A program has 200 rungs averaging 4 instructions each, plus 20 timers, 10 counters, 80 internal bits. Estimate the total memory required.+
Program: 200 × 4 × 4 bytes = 3,200 bytes ≈ 3.2 kB. Data: timers 20×12 = 240, counters 10×12 = 120, bits ⌈80/32⌉ × 4 = 12, total ≈ 372 bytes ≈ 0.4 kB. Plus 1.5 kB I/O image and OS overhead. Total ≈ 5.1 kB. An 8 kB PLC fits with about 35% spare; a 16 kB PLC fits with 70% spare.
Q11Example 3 — A PNP sensor is connected to a sinking-only input module. What will happen, and how do you fix it?+
A PNP sensor sources current upward to the input. A sinking input expects current to flow downward into ground. With this wiring, no current flows through the input — the input will appear permanently OFF, regardless of the sensor’s actual state. Fix: either change the sensor to NPN type, or change the input module to one that accepts sourcing inputs (or both polarities). An interposing relay can also work but is rarely a good engineering choice.
Q12Example 4 — Name the four regions of a good HMI screen and what each one shows.+
(1) Status banner at the top — a single colour showing whether the system is running, stopped, or in fault. (2) Process view — a simple cartoon of the machine with parts that animate as their states change. (3) KPI tiles — large numeric displays of the values management cares about (production count, rate, uptime). (4) Action buttons at the bottom — large, clearly-labelled Start, Stop, Alarms, and Settings buttons.

Need help sizing the hardware for your 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.

Request Consultation →