Hans on IoT

ThingSpeak, MATLAB, and the Internet of Things

Analyze and Visualize Air Quality Data with MATLAB

Have you ever wondered if the air around you is healthy? It is possible to understand air quality by using MATLAB to analyze air quality data collected by an air quality sensor on  ThingSpeak.

What is “healthy” air quality?

Good or moderate air quality is when the Air Quality Index (AQI) is 100 or less. AQI is a relative measurement of five common air pollutants: ground-level ozone, particle pollution, carbon monoxide, sulfur dioxide, and nitrogen dioxide. A high AQI indicates a higher level of pollution and is considered unhealthy over 100.

Air Quality Sensors

We have installed a PurpleAir sensor at the MathWorks Apple Hill campus in Natick, MA. PurpleAir sensors use laser particle counters that provide an accurate and low-cost way to measure smoke, dust, and other particulate in the air. The data from our air quality sensor is available on a public ThingSpeak channel.

PurpleAir produces an interactive map using the air quality data from their sensors deployed around the world. Among other applications, the data is used by researchers to understand the effects of forest fires on air quality.

Air Quality Analysis using MATLAB

On File Exchange, we have posted our MATLAB functions used to analyze the air quality data collected by ThingSpeak. The MATLAB code helps preprocess the sensor data, provides functions to classify the data, and provides functions for visualizing the processed air quality data. The MATLAB visualizations are added to a ThingSpeak channel dashboard so you can see the current air quality near you. The MATLAB analysis code calculates the AQI using the definitions from the United States Environmental Protection Agency (EPA).

You can build a data analysis dashboard on ThingSpeak using publicly available data and MATLAB. This project it makes it easy to explore IoT data analysis using MATLAB to preprocess and visualize data without having IoT hardware.

Download the code from File Exchange and follow along with our video tutorial.

  • print


To leave a comment, please click here to sign in to your MathWorks Account or create a new one.