
Explore the fundamentals and practical use of finite state machines in PLC programming for programmers and engineers, with theory and practice across ladder logic, function block diagram, and structured text.
Master the fundamentals of finite state machines, their states, transitions, events, actions; implement across FBD, CFC, LD, ST with SR flip-flop and case statements, then build an elevator control system.
Explore the fundamentals of finite state machines, balancing mathematical foundations with practical application to design elegant control solutions for PLCs and spot common FSM mistakes.
Explore what a finite state machine is and how it uses finite states, transitions, and actions to model industrial automation, with examples like traffic lights and a conveyor belt.
Explore the IEC 61131-3 standard languages—FBD, LD, IL, ST, and SFC—and how their strengths support implementing finite state machines across PLC brands.
Explore function block diagram as a graphical language for implementing finite state machines. See how fbd shows clear left-to-right signal flow and supports pid controllers, filters, and temperature control.
Explore continuous function chart, an enhanced function block diagram with free block placement that maps state transitions visually, enabling intuitive FSM design, debugging, and maintenance in complex PLC control.
Explore how ld implements state representation, transition logic, and interlocking in ladder diagrams to create a basic state machine using start, stop, and a light coil with a latching circuit.
Examine structured text in the plc environment to reveal its advantages for implementing complex logic, including single-line expressions, boolean operations, and readable, maintainable state-machine code.
Explore sequential function chart (SFC), a visual, step-based approach for sequential control that uses steps, transitions, and actions, and its similarities to finite state machines for cyclic and batch processes.
Explore how sequential programming uses SFC in PLCs: init and step 1 states, transition conditions, and state actions, with a repeating cycle driven by start and stop.
Define and structure well designed states for a finite state machine, using elevator states like idle, moving up, and emergency to illustrate unique, unambiguous actions, transitions, and documentation.
Master finite state machine transitions by designing triggers, guard conditions, and safety-first priorities to achieve complete coverage, deterministic behavior, and reliable, safe operation in programmable logic controller programming.
Explore the elevator FSM transition diagram, showing idle door open/closed, moving up or down, door opening, and emergency stop connections, with guards and timeouts guiding safe, recoverable operation.
Transition from theory to practical FSM implementation in PLC programming by applying SR flip-flop and case-based methods across FBD, CFC, LD, and ST, with maintainability and debugging best practices.
Choose between SR flip-flop and case implementations to model states in PLC FSM, using a central state variable and transitions across languages like FBD, CFC, LD, and ST.
Master the SR flip-flop based FSM by applying three rules: mutual exclusivity with interlocking, A&D transitions with the previous state active, and automatic reset of prior states for reliability.
Explore case-based finite state machines in PLC programming, using enumeration for type safety, separating evaluation from state changes, and leveraging debugging, testing, and maintainability benefits.
Project Description:
You are to develop a Finite State Machine for a simple elevator that operates between the ground floor and the first floor. The elevator is equipped with various sensors, control elements, and safety systems.
System Specifications
Elevator Cabin
The elevator moves between two floors: Ground Floor (GF) and 1st Floor (1F)
The cabin has automatic doors that open and close
The elevator can transport a limited number of people
Available Sensors
Position sensors: Detect whether the elevator is at the ground floor or 1st floor
Door sensors: Monitor the state of the doors (fully opened/closed)
Weight sensor: Measures the cabin load and detects overload
Timer systems: Various time monitoring for safety and comfort
Control Elements
Call buttons: Separate buttons for ground floor and 1st floor
Emergency stop button: Immediate stop of the elevator in emergency situations
Reset button: Reset after an emergency
Functional Requirements
Normal Operation
The elevator starts in idle state
Users can request the desired floor via call buttons
The elevator travels to the requested floor
The doors open automatically upon arrival
After 5 seconds, the doors close automatically again
The elevator returns to idle state
Safety Functions
Overload protection: If weight is too high, doors remain open and elevator does not travel
Emergency stop: Immediate stop when emergency stop button is pressed
Timeout monitoring:
Doors must fully open/close within 10 seconds
Travel between floors may take maximum 2 minutes
Error handling: In case of timeout errors, the elevator goes into emergency mode
Your Tasks
Task 1: State Identification
Identify all necessary states for this elevator. Consider:
Idle state
Movement states
Door states
Safety states
Task 2: Define State Transitions
Determine for each state:
What conditions must be met to enter this state?
What conditions lead to leaving this state?
Which sensors and inputs are relevant?
Task 3: Create State Diagram
Create a complete state diagram with:
All identified states
All transitions between states
Transition conditions (sensors, timers, buttons)
Clear indication of the start state
Task 4: Scenario Analysis
Track the state transitions for the following situations:
Scenario A - Normal Journey:
Elevator is at ground floor, user wants to go to 1st floor
Describe each state transition from beginning to end
Scenario B - Overload:
Elevator is at 1st floor, doors are open, too many people get in
What happens and how is the problem solved?
Scenario C - Emergency:
Elevator is traveling upward, someone presses the emergency stop button
How does the system react?
Task 5: Implementation in IEC 61131-3 Programming Languages
Implement your Finite State Machine in all four IEC 61131-3 programming languages:
A) Structured Text (ST) - Two Variants:
Variant 1 - SR-Flipflops: Use SET/RESET logic for each state with SR-Flipflops
Variant 2 - CASE Statement: Implement the FSM with CASE statements and state variables
Compare both approaches regarding readability and maintainability
B) Function Block Diagram (FBD):
Use SR-Flipflops (SR function blocks) for each state
Connect Set and Reset inputs with corresponding transition conditions
Structure the logic into clear function blocks
C) Continuous Function Chart (CFC):
Implement each state with SR-Flipflops
Use free positioning for clear presentation
Show data flows between SR-Flipflops
D) Ladder Diagram (LD):
Use SR-Flipflops (Set/Reset coils) for each state
Implement Set and Reset conditions as contact logic
Structure each state as separate network
Implementation Notes:
SR-Flipflops: Each state is represented by an SR-Flipflop
Set conditions: Define when a state is activated
Reset conditions: Define when a state is left
CASE structure (ST only): Use enumerations for state variables
Use consistent variable names in all implementations
Task 6: System Optimization
Analyze your design and answer:
What additional safety features could be useful?
How could the system be extended for three floors?
What improvements would increase user comfort?
Helpful Tips
Start with the simplest scenario (normal journey) and then expand with safety functions
Remember that safety has top priority
Consider that the elevator must always switch to a safe state in critical situations
Use meaningful names for your states and variables
Test your design mentally with various scenarios
Submission
Create complete documentation with:
State diagram
Description of all states and transitions
Implementation in all four IEC 61131-3 programming languages:
Structured Text (ST) - both variants: SR-Flipflops and CASE statement
Function Block Diagram (FBD) - with SR-Flipflops
Continuous Function Chart (CFC) - with SR-Flipflops
Ladder Diagram (LD) - with SR-Flipflops
Analysis of the three scenarios
Your optimization suggestions
Comparison of implementation approaches:
SR-Flipflops vs. CASE statement in ST
Advantages and disadvantages of each programming language for FSM implementation
When which approach is best suited
Explore a practical elevator FSM design in PLC programming, identifying normal, transient, and emergency states for motor motion and door states, with safety, obstacle detection, timeouts, and overload handling.
Examine a complete state transition diagram for an elevator control system, detailing an FSM that handles normal operations, safety, and fault recovery through idle, door, movement, and emergency states.
Explore how an elevator finite state machine handles transient states and prevents deadlocks with time-outs, alarms, and emergency stops. It emphasizes door closing/opening safety, fault detection, and maintenance readiness.
Explore simulating an elevator with a finite state machine in PLC programming, using structures for button transitions, sensors, and timed transitions, plus multi-language state chart implementations.
Model the elevator as a state chart with sff flip-flops, defining idle, moving up, moving down, door opening, door closing, and emergency stop. Demonstrate transitions and simulation testing in reo.
Explore finite state machine actions in PLC programming by modeling entering, during, and exiting states using ARTRIG triggers to control motor up and motor down for elevator motion.
Test the PLC program in CFC by examining movable blocks and line connections between the state chart and action program, noting CFC's flexibility and its visual clutter with many states.
Explore modeling an elevator system with a ladder diagram in PLC programming, using simulation mode to visualize state transitions, activation conditions, and blue indicators.
Examine the elevator finite state machine in PLC programming, highlighting flip-flops and active states in structured text, and contrast it with graphical state charts that show conditions clearly.
Implement finite state machines across plc languages using the sr flip-flop or case statement methods, mastering states, transitions, events, and actions for safety-integrated, maintainable industrial control.
This course is about mastering Finite State Machines (FSM) in industrial automation - the secret behind robust, maintainable control systems used in elevators, manufacturing lines, and process plants worldwide. You'll learn to transform complex sequential control challenges into elegant, professional solutions that your colleagues will admire and maintenance teams will thank you for.
Discover the power of structured programming across all major IEC 61131-3 languages with real industry expertise.
FSMs are the backbone of modern industrial automation, yet many engineers struggle with implementing them properly. This comprehensive course bridges that gap by teaching you both the theoretical foundations and practical implementation techniques used in real industrial projects at companies like Merck, Siemens, and leading automation firms.
What You'll Master:
FSM Theory & Design - Understand states, transitions, and actions in industrial context
Multi-Language Implementation - Code professional FSMs in FBD, CFC, LD, and Structured Text
Two Industry-Proven Methods - SR-Flipflop approach for visual languages and CASE statements for complex logic
Complete Elevator Project - Build a real-world control system with safety features, timeout monitoring, and emergency handling
Professional Best Practices - Safety integration, deadlock prevention, error handling, and maintainable code structure
Perfect For:
PLC Programmers with 6 months to 3 years experience looking to advance their skills
Automation Engineers seeking structured programming methodologies
Electrical Technicians wanting to master sequential control systems
Engineers working with manufacturing equipment, material handling, or process control
Prerequisites:
Basic knowledge of IEC 61131-3 programming languages (Ladder Logic, FBD, or ST) and access to PLC development software (CodeSys, TIA Portal, etc.)
2+ hours of expert video instruction from a practicing automation engineer with Master's degree and 6+ years of hands-on experience at pharmaceutical, automotive, and robotics companies. Learn the techniques that are actually used in industry, not just academic theory.