Arduino SGP30 Air Quality Sensor VOC and ECO2 Gas Sensor
by RonFrtek in Circuits > Arduino
863 Views, 1 Favorites, 0 Comments
Arduino SGP30 Air Quality Sensor VOC and ECO2 Gas Sensor
In This tutorial we will learn how to use the SGP30 Air Quality Sensor to Display TVOC-Total volatile organic compounds,CO2 -Carbon dioxide, Hydrogen and Ethanol on the OLED Display.
In Part2 we will learn how to calculate the absolute Humidity and also Display the Temperature and Humidity using the DHT11 Sensor.
What You Will Need
- Arduino UNO (or any other Arduino)
- SGP30 Air Quality Sensor
- OLED I2C Display
- Breadboard
- Jumper wires
- Visuino program: Download Visuino
About the SGP30 Air Quality Sensor
This is a very fine air quality sensor from the sensor experts at Sensirion, with I2C interfacing and fully calibrated output signals with a typical accuracy of 15% within measured values. The SGP combines multiple metal-oxide sensing elements on one chip to provide more detailed air quality signals.
This is a gas sensor that can detect a wide range of Volatile Organic Compounds (VOCs) and H2 and is intended for indoor air quality monitoring. When connected to your microcontroller (running our library code) it will return a Total Volatile Organic Compound (TVOC) reading and an equivalent carbon dioxide reading (eCO2) over I2C.
The SGP30 has a 'standard' hot-plate MOX sensor, as well as a small microcontroller that controls power to the plate, reads the analog voltage, tracks the baseline calibration, calculates TVOC and eCO2 values, and provides an I2C interface to read from. Unlike the CCS811, this sensor does not require I2C clock stretching.
You can read more here: https://www.adafruit.com/product/3709
The Circuit
- Connect OLED Display pin [SCL] to Arduino pin [SCL]
- Connect OLED Display pin [SDA] to Arduino pin [SDA]
- Connect OLED Display pin [VCC] to Arduino pin [5v]
- Connect OLED Display pin [GND] to Arduino pin [GND]
- Connect SGP30 Sensor pin [SCL] to Arduino pin [SCL]
- Connect SGP30 Sensor pin [SDA] to Arduino pin [SDA]
- Connect SGP30 Sensor pin [VIN] to Arduino pin [5v]
- Connect SGP30 Sensor pin [GND] to Arduino pin [GND]
Start Visuino, and Select the Arduino UNO Board Type
The Visuino: https://www.visuino.eu also needs to be installed. Download Free version or register for a Free Trial.
Start Visuino as shown in the first picture Click on the "Tools" button on the Arduino component (Picture 1) in Visuino When the dialog appears, select "Arduino UNO" as shown on Picture 2
In Visuino Add & Set Components
- Add "OLED I2C" component
- Add "Air Quality SGP30" component
Double click on "DisplayOLED1" and in the "Elements" window drag 4X "Draw text" to the left side and 4X "Text Field" to the left side
- On the Left side select "Draw Text1" and in the properties window set Text to "TVOC"
- On the Left side select "Draw Text2" and in the properties window set Text to "CO2" and Y to 15
- On the Left side select "Draw Text3" and in the properties window set Text to "HYDR" and Y to 30
- On the Left side select "Draw Text4" and in the properties window set Text to "ETH" and Y to 45
- On the Left side select "Text Field1" and in the properties window set X to 60
- On the Left side select "Text Field2" and in the properties window set X to 60 and Y to 15
- On the Left side select "Text Field3" and in the properties window set X to 60 and Y to 30
- On the Left side select "Text Field4" and in the properties window set X to 60 and Y to 45
Close the "Elements" window
In Visuino Connect Components
- Connect "AirQuality1" pin [Out I2C] to Arduino board pin [I2C In]
- Connect "DisplayOLED1" pin [Out I2C] to Arduino board pin [I2C In]
- Connect "AirQuality1" pin [TVOC] to "DisplayOLED1" > "Text Field1" pin [In]
- Connect "AirQuality1" pin [CO2] to "DisplayOLED1" > "Text Field2" pin [In]
- Connect "AirQuality1" pin [Hydrogen] to "DisplayOLED1" > "Text Field3" pin [In]
- Connect "AirQuality1" pin [Ethanol] to "DisplayOLED1" > "Text Field4" pin [In]
Generate, Compile, and Upload the Arduino Code
In Visuino, at the bottom click on the "Build" Tab, make sure the correct port is selected, then click on the "Compile/Build and Upload" button.
Play
If you power the Arduino module, the OLED Display will start to show the values from the sensor. To test it you can put some Ethanol near and see how the values change, or breath near the sensor.
Congratulations! You have completed your project with Visuino. Also attached is the Visuino project, that I created for this Tutorial, you can download it and open it in Visuino: https://www.visuino.eu