The embedded part of this project is conserned with the end point traffic light device. It contains a schematic on the device's architecture and a local server for communicating with the main server.
Below is the schematic used to construct a single traffic light node.

- 1x Raspberry Pi
- 3x PCB P16D boards
- 12x SNx4HC164 8-Bit Parallel-Out Serial Shift Registers
- 96x 221Ω resistors
- 256x Red LEDs
- 256x Yellow LEDs
- 256x Green LEDs
This Flask server is running locally on the Raspberry Pi. It is responsible for providing camera image server and controlling the lights through the GPIO on a main server request.
The following setup has been testet on the Raspberry Pi 3 with Raspbian Buster Lite.
Make sure Python 3.7 is installed. Then run the following:
# Install dependencies
$ python3.7 -m pip install pip
$ pip3 install -r requirements.txt
# Run the local server
$ flask run
Installing opencv proves to be challanging on the Pi. If you get import errors, check this guide for building opencv from source, which got everything working for me.
$ sudo echo "python3.7 $PWD/app.py" >> $HOME/.bashrc
Python 3.7 with the following libraries:
- Flask
- OpenCV
Distributed under the MIT license. See LICENSE for more information.