Close

First tests with the PMS5003 particulate sensor

A project log for Street Sense

Portable electronic device to measure air and noise pollution

Mike TeachmanMike Teachman 11/20/2018 at 14:503 Comments

The Plantower PMS5003 device was selected for PM2.5 particulate sensing.  The Plantower particulate sensors have received favourable reviews in independent testing.

Plantower PMS5003 particulate sensor

The sensor is powered with 5V and has a 3.3V UART interface.  A custom cable was made to breakout the sensor ribbon cable to a breadboard-friendly 0.1" spacing.  Testing was done using a breadboard.  Prototype photo is shown at the bottom of this log.

Google hunt for a MicroPython library

The next step is finding some interface code.  I found a few MicroPython libraries for the PMS5003 device in Github.  After evaluation, I decided that the PMS5003 implementation by Kevin Köck is the most promising for this project. 

Here are the compelling reasons to use this library.

The LoBo ESP32 version of MicroPython that I am currently using does not include uasyncio as a built-in library.   This uasyncio library and the PMS5003 library need to be copied into the MicroPython filesystem on the ESP32.   The uasyncio library is found in micropython-lib.  I used the Ampy command line tool to copy these MicroPython libraries into the filesystem.  Here is the filesystem contents after copying.

boot.py
pms5003.py
lib  
  | 
   uasyncio         
        __init__.py         
        core.py


The PMS5003 library worked the first time using some example code.  Here is the test output showing particulate readings, sent using the ESP32 serial port.

Measurements from PMS5003 sensor

Current measurements

The device has two modes of operation:  Active and Standby.  Measurement with a multimeter showed these results.

Observation:  the measured Standby current of 7mA is considerably more than the <200uA value listed in the manufacturer's datasheet.  The measured Active current of 50mA-80mA agrees with the <100mA listed in the datasheet.

current during active state

Discussions

phairote wrote 08/02/2019 at 04:35 point

Hi Mike I'm Paul I also face same problem with Luis " AttributeError: 'UART' object has no attribute 'flush'  I do not know how to solve it do you have any comment

  Are you sure? yes | no

LuisDiazM wrote 05/09/2019 at 23:40 point

Hi Mike, my name is Luis, I am working with a ESP32 and the sensor PMS5003, I have an issue when I run a pms5003_test.py from the  Kevin Köck's repository, the problem is "AttributeError: 'UART' object has no attribute 'flush' " and it is related with the library uasyncio. What would you recommend?

  Are you sure? yes | no

Kevin Köck wrote 08/19/2019 at 18:34 point

Hi, I will check that in the next days (hopefully). It would be helpful if you create github issues as those are more likely to be seen.

  Are you sure? yes | no