Making real traffic lights work

By Trevor Olsson, 28/10/2017

At the Centre for Computing History we finally got the real traffic lights up and running, with kids (and their grown-ups) writing code to control the lights.

This blog describes the steps needed to make it work.

Get some lights! We got ours from Dynniq – many thanks for the donation.

Feed the lights with some electricity to see what works – the lights are sealed units with lots of LEDs and what looks like a Fresnel lens to distribute the light, together with some black box electronics. We do know that modern traffic lights are normally supplied with 48V a.c.; (older lights work on 240V a.c., so are really non-starters in a teaching environment).

Running the lights from a bench power supply at 24V d.c. (its max.) made the green lamp light up, but not the red one. We guessed that 24V is right on the edge, but it’s nice to know they’ll run on d.c. Some kind of bridge rectifier in there? Bringing the voltage back down caused the unit to turn off at about 16V.

We then ran the lights from a gPiO box that primary schools normally use with a 6V d.c. supply. The maximum supply voltage to the gPiO box is 36V d.c. (though that’s actually the limit of the H-Bridge motor control chip, the Darlington driving the lights will go to 48V d.c). With a 36V d.c. supply to the gPiO box and the box feeding the lights it all worked, with each lamp drawing about 300mA.

We carried on testing with the rest of the hardware, i.e. the Red/Green man control box that also contains the beep-beep sounder (for deaf people) and the rotating motor gearbox unit (for deaf-blind people). All worked at 36V d.c.

Caveat: at a Raspberry Jam, Ben Nuttall wrote some code that switched the lights quickly,  .The result was it blew up the gPiO box. Thanks, Ben ;‑). As the lights are sealed units we’ve no real idea what spikes or other nasties will be produced by fast switching. The moral of the story is – use them as traffic lights, not as a disco controller.

To conclude, you can successfully control real traffic lights (and the associated hardware that together make up a Pelican Crossing), with a Raspberry Pi and a gPiO box.

Don’t forget that the reason that we have been given the lights is for use in schools. If you know of a school that wants to use the lights (at their school, and it’s free) please get in touch.

What do you think?

Leave a Reply

Your email address will not be published. Required fields are marked *