Embedded Systems
Products & Resources

Home Products Shipping Resources About Contact

The Traffic
Lights Project

Other General Products

Other Product Groups

All material on
this Web site is
protected under
United States
and International
copyright law.

Liability for your
use of information
on this Web site is
strictly limited.

Trademarks used
on this Web site
are the property of
their respective

The Traffic Lights Project Parts Kit

A complete parts kit is available for the Traffic Lights Project, consisting of the following pieces:

Qty. Description Ref. Des. Comments
1 2 row by 5 pin 0.1" Pin Header J1 For connection to microcontroller
6 Transistors, NPN, 2N3904 or similar Q1 to Q6 LED current switches
6 10 kohm, 1/4 W, 5% Resistor R1, 2, 3, 24, 25 & 26 Base resistors
12 220 ohm, 1/4 W, 5% Resistor R4, 5, 6, 8, 9, 10, 14, 15, 16, 17, 18 & 19 LED current set resistors for 3.3V
12 470 ohm, 1/4 W, 5% Resistor LED current set resistors for 5V
6 Tactile Push-Button Switch SW1 to SW6 Sensors for traffic, etc.
4 LED, 3 mm, Red LR1 to LR4 Red Traffic Lights
4 LED, 3 mm, Yellow LY1 to LY4 Yellow Traffic Lights
4 LED, 3 mm, Green LG1 to LG4 Green Traffic Lights
4 3.3 kohm, 1/4 W, 5% Resistor R7, 11, 20 & 21 Push-button pull-up resistors
4 2 kohm, 1/4 W, 5% Resistor R12, 13, 22 & 23 Input protection resistors

Price and Ordering

The ECROS Technology Traffic Lights Project is available at the following pricing:

Shipping, Payment, etc.

Please visit the Shipping pages if you do not wish to pay using PayPal, for additional information.

Suggested Schematics

The Traffic Lights Project can teach you about both hardware and software for microcontrollers.  You can write any software you like and change it if it doesn't work.  With hardware, however, the layout of the Traffic Lights Project PCB does restrict you and strongly suggests certain circuit configurations.  In this section, the circuits that are built into the PCB are described.  If you are not so interested in the hardware design, you can build the Project as shown here.

Microcontroller Interface

The schematic of the 10-pin header, J1, intended for the interface to the microcontroller is shown at right.  Pins 1 to 8 should be connected to general purpose I/O ports.  Pin 9 should be the common ground and power must be supplied at pin 10.  Note that this pin arrangement is standard on Atmel products such as the STK500 and AVR Butterfly.  You can therefore use a 10-way ribbon cable to directly connect an AVR-based microcontroller system to the Traffic Lights Project.  Click here for a picture of the Traffic Lights Project connected to the Atmel STK500.   Note that pin 1 of header J1 is at bottom-right when you hold the PCB with "North" at the top.  It is marked on the silk screen with a small triangle.  If you turn the PCB over, you will also see that the pad of pin 1 is square, whereas all the others are round.  Be sure to connect the ribbon cable the right way round.

Pins 1 to 8 are routed on the PCB to wiring points marked, in order, P0 to P7 and also to either an LED driver or push-button switch as shown in the table below.  The wiring points can be used if you want to connect your own circuits to the port bits instead of or in addition to the built-in circuits.

Pin Wiring point Built-in Circuit Function
1 P0 East-West Green Traffic Light LED Driver
2 P1 East-West Yellow Traffic Light LED Driver
3 P2 East-West Red Traffic Light LED Driver
4 P3 East-West Vehicle Sensor Push-Button Switch
5 P4 North-South Green Traffic Light LED Driver
6 P5 North-South Yellow Traffic Light LED Driver
7 P6 North-South Red Traffic Light LED Driver
8 P7 North-South Vehicle Sensor Push-Button Switch

LED Driver Circuits

The schematic of the circuits that drive the LED traffic lights is shown at right.  There are six circuits like this, three (red, yellow and green) for East-West traffic and three for North-South traffic.  The circuit shown is for the red traffic light for the North-South direction, but the others are the same except for the signal and component labels.

Both LEDs come on when the input, NS_RED, is taken to a logic high at the microcontroller interface.  With this circuit, you cannot separately control the light shown to traffic from the North and from the South.

The component values shown are those supplied in the kit.  You may want to go through the design of this circuit yourself to check the values or to select your own components.  220 ohm current limiting resistors are suitable for a 3.3V power supply (VCC) and 470 ohm resistors are suitable for 5V.  Any general purpose NPN transistor will do in place of the 2N3904, but if you make any changes to the circuit be sure to perform the necessary calculations to make sure it will work properly.

Push-Button Switches

The schematic of the push-button switch circuits is show at right.  There are four circuits like this.  The vehicle sensor for North-South traffic is shown.  As the switches are connected in parallel, with this circuit you cannot separately sense traffic arriving from the North and from the South.  There is an identical circuit for the East-West vehicle sensor.  The other two circuits are for Pedestrians and Emergency Vehicles and they have only one switch each.

The component values shown are those supplied in the kit.  You may want to go through the design of this circuit yourself to check the values or to select your own components.

Note that the six LED Drivers and two Vehicle Sensors use up the eight general purpose I/O ports available at J1.  The Pedestrian and Emergency Vehicle sensors are routed to wiring points labeled PEDN and EMRG on the PCB near J1 and just above the large prototyping space.  One of the challenges of the Traffic Lights Project is to figure out how to get these extra sensors to work.  Due to a design error, the Pedestrian and Emergency Vehicle sensor push-buttons are not marked as such on the PCB silkscreen (sorry!).  SW2 should be marked EMERGENCY and SW5 should be marked PEDESTRIAN.

Assembly Hints


The 2N3094 transistors supplied in the kit are in TO92 packages.  Before placing such transistors in position, kink the middle lead (base) towards the curved side of the package.  When the leads are inserted in the right holes, the shape of the transistor, when viewed from the top, will match the outline on the PCB silkscreen.


The LEDs must be inserted with the correct polarity.  This is not marked on the silkscreen (there isn't much room).  The longer lead of the LED is the anode.  This must go in the hole closest to the curb of the marked roadways.  When you turn the PCB over to solder, you will see that in each traffic light group the LED anodes are connected together by a wide trace.  The shorter leads, the cathodes, must go in the holes further from the herb and closer to the current setting resistors, to which you will see they are connected.

(You can use the menu on the left hand side to go back to the Traffic Lights Project introduction.)