← Back to Projects

Traffic-Light Controller

Summary

Finite-state-machine intersection controller with timed phases and debounced inputs. The design drives dual three-LED signals (Main & Side), reads a PIR sensor on the side road, and actuates a servo-powered barricade to control a gate.

Highlights

Procedure

Preparation

  1. Design a 3D model that satisfies the needs for the project. Include correctly sized slots for each LED so they slide in and are held in place, and space to house wiring.
  2. Print the finished model and test-fit all parts to confirm fitment is correct.
  3. Model and print a barricade that will fit over the servo to open and close the gate.

Part A (Hardware)

  1. Fit each LED in order (red top, yellow middle, green bottom). Bend all negative LED legs together and solder them into a single common ground lead shared by all six LEDs. Solder a ground cable to the single remaining ground leg.
  2. Solder custom-cut cables for each LED and label them. One row is “Main” and the other row is “Side.”
  3. Connect the labeled LED wires to specific Arduino pins and record the mapping.
  4. Connect the shared ground cable to an Arduino GND pin.
  5. Wire the PIR sensor per spec: 5V, GND, and signal → Arduino input pin.
  6. Attach the servo connections: GND, Vin, and signal → Arduino.
  7. Mount the PIR sensor securely. Attach the 3D-printed barricade to the servo and mount the servo so 0° is the upright position.

Part B (Software)

  1. Write the control program: Main light stays green until the PIR sensor is triggered on the side road. After a short delay, switch Main → red and Side → green; raise the servo (open barricade).
  2. Implement a delay after motion stops to allow traffic to clear. Then switch Side → red and Main → green, and lower the barricade.
  3. Verify all pin constants in code match your recorded LED and sensor/servo wiring so sequences run correctly.

Project Media

Schematic Diagram
Schematic Diagram
Block Diagram
Block Diagram
Flow Chart
Flow Chart
Hardware Diagram 1
Hardware Diagram 1
Hardware Diagram 2
Hardware Diagram 2
Hardware Diagram 3
Hardware Diagram 3

© Sifath Shahab

Presentation Video