LED-Trafficlight



1. Parts
You need at least:
  • 5V-Powersupply
  • 6 transistors: BC 547B (or other NPN)
  • 6 resistors: 10k
  • 6 resistors: 1k
  • 6 LEDs: 2 red, 2 yellow, 2 green
  • 1 Connector for the parallel port(25 or 36 pins).
2. Preparing the Connector
We use the printerport for our circuit and so we have to make the computer believe, that there is a printer at the end of the line, which is switched on and ready to print: We connect the /Ackn-, Busy- and Paper-empty-line to GND. Printer-ready and /Error are connected to Vcc. Click here for information about the parallel port.
Warning!
Vcc has to be rather exactly 5 volts.(4.75-4.25) Higher voltages may damage your printer-port. The simplest way to get a 5-volt-source is to use a LM7805.

3. Connecting the LEDs
(*)You can use any voltage, but then you have to take another resistor.

Transistor: Tested with BC 547B, but you can use any transistor with rather similar properies: NPN, Ic(max): 100mA, Uce(max):45V, P(max)=500mW, b:250-400
The circuit without the connector and the leds is so small, that you can put it into a matchbox. The simplest way to connect the LEDs is:
Connect the data-lines of the parallel port, so that data0 controls the first red Led R1, data1 the first orange(yellow) one, and data5 the second green one.
4. Software
The software to use the lights is very simple:
If you want to switch on only the first red Led R1, you have to send the value 1 to the printer. (Only the LSB=Data0 is set) If you send 6 to the printer, the O1 and the G1 Led is switched on...
traffic.zip contains a simple C-programm(dos) to simulate a traffic-light. You may also want to control the lights from java which is possible (with linux) using the PortTest application from project 7 (manual control) or the project 7 together with the TrafficLightAdapter from project 32.
5. Extending the Circuit
There are much more possibilities to use the circuit if one uses relais instead of LEDs. The advantages are:
  • You are able to control another circuit which isn't electically to your first circuit.
  • You can control high voltages and/or currents such as electrical heaters or light bulbs.
The drawback is, that a relais can't be switched on more then about 100 times per second. Most relais won't do that more then 10 times per second.
Transistor: BC 547B NPN b=300..450 IC(max)100mA UCE(max)=45V
Diode: 1N4148 U(max): 150V I(max)=100mA
Circuit can also be used for switch on/off the lights in your room/around your house, control the electrical heaters,...
Contact: e-mail: me (%) halfdog.net
Last updated: 15.07.2005