LEGO traffic lights (WeMos, Wi-Fi and MQTT)
This project is a work in progress. Please check back later for additional changes.
Sequence and timing
- Yellow time: 3-4 seconds, depending on speed limit (above or below 50 km/h)
- Red/yellow time: 1 second
- Yellow and red/yellow time for two conflicting flows of traffic must not overlap
- Switching time:
- Yellow flash: 60 times per minute (1 hz), 50% interval
- 5 seconds yellow flash
- 5 seconds yellow solid
- 5 seconds red (minimum), all directions
- 1 second red/yellow main direction
- Green main direction
- First test with single traffic light output and MQTT communication.
- Added second traffic lights and auxiliary output.
- Faster MQTT command response.
- Added cold-start sequence on first boot or when ending yellow flash mode.
- Made two traffic light LED test boards.
- GPIO 4 : Traffic light 1, green
- GPIO 0 : Traffic light 1, yellow
- GPIO 16 : Traffic light 1, red
- GPIO 14 : Traffic light 2, green
- GPIO 12 : Traffic light 2, yellow
- GPIO 13 : Traffic light 2, red
- GPIO 15 : Auxiliary (e.g. street lights)
- GPIO 2 : Built-in LED, MQTT connection status
Arduino sketch is available in a git repository: