Air Quality Sensor Using an Arduino




Introduction: Air Quality Sensor Using an Arduino

About: #BnBe is a platform to help teach electronics no matter what the age or skill level. We’re currently designing a wide range of products from beginner level kits to industry-standard microcontroller platforms.

In this post, we will learn how to build a simple yet useful air quality sensor. We will use the SGP30 sensor along with the Piksey Pico, though the sketch will work with pretty much any Arduino compatible board.

The video above talks you through the importance of such a sensor. We also discuss several factors that were considered when selecting the components for this project. I recommend watching it to get an overview of everything, particularly if you will be using the PCB that has been designed for this project.

Step 1: Gather the Electronics

You will need the following in order to build this project:

  • SGP30 sensor: this can be obtained online from sites like Pimoroni, Adafruit, Sparkfun
  • OLED module: A standard 0.96" OLED module will work fine
  • Arduino board: I'll be using the Piksey Pico but you can use any Arduino board you may have
  • Level shifter: We build a 5V to 3.3V level shifter for the OLED module, but you can also buy one
  • 3.3V voltagage source: We use a LM2950 voltage reguator to produce the 3.3V power supply required by the OLED module

Step 2: Download the Sketch & Program the Board

You can download the final sketch using the following link:

Before you can compile and upload the sketch, you need to install the "Sparkfun SGP30" and "U8g2" libraries using the library manager. Please watch the video if you need assistance with this.

Once done, simply upload the sketch to your board.

Step 3: Conenct the Components & Modules

We then need to connect all the components together. If you are using the PCB then you simply need to solder all the components in place. The video shows you how to do this.

You can also use a breadboard along with the connection diagram to conenct everything together. The LM2950 is a 3.3V regulator that is needed only if your OLED module does not have a built-in regulator and needs 3.3V for operation. Some OLED modules work with a 5V supply and in that case, you wouldn't need this section.

Step 4: Test & Monitor the Air Quality

Once you have everything wired in place. SImple power on the build using a microUSB cable and you should see the output on the OLED module. Keep in mind that the first 15 CO2 readings will be 400ppm, which the TVOC readings will be 0ppb as the internal heating element needs to warm up.

You can also modify this to add a buzzer to alert you if the levels cross a certain threshold. The PCB design has been released on Github and you can use that to order your own PCBs. I ordered some extra PCBs and I have listed these for sale on the website if you are just looking for a few.

If you've liked this project, then please consider subscribing to our YouTube channel as it helps us grow.

Thank you for reading.

Be the First to Share


    • Build a Tool Contest

      Build a Tool Contest
    • Eggs Challenge

      Eggs Challenge
    • Fabric Challenge

      Fabric Challenge



    Question 1 year ago on Step 4

    Hello, Thank you for coming up with this detailed instructable! I came across the same YouTube video you referred to by Andreas Spiess, and then came here to Instructables to see if I could find someone who make this more beginner friendly for students in a school makerspace. Your project looks like it fits what I'm looking for!

    My question though is about the LM2950 voltage regulator, and what to do if the OLED display I want to use is in fact 5v tolerant. Although I could follow your schematic to copy what you have done, I don't quite understand what to change if I wanted to take out the voltage regulator. Will I still need all the other components? The way you have the mosfets, caps, and resisters connected, it's not clear to me what the modified schematic would look like. Would you be willing to reply here or add that additional schematic to show how that would work? Thank you so much for all you have done!