Grove - VOC and eCO2 Gas Sensor(SGP30)
The Grove-VOC and eCO2 Gas Sensor(SGP30) is an air quality detection sensor. This grove module is based on SGP30, we provide TVOC(Total Volatile Organic Compounds) and CO2eq output for this module.
The SGP30 is a digital multi-pixel gas sensor designed for easy integration into air purifier, demand-controlled ventilation, and IoT applications. Sensirion’s CMOSens®technology offers a complete sensor system on a single chip featuring a digital I2C interface, a temperature controlled micro hotplate, and two preprocessed indoor air quality signals. As the first metal-oxide gas sensor featuring multiple sensing elements on one chip, the SGP30 provides more detailed information about the air quality.
Tip
We've released the Seeed Gas Sensor Selection Guide, it will help you choose the gas sensor that best suits your needs.
Features¶
- Multi-pixel gas sensor for indoor air quality applications
- Outstanding long-term stability
- I2C interface with TVOC and CO2eq output signals
- Low power consumption
- Chip module tape and reel packaged, reflow solderable
Specification¶
Parameter | Signal | Values |
---|---|---|
Working Voltage | 3.3V/5V | |
Output range | TVOC | 0 ppb to 60000ppb |
CO₂eq | 400 ppm to 60000 ppm | |
Sampling rate |
TVOC | 1HZ |
CO₂eq | 1HZ | |
Resolution |
TVOC |
0 - 2008 ppb / 1 ppb |
2008 - 11110 ppb / 6 ppb | ||
11110 - 60000 ppb / 32 ppb | ||
CO₂eq |
400 - 1479 ppm / 1 ppm | |
1479 -5144 ppm / 3 ppm | ||
5144 - 17597 ppm / 9 ppm | ||
17597 - 60000 ppm / 31 ppm | ||
Default I2C address | 0X58 |
Applications¶
- Air purifier
- demand-controlled ventilation
- IoT applications
- New house air condition monitor
Hardware Overview¶
Pin Map¶
Schematic¶
Power
The typical operating voltage SGP30 is 1.8v, we use a power conversion chip XC6206P182MR to provide a stable 3.3V for the MCP9600.
Bi-directional level shifter circuit
This is a typical Bi-directional level shifter circuit to connect two different voltage section of an I2C bus. The I2C bus of this sensor use 1.8V, if the I2C bus of the Arduino use 5V or 3.3V, this circuit will be needed. In the schematic above, Q7 and Q8 are N-Channel MOSFET BSS138LT3G, which act as a bidirectional switch. In order to better understand this part, you can refer to the AN10441
Platforms Supported¶
Arduino | Raspberry Pi | |||
---|---|---|---|---|
![]() |
![]() |
![]() |
![]() |
![]() |
Caution
The platforms mentioned above as supported is/are an indication of the module's hardware or theoritical compatibility. We only provide software library or code examples for Arduino platform in most cases. It is not possible to provide software library / demo code for all possible MCU platforms. Hence, users have to write their own software library.
Getting Started¶
Note
If this is the first time you work with Arduino, we strongly recommend you to see Getting Started with Arduino before the start.
Play With Arduino¶
Hardware¶
Materials required
Seeeduino V4.2 | Base Shield | Grove-VOC and eCO2 Gas Sensor(SGP30) |
---|---|---|
![]() |
![]() |
![]() |
Get One Now | Get One Now | Get One Now |
Note
1 Please plug the USB cable gently, otherwise you may damage the port. Please use the USB cable with 4 wires inside, the 2 wires cable can't transfer data. If you are not sure about the wire you have, you can click here to buy
2 Each Grove module comes with a Grove cable when you buy. In case you lose the Grove cable, you can click here to buy.
-
Step 1. Connect Grove-VOC and eCO2 Gas Sensor(SGP30) to I2C port of Grove-Base Shield.
-
Step 2. Plug Grove - Base Shield into Seeeduino.
-
Step 3. Connect Seeeduino to PC via a USB cable.
Note
If we don't have Grove Base Shield, We also can directly connectGrove-VOC and eCO2 Gas Sensor(SGP30) to Seeeduino as below.
Seeeduino | Grove-VOC and eCO2 Gas Sensor(SGP30) |
---|---|
5V | Red |
GND | Black |
SDA | White |
SCL | Yellow |
Software¶
-
Step 1. Download the Seeed SGP30 library from Github.
-
Step 2. Refer to How to install library to install library for Arduino.
-
Step 3. Extract the
SGP30_Gas_Sensor-master.zip
you've just downloaded, in theexamples
folder you will see 3 subfolders:
The absolute_humidity_example
requires external humidity sensor calibration
The base_example
is simplely collecting date without any calibration
The baseline_operation_example
can save the data base value to flash. The software will automatically collects the base values and stores them.
We recommand to use the baseline_operation_example
, then click the xxx.ino
file to open the example.
-
Step 4. Upload the demo. If you do not know how to upload the code, please check How to upload code.
-
Step 5. Open the Serial Monitor of Arduino IDE by click Tool-> Serial Monitor. Or tap the Ctrl+Shift+M key at the same time. if every thing goes well, you will get the result.
The result should be like:
318
tVOC Concentration:74ppb
CO2eq Concentration:506ppm
319
tVOC Concentration:80ppb
CO2eq Concentration:509ppm
320
tVOC Concentration:66ppb
CO2eq Concentration:500ppm
321
tVOC Concentration:69ppb
CO2eq Concentration:511ppm
322
tVOC Concentration:70ppb
CO2eq Concentration:511ppm
323
tVOC Concentration:60ppb
CO2eq Concentration:493ppm
324
tVOC Concentration:72ppb
CO2eq Concentration:502ppm
Tips
1- ppm: parts per million. 1 ppm = 1000 ppb (parts per billion)
2- The result is based on baseline_operation_example.ino
3- We tested this demo in our office room, according to your test environment, the results may be different
Play With Raspberry Pi (With Grove Base Hat for Raspberry Pi)¶
Hardware¶
- Step 1. Things used in this project:
Raspberry pi | Grove Base Hat for RasPi | Grove-VOC and eCO2 Gas Sensor(SGP30) |
---|---|---|
![]() |
![]() |
![]() |
Get ONE Now | Get ONE Now | Get ONE Now |
- Step 2. Plug the Grove Base Hat into Raspberry.
- Step 3. Connect Grove-VOC and eCO2 Gas Sensor(SGP30) to port I2C of the Base Hat.
- Step 4. Connect the Raspberry Pi to PC through USB cable.
Software¶
Attention
If you are using Raspberry Pi with Raspberrypi OS >= Bullseye, you have to use this command line only with Python3.
- Step 1. Follow Setting Software to configure the development environment.
- Step 2. Download the source file by cloning the grove.py library.
cd ~
git clone https://github.com/Seeed-Studio/Seeed_Python_SGP30.git
- Step 3. Excute below commands to run the code.
cd Seeed_Python_SGP30
sudo python3 setup.py install
cd examples
python3 sgp30_simpleread.py
Error
It might cause some errors but we should not worry about it.
We copy the path to the error file.
Here is the path that is shown as the example : “/usr/local/lib/python3.7/dist-packages/sgp30-0.1.6-py3.7.egg/sgp30"
Use "cd" command to jump in that path and use your compiler to change the codes of "sgp30.py", for example : “sudo nano sgp30.py”.
We delete "SMBusWrapper" on the second line and then save it.
Go back to “Seeed_Python_SGP30/examples” folder,apply "python3 sgp30_simpleread.py" and all will be fine。
Following is the sgp30_simpleread.py code.
import seeed_sgp30
from grove.i2c import Bus
sgp30 = seeed_sgp30.grove_sgp30(Bus())
while True:
data = sgp30.read_measurements()
co2_eq_ppm, tvoc_ppb = data.data
print("\r tVOC = {} ppb CO2eq = {} ".format(
tvoc_ppb, co2_eq_ppm))
Success
If everything goes well, you will be able to see the following result.
pi@raspberrypi:~/Seeed_Python_SGP30/examples $ python3 sgp30_simpleread.py
tVOC = 9 ppb CO2eq = 943
tVOC = 9 ppb CO2eq = 931
tVOC = 10 ppb CO2eq = 920
tVOC = 14 ppb CO2eq = 904
tVOC = 12 ppb CO2eq = 888
tVOC = 13 ppb CO2eq = 873
tVOC = 11 ppb CO2eq = 865
tVOC = 11 ppb CO2eq = 842
tVOC = 9 ppb CO2eq = 828
tVOC = 10 ppb CO2eq = 814
tVOC = 11 ppb CO2eq = 794
tVOC = 14 ppb CO2eq = 786
tVOC = 9 ppb CO2eq = 764
tVOC = 12 ppb CO2eq = 744
tVOC = 11 ppb CO2eq = 739
tVOC = 12 ppb CO2eq = 715
tVOC = 15 ppb CO2eq = 688
tVOC = 13 ppb CO2eq = 669
You can quit this program by simply press Ctrl+C.
Notice¶
- The SGP30 uses a dynamic baseline compensation algorithm and on-chip calibration parameters to provide two complementary air quality signals. The baseline should be stored in EEPROM.When there is no baseline value in EEPROM at the first time power-ON or the baseline record is older than seven days.The sensor has to run for 12 hours until the baseline can be stored. You can refer to program flow chart blow.
-
The H2_Signal and Ethanol_signal,Both signals can be used to calculate gas concentrations c relative to a reference concentration cref by ln(C/Cref)=(Sref-Sout)/a with a = 512, sref the H2_signal or Ethanol_signal output at the reference concentration, and sout = Sout_H2 or Sout = Sout_EthOH.
-
For more accurate measurement,You can set the abslute humidity compensation,Defalt value is 11.57g/m3,A little troublesome is that you should get relatively humidity value of environment from another way,Because there is no humidity measurement part integrated in SGP30..
Luckly, It's not much neccessary in a normal situation