LED traffic light / digital signal output Traffic light module

SKU: SW1001
LED traffic light module with red, yellow and green LEDs and four pins labelled G, Y, R and GND

LED traffic light / digital signal output Traffic light module

SKU: SW1001
Default
Regular price $2.99
/
  • Free shipping on all orders over $100
  • Secure payments
  • In stock, ready to ship
  • Inventory on the way

Add $100.00 more for free shipping

Tax included. Shipping calculated at checkout.

You'll also need

Tick an item to add it to your cart.

Arduino UNO Compatible
$10.99✓ In cart
Breadboard 400 holes
$4.49✓ In cart

A 56 × 21 × 11 mm LED traffic light module with red, yellow and green LEDs, controlled by three digital signals.

The LED traffic light module has four pins (GND, R, Y, G). Each colour has its own signal pin, so you can drive it straight from an Arduino, ESP32 or Raspberry Pi Pico. It suits traffic light models, signal demos and first lessons in digital output.

LEDs
Red, yellow, green
Control
3 digital inputs
Voltage
5 V
Size
56 × 21 × 11 mm

Why choose it

  • One pin per colour — red, yellow and green are switched separately, so any light sequence is possible.
  • Four-pin header — GND, R, Y and G are labelled on the board, so wiring is quick to check.
  • Works with common boards — the tutorial below covers Arduino UNO, ESP32 and Raspberry Pi Pico.

Specifications

Electrical
Type LED traffic light module
Operating voltage 5 V
Input Digital signal (HIGH = on, LOW = off)
Interface Red, yellow and green control, one pin each
Pins
Pin count 4
Pin labels GND, R, Y, G
Physical
LED colours Red, yellow, green
Dimensions 56 × 21 × 11 mm

Compatibility

Platform Works Notes
Arduino UNO / Nano (5 V) ✓ Yes Connect R, Y and G to any digital pins.
ESP32 / ESP8266 (3.3 V) ✓ Yes Use GPIO pins as outputs. Never connect R, Y or G to 5 V.
Raspberry Pi Pico (3.3 V) ✓ Yes Use GP pins as outputs. The tutorial uses MicroPython.
Software ✓ Yes No library needed. Arduino IDE or MicroPython.

In the box

Included
  • 1 × LED traffic light module

Applications

  • Model road junction or railway signal
  • Learning digital output and timing with delay()
  • Status indicator (green = OK, yellow = warning, red = fault)

Tutorial

What you'll build: a three-colour traffic light that cycles green, yellow and red, with the colour name printed on your computer. · About 15 minutes.

Choose your board

Board Logic voltage Pins used Language Best for
Arduino UNO 5 V D2, D3, D4, GND C++ (Arduino IDE) First-timers
ESP32 3.3 V GPIO25, GPIO26, GPIO27, GND C++ (Arduino IDE) Adding Wi-Fi later

New to this? Start with the Arduino UNO.

How it works

The module is three LEDs on a small board. Each light has its own signal pin. When a pin is HIGH the light turns on, and when it is LOW the light turns off.

  • GND — the return path for the current. It must be joined to the GND of your board.
  • HIGH / LOW — a pin set HIGH gives out the board's logic voltage (5 V or 3.3 V). LOW gives 0 V.
  • GPIO — a pin on your board that your program can switch on and off.
Arduino UNO Tutorial

You need: Arduino UNO R3, USB cable (data type), 4 jumper wires.

Wiring diagram: traffic light module to Arduino UNO Arduino UNOTraffic light moduleD2RD3YD4GGNDGND

■ GND ■ Signal (R, Y, G lines)

# Arduino UNO pin Module pin Wire Notes
1 D2 R Yellow Red light signal
2 D3 Y Yellow Yellow light signal
3 D4 G Yellow Green light signal
4 GND GND Black Return path. Always connect it.

Check the pin labels printed on your module: they read G, Y, R, GND along the edge.

Watch out: Wire it with the USB cable unplugged. The module has no power pin: each light is fed by its own signal pin, so only the four wires above are needed.

1
Install the Arduino IDE
Download it from arduino.cc/en/software and install it.
2
Connect and select the board
Plug in the UNO with a data USB cable. Tools → Board → Arduino AVR Boards → Arduino Uno. Tools → Port → choose the new port. If no port appears, try another data USB cable and install the USB driver for your board.
3
Upload the example
Paste the code below into a new sketch and click Upload (the right-arrow button). Then open Tools → Serial Monitor and set 115200 baud.
▸ Example 1 — Traffic light sequence (Arduino UNO)
// Wiring: R -> D2, Y -> D3, G -> D4, GND -> GND
const int RED_PIN = 2;     // same as the pin table
const int YELLOW_PIN = 3;
const int GREEN_PIN = 4;

const int GREEN_TIME = 3000;   // you can change this (milliseconds)
const int YELLOW_TIME = 1000;  // you can change this
const int RED_TIME = 3000;     // you can change this

// Turn each light on (true) or off (false)
void setLights(bool r, bool y, bool g) {
  digitalWrite(RED_PIN, r ? HIGH : LOW);
  digitalWrite(YELLOW_PIN, y ? HIGH : LOW);
  digitalWrite(GREEN_PIN, g ? HIGH : LOW);
}

void setup() {
  Serial.begin(115200);                     // speed used by the Serial Monitor
  Serial.println("OK - epartners.co.nz test");
  pinMode(RED_PIN, OUTPUT);                 // the pins send signals out
  pinMode(YELLOW_PIN, OUTPUT);
  pinMode(GREEN_PIN, OUTPUT);
  setLights(false, false, false);           // start with all lights off
}

void loop() {
  Serial.println("Green");
  setLights(false, false, true);            // green on
  delay(GREEN_TIME);
  Serial.println("Yellow");
  setLights(false, true, false);            // yellow on
  delay(YELLOW_TIME);
  Serial.println("Red");
  setLights(true, false, false);            // red on
  delay(RED_TIME);
}

✓ Check: The Serial Monitor prints "OK - epartners.co.nz test" once. Then the green light shows for 3 seconds, yellow for 1 second and red for 3 seconds, and the cycle repeats.

ESP32 Tutorial

You need: ESP32 DevKitC (ESP32-WROOM-32), USB cable (data type), 4 jumper wires.

Wiring diagram: traffic light module to ESP32 ESP32 DevKitCTraffic light moduleGPIO25RGPIO26YGPIO27GGNDGND3.3 V signals

■ GND ■ Signal (R, Y, G lines)

# ESP32 pin Module pin Wire Notes
1 GPIO25 R Yellow Red light signal
2 GPIO26 Y Yellow Yellow light signal
3 GPIO27 G Yellow Green light signal
4 GND GND Black Return path. Always connect it.

Check the pin labels printed on your board, because ESP32 boards from different makers can have a different pin order.

Watch out: ESP32 pins give out 3.3 V, so the lights may look dimmer than on an Arduino UNO. Never connect R, Y or G to a 5 V pin.

1
Install the Arduino IDE
Download it from arduino.cc/en/software.
2
Add the ESP32 boards
File → Preferences → "Additional boards manager URLs" → paste https://espressif.github.io/arduino-esp32/package_esp32_index.json (see the official install guide). Then Tools → Board → Boards Manager → search "esp32" → install "esp32 by Espressif Systems".
3
Select the board and port
Tools → Board → esp32 → ESP32 Dev Module. Tools → Port → choose the new port. If no port appears, use a data USB cable and install the USB driver for your board.
4
Upload the example
Paste the code below and click Upload. If the upload fails, set Tools → Upload Speed → 115200 and upload again. If it stays on "Connecting…", hold the BOOT button until uploading starts. Then open the Serial Monitor at 115200 baud.
▸ Example 1 — Traffic light sequence (ESP32)
// Wiring: R -> GPIO25, Y -> GPIO26, G -> GPIO27, GND -> GND
const int RED_PIN = 25;    // same as the pin table
const int YELLOW_PIN = 26;
const int GREEN_PIN = 27;

const int GREEN_TIME = 3000;   // you can change this (milliseconds)
const int YELLOW_TIME = 1000;  // you can change this
const int RED_TIME = 3000;     // you can change this

// Turn each light on (true) or off (false)
void setLights(bool r, bool y, bool g) {
  digitalWrite(RED_PIN, r ? HIGH : LOW);
  digitalWrite(YELLOW_PIN, y ? HIGH : LOW);
  digitalWrite(GREEN_PIN, g ? HIGH : LOW);
}

void setup() {
  Serial.begin(115200);                     // speed used by the Serial Monitor
  Serial.println("OK - epartners.co.nz test");
  pinMode(RED_PIN, OUTPUT);                 // the pins send signals out
  pinMode(YELLOW_PIN, OUTPUT);
  pinMode(GREEN_PIN, OUTPUT);
  setLights(false, false, false);           // start with all lights off
}

void loop() {
  Serial.println("Green");
  setLights(false, false, true);            // green on
  delay(GREEN_TIME);
  Serial.println("Yellow");
  setLights(false, true, false);            // yellow on
  delay(YELLOW_TIME);
  Serial.println("Red");
  setLights(true, false, false);            // red on
  delay(RED_TIME);
}

✓ Check: The Serial Monitor prints "OK - epartners.co.nz test" once. Then green shows for 3 seconds, yellow for 1 second and red for 3 seconds, and the cycle repeats.

Troubleshooting

Board Problem Likely cause Fix
All No light turns on GND wire missing or loose Check that the GND wire joins the module GND to a GND pin on the board.
All Colours are in the wrong order R, Y and G wires swapped Match the letters printed on the module (R, Y, G, GND) to the pin table.
All Only one light works A signal wire is loose, or the pin number in the code does not match Re-seat the wire and check the pin numbers at the top of the code.
Arduino UNO No port appears in the Tools menu Charge-only cable or missing USB driver Use a data USB cable and install the USB driver for your board.
ESP32 Stuck on "Connecting…" Board is not in upload mode Hold the BOOT button until uploading starts.
ESP32 Upload fails or stops part-way Upload speed too high for the USB cable or USB chip Tools → Upload Speed → 115200, then upload again.

Try next: add a push button so a pedestrian press turns the light red, or flash the yellow light on its own as a warning signal.

Spotted a problem in this tutorial? Email support@epartners.co.nz and we'll check it and update the tutorial.

Good to know
  • Connect GND first, and wire with the power off.
  • Drive R, Y and G from signal pins only. Do not join them to a power pin.
  • Check the letters printed on the module before wiring: G, Y, R, GND.

Resources

FAQ

▸ Does it work with an Arduino UNO?

Yes. Connect R, Y and G to three digital pins and GND to GND, then set the pins as outputs.

▸ Do I need a library?

No. Switching a pin HIGH or LOW with digitalWrite() (Arduino) or Pin.value() (MicroPython) is enough.

▸ Which pins are on the module?

Four pins, labelled GND, R, Y and G.

▸ Can I use it with an ESP32 or Raspberry Pi Pico?

Yes. Use any free output pin for each colour. The tutorial shows GPIO25, GPIO26 and GPIO27 on the ESP32 and GP13, GP14 and GP15 on the Pico.

Technical question about this part? Email support@epartners.co.nz with your board and wiring, and we'll help you get it working.

Shipping: $5.99 urban, $9.99 rural. Free shipping on orders of $100 or more.

Order by 10:30am (NZT), Monday to Friday, and we dispatch the same day. Orders placed after 10:30am, on weekends or on public holidays are dispatched the next business day.

Delivery usually takes 1–2 business days after dispatch (2–3 for rural addresses). See our Shipping Policy for full details.

This site is protected by hCaptcha and the hCaptcha Privacy Policy and Terms of Service apply.

Recently viewed