The Plantower PMS5003 device was selected for PM2.5 particulate sensing. The Plantower particulate sensors have received favourable reviews in independent testing.
- The Plantower PMS5003 and PMS7003 Air Quality Sensor experiment
- Laboratory Evaluation of Low to Medium Cost Particle Sensors
- Field evaluation of low-cost particulate matter sensors in high- and low-concentration environments
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.
- uasyncio implementation. I was anticipating needing to rewrite a library to work with uasyncio. This library saves me that effort.
- all sensor functions are implemented
- example code
- good documentation
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.
Current measurements
The device has two modes of operation: Active and Standby. Measurement with a multimeter showed these results.
- Active: current varies between 50mA and 80mA
- Standby: 7mA
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.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.
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
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
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