A python driver for plantower pms7003 pm sensor
Project description
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)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pms7003-1.1.0.tar.gz
(3.2 kB
view details)
Built Distribution
File details
Details for the file pms7003-1.1.0.tar.gz
.
File metadata
- Download URL: pms7003-1.1.0.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0c71cf9d212f36d73359248ef558d14259b592b78f494dbdfcbf0631e4281d37 |
|
MD5 | c0d47b69ae9db646736aac0c0fea150a |
|
BLAKE2b-256 | 4d464b95d3dd3fdcbb879acba613edc888142f72f833eadfc7dc32c5494f244d |
File details
Details for the file pms7003-1.1.0-py3-none-any.whl
.
File metadata
- Download URL: pms7003-1.1.0-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a2f3be2cf01b71cd22d5bd6f671f5b0c6767acd0f50752a21b039235713a966f |
|
MD5 | 1d02f46eacfdd45bf3d64655a5fd2e19 |
|
BLAKE2b-256 | cdcbbd75c23007c4a93df294e54f88091a0831440566b2c988ad750916f05e77 |