phgachoud / py-sds011

Python 3 interface to the SDS011 air particulate density sensor.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

py-sds011

This is a python 3 interface to the SDS011 air particulate density sensor. The datasheet, which this implementation follows, can be found here.

Depends on pyserial.

API

>>> sensor = SDS011("/dev/ttyUSB0", use_query_mode=True)
>>> sensor.query()  # Gets (pm25, pm10)
(15.6, 20.3)
>>> sensor.sleep()  # Turn off fan and diode
>>> sensor.sleep(sleep=False)  # Turn on fan and diode
>>> time.sleep(15)  # Allow time for the sensor to measure properly
>>> sensor.query()
(16.2, 21.0)
>>> # There are other methods to configure the device, go check them out.

About

Python 3 interface to the SDS011 air particulate density sensor.

License:MIT License


Languages

Language:Python 100.0%