PMS5003 -- how to use?


Tech Tip. programs like the win32disk imager, can make a backup image of your SD Card. Its just the reverse of flashing an image to it. It will create an image of your card and store it on your PC. Then if you do some other stuff, and screw things up (happens some times ;) ) you don’t have to start all over again from scratch. You just flash the image you saved back to the card. I don’t think etcher can do it though.


I wanted to write a short something on where I am with my project. Thanks to everything above this post, the hardware is working. (Yay!) I’ve plugged in my BME680 sensor as well as the PMS5003 sensor and I’m able to run python programmes that get data coming out of both.

I put together a script that logs the data coming from the BME680 to start with, since that seemed easiest:

import bme680
from time import *

# setting up the sensor
sensor = bme680.BME680()



with open("data.csv", "a") as log:
    while True:
        temp =
        pressure =
        humidity =
            airquality =
            log.write("{0},{1},{2},{3},{4}\n".format(strftime("%Y-%m-%d %H:%M:%S"), str(temp), str(humidity), str(pressure), str(airquality)))
            log.write("{0},{1},{2},{3},NaN\n".format(strftime("%Y-%m-%d %H:%M:%S"), str(temp), str(humidity), str(pressure)))

That runs until I CTRL-C out of the programme, at which point I can go an inspect data.csv to see what it measured.

I’m SSHing into a headless version of raspberry pi, but I haven’t figured out how to get the code to run in the background.

I tried python3 That runs and gives me a PID number for the process, but when I kill the process I find I have nothing in data.csv. Any idea how to get this working as a background process? At some point I’d like to close out the ssh window / connection and still have the raspberry pi working throughout the day / night etc…

I have another (more complicated) question about the PMS5003 sensor and some code, but I’ll save that for later.


What I do is lunch my python file on boot up via crontab
I run sudo crontab -e from terminal and add the following line at the end of the file.
@reboot python3 /home/pi/ &
/home/pi is where my file is.


I tried to use PMS7003 and coded in python and below is the output i am getting :
Date_Time PM1 PM2.5 PM10
"2019/02/13 12:52:09 " 386 1142 1267
"2019/02/13 12:52:12 " 386 1142 1267

Can you please let me know what can be the unit for it?
IS it ug/m3 or count of number of particles?
Can you also send your code so that i know where have i gone wrong

@ strickvl Please help
Thank you.