1
1
Introduction
2
2
============
3
3
4
- This fork adds DFRobots VOC Index algorithm to adafruits CircuitPython SGP40 library.
4
+ .. image :: https://readthedocs.org/projects/adafruit-circuitpython-sgp40/badge/?version=latest
5
+ :target: https://circuitpython.readthedocs.io/projects/sgp40/en/latest/
6
+ :alt: Documentation Status
5
7
6
- CircuitPython library for the Adafruit SGP40 Air Quality Sensor / VOC Index Sensor Breakouts.
8
+ .. image :: https://img.shields.io/discord/327254708534116352.svg
9
+ :target: https://adafru.it/discord
10
+ :alt: Discord
7
11
8
- * `Original Library <https://github.com/adafruit/Adafruit_CircuitPython_SGP40 >`_
9
- * `DFRobot Algorithm <https://github.com/DFRobot/DFRobot_SGP40 >`_
12
+ .. image :: https://github.com/adafruit/Adafruit_CircuitPython_SGP40/workflows/Build%20CI/badge.svg
13
+ :target: https://github.com/adafruit/Adafruit_CircuitPython_SGP40/actions
14
+ :alt: Build Status
15
+
16
+ .. image :: https://img.shields.io/badge/code%20style-black-000000.svg
17
+ :target: https://github.com/psf/black
18
+ :alt: Code Style: Black
19
+
20
+ CircuitPython library for the Adafruit SGP40 Air Quality Sensor / VOC Index Sensor Breakouts
10
21
11
22
12
23
Dependencies
@@ -17,7 +28,6 @@ This driver depends on:
17
28
* `Bus Device <https://github.com/adafruit/Adafruit_CircuitPython_BusDevice >`_
18
29
* `Register <https://github.com/adafruit/Adafruit_CircuitPython_Register >`_
19
30
20
-
21
31
Please ensure all dependencies are available on the CircuitPython filesystem.
22
32
This is easily achieved by downloading
23
33
`the Adafruit library and driver bundle <https://circuitpython.org/libraries >`_.
@@ -50,6 +60,20 @@ To install in a virtual environment in your current project:
50
60
Usage Example
51
61
=============
52
62
63
+ .. code-block :: python3
64
+
65
+ import time
66
+ import board
67
+ import adafruit_sgp40
68
+
69
+ i2c = board.I2C() # uses board.SCL and board.SDA
70
+ sgp = adafruit_sgp40(i2c)
71
+
72
+ while True:
73
+ print("Measurement: ", sgp.raw)
74
+ print("")
75
+ sleep(1)
76
+
53
77
For humidity compensated raw gas and voc index readings, we'll need a secondary sensor such as the bme280
54
78
55
79
.. code-block :: python3
@@ -67,10 +91,10 @@ For humidity compensated raw gas and voc index readings, we'll need a secondary
67
91
temperature = bme280.temperature
68
92
humidity = bme280.relative_humidity
69
93
70
- # Compensated raw gas reading
94
+ # For compensated raw gas readings
71
95
compensated_raw_gas = sgp.measure_index(temperature = temperature, relative_humidity = humidity)
72
96
73
- # Compensated voc index reading
97
+ # For Compensated voc index readings
74
98
voc_index = sgp.measure_raw(temperature = temperature, relative_humidity = humidity)
75
99
76
100
print(compensated_raw_gas)
0 commit comments