Blog  /  Air Quality Sensor: A Comprehensive Guide

Air Quality Sensor: A Comprehensive Guide

Have you ever wanted to know the current air quality in your surroundings for precautionary reasons? An air quality Sensor monitor provides the perfect solution for your needs! This device features a sensor that integrates on a PCB and provides a reading after detecting pollutants that may affect your health. After all, high levels of particle pollution can make it difficult for anyone to function normally, indoors and outdoors. Of course, if that becomes an issue, you should purchase an air purifier to reduce or eliminate toxins.

This article covers the basics of an air quality sensor and how to build one. So continue reading if you want to learn more!


What is an Air Quality Sensor?


This sensor can detect hazardous gas in the air. 

This sensor can detect hazardous gas in the air. 


An air quality sensor refers to a portable device with air quality measurement capabilities. These monitor hazardous air pollutants, including ozone, nitrogen dioxide, carbon dioxide, and particulate matter.

Anyone may install consumer air quality sensors on various structures to help monitor outdoor air quality. In this case, you can form a network with several sensors to observe the movement of pollutants and other factors.


An air quality sensor detecting small amounts of particulate matter

An air quality sensor detecting small amounts of particulate matter


Indoor air quality monitors also exist on the market to detect hazardous pollutants, such as carbon monoxide.


How Does an Air Quality Sensor Work?


Sensors can also detect outdoor pollutants.Sensors can also detect outdoor pollutants.


Air quality monitoring relies on varying mechanisms to operate for a specific purpose. For example, laser particle counters provide data on the size and amount of particles moving through a chamber. On the other hand, meters calculate how much gas flows through the sensor. These sensors also rely on algorithms to turn the data into readable measurements. In addition, the algorithms can make necessary changes if factors like humidity, temperature, etc., disrupt measurements.

Meanwhile, high-quality sensors feature other mechanisms that will adjust the air temperature within the sensor. This helps to provide consistent measurements.


Satellites also feature sensors to measure Earth pollution.

Satellites also feature sensors to measure Earth pollution.


Satellites carrying these sensors measure the energy released from the earth and its atmosphere to detect pollutants. Some may consistently monitor one area while others monitor different regions.


Types of Air Quality Sensors


Varying types of air quality sensors exist on the market. These detect dangerous gases and pollutants in the air, which can impact your health. We listed a few sensor types below:


Image showing a carbon dioxide-based sensor. 

Image showing a carbon dioxide-based sensor. 


  • Electrochemical
  • Metal oxide
  • Photoionization
  • Optical particle counters
  • Optical


How to Build a DIY Air Quality Sensor


Of course, you can also build a cost-effective air quality monitor with a Raspberry Pi and simple coding. Follow the steps below to get started!


Required tools and components:


  • PC
  • SD Card Reader
  • 5.1V/2A Raspberry Pi Universal Power Supply
  • 8GB Micro SD Card
  • Pre-assembled Raspberry Pi Zero WH
  • GPIO Hammer header kit (solderless)
  • Enviro+ Air Quality HAT Sensor
  • PMS5003 Particulate Matter Sensor
  • Pibow Zero W case for the Raspberry Pi


Step one: Setup


An SD card

An SD card


To get started, visit the Raspberry Pi website and install the Raspberry Pi Imager on your PC. The SD card will need the operating system for Raspberry Pi to operate, similar to how a computer requires a hard drive. Load the micro SD card into the SD card reader, which will open it up on the computer. Afterward, launch the Raspberry Pi Imager and select 'Choose OS' under Operating System. You will need to choose Raspberry Pi OS (other) on the next screen. Then, select Pi Raspberry OS Lite. Click on the choose SD card option and select the SD card you placed in the card reader. Next, write and wait until the process completes.

You will need to implement some pre-configurations to provide remote access to the device. Follow this step-by-step guide to connect it to your WiFi and activate SSH. Lastly, conduct Raspberry Pi connectivity tests to ensure it works properly. Place the SD card in the slot, turn on your device, and wait a few minutes to test it out. Then, open a secure command line, like Putty, and enter raspberry pi. Local or the IP address associated with the device.


Step two: Assembly


First, you must fit the hammer header onto your Raspberry Pi. Follow this step-by-step guide to complete the process. Next, insert your SD card into the Raspberry Pi's card slot and follow these instructions to assemble the Pibow Zero W.

Afterward, attach the Enviro+ to the Raspberry Pi Zero WH. First, ensure that the Enviro+'s female header pins align with the Raspberry Pi male header pins. Then, push the female header down until it fits perfectly.

This step involves connecting the Particulate Matter Sensor. Grab a cable and connect one end to the sensor's connector and the other into the Enviro+ underside. Make sure you turn off the Raspberry Pi before proceeding.


Step three: Software setup and testing


You will need to set up the software and test the device. Overall, this part doesn't require much programming skill. So launch the Putty SSH command line terminal via the same approach in step one and type in the following:

git clone

cd enviro plus-python

sudo ./

Then, type sudo reboot to restart the device and apply the installation. You can also run some examples through this guide.


Are air Quality Sensors Accurate?


Low-cost sensors prove less accurate compared to those made in laboratories. Despite this drawback, these still provide monitoring capabilities, informing users of air particulates and toxic gases. Other monitors that can detect volatile organic compounds (VOCs) and carbon monoxide contain electrochemical sensors, which react if toxic gases inhabit the air. However, users may need to calibrate these sensors to maintain accuracy.




Overall, an air quality sensor provides helpful readings on pollutants that may affect your health. You can utilize these devices to detect VOCs in any indoor environment. Plus, deploying this device outdoors allows for monitoring poor air quality. This makes it easier to determine if you should perform light or heavy physical exertion outdoors. As a result, anyone can significantly benefit from installing these devices.

Do you have any questions regarding the air quality sensor? Feel free to contact us!