Traffic Indicator (based on Google Maps API)

When I return back home from office sometimes I get stuck in the traffic jam and there I am reflecting on what could have been done if I would have had a look at the traffic status prior starting (e.g. … at least saving the world?!).

This project checks regularly the actual traffic between two fix locations (e.g. work & home) and displays the estimated time of arrival on an ePaper screen. The data is gained by triggering a webhook towards the Google Maps API.

This is the first time I was generating & triggering webhooks; its nice! The sketch is only 59 lines long and can be found here:
https://github.com/RobPo/Paperino/blob/master/code/examples/TrafficIndicator.ino

If you like the ePaper shield please have a look at the currently running crowdsupply campaign.
If you have any further input about the project or how to shorten the code please let me know.

Thanks in advance & Cheers

8 Likes

The webhook should have the following syntax:
https://maps.googleapis.com/maps/api/distancematrix/json?origins=X1Y1&destinations=X2Y2&departure_time=now&key=YOURAPIKEY

  • X1Y1 and X2Y2 are the coordinates from your favourite destinations at google maps.
  • YOURAPIKEY cam be individually requested here
  • &departure_time=now needs to be added to take into account the actual traffic situation along the route. We need to add this otherwise the estimated time of arrival would be always constant…

This day was a good one: :wink:

5 Likes

Hi,
Very nice. Wish my area had data source for traffic, could have been easier.

I am doing something similar except I will have the particle electron connected to lidarlite getting the actual traffic data from the roads. I feed that data stream to Thingspeak, make some calculations and send alerts via Twitter, telegram and also plot on

custom Google maps. Just waiting for government approval to mount the devices on the street. The pilot tests at my house have been working well for past 8 months. Runs 24/7 on 20W solar panel connected to 12V battery. If you follow that Twitter handle in the image, you get a notification every 1 hour from test data being measured with sensor pointed at some object in my home garden :grinning:

Cheers
Anthony

3 Likes

@goof2092 very nice! :wink:

1 Like