markjb / python-pms7003 Goto Github PK
View Code? Open in Web Editor NEWPython script to test a Plantower PMS7003 serial laser particulate sensor
License: MIT License
Python script to test a Plantower PMS7003 serial laser particulate sensor
License: MIT License
Hi,
When i print data it gives
data= b'\x00\x1c\x00,\x00I\x00M\x00\x1f\x002\x00> \x1c\t:\x01\xca\x00&\x00\x06\x00\x02\x97\x00\x04\x0b'
frameLength = ord(data[1]) + (ord(data[0])<<8)
the above line gives this error
TypeError: ord() expected a character, but string of length 2 found
Hi Mark,
In the meantime, it looks like your checksum calculation is wrong:
# Calculate the payload checksum (not including the payload checksum bytes)
inputChecksum = 0x42 + 0x4d
for x in range(0, 27):
inputChecksum = inputChecksum + data[x]
Here, range(0, 27) will only give you the first 27 indexes ([0, 1, ..., 26]).
You need the first 28 indexes, as the last
2 are the checksum.
Instead you can write the checksum calculation as:
# Calculate the payload checksum (not including the payload checksum bytes)
inputChecksum = 0x42 + 0x4d + sum(data[:-2])
Please let me know if i am wrong.
Thank you.
Hi Mark,
I am getting this type of readings.
Date_Time | PM1 | PM2.5 | PM10
2019/02/14 09:52:35 | 260 | 2854 | 3936
Can you tell me what can be the unit of this readings?
Thank you.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.