avaldebe / PyPMS

Data acquisition and logging for Air Quality Sensors with UART interface
https://avaldebe.github.io/PyPMS/
MIT License
29 stars 8 forks source link

Discard invalid observations after wake up #3

Closed avaldebe closed 4 years ago

avaldebe commented 4 years ago

Plantower sensors have a quirk

On my tests I found out that it is not enough to wait some time before reading from a sensor who just woke up. The sensor needs to be "exercised" a few times before the measurements become meaningful. After a sleep/wake up cycle, the sensor the first few readings have non zero PM values but all the number concentrations are zero. IMO, this observations should be discarded so I'm considering to add an --strict option for this. I have not observed the problem when the modules are just powered up.

Originally posted by @avaldebe in https://github.com/avaldebe/PyPMS/issues/1#issuecomment-609679688

This quirk is not present after power cycling and on most cases the first observations after wake up can be discarded on post processing. However, if the sensors are read on "one-shot" mode as requested on #1, these kind of inconsistent observations need to be discarded.

The new option --strict will take care of this kind of inconsistent observations.

avaldebe commented 4 years ago

As far as I know, only PMSx003 sensors show this strange behaviour. On my tests, this can be avoided by extending the waiting time after an empty message. Therefore, this is an artefact of the sleep/wake cycle and there is no need for an --strict flag.