Skip to main content

simple-sds011

A minimal library for reading samples from a Nova Fitness SDS011 particulate sensor.

In a nutshell

>>> import simple_sds011
>>> pm = simple_sds011.SDS011('/dev/ttyUSB0')
>>> pm.mode = simple_sds011.MODE_PASSIVE
>>> pm.period
{'type': 'period', 'value': 0, 'id': b'\xcb\xc2', 'checksum': True}
>>> pm.query()
{'type': 'sample', 'value': {'pm2.5': 8.5, 'pm10.0': 12.4}, 'id': b'\xcb\xc2', 'checksum': True}

Quick help

Writable properties

  • SDS011.active: Whether the device fan and laser are powered (1) or not (0).
  • SDS011.mode: Continuous (0) or passive (1) sampling. In continuous mode, the device sends sample data once a second or once a sample period. In passive mode, the device only sends sample data when queried.
  • SDS011.period: The period between air samples. Can be 0 or any value between 1 and 30. The device will sleep for N * 60 - 30 seconds, then take a single sample at the end of a 30-second warm up.

Read-only properties

  • SDS011.device_id: A two-byte identifier unique to the sensor.
  • SDS011.firmware: The device firmware identifier.
  • SDS011.port: The open serial port the device is attached to.

Commands

  • SDS011.query(): Get a dictionary containing the current pm2.5 and pm10.0 levels as read by the sensor.

Caveats/to-do

  • Obviously unfinished and delicate. Most useful in the interactive shell for casual readings.
  • Properties are not stored in the instance, but queried to the device. If the device is not active at that moment, an exception is returned. This includes the sleep phase when period != 0.
  • The continuous-report mode is not yet supported—only single queries.
  • The port and ID cannot be changed.

Metadata

Release files for simple-sds011 0.0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for simple-sds011 0.0.7
File Size Uploaded Provenance Actions
simple-sds011-0.0.7.tar.gz 5.2 kB Without provenance Details for simple-sds011-0.0.7.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for simple-sds011 0.0.7
File Interpreter ABI Platform Actions
simple_sds011-0.0.7-py3-none-any.whl Python 3 none any Details for simple_sds011-0.0.7-py3-none-any.whl

Total release size: 11.4 kB

Release files / simple-sds011-0.0.7.tar.gz

Download URL simple-sds011-0.0.7.tar.gz
Size 5.2 kB
Tags Source
SHA-256 checksum
How to use checksums
db7f8ff9995209d14c0cc0880829564b8b188b18b1a15701381492ae95065e0a
BLAKE2b-256 checksum
How to use checksums
78bf3f9c85e0f14bfd8e22fd2f69254150974e72ccccbca7d37f5b1dc48c5010
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.24.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.6

Release files / simple_sds011-0.0.7-py3-none-any.whl

Download URL simple_sds011-0.0.7-py3-none-any.whl
Size 6.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5f51a039611d9a9bed8fbd9397f8a0ff58581765d2ba4ad2b70217f75ae9e518
BLAKE2b-256 checksum
How to use checksums
85f2512d8b76c0572cf709c3bb9d4ab1f8a7b0844cc2a5edb47f9521987d5eed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.24.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.6

Security for simple-sds011 0.0.7

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page