Traffic Light Controller in Logisim-evolution: 4-Way FSM and Timer Guide

Direct Answer: Building a Traffic Light Controller in Logisim-evolution

A Traffic Light Controller in Logisim-evolution is implemented as a synchronous Moore Finite State Machine (FSM) coupled to a programmable 4-bit down-counter timer driven by a 1 Hz clock. In a standard 4-way intersection, North-South (NS) and East-West (EW) directions alternate across four core states (or six states when including 1-second All-Red clearance intervals): NS_Green / EW_Red (15s), NS_Yellow / EW_Red (3s), NS_Red / EW_Green (15s), and NS_Red / EW_Yellow (3s). Driving all six Red/Yellow/Green LEDs from a single shared state register guarantees mutually exclusive green signals, while a 4-bit zero comparator advances the FSM cleanly when each phase timer reaches zero.

Recommended Hardware Kits and Textbooks for Intersection Prototyping

Traffic light controllers are a flagship university digital logic lab project because they combine sequential timers, combinational decoders, and asynchronous pedestrian button latching. The following hardware kits and texts support physical breadboard and FPGA implementation:

Breadboard Lab Kit

Elegoo Electronics Component Starter Kit

Includes red, yellow, and green 5mm LEDs, 220Ω current-limiting resistors, tactile pedestrian pushbuttons, 555 clock timers, and 830-point breadboards.

Price: ~$25–$35 USD • Complete LED & Switch Lab Pack
Check Starter Kit on Amazon →
FPGA Silicon Target

Digilent Basys 3 Artix-7 FPGA

Synthesize your traffic controller directly onto Xilinx Artix-7 silicon: display live phase countdowns on the 7-segment digits and map car/pedestrian sensors to slide switches.

Price: ~$165 USD • Native Logisim FPGA Commander Support
Check Basys 3 on Amazon →

Comparing Fixed-Time vs Sensor-Actuated Intersection Architectures

Depending on your coursework complexity, traffic controllers are built in one of three architectural tiers:

Architecture Tier State Count Timing Mechanism Safety & Sensor Features
4-State Fixed Timer 4 states (2 flip-flops) Single 4-bit down-counter (15s / 3s) Basic mutual exclusion; no pedestrian input
6-State Safe + Sensor 6 states (3 flip-flops) 15s Green, 3s Yellow, 2s All-Red Car loop sensor (EW_Car) shortens NS Green after min 5s
8-State + Pedestrian Walk 8 states (3 flip-flops) ROM-based state & duration lookup SR-latched Walk request + flashing Don’t Walk output

State Encoding and Signal Output Table for a 6-State Safe Controller

Real intersections include a brief All-Red clearance buffer between Yellow and the opposing Green so vehicles clearing the intersection do not collide. Using a 3-bit state register (Q2 Q1 Q0), each state drives six LED outputs directly:

State (Q2 Q1 Q0) North-South East-West Timer Load (N-1) Transition Condition
S0 (000) GREEN RED 14 (15s) Timer == 0 (or EW_Car & Timer ≤ 10) → S1
S1 (001) YELLOW RED 2 (3s) Timer == 0 → S2
S2 (010) RED RED 1 (2s) Timer == 0 → S3 (All-Red Clearance)
S3 (011) RED GREEN 14 (15s) Timer == 0 (or NS_Car & Timer ≤ 10) → S4
S4 (100) RED YELLOW 2 (3s) Timer == 0 → S5
S5 (101) RED RED 1 (2s) Timer == 0 → S0 (All-Red Clearance)

Four Stage Assembly Guide in Logisim Schematics

Organize your schematic into four clean functional blocks so timing and LED decoding remain completely modular:

Phase 1: Synchronous State Register and Mod-6 Counter

Place a 3-bit Counter (or 3-bit Register + ROM next-state table) set to Maximum Value = 5 (0x5). Wire your 1 Hz Clock component to its clock pin, and drive its count enable pin from the Timer_Done pulse so the state advances by 1 strictly when a phase finishes.

Phase 2: Programmable Phase Countdown Timer

Place a 4-bit Counter configured to count down (load = 0, count = 1 during normal ticks). Attach an 8-to-1 4-bit Multiplexer (or a small 8×4 ROM) indexed by the next state to supply the exact reload duration (14 for Green, 2 for Yellow, 1 for All-Red) whenever Timer_Done asserts load = 1, count = 0.

Phase 3: Zero Comparator and Early Sensor Bypass

Connect a 4-bit Comparator comparing the down-counter output against constant 0x0. Its A == B output becomes Timer_Done. To add a smart traffic sensor, add an OR gate combining Timer_Done with (In_NS_Green & EW_Car & Timer ≤ 10) so waiting cross-traffic triggers an early yellow transition without cutting green shorter than 5 seconds.

Phase 4: Mutually Exclusive LED Output Decoding

Feed the 3-bit state bus Q[2:0] into a 3-to-8 Decoder. Connect Y0 to NS_Green, Y1 to NS_Yellow, Y3 to EW_Green, and Y4 to EW_Yellow. Drive NS_Red = Y2 + Y3 + Y4 + Y5 and EW_Red = Y0 + Y1 + Y2 + Y5 via 4-input OR gates, then attach colored LED components (from Input/Output) and a Hex/7-Segment display showing the live countdown timer.

Frequent Design Traps in Traffic Light Controllers

Trap 1: Simultaneous Green Light Collision

Problem: Driving NS and EW lights from two separate unsynchronized timers causes drift where both directions turn green simultaneously.
The Fix: Drive all six LEDs exclusively from one single Moore state register so hardware physics makes dual-green mathematically impossible.

Trap 2: Off-By-One Countdown Duration

Problem: Loading 15 into a down-counter that triggers reload at 0 stays in that state for 16 ticks (15, 14, …, 1, 0).
The Fix: Always load N - 1 (14 for 15 seconds, 2 for 3 seconds) when zero-comparing.

Trap 3: Loading Current State Duration Instead of Next State

Problem: Using the current state S0 to select the reload value loads 15s into S1 (Yellow) when S0 expires.
The Fix: Index the duration MUX/ROM with the Next State (or Current_State + 1) on the clock edge when Timer_Done = 1.

Trap 4: Dropping Brief Pedestrian Button Presses

Problem: A pedestrian taps the Walk button for 1 second during Green, and the FSM misses it when the phase ends 10 seconds later.
The Fix: Latch the button in an SR Flip-Flop (Set = Walk_Btn, Reset = In_Walk_State).

Curriculum Progression from Traffic Controllers to Embedded Systems

Frequently Asked Questions About Traffic Light Controllers

How do I add a night-time flashing yellow/red emergency mode?

Place a 2-to-1 Multiplexer right before the six output LEDs controlled by an Emergency_Mode switch: when asserted, bypass the FSM outputs and wire the 1 Hz clock directly to NS_Yellow and EW_Red.

How do I connect a Pedestrian Walk button safely?

Latch the button press into an SR Flip-Flop so brief presses are remembered until the next All-Red clearance interval, then insert a dedicated 8-second Walk state before clearing the latch.

Why shouldn’t I use a ripple counter’s carry output as a clock?

Clocking the FSM from a combinational comparator output creates gated-clock timing glitches on FPGAs. Always keep every register on the master 1 Hz clock and wire Timer_Done to the synchronous enable pin.

Can I display the remaining green-light seconds on a 7-segment display?

Yes. Add 1 to the down-counter’s 4-bit bus (or convert 0–14 via a Binary-to-BCD ROM) and wire it into two Hex Digit Displays for a real-time crosswalk countdown.

Affiliate Disclosure: Logisim-evolution Community is an independent educational resource. Some links in this guide are affiliate links. If you purchase textbooks, FPGA boards, or electronics kits through these links, we may earn an affiliate commission at no extra cost to you. We only recommend genuine laboratory equipment tested for digital logic coursework.

Similar Posts