Air Quality Sensor Kit: Using SGP30
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 link at the bottom of this post.
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.
Thank you for reading!
PCB Design: https://github.com/bnbe-club/air-quality-kit