Teqvault.study

PLC Programming for Complete Beginners

How industrial automation actually works โ€” wiring, ladder logic, timers and counters, motor control, safety systems, and a full automated system as your capstone. Zero assumed knowledge.

โš™๏ธ ๐Ÿ”Œ ๐Ÿญ ๐Ÿ›ก๏ธ ๐Ÿ
Course Progress
0%
MODULE 01

โš™๏ธ What a PLC Actually Is

Before any wiring or programming: what a PLC actually is, why it exists, and how it's different from a regular computer or a microcontroller like the Raspberry Pi.

๐Ÿญ What Problem a PLC Solves

A PLC (Programmable Logic Controller) is an industrial computer built to control machinery โ€” conveyor belts, motors, valves, pumps, packaging lines, elevators, traffic lights โ€” reliably, continuously, for years, in environments a regular computer would never survive: heat, vibration, dust, electrical noise, and constant on/off power cycling.

Before PLCs existed (pre-1970s), factory control was done entirely with physical relays โ€” electromechanical switches wired together in large panels. Changing the control logic meant physically rewiring the panel. A PLC replaced that panel with a computer that runs a program instead โ€” the same physical wiring stays in place, and changing the logic means editing software, not rewiring hardware.

๐Ÿ†š PLC vs. Regular Computer vs. Microcontroller
Regular ComputerMicrocontroller (e.g. Raspberry Pi)PLC
Built forGeneral-purpose computingHobbyist/embedded projects, prototypingIndustrial control, running for years unattended
EnvironmentClimate-controlled office/homeUsually indoors, mild conditionsFactory floors โ€” heat, vibration, dust, electrical noise
How it runs logicMultitasking OS, many programs at onceUsually one program, general-purpose code (Python, C)One continuous scan cycle (this module, below), often ladder logic
Failure toleranceReboots are normal/expectedReboots are normal/expectedDesigned to almost never need a reboot โ€” an unplanned stop can halt a whole production line
๐Ÿ’ก
If you've done the Raspberry Pi courseA lot of this will feel familiar โ€” GPIO pins, digital inputs/outputs, wiring a switch or a motor. A PLC is that same core idea, built to industrial-grade reliability standards, with a different programming style (ladder logic instead of Python) that traces directly back to how electricians already think about relay circuits.
๐Ÿ” The Scan Cycle โ€” How a PLC "Thinks"

A PLC doesn't run code top-to-bottom once and stop โ€” it repeats the same three-step cycle continuously, often hundreds of times per second, for as long as it's powered on:

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ 1. READ INPUTS โ†’ snapshot every input's current state โ”‚ 2. RUN PROGRAM โ†’ execute the logic against that snapshot โ”‚ 3. WRITE OUTPUTS โ†’ update every output based on the result โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ–ฒ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ repeat forever โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
โš ๏ธ
Inputs are "frozen" during one scanStep 1 takes a snapshot of every input at the start of the cycle โ€” if a sensor changes state mid-scan, the program doesn't see that change until the next cycle. This is a deliberate design choice: it keeps the logic's behavior predictable and consistent within a single scan, instead of inputs changing out from under the program mid-calculation.
๐Ÿงฑ The Physical Pieces
๐Ÿง 

CPU Module

Runs the scan cycle and stores the program โ€” the "brain" of the system.

๐Ÿ”‹

Power Supply

Converts incoming AC power (often 120V/240V) into the low-voltage DC (typically 24V) the PLC's electronics actually run on.

๐Ÿ“ฅ

Input Modules

Where field devices connect in โ€” switches, sensors, pushbuttons โ€” read every scan cycle (Module 2).

๐Ÿ“ค

Output Modules

Where field devices connect out โ€” motor starters, solenoid valves, indicator lights โ€” written every scan cycle.

๐Ÿ›ค๏ธ

Backplane/Rack

The physical chassis the modules plug into, providing power and a communication bus between them.

๐Ÿ’ป

Programming Software

Runs on a separate laptop/PC, used to write, download, and monitor the program running on the PLC โ€” not run on the PLC itself.

๐Ÿข Common PLC Brands You'll See
BrandNotes
Allen-Bradley / Rockwell AutomationExtremely common in the US, including many government/military facilities
SiemensDominant in Europe, very common globally
Schneider Electric (Modicon)Widespread, invented the first commercial PLC line
Omron, MitsubishiCommon in machine building and robotics, especially in Asia
๐Ÿ’ก
This course teaches concepts, not one vendor's softwareEvery brand's programming software looks a little different, but the underlying concepts โ€” scan cycle, ladder logic, timers, I/O wiring โ€” are essentially universal across all of them. Once you understand the concepts here, picking up any specific vendor's software is a much smaller jump.
๐Ÿง  Quick Check
A sensor changes state exactly halfway through a PLC's scan cycle. When does the program actually see that change?
MODULE 02

๐Ÿ”Œ Digital I/O โ€” Inputs, Outputs & Wiring

How real switches, sensors, and motors actually connect to a PLC โ€” voltage levels, sourcing vs. sinking, and the two contact types every electrician needs to recognize on sight.

โšก What "Digital I/O" Means

A digital input reads one of two states: ON or OFF (also called 1/0, TRUE/FALSE, or High/Low). A pushbutton, a limit switch, a proximity sensor โ€” anything that's simply "triggered or not" connects to a digital input. A digital output is the same idea in reverse: the PLC turns something ON or OFF โ€” a motor starter coil, an indicator light, a solenoid valve.

๐Ÿ”‹ Common Voltage Levels
VoltageWhere You'll See It
24V DCThe most common industrial I/O voltage โ€” sensors, pushbuttons, most modern PLC I/O modules
120V ACOlder/legacy equipment, some motor control circuits directly
5V DC / 3.3V DCRare directly on PLC I/O โ€” this is more the territory of microcontrollers like the Raspberry Pi's GPIO
โš ๏ธ
Always check the module's rated voltage before wiring anythingConnecting a 120V AC device to a 24V DC-rated input module (or vice versa) can destroy the module instantly. This is the industrial equivalent of the Raspberry Pi course's "never connect 5V to a 3.3V GPIO pin" rule โ€” the exact voltage differs, but the principle is identical: always match voltage before connecting.
๐Ÿ”„ Sourcing vs. Sinking โ€” The Concept That Confuses Every Beginner

This describes which direction current flows through an input or output, and it's the single most common point of confusion for anyone new to industrial wiring.

Sourcing (PNP)Sinking (NPN)
Current flowsOut of the PLC module, through the device, to groundInto the PLC module, from the device, from the supply
The PLC module providesThe positive voltageThe path to ground (0V)
More common inNorth AmericaEurope and Asia
๐Ÿ’ก
A simpler way to think about itAsk "does this module supply the positive voltage, or does it supply the path to ground?" A sourcing (PNP) module pushes voltage out to the device; a sinking (NPN) module pulls current in from the device. Mixing sourcing and sinking devices on the wrong type of module is a common real-world wiring mistake โ€” the device often simply won't work, with no damage, but it also won't be obvious why.
๐Ÿ”˜ Normally Open vs. Normally Closed Contacts

Every switch, sensor, or pushbutton has a "resting" state before it's triggered โ€” this is what NO/NC describes, and it matters enormously for both wiring and logic design.

TypeResting StateWhen TriggeredTypical Use
Normally Open (NO)Circuit open โ€” no current flowsCloses, current flowsStart buttons โ€” you want "nothing happens" until pressed
Normally Closed (NC)Circuit closed โ€” current flowsOpens, current stopsStop buttons and safety circuits โ€” see the callout below
โš ๏ธ
Why stop buttons and safety devices are almost always Normally ClosedAn NC stop button means current is flowing while everything is fine. If a wire breaks, the button fails, or someone unplugs it entirely โ€” the circuit opens exactly as if the button were pressed, and the machine stops safely. If a stop button were wired Normally Open instead, a broken wire would mean the stop button silently stops working, and the machine would have no way to know something failed. This "fail-safe" wiring principle is foundational to Module 9's safety systems.
๐Ÿ”ง A Basic Wiring Example โ€” A Pushbutton to an Input
24V DC Sourcing Input Module (PNP) [24V+] โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ [Pushbutton] (Normally Open) โ”‚ [Input 1] โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ† module reads HIGH only while pressed [24V COM] โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ โ† common/ground reference for the module

When the button is pressed, it completes the circuit from 24V, through the button, into Input 1 โ€” the module reads that as ON. Release the button, the circuit opens, the module reads OFF. Every digital input works on this same basic principle, regardless of the specific sensor or switch involved.

๐Ÿง  Quick Check
Why are emergency stop buttons almost always wired Normally Closed instead of Normally Open?
MODULE 03

๐Ÿชœ Ladder Logic Fundamentals

The most common PLC programming language, designed on purpose to look like the relay wiring diagrams it replaced. Rails, rungs, contacts, and coils โ€” the entire visual vocabulary.

๐Ÿชœ Why It's Called "Ladder" Logic

A ladder logic program is drawn to look like a ladder: two vertical lines (the rails) representing power and ground, with horizontal rungs connecting them โ€” each rung is one independent piece of logic, evaluated top to bottom, every scan cycle.

Rail Rung Rail โ”‚ โ”€โ”€โ”ค โ”œโ”€โ”€โ”ค โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€( ) โ”‚ โ† Rung 1 โ”‚ โ”‚ โ”‚ โ”€โ”€โ”ค/โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€( ) โ”‚ โ† Rung 2 โ”‚ โ”‚

Electricians already read relay diagrams this way โ€” ladder logic was designed deliberately to feel familiar to someone who already understood relay control panels, which is exactly why it became the dominant PLC language.

๐Ÿ”— Contacts โ€” Reading the Symbols
SymbolNameTrue (passes power) Whenโ€ฆ
โ”€โ”€โ”ค โ”œโ”€โ”€Normally Open contact (XIC)The referenced bit is ON
โ”€โ”€โ”ค/โ”œโ”€โ”€Normally Closed contact (XIO)The referenced bit is OFF

A contact doesn't control power itself โ€” it represents a condition being checked. "Is this input ON?" (Normally Open contact) or "Is this input OFF?" (Normally Closed contact). If the condition is true, that contact "passes power" along the rung, continuing to the next element.

โš ๏ธ
Don't confuse ladder logic's NO/NC with the physical switch's NO/NC from Module 2A physical Normally Closed stop button, wired correctly, is read by the PLC as ON while everything is fine (since current is flowing). In the ladder program, you'd typically use a Normally Open contact (XIC) referencing that input โ€” checking "is the stop button's input ON (i.e., not pressed)?" This mismatch between physical wiring convention and ladder logic symbol trips up almost every beginner at least once.
๐Ÿ’ก Coils โ€” The Output of a Rung
SymbolNameBehavior
โ”€โ”€( )โ”€โ”€Output Energize (OTE)Turns ON when the rung's conditions are true, turns OFF when they're false โ€” re-evaluated every scan
โ”€โ”€(L)โ”€โ”€Output Latch (OTL)Turns ON when triggered and stays ON even after the condition goes false โ€” until explicitly unlatched
โ”€โ”€(U)โ”€โ”€Output Unlatch (OTU)Turns a latched output back OFF

A coil sits at the end of a rung and represents the actual output โ€” either a real physical output (a light, a motor starter) or an internal memory bit used elsewhere in the program.

๐Ÿ”€ Series vs. Parallel โ€” AND vs. OR

How contacts are arranged on a rung directly maps to logical AND/OR โ€” exactly like circuit theory.

SERIES = AND (both must be true) โ”‚ โ”€โ”€โ”ค โ”œโ”€โ”€โ”ค โ”œโ”€โ”€( ) Input1 AND Input2 โ†’ Output โ”‚ PARALLEL = OR (either can be true) โ”‚ โ”Œโ”€โ”€โ”ค โ”œโ”€โ”€โ” โ”‚ โ”œโ”€โ”€โ”ค โ”œโ”€โ”€โ”คโ”€โ”€( ) Input1 OR Input2 โ†’ Output โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
๐ŸŒฑ A Complete First Rung โ€” Start/Stop with a Seal-In

This single pattern is one of the most common circuits in all of industrial control โ€” it appears constantly starting in Module 8's motor control circuits.

โ”‚ โ”€โ”€โ”ค โ”œโ”€โ”€โ”€โ”€โ”ค/โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€( ) โ† Start (NO) Stop (NC) Motor coil โ”‚ โ”Œโ”€โ”ค โ”œโ”€โ” โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ† Motor's own contact, in parallel with Start

Pressing Start energizes the Motor coil. The Motor's own contact (wired in parallel with Start) also closes at the same moment โ€” so even after you release the Start button, that parallel contact "seals in" the circuit, keeping the motor running. Pressing Stop breaks the circuit entirely, dropping the seal-in along with it.

๐Ÿง  Quick Check
Two contacts are wired in parallel on a rung, both leading to the same coil. What logic does this represent?
MODULE 04

โฑ๏ธ Timers & Counters

The building blocks that turn simple on/off logic into real automation โ€” delaying an action, counting parts, and building a repeating sequence.

โฑ๏ธ TON โ€” Timer On-Delay

The most common timer type. Starts counting the moment its input goes true; once the preset time elapses, its Done (DN) bit turns ON. If the input goes false before the preset is reached, the timer resets to zero.

ParameterMeaning
PRE (Preset)How long to wait, e.g. 3000ms (3 seconds)
ACC (Accumulated)How much time has elapsed so far, resets to 0 whenever the input goes false
DN (Done) bitTurns ON once ACC reaches PRE โ€” this is what the rest of your program reacts to
๐Ÿ’ก
A real exampleA conveyor motor starts, but you want the discharge gate to stay closed for 3 seconds before opening (to let product build up first). Wire a TON timer's input to "motor running," set PRE to 3000ms, and use the timer's DN bit to open the gate.
โณ TOF โ€” Timer Off-Delay

The mirror image of TON. The DN bit turns ON immediately when the input goes true, and stays ON for the preset duration after the input goes false โ€” useful for "keep something running a little longer after the trigger stops," like a cooling fan.

ScenarioTimer Choice
Wait before starting somethingTON
Keep something running briefly after it should've stoppedTOF
๐Ÿ” RTO โ€” Retentive Timer

Like a TON, except the accumulated time is not reset when the input goes false โ€” it holds its progress and resumes counting next time the input goes true again. Requires a separate explicit "reset" instruction to zero it out. Used for things like tracking total accumulated run-time toward a maintenance interval, across many separate on/off cycles.

๐Ÿ”ข Counters โ€” CTU & CTD
CounterBehavior
CTU (Count Up)Increments by 1 every time its input transitions from false to true; DN bit turns ON once the count reaches the preset
CTD (Count Down)Decrements by 1 on each true transition โ€” commonly paired with a CTU to count something down from a starting batch size
โš ๏ธ
Counters count transitions, not "is it true right now"A counter only increments on the false-to-true edge, not for every scan the input happens to be true. A part sitting in front of a sensor for several scan cycles in a row still only counts once โ€” it's counting events (a part arriving), not measuring how long the input stays on (that's what a timer is for).
๐Ÿงฉ Combining Timers and Counters โ€” A Simple Batch Example

A real, common pattern: count 10 boxes onto a pallet, then pause 5 seconds (to let a wrapper machine finish), then reset and start the next pallet.

Box sensor input โ”€โ”€โ–บ CTU (preset: 10) โ”‚ DN bit โ”‚ โ”€โ”€โ–บ TON (preset: 5000ms) โ€” pause for wrap โ”‚ DN bit โ”‚ โ”€โ”€โ–บ Reset CTU, start next pallet
๐Ÿง  Quick Check
A part sensor stays triggered (true) for 4 full scan cycles in a row as one box passes by. How many times does a CTU counter connected to it increment?
MODULE 05

๐Ÿ“Š Analog I/O & Scaling

Not everything in the real world is simply on or off. Temperature, pressure, level, speed โ€” these need analog I/O, and a conversion step called scaling to turn raw numbers into something meaningful.

๐Ÿ“ˆ Digital vs. Analog Signals

A digital signal is one of two states โ€” on or off. An analog signal is a continuously variable value โ€” a tank's water level isn't "full or empty," it's anywhere from 0% to 100%. Analog inputs/outputs read and write these continuous values, most commonly using one of two standard signal ranges.

Signal StandardRangeNotes
4-20mA current loop4mA = 0%, 20mA = 100%The industrial standard โ€” resistant to electrical noise over long wire runs
0-10V DC0V = 0%, 10V = 100%Common on shorter wire runs, simpler wiring
๐Ÿ’ก
Why 4-20mA starts at 4, not 0Starting the range at 4mA instead of 0mA means a broken wire (reading 0mA) is instantly distinguishable from a legitimate "0%" reading. This is the same fail-safe design principle from Module 2's Normally Closed stop button โ€” a wiring fault produces an obviously-wrong value instead of silently looking like a valid low reading.
๐Ÿ”ข Raw Counts โ€” What the PLC Actually Sees

An analog input module doesn't directly store "4-20mA" โ€” it converts the incoming signal into a raw digital number, typically over a range like 0-32767 (a common 15-bit resolution). The PLC program then has to convert that raw number into an actual engineering value (like degrees, PSI, or gallons) โ€” this conversion is called scaling.

๐Ÿงฎ The Scaling Formula

Scaling maps one range of numbers onto another โ€” the raw count range onto the real-world engineering unit range.

Scaled Value = (Raw โˆ’ RawMin) ร— (EngMax โˆ’ EngMin) รท (RawMax โˆ’ RawMin) + EngMin

Worked example: a pressure transmitter reads 4-20mA, scaled by the analog module into raw counts 0-32767. The transmitter is rated for 0-150 PSI. If the current raw reading is 16,384 (roughly the midpoint):

Scaled = (16384 โˆ’ 0) ร— (150 โˆ’ 0) รท (32767 โˆ’ 0) + 0 = 16384 ร— 150 รท 32767 โ‰ˆ 75 PSI
โš ๏ธ
Getting the min/max values wrong is a common, subtle bugIf the transmitter is actually rated 0-200 PSI but the program is scaled assuming 0-150 PSI, every single reading will be wrong by a consistent, predictable amount โ€” often not obviously wrong at a glance, which makes it a dangerous bug to leave unnoticed. Always double check a sensor's actual rated range against the datasheet, not against what "seems reasonable."
๐Ÿ“ค Analog Outputs

Analog outputs work the same way in reverse โ€” the program calculates a desired real-world value (like "run this valve 60% open"), scales it back down into a raw count, and the output module converts that into an actual 4-20mA or 0-10V signal driving the physical device (often a variable speed drive or a proportional valve).

๐Ÿง  Quick Check
Why does the 4-20mA standard start at 4mA instead of 0mA?
MODULE 06

๐Ÿ”ข Data Types & Memory Addressing

Every input, output, timer, and calculated value needs somewhere to live in the PLC's memory, and a type describing what kind of value it holds. This is the vocabulary every ladder rung and every piece of documentation depends on.

๐Ÿงฑ The Core Data Types
TypeHoldsExample Use
BOOLA single bit โ€” ON/OFF, TRUE/FALSEA digital input, a coil, an internal flag
INTA whole number, typically -32768 to 32767A part count, a raw analog value
DINTA larger whole number (32-bit)A large running total, a high-resolution counter
REALA decimal/floating-point numberA scaled engineering value like 75.3 PSI
TIMER / COUNTERA structured type bundling PRE, ACC, and status bits together (Module 4)Every TON, TOF, CTU, CTD instruction
๐Ÿ’ก
Why the type mattersUsing a BOOL where a REAL is needed (or vice versa) isn't just a style issue โ€” a scaled PSI value like 75.3 simply can't be stored correctly in a BOOL or an INT. Picking the right type is the difference between a program that calculates correctly and one that silently loses precision or won't compile at all.
๐Ÿท๏ธ Two Addressing Styles: Tags vs. Direct Addresses
Direct Addressing (older style)Tag-Based (modern style)
Looks likeI:1/0, O:2/3ConveyorMotorRunning, Tank1_Level
MeaningA specific memory location/module slot/bit positionA human-readable name you assign yourself
ReadabilityRequires memorizing what each address representsSelf-documenting โ€” the name describes the purpose
๐Ÿ’ก
Modern platforms are almost entirely tag-based nowDirect addressing still exists (and you'll see it in older programs and some documentation), but nearly all current PLC programming uses tags โ€” you name a piece of data once, and the underlying memory address is handled automatically. This course uses tag names throughout for exactly that readability reason.
๐Ÿ“› Good Tag Naming Conventions
  • Be specific and consistent โ€” Conveyor1_MotorRunning beats M1 for anyone maintaining the program later, including future-you.
  • Group related tags with a shared prefix โ€” Tank1_Level, Tank1_HighAlarm, Tank1_LowAlarm makes it obvious at a glance which equipment a tag belongs to.
  • Match physical labels where possible โ€” if the wiring diagram calls a device "PB-101" (pushbutton 101), naming the tag PB101_Start keeps the software and the physical panel traceable to each other.
โš ๏ธ
Undocumented direct addresses are a real, common maintenance nightmareWalking into an older facility with a program full of bare I:1/0-style addresses and zero documentation is one of the most common frustrations in industrial maintenance โ€” nobody currently on staff may remember what half the addresses actually control. Good tag names are cheap to write now and expensive to reconstruct later.
๐Ÿง  Quick Check
A scaled pressure reading needs to store a value like 75.3 PSI. Which data type is appropriate?
MODULE 07

๐Ÿ—‚๏ธ Program Organization โ€” Routines & Structured Text

A real facility's program can be thousands of rungs long. Here's how it's kept manageable โ€” breaking it into organized pieces, and a second PLC language better suited to math-heavy logic than ladder.

๐Ÿ“ Why One Giant Program Doesn't Work

A single flat ladder program thousands of rungs long is nearly impossible to navigate, test, or safely modify. Real PLC programs are broken into routines (sometimes called programs or subroutines depending on platform) โ€” each one handling one specific piece of equipment or one specific job, called from a main routine that coordinates them.

MainRoutine โ”œโ”€โ”€ Conveyor1_Control โ”œโ”€โ”€ Conveyor2_Control โ”œโ”€โ”€ Tank_LevelControl โ”œโ”€โ”€ Alarms_Monitoring โ””โ”€โ”€ HMI_Faceplate_Handling
๐Ÿ’ก
The same instinct as organizing code into functionsIf you've done any of this platform's programming courses, this is the exact same reasoning behind breaking a program into functions or classes instead of one giant script โ€” smaller, named, single-purpose pieces are easier to test, easier to reuse, and dramatically easier for someone else (or future-you) to understand.
๐Ÿ“ IEC 61131-3 โ€” The Standard Behind Every PLC Language

Ladder Logic isn't the only PLC programming language โ€” it's one of five standardized languages defined by IEC 61131-3, the international standard nearly every PLC platform follows in some form.

LanguageLooks LikeBest For
Ladder Diagram (LD)Relay-style rungs (Module 3)On/off control logic, the most common starting language
Structured Text (ST)Text-based code, resembling Pascal/BASICMath-heavy logic, loops, complex calculations
Function Block Diagram (FBD)Connected boxes representing functionsSignal-flow-style processes (common in process/chemical industries)
Sequential Function Chart (SFC)A flowchart of steps and transitionsClearly sequential, step-by-step processes (like a batching recipe)
Instruction List (IL)Low-level, assembly-likeRare today โ€” mostly legacy
๐Ÿ“ A Taste of Structured Text

The same conveyor gate-delay example from Module 4, written in Structured Text instead of ladder โ€” notice how much more naturally a mix of conditions and math reads as text versus as rungs.

Structured Text
IF ConveyorRunning THEN
    GateDelayTimer.TON(IN := TRUE, PT := T#3s);
ELSE
    GateDelayTimer.TON(IN := FALSE, PT := T#3s);
END_IF;

IF GateDelayTimer.Q THEN
    DischargeGate_Open := TRUE;
END_IF;
๐Ÿ’ก
Ladder and Structured Text aren't rivals โ€” they coexistMany real programs mix both: ladder for the overall on/off control flow (since it's intuitive to trace and matches how electricians troubleshoot with a multimeter), with Structured Text used inside specific routines that need heavier math or complex conditional logic ladder handles clumsily.
๐Ÿง  Quick Check
A routine needs to calculate a complex scaling formula with several nested conditions. Which language is generally the better fit?
MODULE 08

๐ŸŒ€ Motor Control Circuits

The single most common thing a PLC actually controls in the real world. Motor starters, overload protection, and the standard start/stop pattern from Module 3, now applied to a real physical motor.

โšก Why a PLC Never Switches a Motor Directly

A PLC's digital output is only rated for a small current โ€” enough to energize a relay coil, not enough to directly handle a motor's actual running current. Instead, the PLC output energizes a motor starter (a large relay/contactor plus overload protection), and the starter's much heavier-duty contacts handle the motor's real current.

PLC Output โ”€โ”€โ–บ Motor Starter Coil โ”€โ”€โ–บ Starter Contacts โ”€โ”€โ–บ Motor (small current, (energizes the (heavy-duty, just enough to starter, doesn't handles actual energize a coil) carry motor current) motor current)
โš ๏ธ
This mirrors the Raspberry Pi course's motor driver lesson exactlyA GPIO pin can't safely drive a DC motor directly โ€” it goes through a motor driver chip instead. A PLC output can't safely drive an industrial motor directly either โ€” it goes through a motor starter instead. Same underlying principle, different scale.
๐Ÿ›ก๏ธ Overload Protection

A motor starter includes overload relays โ€” devices that monitor the actual current the motor is drawing and trip the circuit if it draws too much for too long (a sign of a jammed mechanism, a failing motor, or a mechanical overload). This protects the motor from burning out, and the overload's own contact is typically wired directly into the motor's stop circuit โ€” hardware-level protection that works even if the PLC program has a bug.

๐ŸŒฑ The Full Start/Stop/Seal-In, Applied to a Real Motor

This is Module 3's seal-in rung, now with real motor control components labeled:

โ”‚ โ”€โ”€โ”ค โ”œโ”€โ”€โ”€โ”€โ”ค/โ”œโ”€โ”€โ”€โ”€โ”ค/โ”œโ”€โ”€โ”€โ”€โ”€โ”€( ) Start Stop Overload Starter coil โ”‚ โ”Œโ”€โ”ค โ”œโ”€โ” โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ Starter's own auxiliary contact, sealing in Start

Notice the overload relay's contact is wired the same way as the Stop button โ€” Normally Closed, in series. If the overload trips (motor drawing too much current), that contact opens exactly like someone pressed Stop, and the motor shuts down.

๐Ÿ”„ Variable Frequency Drives (VFDs) โ€” Conceptually

For motors that need variable speed rather than just on/off, a VFD sits between the motor starter and the motor, controlling the motor's speed by varying the frequency of the power sent to it. The PLC typically controls a VFD one of two ways:

Control MethodHow It Works
Analog outputA 0-10V or 4-20mA signal (Module 5) tells the VFD what speed to run at
Digital communicationThe PLC sends speed commands over a network protocol (Module 11) instead of a wired analog signal
๐Ÿง  Quick Check
Why does a PLC energize a motor starter's coil instead of switching the motor's power directly from its own output?
MODULE 09

๐Ÿ›‘ Safety Systems & E-Stops

The single most important module in this course. Safety circuits protect people, and they're built on a principle that shows up everywhere else you've seen it so far: fail safely, in hardware, not just in software.

โš ๏ธ Why Safety Is Never "Just Software"

A PLC program can have bugs. A PLC can freeze, lose power unexpectedly, or run corrupted logic. Because of this, safety-critical functions โ€” emergency stops, guard door interlocks, light curtains โ€” are built using dedicated hardware safety circuits that work independently of whether the PLC's program is even running correctly at all.

โš ๏ธ
The core principle, stated directlyNever rely solely on PLC program logic to stop a machine in an emergency. An E-stop button should physically remove power from the hazard through hardware โ€” relays, contactors โ€” not just set a bit that the program then reacts to. If the PLC has crashed, a purely software-based "safety" check does nothing at all.
๐Ÿ”ด The Emergency Stop Button

An E-stop is a Normally Closed, mushroom-head pushbutton (Module 2's fail-safe principle, applied at its most critical) wired directly into a hardware safety circuit โ€” pressing it physically breaks the circuit supplying power to the hazard, immediately, regardless of what the PLC program is doing.

PropertyWhy
Normally ClosedA cut wire or failed button trips the safety circuit exactly like pressing it โ€” fails safe, not silent
Mushroom-head, red on yellowInstantly recognizable and easy to hit under stress, standardized internationally
Latching (stays pressed until twisted/pulled to release)Prevents the machine from restarting the instant someone releases the button
๐Ÿ”— Safety Relays & Redundancy

A safety relay is a specialized relay built specifically for safety circuits, often monitoring TWO independent contacts for every safety input โ€” if those two contacts ever disagree with each other, the safety relay assumes a fault has occurred and trips to the safe state, rather than guessing which one is correct.

๐Ÿ’ก
Redundancy catches failures a single circuit can'tIf a safety circuit only used one contact and that one contact welded itself shut (a real failure mode for relay contacts), the circuit would appear to work fine forever โ€” until the day it actually needed to trip and didn't. Two independently-monitored contacts dramatically reduce the odds of that single point of failure going undetected.
๐Ÿ“‹ Safety Categories โ€” A Brief Overview

Machine safety standards (like ISO 13849) define Categories and Performance Levels describing how robust a safety circuit needs to be, based on the severity and likelihood of the hazard it's protecting against. This is genuinely deep, certification-level territory โ€” the key beginner takeaway is simply that not every safety circuit needs to be built identically; the required level of redundancy and monitoring scales with how dangerous the specific hazard actually is.

๐Ÿšง Other Common Safety Devices
DevicePurpose
Light curtainsAn invisible infrared barrier โ€” breaking it (e.g., reaching into a machine) trips the safety circuit
Guard door interlocksA switch confirming a safety guard/door is fully closed before allowing the machine to run
Two-hand controlRequires both of an operator's hands on separate buttons simultaneously to run a cycle, physically keeping hands out of a hazard zone
๐Ÿง  Quick Check
Why shouldn't an emergency stop rely solely on the PLC program detecting a button press and then commanding a shutdown?
MODULE 10

๐Ÿ–ฅ๏ธ HMI Basics

The touchscreen an operator actually interacts with on the factory floor โ€” how it connects to the PLC, and the design principles that separate a genuinely usable HMI from a confusing one.

๐Ÿ–ฅ๏ธ What an HMI Is

An HMI (Human-Machine Interface) is the screen an operator uses to monitor and control a process โ€” start/stop buttons, live readings (tank levels, temperatures, speeds), alarms, and setpoint entry. It's a separate device from the PLC, communicating with it over a network connection (Module 11) to read and write the same tags the ladder program uses.

๐Ÿ”— How an HMI Connects to Tags

An HMI screen doesn't run its own independent logic โ€” every button, gauge, and indicator on the screen is bound directly to a PLC tag. Pressing an HMI "Start" button writes TRUE to a tag; the ladder program's Start rung reads that exact same tag, same as if a physical button had been pressed.

HMI "Start" Button โ”€โ”€writesโ”€โ”€โ–บ PLC Tag: Conveyor1_StartCmd โ”‚ read by the ladder rung, exactly like a physical button
๐Ÿ’ก
This is why good tag naming (Module 6) matters even more hereAn HMI project might reference hundreds of tags across dozens of screens. Clear, consistent tag names make building and maintaining the HMI dramatically easier โ€” the same Tank1_Level tag gets used in the ladder logic, the HMI's gauge, and the alarm system, all pointing at one single source of truth.
๐Ÿšจ Alarms

An HMI's alarm system watches specific tags against defined limits (e.g., "Tank1_Level below 10%") and displays an alert when the condition is true โ€” often with a log of every alarm's time, description, and whether it's been acknowledged by an operator. Good alarm design deliberately limits how many alarms can fire at once; a screen flooded with 200 simultaneous alarms during a real emergency is far less useful than a screen showing the 3 that actually matter right now.

๐ŸŽจ Basic HMI Design Principles
  • Match the physical layout โ€” if Tank 1 is physically on the left side of a building, put it on the left side of the overview screen too. Operators build a mental map that should match reality.
  • Use color deliberately, not decoratively โ€” red should consistently mean "problem," green "running/good," rather than colors chosen for visual appeal that end up meaning different things on different screens.
  • Show what matters, hide what doesn't โ€” an overview screen with 40 dense data points is harder to act on quickly than one showing the 5 numbers that actually drive a decision, with detail screens available a tap away.
  • Confirm destructive actions โ€” stopping a whole production line or resetting a batch should require a confirmation step, not a single accidental tap.
๐Ÿง  Quick Check
An operator presses "Start" on the HMI screen. What actually happens, mechanically?
MODULE 11

๐Ÿ“ก Communication Protocols

How a PLC talks to an HMI, other PLCs, and the wider plant network. Real networking concepts, applied to the industrial floor.

๐Ÿ”Œ Why PLCs Need to Communicate

A single machine rarely stands alone โ€” a PLC typically needs to talk to an HMI (Module 10), other PLCs controlling adjacent equipment, and often a central SCADA (Supervisory Control and Data Acquisition) system giving plant-wide visibility. Communication protocols are the agreed-upon rules that let all of this talk to each other reliably.

๐Ÿ“ถ Common Industrial Protocols
ProtocolNotes
Modbus (RTU / TCP)Simple, extremely widespread, works over serial (RTU) or standard Ethernet (TCP) โ€” often the "universal fallback" that nearly everything supports
EtherNet/IPAllen-Bradley/Rockwell's primary Ethernet-based protocol, very common in North America
PROFINETSiemens' primary Ethernet-based protocol, very common in Europe
DeviceNet, PROFIBUSOlder, non-Ethernet industrial networks โ€” still found on existing equipment, less common in new installs
๐Ÿ’ก
If this feels familiarThis is the exact same idea as the Networking course's discussion of TCP/IP and application protocols โ€” different specific standards, but the same underlying concept: agreed-upon rules that let different devices exchange data reliably. Modern industrial protocols increasingly run over standard Ethernet, converging with the same infrastructure IT networks already use.
๐Ÿ“š Modbus, a Closer Look

Modbus is worth understanding in a bit more detail since it's so widespread. It organizes data into simple numbered registers โ€” a device (the "slave"/"server") holds data at specific register addresses, and a controller (the "master"/"client") reads or writes those registers.

Register TypeHolds
CoilsSingle ON/OFF bits, read/write
Discrete InputsSingle ON/OFF bits, read-only
Holding Registers16-bit numeric values, read/write
Input Registers16-bit numeric values, read-only
๐ŸŒ IP Addressing on the Plant Floor

Ethernet-based industrial protocols use the same IP addressing concepts from general networking โ€” every PLC, HMI, and networked device gets its own IP address on the plant network. Industrial networks are very commonly segmented (kept physically or logically separate from the general office network) specifically for security and reliability โ€” a problem on the office network shouldn't be able to affect production equipment, and vice versa.

๐Ÿง  Quick Check
Why are industrial plant-floor networks commonly kept segmented/separate from a facility's general office network?
MODULE 12

๐Ÿ› ๏ธ Troubleshooting a PLC System

Everything from this course, applied to the actual job of figuring out why a machine stopped working โ€” a real methodology, not just guessing.

๐Ÿ–ฅ๏ธ Online/Monitor Mode โ€” Watching Logic Run Live

Every PLC programming platform has an "online" or "monitor" mode โ€” connecting a laptop to the running PLC and watching the actual ladder logic execute in real time, with every contact and coil highlighted to show its current true/false state. This is the single most powerful troubleshooting tool available: instead of guessing what the program is doing, you watch it happen.

๐Ÿ’ก
Trace power flow, not just the end resultIf a motor won't start, don't just stare at the coil โ€” look at the entire rung leading up to it. Which specific contact is not passing power? That's your actual starting point: is the Start button input not reading true? Is the Stop or overload contact open when it shouldn't be? Monitor mode shows you exactly which piece of the rung is breaking the chain.
๐Ÿงญ A Systematic Troubleshooting Order
  1. Check the physical machine first โ€” is there an obvious mechanical jam, a tripped overload, a door interlock open? Many "PLC problems" are actually simple physical/electrical issues.
  2. Check field device power โ€” does the sensor/switch actually have power? A surprising number of "broken sensor" calls are actually a blown fuse or a loose terminal.
  3. Check the physical input LED on the PLC module โ€” most input/output modules have small indicator LEDs showing each point's current state, independent of the program. If the input LED isn't lighting when it should, the problem is upstream of the PLC program entirely (wiring, the sensor itself, power).
  4. Go online and monitor the actual rung โ€” if the input LED is correct but the expected output still isn't happening, the issue is in the logic itself โ€” trace power flow through the rung as described above.
  5. Check the output LED and the field wiring beyond it โ€” if the program is correctly energizing the output but the physical device still isn't responding, the problem has moved back out to the field wiring or the device itself.
โš ๏ธ
This mirrors the Networking course's troubleshooting methodology directlyWorking from the physical layer up (or down) through each layer in order โ€” checking power and wiring before assuming it's a software/logic problem โ€” is the exact same "bottom-up methodology" idea from that course's OSI-model-based troubleshooting. The layers are different (relay/wiring vs. network protocols), but the discipline of ruling out the physical layer first is identical.
๐Ÿ” Common Real-World Failure Points
SymptomCommon Cause
Input LED never lights, regardless of the switchLoose wire terminal, blown fuse, or the field device itself has failed
Motor won't start, Start button LED confirms it's pressedOverload tripped, seal-in contact not sealing, wrong tag referenced in the rung
Everything worked, then suddenly the whole system stoppedE-stop circuit tripped somewhere โ€” check every E-stop and safety device in the chain
Analog reading is a fixed, obviously-wrong number (like 0 or full-scale)Broken signal wire, disconnected sensor, or the 4-20mA fault-detection scenario from Module 5
๐Ÿง  Quick Check
A motor won't start. The physical input LED for the Start button correctly lights up when pressed. What's the appropriate next troubleshooting step?
MODULE 13 ๐Ÿ

๐Ÿ Capstone โ€” Program a Complete Automated Sorting System

Every module in this course, combined into one system: a conveyor that runs, counts boxes, sorts rejects with a pusher, tracks a batch total, and shuts down safely โ€” on command or in an emergency.

๐Ÿญ The Scenario

A small sorting station: boxes arrive on a conveyor. A sensor detects each box. A second sensor (a simple height/weight-style "reject" sensor) flags bad boxes. Good boxes continue to the end; bad boxes get pushed off onto a reject line by a pneumatic pusher. The system tracks how many boxes have passed, pauses briefly for the pusher to cycle, and can be stopped instantly at any time.

๐Ÿ—‚๏ธ The I/O List โ€” Start Here, Always

Every real PLC project starts with a documented I/O list before a single rung is written โ€” directly applying Module 6's tag naming discipline.

Tag NameTypeDescription
StartPBBOOL (Input)Start pushbutton, Normally Open
StopPBBOOL (Input)Stop pushbutton, Normally Closed
EStopBOOL (Input)Emergency stop, Normally Closed, hardwired safety circuit (Module 9)
BoxSensorBOOL (Input)Detects any box arriving
RejectSensorBOOL (Input)Detects a box that fails inspection
ConveyorMotorBOOL (Output)Runs the conveyor, via a motor starter (Module 8)
PusherSolenoidBOOL (Output)Fires the reject pusher
BoxCountDINTRunning total of good boxes passed
๐ŸŒฑ Rung 1 โ€” Conveyor Start/Stop/Seal-In

Directly from Modules 3 and 8, with the E-stop added as an additional Normally Closed condition in series โ€” anywhere along this chain going false stops the conveyor immediately.

โ”‚ โ”€โ”€โ”ค โ”œโ”€โ”€โ”€โ”€โ”ค/โ”œโ”€โ”€โ”€โ”€โ”ค/โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€( ) StartPB StopPB EStop ConveyorMotor โ”‚ โ”Œโ”€โ”ค โ”œโ”€โ” โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ ConveyorMotor's own contact โ€” seals in Start
๐Ÿ”ข Rung 2 โ€” Counting Good Boxes

Only count a box as "good" if it triggered the box sensor but not the reject sensor โ€” Module 3's series/AND logic combined with a Normally Closed contact acting as a NOT condition.

โ”‚ โ”€โ”€โ”ค โ”œโ”€โ”€โ”€โ”€โ”ค/โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€( CTU ) BoxSensor RejectSensor Count up
โฑ๏ธ Rung 3 โ€” The Reject Pusher, With a Timed Pulse

Directly applying Module 4's TON pattern โ€” the reject sensor triggers the pusher, and a timer holds it extended just long enough to push the box off, then automatically retracts it.

โ”‚ โ”€โ”€โ”ค โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€( ) RejectSensor โ†’ PusherSolenoid โ”‚ โ”€โ”€โ”ค โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€( TON, PRE=500ms ) Same condition also starts a timer โ”‚ โ”€โ”€โ”ค/โ”œ( from TON DN )โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€( U ) PusherSolenoid Timer done โ†’ unlatch/retract
๐Ÿ–ฅ๏ธ HMI Screen โ€” What the Operator Sees

Applying Module 10's principles: an overview screen showing conveyor running/stopped status (color-coded, matching Module 10's "red means problem" convention), the live BoxCount, a Start and Stop button bound to the same tags the ladder logic reads, and an alarm tile that lights if EStop is ever tripped.

โœ… Definition of Done
SystemPasses Whenโ€ฆ
Start/Stop/Seal-inConveyor starts on Start, keeps running after the button is released, and stops immediately on Stop or E-stop
SafetyE-stop breaks the circuit in the same rung as Stop โ€” not as a separate "check" elsewhere in the program
CountingBoxCount increments only for good boxes โ€” verified against Module 4's "counts transitions, not scans" rule
Reject handlingPusher fires for exactly 500ms per reject and correctly retracts โ€” no sticking on or staying retracted
DocumentationA complete I/O list exists, with tag names any future maintainer could understand without asking you
๐Ÿ Final Challenge

Build, Simulate, and Explain It

Using any PLC simulation software (many vendors offer free trial/educational versions, or use a ladder logic simulator), build this complete system from the I/O list up. Then โ€” the part that actually proves understanding โ€” write a one-paragraph explanation of what happens, in order, if the E-stop is pressed while a box is mid-reject-cycle. Being able to trace that exact sequence through your own rungs is the real test of whether you understand the system, not just whether it runs.

  • A complete, documented I/O list with clear tag names
  • Start/Stop/Seal-in conveyor control with E-stop wired into the same safety chain
  • Accurate box counting that only counts good boxes, verified against transition-counting logic
  • A working timed reject-pusher cycle
  • A written explanation tracing the E-stop-during-reject scenario through your actual logic
Roadmap