State Diagram Examples & Templates

State diagrams (or state machines) show the different states an object can be in and how it transitions from one state to another based on events.

When to Use State Diagrams

Use state diagrams to model object lifecycles, design control systems, document state-dependent behavior, and illustrate workflow states.

Common Use Cases:

  • IoT device state management
  • Order status tracking
  • User session states
  • Control system logic
  • Game state transitions

Featured State Diagram Examples

Explore 3 real-world state diagram examples with detailed explanations and PlantUML source code.

Smart Home ThermostatSmart Home ThermostatIdleMonitoring temperatureHeatingHeat system ONCoolingAC system ONCore States:- Idle: Monitoring- Heating: Warming- Cooling: CoolingToo coldTarget reachedToo hotTarget reached

Smart Home Thermostat

A state diagram modeling the behavior of a smart home thermostat system with states for idle, heating, cooling, fan only, and error conditions. Shows transitions based on temperature changes, manual overrides, and device failures.

View Example
Traffic Light System State DiagramTraffic Light System State DiagramGreenGreen light ONTraffic flows normallyTimer: 30-60 secondsYellowYellow light ONCaution phaseTimer: 3-5 secondsRedRed light ONTraffic must stopTimer: 30-90 secondsMaintenanceFlashing lightsAll-way stop operationSystem diagnosticsNormal Flow State:- Duration: 30-60 seconds- Vehicle sensors active- Varies by traffic conditionsWarning State:- Fixed duration: 3-5 seconds- Clearance interval- Prepare to stopStop State:- Duration: 30-90 seconds- Pedestrian crossing allowed- Safety priorityFallback Mode:- Flashing operation- All-way stop- Service requiredSystem startupTimer expiresTimer expiresEmergency overrideTimer expiresEmergency vehicleSystem malfunctionSystem malfunctionSystem malfunctionSystem reset (safe default)

Traffic Light System

A state diagram modeling a traffic light control system with the standard Green → Yellow → Red cycle, including a maintenance state for sensor errors and system malfunctions. Demonstrates automated traffic flow control with safety mechanisms.

View Example
Elevator Control SystemElevator Control SystemIdleWaiting for requestsMoving UpAscending to floorMoving DownDescending to floorDoor OpeningOpening doorsDoor ClosingClosing doorsMaintenanceService modeCore States:- Idle: Waiting- Moving: Traveling- Doors: Opening/Closing- Maintenance: ServiceRequest aboveRequest belowCurrent floor requestTarget reachedTarget reachedTimer expiresObstructionDoors closedEmergencyEmergencyService neededService completeMalfunctionMalfunction

Elevator Control System

A state diagram modeling an elevator control system with states for idle, moving up/down, door operations, and maintenance mode. Includes safety mechanisms for emergency stops, overload detection, and proper door sequencing.

View Example

How to Create State Diagrams in PlantUML

With Plantdiagrams AI-powered editor, you can create professional state diagrams in seconds. Simply describe what you want to diagram, and our AI will generate the PlantUML code for you.

1

Open the Editor

Start with our free online PlantUML editor - no installation required.

2

Describe Your Diagram

Use our AI assistant to generate state diagram code from natural language.

3

Customize & Export

Edit the diagram with live preview, then export or share with your team.

Need More Examples?

Explore our full gallery of PlantUML diagram examples across all diagram types and industries.