Air Pollution Detection + Air Filtration

Introduction: Air Pollution Detection + Air Filtration

The students (Aristobulus Lam, Victor Sim, Nathan Rosenzweig and Declan Loges) of German Swiss International School worked with the staff of MakerBay to produce an integrated system of air pollution measurement and air filtration effectiveness. This integrated system will allow you to monitor filtered and unfiltered air quality at the same time. The data will be converted into an effectiveness ratio and be graphed. This project is recommended for 15+, though younger ages need to mind the risk of electrocution and the difficulty of the programming.

Why you should do this:

Well, we think that while there certainly is a lot of motivation to provide data for air pollution monitoring (which is explained in detail on Smartcitizen's website, we also believe that just knowing how much air pollution there is around you does nothing for your health. We believe that we need to take action ourselves. So, we created these integrated sensors and air filter.


  • A large piece of cardboard
  • 2x PC fans
  • Several varieties of air filters
  • 2 LED lights
  • 2x Smartcitizen Starter Kits (buy here)
  • 2x Resistors
  • 1 electric switch
  • 1 computer capable of running Jupyter Notebook, Matplotlib and Python
  • Plus any other decorations you want to have!!!

Step 1: SCK Sensor Setup

Make sure that you have your two SCK sensors. Choose the first one and connect it to the battery or to your computer. Then, go to the setup site and follow the instructions. Do the same for the other sensor. When you have to name them, name them A and B respectively for the unfiltered and filtered air sensor. After this, register both to the same account and make sure that you log into the account to get the data.

Check that the sensors are working by going to this platform and searching your sensors' names. Make sure that it is continuously posting data every minute.

Step 2: Enclosure Design

Use the aforementioned cardboard and lay it out in front of you. All measurements will be according to our final prototype. Measure out 12.5 cm on one side and cut across the cardboard. Then, put the fan on the cardboard, and start using the fan to roll the cardboard. When you have made a complete square, then mark the point with a marker. Use scissors to cut across. Repeat this for the other fan.

Step 3: Power to the Fans!

We made a switch that switches the air purifier on and off. To explain how the switch works, you may use the diagram for reference. Starting from the left of the diagram, we have a 220 volt AC to DC converter that reduces the volts down to 12 volts to safely use. Without this device, the electricity from a power source will be too dangerous for us to use. After the volts have been reduced significantly, we have 2 wires that are connected to 2 LED lights and the switch. You have to solder the wires to the LED lights so they are all connected to one another. Once the circuit is complete and both LED lights have been tested, connect both wires, one positive and one negative, into the fan. Once the setup is complete, insert the plug into the socket. Once you have done this, the 'power on' LED should light up. Once you flip the switch, the 'fan on' LED light should light up and the fan should begin to function.

Step 4: Coding!

Recommended for 15+

This program is made by Victor Sim. This program will allow the smart citizen sensor’s data to be extracted from the developer API of the smart citizen website and for an efficiency value to be calculated . The program that I used will be written in Python 3. I wrote the code on a Jupyter Notebook on a Macbook air equipped with Mac OS(version 10.14.6).

What you will need for this program: Matplotlib Numpy Pandas JSON CSV A python 3 IDE

Step 1: Import the necessary libraries You will need urllib.request inorder to request access to the API and to open the URL of the API. You will need csv to convert the file into a csv file that can be manipulated easily. You will need JSON to read the JSON that the api comes in. You will need pandas to analyze the data frame easily. The matplotlib is necessary for the data to be represented in an intuitive graph.

Step 2: Request access to the Smart-citizen API: This code request data from the API. From experience, it is essential to put the headers to source the request to get a response. The two the Requested URLS are formatted as so: Referencing the smart citizen API, getting information for the devices, checking the id of a certain device, referencing the sensor id of 87(PM 2.5 sensor) and recording data every minute. It then requests the access to the API.

Step 3: Open and Parse the data:

These lines read the data and then put the data into a “pretty print”. This makes the data easy to read and thus easier to troubleshoot.

Step 4: Convert the data into a CSV file: In these lines of code the pandas library reads the data and converts it into a csv form that can be manipulated easily. The CSV file is then stored under the variable data_csv.

Step 5: Make CSV data digestible: The CSV’s columns are now named ‘ignore’ for the unnecessary index row, ‘time’ for the time the recording was recorded and ‘value’ for the PM 2.5 concentration recorded. All of the slashes and values are removed so that the values can be plotted on the graph easily.

Step 6: Find the mean of the value column:

These lines find the mean of the values column and then puts the values in a list to plot them easily.

Step 7: Creating more data for comparison: Repeat the code from step 1 to 6 for sensor B to compare

Step 8: Plotting the data:

The line plots the means of both sensor and shows the difference

Step 9: Finding the efficiency:

The efficiency can be calculated by the initial mean and the later mean and then dividing by the initial mean. That can be then calculated as a percentage.

COMPLETE: You should get a percentage and a Graph as an output. Your output should look something like the image below:

Be the First to Share


    • Clocks Speed Challenge

      Clocks Speed Challenge
    • Toys & Games Contest

      Toys & Games Contest
    • Big vs Small Challenge

      Big vs Small Challenge



    Question 5 months ago on Introduction

    Hello I was wondering can you show a video of what each item is used for and other items you would need to build it


    1 year ago

    Thanks for sharing your system and some of your research!