This project displays live traffic conditions between two locations on a physical map, using an Arduino device that gathers data from the Google Maps API and then sets the color of a string of NeoPixels — green for good traffic, yellow for slower traffic, and red for bad traffic conditions, just like online maps. It refreshes every minute to adjust the color of the LEDs as the traffic changes.

The project runs on an AdaFruit Feather HUZZAH ESP8266 programmed via the Arduino IDE, but the code should run on any ESP8266 board. Its configuration is persistent across resets, as it uses SPIFFS, which is internal flash memory on the ESP8266.

1. Build the circuit

On your breadboard:

  • Place a 220uF capacitor between 3V and GND
  • Connect the positive power lead of your first NeoPixel to 3V, and then wire the positive leads of your remaining NeoPixels in parallel
  • Repeat this same step for GND and the negative power leads
  • Place a 330 Ohm resistor between the output pin of your board and the data-in of your first NeoPixel
  • Connect the data-out of the NeoPixel to the data-in of the next, and repeat. The data-out of the last NeoPixel should be left disconnected

2. Get the Google Maps API Key

In order to get the traffic data from the Google Maps API you need use an API key, these are free and very easy to get.

I recommend trying out your key using the following URL to make sure it’s working correctly (Make sure to change the key at the end!),+Ireland&destinations=Dublin,Ireland&departure_time=now&traffic_model=best_guess&key=PutYourNewlyGeneratedKeyHere

If everything appears to be working, you’ll paste your API key into line 89 of the code, which you’ll download from the project’s Github page.

3. Set The Code For Your Map

You now have everything you need to program you board with the example sketch.

  • Open the traffic-notifier sketch in the Arduino IDE
  • There is a list of libraries up the top of the sketch, they will all need to be installed if you do not have them already (All are available on the Arduino Library Manager)
  • If you scroll down a small bit, you will see a commented section where you can adjust the code for your specific use. It is here that you can set your output pin, number of NeoPixels, brightness, traffic thresholds, and refresh rate

You should now be able to program your board with the sketch.

4. Run the Device

First, connect board to wifi:

  • Power board on and find its WiFi network. Connect computer to the board’s WiFi and configure it to join your network. Now it can load traffic condition data.
  • Find your starting longitude and latitude:
    • Navigate to your starting point in Google Maps, then copy the longitude and latitude from the end of the URL
    • Input it into line 96 of the code
  • Repeat for destination (line 97)
  • Upload code to the board
  • Unplug your computer and connect supply power to the board if not already done.
  • Wait a few seconds as the map downloads the traffic data and changes the map’s lights to the appropriate color.

5. Mount it

This part is up to you — we used a vintage map of San Francisco that we downloaded and printed to track traffic over the Bay Bridge, placing four LEDs along the bridge’s path. We mounted the map and circuitry to a foamcore board for rigidity. This can be placed inside a nice picture frame and hung on the wall.

NOTE: If you use more than five LEDs, you may need to add a logic level converter to supply adequate power to all. Wire it up as such:


The rare “daytime all green”.

Your traffic map is done! Now you simply have to plug it in using any standard 5V power source with a MicroUSB plug on it. The board will connect to the internet and run the code; a few moments later, the LEDs will light up to show you the traffic between the locations you’ve specified.

I think the Google Maps API paired with an ESP8266 has the potential to create some really interesting projects that represent the information available on google maps in a physical way. It can be used to compare the travel times of several different routes home to or from work (as shown here or even could be used to compare travel times between different modes of transport (driving / walking / public transport etc) so it could even be used as a device to try encourage people to try alternative ways of getting to work if driving is significantly slower.