PLCs and Industrial Control
Introduction
Programmable Logic Controllers (PLCs) are industrial computers built for reliable, deterministic control of machines and processes. Unlike a general PC, a PLC tolerates vibration, electrical noise, and 24/7 operation with predictable scan cycles. DCS (Distributed Control Systems) coordinate many controllers across plants. As an embedded/robotics engineer, you interface with PLCs via Modbus, PROFINET, EtherCAT, or digital I/O, and you apply the same state-machine thinking in your firmware.
PLC vs general-purpose control computer
| Aspect | PLC | PC / embedded SBC |
|---|---|---|
| Purpose | Real-time control | General computation |
| OS | Often proprietary RTOS or bare runtime | Windows, Linux |
| I/O | Built-in isolated digital/analog I/O | USB/GPIO adapters |
| Environment | Factory floor (-20–60 °C, EMI) | Office or cabinet |
| Programming | Ladder, FBD, ST (IEC 61131-3) | C, Python, etc. |
| Certification | SIL/PL levels for safety PLCs | Project-dependent |
Use a PLC when regulations, safety integrity, and maintainer skill (electricians read ladder) dominate. Use embedded MCU when cost, size, and custom algorithms dominate, sometimes both in one system.
PLC scan cycle
Typical cyclic execution:
| Phase | Action |
|---|---|
| Input scan | Copy physical inputs to input image table |
| Program scan | Run ladder/ST logic on image tables |
| Output scan | Drive physical outputs from output image |
| Housekeeping | Communications, diagnostics |
Scan time, e.g. 10 ms, bounds how fast the PLC reacts. Faster not always better, match process dynamics.
IEC 61131-3 languages
| Language | Style | Who uses it |
|---|---|---|
| Ladder Diagram (LD) | Relay logic symbols | Electricians |
| Function Block (FBD) | Block diagrams | Process engineers |
| Structured Text (ST) | Pascal-like | Software-oriented |
| Instruction List (IL) | Low-level | Legacy |
| SFC | Sequential function chart, steps/transitions | Batch processes |
ST example (conceptual):
1 2 3 | |
Same semantics as your C if, different syntax and runtime guarantees.
DCS (Distributed Control System)
| PLC (cell) | DCS (plant) | |
|---|---|---|
| Scope | Machine, line | Entire plant |
| Architecture | Often standalone | Controllers + engineering station + historians |
| Domains | Automotive cell, packaging line | Oil refinery, chemical plant |
Robotics cells often have robot controller + PLC safety + HMI SCADA, know each layer's role.
Control state machines
Industrial sequences are finite state machines with explicit steps:
| Step | Condition to advance | Actions |
|---|---|---|
| IDLE | Start pressed | Open valve A |
| FILL | Level ≥ setpoint | Close A, start mixer |
| MIX | Timer done | Drain |
| DRAIN | Empty sensor | Return IDLE |
SFC in IEC 61131-3 formalizes this, parallel to Sequential logic design and firmware state machines.
Interlocks: never energize motor if guard door open, safety-rated inputs on safety PLC.
Fieldbus and integration
| Protocol | Medium | Notes |
|---|---|---|
| Modbus RTU/TCP | RS-485 / Ethernet | Simple registers, very common |
| PROFINET | Ethernet | Siemens ecosystem |
| EtherCAT | Ethernet frame processing | Low jitter motion control |
| CANopen | CAN | Drives, sensors |
| OPC UA | Ethernet | Information model above fieldbus |
Your embedded gateway might translate Modbus registers to MQTT for cloud, respect scan timing and stale data flags.
Safety PLCs
SIL 2/3 or PL d/e systems use redundant channels, certified toolchains, and restricted languages. Do not implement emergency stop on a hobby MCU without functional safety analysis, use rated safety relay or safety PLC.
Robotics connection
| Function | Typical device |
|---|---|
| Motion | Robot controller or motion PLC |
| Safety | Safety PLC, light curtains |
| Peripherals | Standard PLC I/O |
| HMI | Panel PC or SCADA |
| Custom sensing | Your embedded board → fieldbus slave |
Document interface control document (ICD), register map, timing, fault codes.
Relevant topics
- Sequential logic design
- Real-time systems
- Serial communication protocols
- Firmware architecture
- IEC 61131-3 (Wikipedia)
- Programmable logic controller
Starting points
- Simulate a bottle-filling FSM on paper, inputs, outputs, timers.
- Read Modbus holding register map from a VFD or sensor manual.
- Open CODESYS or vendor PLC IDE demo, compare LD vs ST for same logic.
- List safety interlocks for a robot cell, which belong in safety PLC vs robot controller.
Focus points
- Scan cycle defines worst-case reaction time, not just program complexity.
- Never bypass safety interlocks in "quick fixes."
- Modbus has no standard typing, document endianness and scaling (×0.1 °C).
- Stale data when communication fails, fail safe (de-energize or hold last safe state per risk analysis).
Key points
- PLCs are industrial controllers with cyclic I/O scan and IEC 61131-3 languages.
- DCS scales control across large plants; cells use PLCs plus robot/motion controllers.
- State machines and interlocks structure safe sequential processes.
- Fieldbuses (Modbus, PROFINET, EtherCAT) link your embedded devices to plant equipment.