Python & CircuitPython
It's easy to use the SGP40 with Python or CircuitPython, and the Adafruit CircuitPython
SGP40 (https://adafru.it/PBZ) module. This module allows you to easily write Python code that reads gas
measurements from the SGP40 sensor.
You can use this sensor with any CircuitPython microcontroller board or with a computer that has GPIO
and Python thanks to Adafruit_Blinka, our CircuitPython-for-Python compatibility
library (https://adafru.it/BSN).
CircuitPython Microcontroller Wiring
First wire up a SGP40 to your board exactly as shown below. Here's an example of wiring a Feather M4 to
the sensor with I2C using one of the handy STEMMA QT (https://adafru.it/Ft4) connectors:
Board 3V to sensor VIN (red wire)
Board GND to sensor GND (black
wire)
Board SCL to sensor SCL (yellow wire)
Board SDA to sensor SDA (blue wire)
You can also use the standard 0.100" pitch headers to wire it up on a breadboard:
Board 3V to sensor VIN (red wire)
Board GND to sensor GND (black
wire)
Board SCL to sensor SCL (yellow wire)
Board SDA to sensor SDA (blue wire)
Python Computer Wiring
Since there's
dozens
of Linux computers/boards you can use, we will show wiring for Raspberry Pi. For
other platforms, please visit the guide for CircuitPython on Linux to see whether your platform is
supported (https://adafru.it/BSN).
Here's the Raspberry Pi wired to the sensor using I2C and a STEMMA QT (https://adafru.it/Ft4) connector: