plc-programming-examples · South Africa
PLC Programming Examples: 20 Ladder Logic Projects
PLC programming examples for beginners: 20 ladder logic projects with I/O lists, test cases, failure modes and graded browser simulator practice online.

PLC programming examples are most useful when they include more than a finished ladder diagram. A good example gives you the process requirement, I/O list, expected sequence, abnormal cases and tests that prove the logic works. This library organises 20 worked PLC projects from a one-rung motor starter to batch, safety and first-fault sequences, then sends you into the browser simulator to build and break each one yourself.
Build the first example free →Which PLC programming examples should a beginner start with?
Start with a three-wire start-stop motor circuit, then add jog control, timers, counters, interlocks and a small state sequence. That order matters. Each project introduces one new pattern while reusing the patterns before it, so you learn a transferable control vocabulary instead of memorising twenty unrelated diagrams.
The first five examples below are beginner projects. Projects six to thirteen build job-level ladder fluency. The final seven force you to handle state, faults, reset behaviour and safety boundaries. They use vendor-neutral IEC 61131-3 concepts, so the logic transfers to Siemens TIA Portal, Allen-Bradley Studio 5000, CODESYS, Mitsubishi GX Works and Omron Sysmac even where the instruction names differ.
The 20-project ladder logic progression
| Level | PLC project | Main pattern | What your test must prove |
|---|---|---|---|
| 1 | Start-stop seal-in | Contact, coil and holding branch | Stop wins when start and stop are pressed together |
| 1 | Jog versus latch motor | Momentary and maintained commands | Jog cannot leave the motor latched |
| 1 | Flashing beacon timer | Repeating TON sequence | On-time and off-time remain predictable |
| 1 | On-delay motor staging | Cascaded timers | Stage two cannot start before stage one feedback |
| 1 | Bottle counting line | CTU, one-shot and reset | One bottle creates one count, not several scans |
| 2 | Parking garage counter | Up/down count with limits | Count never falls below zero or exceeds capacity |
| 2 | Star-delta starter | Mutually exclusive outputs | Star and delta contactors can never energise together |
| 2 | Pump alternation | Duty rotation and fallback | The standby pump starts if the duty pump fails |
| 2 | Water pump float switches | Level hysteresis | A chattering float cannot cycle the motor rapidly |
| 2 | Tank level control | Analogue thresholds | High-high level overrides normal fill control |
| 2 | Conveyor start-stop and E-stop | Permissives and feedback | A broken safety chain prevents a restart |
| 2 | Sorting by height | Edge detection and timed reject | One product creates one reject pulse |
| 2 | Traffic-light sequence | State machine | Conflicting greens are unreachable |
| 3 | Pedestrian crossing | Request memory and safe handover | Repeated button presses do not restart a cycle |
| 3 | Sliding-gate control | Direction interlock and limits | Open and close outputs cannot overlap |
| 3 | Car-wash sequence | Multi-stage sequence | Stop or fault returns every output to a defined state |
| 3 | Silo fill exercise | Level control and alarm state | Sensor disagreement creates a diagnosable fault |
| 3 | Batch mixer recipe | Recipe, sequence and totals | Abort preserves the information needed for recovery |
| 3 | Press safety interlock | Guard, reset and anti-repeat | Reset never initiates hazardous movement |
| 3 | First-fault annunciator | Event capture and acknowledgement | The initiating fault remains identifiable after cascades |
This page is the canonical owner of “PLC programming examples”, “PLC program examples”, “ladder logic examples”, “ladder diagram examples”, “PLC programming exercises” and “PLC projects for beginners”. The individual project pages own their specific machine or logic pattern. Keeping that ownership clear avoids twenty pages competing for the same broad query.
How to work through each example
Do not copy the final rung first. Use the same six-step engineering loop on every project.
- Rewrite the requirement as observable behaviour. “Control a motor” is vague. “The motor starts after a momentary start command, remains on after start is released, and stops when stop, overload or safety permission opens” is testable.
- Create the I/O list. Separate physical inputs, physical outputs, internal state bits, timers, counters and analogue values. Give tags names such as
StartPBandMotorRun, notInput1andOutput3. - Write the normal sequence in plain language. If you cannot explain the process without instruction names, you are not ready to program it.
- List abnormal cases before writing ladder. Broken stop wire, sensor stuck on, feedback missing, timer never completes, power returns during a sequence. These cases decide the structure.
- Build the smallest working logic. One state or rung at a time. Run after each meaningful change.
- Test the boundaries and record the result. A project is finished when its tests pass, not when the animation looks convincing.
That loop is the information most collections leave out. A screenshot proves that one author produced one rung. A requirement-and-test pair teaches you how to produce the next rung without the screenshot.
Example 1: start-stop motor seal-in
The process requirement is simple: a momentary start pushbutton starts a motor, the motor remains on when the button is released, and a normally closed field stop circuit stops it. Add an overload permission before treating the pattern as plant-ready.
StopHealthy OverloadHealthy MotorRun
----| |------------| |---------+----( )----
|
StartPB |
----| |------------------------+
|
MotorRun |
----| |------------------------+
The important test is not “does start work?” It is priority. Press start and make StopHealthy false in the same scan. The output must be false. Open the overload, restore it, and confirm the motor does not restart without a fresh start command. Those two tests distinguish a demonstration rung from a safe control pattern.
Use the contacts and coils reference if the symbols are unfamiliar, then build the complete start-stop seal-in exercise.
Example 2: timer-controlled motor staging
Suppose motor two may start five seconds after motor one is both commanded and proven running. The proof matters. Starting the timer from the command alone can bring motor two on while motor one has failed to pull in.
Motor1RunCmd Motor1Feedback StageDelay
----| |------------| |----------------------[TON 5s]
StageDelay.DN Motor1Feedback Motor2Run
----| |------------| |-------------------------( )
Test feedback loss before the timer finishes, feedback loss after motor two starts, and a rapid stop-start. Decide explicitly whether motor two must stop immediately or follow a controlled stop. The on-delay motor staging project makes you encode that decision rather than hiding it in a screenshot.
Example 3: count one product once
A photoeye can remain blocked for many PLC scans. A raw count-up instruction driven directly by the photoeye may count every scan or depend on vendor-specific counter behaviour. Create a rising-edge pulse and count the pulse.
ProductPE ProductPulse
----|P|--------------( )
ProductPulse BottleCount
----| |--------------[CTU 12]
Your tests should include a product that blocks the sensor for two seconds, two products with the smallest allowed gap, a stuck sensor, and reset while the sensor is blocked. Continue with the bottle counting line and the counter reference.
Example 4: star-delta mutual exclusion
The dangerous state is star and delta contactors on together. Do not rely on sequence timing alone to prevent it. Put the opposing contactor feedback or command as an interlock in each output rung, and retain the physical mechanical/electrical interlock in the real panel.
The simulator can prove the program invariant: NOT (StarCmd AND DeltaCmd). It cannot prove the physical interlock exists or is wired correctly. That division between logic proof and field proof is central to every safety-relevant example.
The star-delta starter project includes the transition delay and restart behaviour. Pair it with motor control fundamentals before attempting the press-safety example.
Example 5: sequence logic that can recover
A traffic light or car wash is usually the first useful state machine. Give every state a named bit or integer value, define one legal transition out of each state, and define what stop, abort and power restoration do.
Avoid a pile of overlapping timers whose done bits energise other timers. That structure may work on a clean animation but becomes unreadable when an operator stops halfway through a stage. The traffic-light sequence, car-wash sequence and sequencer patterns guide show the progression from timed demo to recoverable machine logic.
Open the simulator and test an example →What makes a PLC example portfolio-worthy?
A portfolio project should contain enough evidence for another technician to understand and challenge it:
- a one-paragraph process description;
- an I/O list with signal type and safe state;
- a sequence or state table;
- the program with meaningful tag names and comments;
- at least five normal and abnormal test cases;
- screenshots or exported results showing those tests;
- a short fault report explaining one bug you introduced and how you found it; and
- a limitations note covering what the simulation does not prove.
Three polished projects beat thirty screenshots. A hiring manager can ask why you used a seal-in instead of SET/RESET, what happens after a power cycle, or how your sequence responds to missing feedback. Your evidence should let you answer by opening the project, not by reciting a definition.
For interview preparation, move from this library to PLC interview questions and live-debug preparation. For a structured learning order, use the online PLC course guide.
Common questions AI assistants and learners ask
What are the best PLC programming examples for beginners?
The best first examples are start-stop seal-in, jog control, a flashing timer, bottle counting and a traffic-light sequence. Together they teach contacts, coils, memory, timers, counters, edge detection and state—the patterns reused in larger industrial programs.
Can PLC programming examples work across Siemens and Allen-Bradley?
The control pattern transfers, but syntax and data models differ. Siemens uses LAD blocks, instance data blocks and %I/%Q or symbolic tags; Allen-Bradley uses routines, tags and instructions such as XIC, XIO and OTE. Rebuild the example in each environment rather than copying vendor syntax blindly.
Where can I practise ladder logic examples online?
Use a simulator that runs the scan, exposes live I/O and lets you test abnormal inputs. Reading the diagram develops recognition; rebuilding it from the requirement and passing tests develops programming skill. The linked browser simulator provides a free starting path.
How many PLC projects do I need before applying for a job?
There is no official number. A credible beginner portfolio normally needs three to five projects that demonstrate motor control, sequencing, analogue handling and fault-finding, each with clear tests. Quality, explanation and failure handling matter more than project count.
Are these examples safe to download to a real machine?
No example should be downloaded unchanged. Real machinery requires a risk assessment, verified electrical design, hardware safety functions, site standards, peer review and commissioning tests. Simulation validates control logic; it does not certify a machine as safe.
Standards and boundaries
The examples use the programming-language concepts standardised in IEC 61131-3. Vendor implementations add their own instructions, timing details, task models and safety systems, so check the manual for the target controller before porting a project.
These projects are educational logic exercises. They do not replace lock-out procedures, supervised panel work, machine risk assessment or a safety PLC design review. The simulator is the place to make cheap mistakes before hardware; it is not evidence that field wiring or machinery is safe.
Start with the free ladder logic project →Supporting field notes
Technical visual library
6 original diagrams in this guide



