Good news - we're open for limited services in Wembley. Ujima House is now actively under refurbishment and we'd love your help in making the space the best it can be.

Please pay attention to the main LHS mailing list or pop into our #london-hack-space IRC channel and say hello.

During this interim period donations and continued membership are greatly appreciated while we transition to our new space.

Project:Traffic Lights

From London Hackspace Wiki
(Redirected from Project:TrafficLights)
Jump to: navigation, search

Warning: You should read and understand this document in full before opening or hacking on the traffic light

Please speak with marrold prior to hacking to find out the current status of the Project.

Traffic Light

Safety

  • Mains voltage is present in the traffic light.
  • Always isolate the power before opening up any of the sections.
  • Always isolate the power before programming the ESP8285 - otherwise your risk damaging your computer or yourself.

Hardware

The traffic light is a PEEK Elite Traffic Light in a RAG (Red - Amber - Green) configuration, manufactured around 2001. It's currently fitted with Pedestrian hoods as these are more compact than the Primary or Secondary hoods.

Controller

The traffic light is controlled by a "Sonoff 4CH" 4 channel relay board, a commercially available device that costs around £15-25. The relay board itself is controlled by an Espressif ESP8285 System on Chip (SoC), which is almost identical to the popular ESP8266, but contains additional memory. The ESP8285 has onboard WiFi and supports the Arduino platform and libraries, making it ideal for an "IoT" device.

Wiring

The traffic light is powered from 90-250v AC (50/60Hz). The controller contains an AC-DC convertor to bring it down to the 3.3V required by the ESP8285. The 4 relays output mains voltage, which is then dropped down to ~12v AC by an individual transformer per bulb.

Lamp to GPIO mapping

Function GPIO Pin
Red Lamp IO12
Amber Lamp IO5
Green Lamp IO4

Bulbs

The "real" bulbs for these traffic lights are 12V, 50W Halogen Bulbs with a GY6.35 base from General Electric, however they have been replaced with generic 4W LED bulbs to reduce the brightness and power consumption.

There is 2x spare LED bulbs inside the amber section of the traffic light.

Programming

The Sonoff 4CH can be programmed via serial using the Arduino IDE, Platformio, or any other software capable of programming an ESP8285.

To get into flashing mode, you must press and hold the L1 button down as you power up the board.

Some USB to Serial adapters are unable to supply the required current to the Sonoff. If you see weird behaviour like the board restarting, you may need to power it externally with 3.3V (NOT MAINS!).

Colour Use
Violet VCC (3.3V)
White Tx
Grey Rx
Black Ground

N.B: Remember to "invert" the UART connections

Current Use

The traffic light currently cycles through the light cycle displayed at road junctions.


Pictures

Inside, showing the controller.
A close up of the controller, showing the programming lead.
The "real" 50W GY6.35 bulbs.