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: Black

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.10.tar.gz (27.5 kB view details)

Uploaded Source

Built Distribution

File details

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

File metadata

File hashes

Hashes for adafruit_circuitpython_sgp30-3.0.10.tar.gz
Algorithm Hash digest
SHA256 3cc04b03f8a9d426f4f3801929192245dcb7fd097b02d33ae212ea96756ab0ef
MD5 47a1b50b5cee3df2bea76f5c2b5a6989
BLAKE2b-256 bb1243d59203e42b90e6c10391878224697ac1e20ed4c5dc949e39310343c21f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for adafruit_circuitpython_sgp30-3.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 ecbe6db6ac049fbac50193b64ae5051125ceceaf451f7e9e3d048529f5efd082
MD5 b2b37b85c5a7cfc35b2cd0ce7db8cc39
BLAKE2b-256 16d38f9df9e0f949ab9f96fb9b25a4fd1aa9a72f660dda7e448196ed7924d27c

See more details on using hashes here.

Supported by

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