adafruit / adafruit/Adafruit_CircuitPython_PM25

UART fails to operate with PMS5003

Open
#9 13 comments 3 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
31
Forks
19
PR merge metrics
No merged PRs in 30d

Description

Thanks for this library! Its works great with the [I2C PMSA003i device](https://www.adafruit.com/product/4632) I bought from Adafruit a few weeks ago. :)

Unfortunately, I was having trouble getting this library to work with a PMS5003 connected over UART using the [Pimoroni Envirio+ hat](https://learn.pimoroni.com/tutorial/sandyj/getting-started-with-enviro-plus) on a Pi Zero. It looks like this is being caused by two different but somewhat related problems.

In one case, the PM2.5 sensor was set to "passive" mode when using another library or its default on power-on may actually be to run in "passive" mode. In this case `_read_into_buffer()` always times out.

In the other case, it looks like `_read_into_buffer()` is sometimes misreading the UART data stream coming in, leading to "Invalid checksum" errors when `read()` tries to parse the buffer's data after an otherwise successful `_read_into_buffer()`.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with `_read_into_buffer()` and `read()` in the Python library, then reproduce the PMS5003 UART cases described on the Pimoroni Envirio+ hat and Pi Zero. Check the passive-mode timeout and the invalid-checksum behavior; done means valid UART readings work reliably in both cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
embedded-iot
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.