CircuitPython library for Sensirion SGP30 gas sensor with eCO2 and TVOC.
Project description
Introduction
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file adafruit-circuitpython-sgp30-3.0.3.tar.gz
.
File metadata
- Download URL: adafruit-circuitpython-sgp30-3.0.3.tar.gz
- Upload date:
- Size: 29.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3cb13465dacf6b2cd1c56d03929e1f196add0e2db1c23614388b3e5ffedccc75 |
|
MD5 | 29eb70d245bc1047b19bdd353c60bfaf |
|
BLAKE2b-256 | 1fdd5dd10b09b12c45fda6de5d2b39f1405e314e1336ccafbddf737d88b1d19c |
File details
Details for the file adafruit_circuitpython_sgp30-3.0.3-py3-none-any.whl
.
File metadata
- Download URL: adafruit_circuitpython_sgp30-3.0.3-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b4a5b0af0d0db4ef5f842b1e2a0142e8dbafec1e9e61764f5ce99b42ec311726 |
|
MD5 | 2d1f676735a2576687a83e5bb5c00bd1 |
|
BLAKE2b-256 | 0709eb47cd4bea9aa92101b9806079c827948fd2a29d3349aa2a68e6fceb7169 |