8bff008b3612541d2855e1f935487058ab71588a
The old time keeping routine was a bit flaky, this one might blow up in irritating ways if a cycle takes more than 1 second. Also uses the new init functions to set up the SGP. Be ware of the dangerous i2c-general call that resets any device on the buss that listens to general call.
RPI_SGP30
Program to read eCO_2 and TVOC from the SGP30 sensor. Based on the smbus2 i2c library for ease of use.
It currently lacks support for many features features and is more of a crude demo than a proper library.
Features that are known to be missing (listing in rough order of importance):
- CRC support
- reading/writing base-line data
- reading raw-values
- Proper structuring of the code
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 probbably need to enable i2c in the kernel using raspi-config
and reboot
Languages
Python
100%