Skip to main content

CircuitPython library for Sensirion SGP30 gas sensor with eCO2 and TVOC.

Project description

Introduction

Documentation Status Discord Build Status Code Style: Ruff

A CircuitPython driver for the Sensirion SGP30 gas sensor with eCO2 and TVOC output. This sensor uses I2C!

Installation and Dependencies

This driver depends on:

Please ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloading the Adafruit library and driver bundle.

Installing from PyPI

On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally from PyPI. To install for current user:

pip3 install adafruit-circuitpython-sgp30

To install system-wide (this may be required in some cases):

sudo pip3 install adafruit-circuitpython-sgp30

To install in a virtual environment in your current project:

mkdir project-name && cd project-name
python3 -m venv .venv
source .venv/bin/activate
pip3 install adafruit-circuitpython-sgp30

Usage Notes

See the guide for wiring and installation instructions.

First, import the library:

import busio
import adafruit_sgp30

Next, initialize the I2C bus object:

import board
i2c_bus = busio.I2C(board.SCL, board.SDA, frequency=100000)

Since we have the I2C bus object, we can now use it to instantiate the SGP30 object:

sgp30 = adafruit_sgp30.Adafruit_SGP30(i2c_bus)

Reading from the Sensor

To read from the sensor:

eCO2, TVOC = sgp30.iaq_measure()
print("eCO2 = %d ppm \t TVOC = %d ppb" % (eCO2, TVOC))

Documentation

API documentation for this library can be found on Read the Docs.

For information on building library documentation, please check out this guide.

Contributing

Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

adafruit_circuitpython_sgp30-3.0.15.tar.gz (24.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

adafruit_circuitpython_sgp30-3.0.15-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file adafruit_circuitpython_sgp30-3.0.15.tar.gz.

File metadata

File hashes

Hashes for adafruit_circuitpython_sgp30-3.0.15.tar.gz
Algorithm Hash digest
SHA256 27328a7a993e2f0bf46d7240899c2eb9e64625758791f4d136a32b3e33d13cd7
MD5 57e6ae595f5c9b260856f44390f75e7c
BLAKE2b-256 199714438040b08754e0c1a137d4a9d6d4a2b49adb77895fb6f45b29ee0d55d4

See more details on using hashes here.

File details

Details for the file adafruit_circuitpython_sgp30-3.0.15-py3-none-any.whl.

File metadata

File hashes

Hashes for adafruit_circuitpython_sgp30-3.0.15-py3-none-any.whl
Algorithm Hash digest
SHA256 0f23f59a07fcf4f5fb5b0be0f5ddd3669221d307c1f2085ef78503b344f760de
MD5 6e46a7fa3fe39fc01db4e1a055b31400
BLAKE2b-256 46f682dfbe926aa1afeec891eedc61219d514bb87c437beb793c3a36549bd5f5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page