Helper library for the Sensirion SPS30 particulate matter sensor
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.
On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally `from PyPI <https://pypi.org/project/adafruit-circuitpython-sps30`_. To install for current user:
pip3 install adafruit-circuitpython-sps30
To install system-wide (this may be required in some cases):
sudo pip3 install adafruit-circuitpython-sps30
To install in a virtual environment in your current project:
mkdir project-name && cd project-name
python3 -m venv .env
source .env/bin/activate
pip3 install adafruit-circuitpython-sps30
import time
import board
from adafruit_sps30.i2c import SPS30_I2C
# For i2c mode the SPS30 interface select pin needs to be connected to ground
i2c = board.I2C() # uses board.SCL and board.SDA
sps = SPS30_I2C(i2c)
while True:
aqdata = sps.read()
print("PM2.5: {:d}".format(aqdata["pm25 standard"]))
time.sleep(1)
Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.
For information on building library documentation, please check out this guide.