Air Pollution Monitoring Through Crowdsourcing

Dumindu Buddhika
Code Insights
Published in
6 min readOct 22, 2017

Air pollution has become one of the biggest problems in modern world, which causes harmful illnesses, negatively affect day to day life of everyday people. Unfortunately, despite the very real impact air pollution has on people’s lives, it often goes unnoticed, unless the pollution is critically high. With that being said, most developed countries and countries which are mostly affected by this problem (such as China) have developed methods to monitor air pollution. Nonetheless, air quality monitoring and relaying that information to public is at poor level because government maintained air quality monitoring networks are sparse and do not possess a proper method to deliver gathered information to the public.

“Breathe Free”, the solution we developed, is a new generation hand-held device, paired with a smart phone, which reveals various hazardous gas levels to users in real time. Moreover, air quality details are gathered through crowdsourcing and visualized in a web application. The web application visualizes gas levels in a three-dimensional geographical map with time axis. This article describes about the “Breath free” device and related applications.

Breathe Free

“Breathe Free” is a solution which is not only limited to monitoring real time air quality, but also a complete system to transmit, store, process and present data to public in simple easily understandable interface. It is composed of three major components.

  • Hand-held device
  • Mobile application
  • Visualization platform

“Breathe Free” employs crowdsourcing to gather real-time environmental pollution data.

Hand-held Device

This is an Arduino driven small device which consists of three main air sensing modules. Those are CO sensor module (MQ-7), SO2 sensor module (MQ-136)and NOx sensor module (MiCS-2714). This device is capable of collecting ambient gas level details and sending them using serial communication method to a smartphone. In order to connect the device and the phone, mini USB to micro USB cable is used and moreover this device is powered by the smartphone itself hence no need of external battery or Bluetooth/Wi-Fi transferring module for operating the device. Since this device is aimed to be a low-cost device, this method of operation is more beneficial because battery cost and data transfer module costs are reduced from the manufacturing cost.

Hand-held device

Mobile Application

A mobile application was developed in order to provide an interface to handheld device by allowing user to control the device and providing readings from the device.

Functionalities of the Android application are,

  1. Displaying current gas levels
  2. Warning user when gas levels are above a threshold value
  3. Sending data to an online server
  4. Changing settings of the device

Primary requirement of the mobile application is to sync gathered data to an online database which is also the crowdsourcing component. In order to achieve this, android application uses a NoSQL database called Couchbase as the medium to store data received by the device.

Measured gas level data are fed to the mobile phone via USB interface and Android application collects received data and saves to local Couchbase database. Real-time gas levels are displayed on the main screen of the application. User can easily view what are the gas levels in the area the user is at.

Furthermore, application warns to the user of any increased reading of a pollution gas. The application produces an alert if it senses that a pollution gas level is above some threshold. These threshold values are determined according to standard maximum gas levels a human can withstand without a problem.

Another key feature in the application is it provides the user to control the device through few important settings. Application allows user to configure the time interval, which the device should collects data from the sensors. This is important since this interval becomes smaller, power consumption increases but provide more real-time data. Another configuration it provides is the device sleep settings which lets user to set a time which put device in to sleep mode in order to preserve battery power. Another setting is to select type of internet the connection which should be used to sync data like Wi-Fi or mobile data.

Data Visualization

This is one of the most important parts of the project. Key thing to mention is that this visualization platform can be easily extended to add more maps to visualize data in rich formats.

Visualization platform consists of web server and Couchbase database. Following are the types of maps which are currently added in order to showcase the possible multiple modes of visualization and their related technologies.

CesiumJS For 3D Map Visualization

CesiumJS is an excellent alternative to Google Earth. CesiumJS has client side rendering of data which was much suitable for this use case since it leverages rendering the map to the client which reduce the load on server. CesiumJS is also built on plugin free technology. Furthermore, CesiumJS uses webGL to render 3D maps.

CesiumJS 3D map

2D Dot Map

Visualization of each data point as a dot with a color. Here each data point represents a single reading observed by a user. Advantage of this map is it gives a clear top down view of data and gives a straight forward color representation of different gas levels.

2D dot map

Average Map

Aim of this map is to visualize city wise data to provide the overall notion. Here each cylinder represents a city. Height of the cylinder represents the average value of a certain pollution gas. Radius of the cylinder represents the radius covered by the city. Importance of this map is it represents the average pollution of a particular city.

Average Map

Heat Map

This map represents the amount of data available for a given gas. If a higher number of users are available, color becomes red. Importance of this map is, if there are a large number of users in a particular area, the accuracy of data in that area is high.

Heat map

Public API to retrieve air pollution data

We were able to develop an API for public which can be used to retrieve air pollution data in particular area. At the very basic level, by providing latitude and longitude to this API, average pollution gas levels of that location can be received. This API can be useful because it facilitates large number of other types of applications in air quality monitoring domain which depends on data collected by this system. For an example, billboards in cities that shows real time air pollution data, desktop or mobile widgets that show air pollution like weather apps which currently have or small devices which shows air pollution data can be developed.

--

--

Dumindu Buddhika
Code Insights

Full-stack developer — Golang, React, Node, Kubernetes