State Machine Applications

Real-world FSM designs - sequence detectors, traffic lights, and vending machines.

State machines are everywhere in digital systems. This topic applies the FSM design methodology to practical problems: a sequence detector that recognizes bit patterns, a traffic light controller with pedestrian crossing, and a vending machine controller. Each example demonstrates the complete design process from specification to implementation.

Objectives

  • Design a "101" sequence detector (overlapping and non-overlapping versions)
  • Design a traffic light controller FSM with timing and pedestrian input
  • Design a vending machine controller with coin acceptance and dispensing
  • Handle real-world concerns: reset, timing, multiple outputs

Key Takeaways

  • Sequence detectors: states track pattern progress, output on complete match
  • Traffic lights: timed FSM with safety intervals between conflicting phases
  • Vending machines: states track accumulated value, dispense when sufficient
  • Overlapping vs. non-overlapping detection changes the reset behavior
  • Real-world FSMs need reset handling, timing, and multiple output management
  • The design methodology (diagram → table → equations → circuit) works for all applications

Applications

  • Communication Protocols: UART, SPI, I²C all use FSMs for framing and synchronization.
  • Motor Control: Stepper motor sequencing and DC motor state control.
  • User Interfaces: Menu navigation and button handling in embedded systems.
  • Game Logic: Game states (menu, playing, paused, game over) and transitions.

Practice Problems

Problem 1: Design a "110" sequence detector (overlapping). How many states are needed?

Problem 2: A traffic light has Green (30s), Yellow (5s), Red (30s) for each direction. How many states minimum?

Problem 3: A vending machine costs 25¢ and accepts nickels and dimes. How many states for tracking the accumulated value?

Problem 4: What is the difference between overlapping and non-overlapping sequence detection for "101"?