Skip to main content

A minimalistic python interface for PMS7003 sensor

The code reads PM values from serial port. Tested on Raspberry Pi, but it should work on any machine with Python and serial port.

Device description: https://aqicn.org/sensor/pms5003-7003/

Setup

To install the driver, simply do:

pip3 install pms7003

Usage example

from pms7003 import Pms7003Sensor, PmsSensorException

if __name__ == '__main__':

    sensor = Pms7003Sensor('/dev/serial0')

    while True:
        try:
            print(sensor.read())
        except PmsSensorException:
            print('Connection problem')

    sensor.close()

The read function has an option of returning values as a dict or OrderedDict.

sensor.read(ordered=True)

Usage example with threading:

import time
from pms7003 import Pms7003Thread

if __name__ == "__main__":

    with Pms7003Thread("/dev/serial0") as sensor:

        while True:
            print(sensor.measurements)
            # We're free to do computation in main thread 
            a = 2**32
            time.sleep(1)

Metadata

Release files for pms7003 1.1.0

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

Source distribution (sdist)

Source distribution for pms7003 1.1.0
File Size Uploaded Provenance Actions
pms7003-1.1.0.tar.gz 3.2 kB Without provenance Details for pms7003-1.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pms7003 1.1.0
File Interpreter ABI Platform Actions
pms7003-1.1.0-py3-none-any.whl Python 3 none any Details for pms7003-1.1.0-py3-none-any.whl

Total release size: 9.0 kB

Release files / pms7003-1.1.0.tar.gz

Download URL pms7003-1.1.0.tar.gz
Size 3.2 kB
Tags Source
SHA-256 checksum
How to use checksums
0c71cf9d212f36d73359248ef558d14259b592b78f494dbdfcbf0631e4281d37
BLAKE2b-256 checksum
How to use checksums
4d464b95d3dd3fdcbb879acba613edc888142f72f833eadfc7dc32c5494f244d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.2

Release files / pms7003-1.1.0-py3-none-any.whl

Download URL pms7003-1.1.0-py3-none-any.whl
Size 5.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a2f3be2cf01b71cd22d5bd6f671f5b0c6767acd0f50752a21b039235713a966f
BLAKE2b-256 checksum
How to use checksums
cdcbbd75c23007c4a93df294e54f88091a0831440566b2c988ad750916f05e77
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.2

Security for pms7003 1.1.0

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.

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files No provenance

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