Simple Lego Traffic Light - Prototype

Posted by ferrisoxide
on Monday, April 27

Initial Prototype

The kids were after a traffic light set up for an intersection on a Lego road. My first idea was to stick some LEDs into a suitable brick. The 4595 brick seemed a reasonable candidate – it looks a bit like a traffic light, even though it only has two holes on each face. I thought of building a basic red/green traffic light, but couldn’t figure how to could control the light effectively – there’s not much room at the bottom of the 4595 to fit four wires and keep the lot from shorting. Then there’s the issue of switching the current from one LED to another as the signal changes. Tricky.

Then I had a wee brain storm: only one LED needs to be on at a time – all I needed to do was to wire the LEDs together so the cathode of one was connected to the anode of the other and vice versa. Because LEDs only allow current to flow in one direction, when the current runs one way only one LED will light up. Reverse the current and the other LED lights up. So simple I felt dumb after working it out.

The basic components: a 4595 brick, a small red LED, a small green LED and some heat shrink to isolate the wires from each other.

Testing: Setting up the LEDs with the anodes around the right way. The wires are bent prior to pushing into the brick (and so I’ll remember which way around they go).

Red means stop: Current is applied to both LEDs, but only the red one can light up.

Green means go: Reverse the direction of the current and the green light comes on, the red light turns off.

The pictures didn’t turn out too well as I took these on a crappy old camera. Time to buy a new one – though cameras get dropped so often in this house they may as well be consumable items.

Getting the wires into place was a pain. The red LED went in OK but the green was awkward as the wires are quite stiff and it’s hard to bend and pull them through without threatening to fracture the LED.

I didn’t bother trying to make sure the anode/cathode pairs of each LED were connecting properly. The green LED was forced in over the top of the red so its two wires were pushed down on the red LED’s wires, ensuring contact.

There’s a small peg inside the 4595 that keeps the wires apart inside the brick. As they come through the hole in the bottom there a danger that the two sets of wires may touch each other so I pushed a small piece of heat shrink up through the hole over just one pair of the wires.

Next Steps

The prototype seems to work OK, so the next steps are to clean up the design. I didn’t really use the heat shrink properly, nor made sure everything was well connected, so I’d look towards improving that.

If I do this again I’d cut the wires right back and solder the LEDs together. I’d solder a flexible pair of coated wires to each side of the LEDs and pull them through the bottom of the brick. I’d probably use an RCX to control the direction of the current. You’d only need one set of wires to control a complete traffic intersection: if you hooked a set of four traffic signals – one for each direction at a cross road – all you’d need to do is run the current one way to turn one flow of traffic ‘green’, reverse the current the turn on the green lights for the other flow. Providing it can supply enough voltage, one RCX should be able to control up to three sets of intersections.

I can see how this could be used for other things. You could easily make a flashing railway crossing signal by wiring two red LEDs in the same way and swapping the direction of the current back and forth. More fun to be had.