Skip to content

Sensirion/arduino-i2c-sgp43

Repository files navigation

Sensirion I²C SGP43 Arduino Library

This is the Sensirion SGP43 library for Arduino allowing you to communicate with a SGP43 sensor over I²C.

Image of the SGP4x eval kit

Click here to learn more about the Sensirion SGP43 sensor.

Air Quality Sensor for VOC and NOx Measurements.

The default I²C address of SGP43 is 0x59.

Installation of the library

This library can be installed using the Arduino Library manager: Start the Arduino IDE and open the Library Manager via

SketchInclude LibraryManage Libraries...

Search for the Sensirion I2C SGP43 library in the Filter your search... field and install it by clicking the install button.

If you cannot find it in the library manager, download the latest release as .zip file and add it to your Arduino IDE via

SketchInclude LibraryAdd .ZIP Library...

Don't forget to install the dependencies listed below the same way via library manager or Add .ZIP Library

Dependencies

Connect the sensor

Use the following pin description to connect your SGP43 to the standard I²C bus of your Arduino board:

The pinout of the SGP43 sensor.

Pin Cable Color Name Description Comments
1 red VDD Supply Voltage 1.7V to 3.6V
2 black GND Ground
3 green SDA I2C: Serial data input / output
4 blue NC Do not connect
5 VDDH Supply voltage hotplate; see data sheet on how to connect.
6 yellow SCL I2C: Serial clock input

The recommended voltage is 3.3V.

Board specific wiring

You will find pinout schematics for recommended board models below:

SparkFun ESP32-C6 Qwiic Pocket

A photo of the SparkFun ESP32-C6 Qwiic Pocket

Qwiic connection (no soldering):

  • The SparkFun ESP32-C6 Qwiic Pocket has a 4-pin Qwiic connector (JST-SH) that is wired to the I²C bus at 3.3V. The SGP43 sensor uses I²C at address 0x59.
  • Simply plug a Qwiic cable between the board and the SGP43 eval kit. Power the board over USB-C. No additional wiring is required.
  • If your SGP43 board exposes a STEMMA QT/Qwiic port, use a standard Qwiic-to-Qwiic cable. If it only exposes header pins, use a Qwiic adapter cable to break out to 3.3V, GND, SDA and SCL.

Notes:

  • The Pocket board provides the required pull-ups on the I²C lines.
  • The default Wire instance is used by this library; the Qwiic connector is on the default I²C pins, so no pin configuration is needed in code.
SparkFun ESP32-C6 Qwiic Pocket with SGP43 eval kit

Arduino IDE board support (Espressif) and board selection:

  1. Install ESP32 boards by Espressif Systems

  2. Select the correct board

    • Once you have installed the Espressif ESP32 board package, choose: Tools ➔ Board ➔ esp32 ➔ “SparkFun ESP32-C6 Qwiic Pocket”.
    • Optionally you can also use the generic Espressif definition: Tools ➔ Board ➔ esp32 ➔ “ESP32C6 Dev Module”. This works well for the examples in this library.

After selecting the board, set the upload port under Tools ➔ Port, open File ➔ Examples ➔ Sensirion I2C SGP43 ➔ exampleSGP43Classifier, and upload. Open Tools ➔ Serial Monitor at 115200 baud to see readings.

Arduino Uno

SGP43 SGP43 Pin Cable Color Board Pin
VDD 1 red 3.3V
GND 2 black GND
SDA 3 green D18/SDA
VDDH 5
SCL 6 yellow D19/SCL
Arduino UNO pinout image

Arduino Nano

SGP43 SGP43 Pin Cable Color Board Pin
VDD 1 red 3.3V
GND 2 black GND
SDA 3 green A4
VDDH 5
SCL 6 yellow A5
Arduino Nano pinout image

Arduino Micro

SGP43 SGP43 Pin Cable Color Board Pin
VDD 1 red 3.3V
GND 2 black GND
SDA 3 green D2/SDA
VDDH 5
SCL 6 yellow ~D3/SCL
Arduino Micro pinout image

Arduino Mega 2560

SGP43 SGP43 Pin Cable Color Board Pin
VDD 1 red 3.3V
GND 2 black GND
SDA 3 green D20/SDA
VDDH 5
SCL 6 yellow D21/SCL
Arduino Mega 2560 pinout image

ESP32 DevKitC

SGP43 SGP43 Pin Cable Color Board Pin
VDD 1 red 3V3
GND 2 black GND
SDA 3 green GPIO 21
VDDH 5
SCL 6 yellow GPIO 22
ESP32 DevKitC pinout image

ML-based smell detection

For instructions on using the SEK-SGP4x evaluation board for machine learning-based smell detection, please read application note GAS_AN_SGP43 in combination with the documentation of the dedicated example.

Contributing

Contributions are welcome!

This Sensirion library uses clang-format to standardize the formatting of all our .cpp and .h files. Make sure your contributions are formatted accordingly:

The -i flag will apply the format changes to the files listed.

clang-format -i src/*.cpp src/*.h

Note that differences from this formatting will result in a failed build until they are fixed. :

License

See LICENSE.

About

SGP43 Arduino driver

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages