Skip to content

Commit f9d6956

Browse files
authored
Remove inappropriate sleep between reads
The PMS5003 seems to buffer unread samples. If you are reading at a lower rate than it takes readings, then a progressively larger delay will occur between changes in actual PM levels and indicated PM levels. To see the issue: 1) run this example with the `time.sleep(1)` *included* 2) wait a few minutes 3) burn a piece of paper near the sensor and wait for the reported PM levels to spike With the sleep included, there is a delay between introducing smoke and seeing reported levels rise (often a few minutes or longer). With the sleep removed you will see reported levels update almost immediately. The correct way to use the sensor is to read as fast as the sensor allows, and not make any assumptions about what rate samples will be published at
1 parent 655d013 commit f9d6956

File tree

1 file changed

+0
-1
lines changed

1 file changed

+0
-1
lines changed

examples/particulates.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
try:
2424
readings = pms5003.read()
2525
logging.info(readings)
26-
time.sleep(1.0)
2726
except ReadTimeoutError:
2827
pms5003 = PMS5003()
2928
except KeyboardInterrupt:

0 commit comments

Comments
 (0)