Using the SGP30 Qwiic Breakout from Adafruit
Table of contents
- Overview
- STEMMA QT Connections
- Install the Adafruit SGP30 Library
- Run the
sgp30test.ino
sketch from the Adafruit Library - Run the
sgp30_simple.ino
sketch
Overview
The SGP30 is a sensor from Sensiron that provides measurements to indicate CO2 and TVOC (Total Volatile Organic Compounds) in the air around the sensor.
The Adafruit breakout board has a STEMMA/QT (compatible with SparkFun’s Qwiic) for convenient solderless connection via I2C.
STEMMA QT Connections
The SGP30 has two STEMMA QT (Qwiic) connectors, which allows daisy-chaining with other devices
Connect the STEMMA QT connector to the Breadboard
The wires of the STEMMA QT connector have four colors, which correspond to the I2C communication protocol. Insert the male end of the STEMMA QT cable into the sockets adjacent to the pins on the Feather with the labels corresponding to the following color scheme.
Black: GND
Red: 3V
Yellow: SCL
Blue: SDA
The SCL and SDA labels are for “clock” and “data”, respectively.
The following images shows the Feather nRF52840 Sense connected to an Adafruit 128 x 64 OLED and an Adafruit SGP30 breakout board. Only the Feather (with header pins) and one of the STEMMA QT connectors use the breadboard sockets. The SGP30 and the OLED are only resting on the breadboard.
The STEMMA QT cable is inserted into the socket of the OLED board, and the exposed pins on the opposite end of the STEMMA QT cable are inserted into the breadboard in sockets adjacent to the SCL and SDA pins on the Feather and to the power and ground rail on the side of the breadboard.
Install the Adafruit SGP30 Library
To use the Adafuit SGP30 breakout board, you first need to install the Adafruit SGP30 Arduino Library. The following steps with the Library Manager assume that you have properly configured the board support via the Arduino IDE Preferences.
From menu at the top of the Arduino IDE, select Sketch –> Include Library –> Manage Libraries…
- Enter “sgp30” in the search box to narrow the range of choices. Or, if you prefer, scroll through the entire list of libraries (not recommended).
- Choose the “Adafruit SGP30 Sensor” panel, which will cause the Install button to become visible.
- Click Install.
Run the sgp30test.ino
sketch from the Adafruit Library
The Adafruit SGP30 Sensor library includes an example sketch to demonstrate features of the SGP30. Using the menus at the top of the Arduino IDE, select File –> Examples –> Adafruit SGP30 Sensor –> sgptest. Upload that sketch to the Feather board.
If you have connected the STEMMA QT cable to the correct pins on the breadboard, the sgp30.ino
should run and display eCO2 and eVOC readings in the Serial Monitor. A typical output follows, where #015441EC
is the serial number of a particular SGP30. Your serial number should be different.
SGP30 test
Found SGP30 serial #015441EC
TVOC 0 ppb eCO2 400 ppm
Raw H2 6577 Raw Ethanol 11679
TVOC 0 ppb eCO2 400 ppm
Raw H2 10586 Raw Ethanol 14456
TVOC 0 ppb eCO2 400 ppm
Raw H2 11607 Raw Ethanol 15171
TVOC 0 ppb eCO2 400 ppm
Raw H2 12035 Raw Ethanol 15512
...
Run the sgp30_simple.ino
sketch
The sgp30_simple
sketch makes measurements of eCO2 and eTVOC with the Adafruit SGP30 breakout board. Those values along with time are displayed in columns and updated once every second.
Download the sgp30_simple.ino sketch