[Guide] Overlay Air Quality Index (AQI) telemetry

Air quality in our modern cities is a big concern. Most often poor air quality is due to industry but also the masses of cars (in western countries) and scooters/motorbikes (in Asia) that crowd the streets of our cities.

To raise awareness about air pollution in your city, you can simply setup quickly a Facebook stream with a camera facing out at the skyline and overlay the current Air Quality Index (AQI) read-out for your district. Here is how.

Retrieve AQI information

There is one thing you will need before you start. Head over to the AQICN.org website to register and retrieve your own API key : http://aqicn.org/data-platform/token/#/

With this key you will be granted permission to query their data API at a pace of 1000 request per minutes, or 16 requests per seconds. Also, with this API you get access to read outs from over 10,000 stations worldwide.

BTW, big thank you to the World Air Quality Index project (WAQI) as well as the local EPA’s for providing the data.

Run the code

We  create a simple example code that runs with nodeJS and makes use of the Overlay.live nodejs library The code is available from our github.

  1. Simply download / clone the source code from github: https://github.com/OverlayLive/device-library/tree/master/src/examples
  2. Then edit the device config in “device-config.js” to link it to your Overlay.live account.
  3. Edit the WAQI config in “WAQI-config.js” to enter your own API token as well as the city code (UID) that corresponds to your city/district or nearest sensor. 
  4. and run with the following command:
$ node aqi-example.js

You should have something similar to this in your terminal:

AQI telemetry console view

Air Quality Index telemetry script running

And on your Overlay.live Dashboard, you should be getting the following for the linked manual device you’ve added.

AQI telemetry in the dashboard

Air Quality Index telemetry in the dashboard

Final step – Overlay and stream

Finally, all there is left to do is to simply create a new overlay, and customize it. Then, configure for example OBS adding your overlay URL as a web-source, connect with your favorite streaming service and go live!

OBS window streaming with AQI telemetry

Air Quality Index livestream telemetry with OBS

Congrats!

So that’s it for this quick guide. Hopefully this will help you raise awareness around you for a world with less air pollution. If you have any questions or issues with this code – please reach out! And head over to our community forums for support.

Illustrations by Petter Rudwall, and Remi Yuan