SGP30
Library to read eCO2 and TVOC from the SGP30 sensor. Based on the smbus2 i2c library for ease of use.
It should be compatible with both Python 2 and 3
Quick usage-example:
from smbus2 import SMBusWrapper
from sgp30 import SGP30
import time
with SMBusWrapper(1) as bus:
sgp = SGP30(bus, baseline_filename=BASELINE_FILENAME+".TESTING")
print("resetting all i2c devices")
sgp.i2c_general_call()
print(sgp.read_features())
print(sgp.read_serial())
sgp.init_sgp()
for i in range(300):
print(sgp.read_measurements())
time.sleep(0.1)
sgp.store_baseline()
bus.close()
Current design considerations:
The class strives to to be light-weight and portable. It is currently a bit to tightly bound to the smbus2 class. In most cases I try to ease of readability rather than purity or speed.
Features that are known to be missing (listing in rough order of importance):
- The handing of baseline values is not that great, it should probably be up to the end user to save and restore them as needed.
- Write doc-strings for all or at least most methods.
- reading raw-values.
- A more "driver like" class that takes care of all chip identification, polling at regular intervals, restoring baseline and so on.
- Run real hardware tests under Python3
Hardware notices:
If you have the Adafruit board with built in level shifters and voltage regulator it is should work if you just plug in SDA to pin 3, SCL to pin 5, VCC to pin 17 and GND to pin 20. You should then be able to find the SGP30 an address 0x58 using i2cdetect -y 1. If you get an error message you probably need to enable i2c in the kernel using raspi-config and reboot
Feel free to contact me with bugs, questions or issues.
Metadata
Release files for PySGP30 0.1.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| PySGP30-0.1.8.tar.gz | 5.3 kB | Without provenance | Details for PySGP30-0.1.8.tar.gz |
Release files / PySGP30-0.1.8.tar.gz
| Download URL | PySGP30-0.1.8.tar.gz |
|---|---|
| Size | 5.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
239439e96f9055965bbd26fc3e836c19024459205f3f29a6fa5088e2aeec47df
|
|
BLAKE2b-256 checksum How to use checksums |
68974a8d01a65b282f2aca1cc7ae12d43ebf1504bcf217ca2134f64b7593e2af
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.4.2 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.3
|
Security for PySGP30 0.1.8
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.