Dust Sensor - PMS 5003/6003/7003

I tried to get the libraries for Arduino UART library working on an Arduino Uno and a Particle Photon.

I couldn’t get the Arduino library to compile without errors on the Arduino.

I could get it to compile in Particle DEV for a Photon but the Serial Output says is “Probe Failed”

I was trying to use this library:

The i2C library is here if your interested:

Hi there,

I was wondering if any of you guys managed to get it working on Arduino.I got it working on my Raspberry Pi 3 but the Arduino implementation I have problems with. I installed their library (https://github.com/Sensirion/embedded-uart-sps) but can’t get their example sketch to compile. I am using their Arduino implementation cpp file. Upon compilation I get a number of errors but they are as a result of this one

“error: ‘Uart’ does not name a type
Uart Serial2 (&sercom1, PIN_UART_RX, PIN_UART_TX, SERCOM_RX_PAD_0,”

I am an Arduino newbie as well so…any help is much appriciated.

I never was able to get the Arduino library to work on an Arduino Uno or the Photon no matter what I did to the library.

I’m kinda stuck at the moment until somebody else comes along and figures this one out. :disappointed_relieved:

@MartyMacGyver any luck?

That library needs some porting to work on the Photon. I don’t have one of the sensors so even if I attempt a port, I can’t test it.

I got the device a couple of weeks back but haven’t had time to mess with it. However, I will make some time for it soon and see if I can’t get it working. It should be pretty easy to port, or I’ll create my own library.

1 Like

That would be great!

My unit is useless until I find a working library.

I found this Windows program for interfacing with the sensor which is better than nothing right now

Find any time to play with this dust sensor yet?

Some. It’s more complex than I expected it to be (and time has been more limited) - the byte-stuffing is a novel twist. I’m able to talk to it (initialize via UART) but it’s nowhere near library-form yet. But it’s coming along.

1 Like

Some progress is better than no progress :grinning:

I just figured the library would work like all the others.

Yeah, no. The Plantower device is relatively simple: power it on and enable it via pin and read, read, read.

The Sensirion device is a lot more complicated: special framing bytes, byte-stuffing to compensate for the special framing bytes, init, enable, clean, configure, read, write, etc. And I haven’t even looked at the I2C mode yet (though I suspect it’ll be similar enough).

That said, it’s an interesting project and I’m working on it in my spare time from all my other projects.


Mine is sitting here until you have some working code or I find another simplified working library for this thing :wink:

I am looking forward to being able to measure, Temp, Humidity, Voc, Co2, & Dust Particle levels at the same time considering I use it in a shop where CNC & Laser cutting machines are used and the particle levels are always changing.

Hi folks,

I have been using both SPS30 and PMS5003.

Here is a screenshot of the output.

The above values are using an ESP32 and not particle board, but I found this forum interesting so posting my doubts here.

My doubt is regarding the standard(CF = 1) vs environmental values from PMS5003. Till now I haven’t been able to find out the difference between these two. Could anyone guide me to some literature I can read about their differences?

Also, SPS30’s PM2.5 value is more close to PMS5003’s environmental PM2.5 value than it’s standard PM2.5 value. That makes me believe that environmental values are more useful than the standard values.

Please correct me if I am wrong.

1 Like

@kadyan Can you post the code you have running on the ESP? So we can see if we can get it working on the Particle devices?

I trust the accuracy of SPS30 for the simple fact that all there other sensors I have tried from them have been very accurate and I would assume the SPS30 is closer to reality than the other sensor your using.

1 Like

I thought I would add my two cents for anyone looking for code on using a photon and a plantower PMS 5003. I gained a lot of ideas from this posts so thank you to all who contributed. Here is my code that includes temp and humidity.

I am currently trying to build a solar powered one using an electron. Let me know if any one has already built that. Thanks

This tread will teach ya about solar on the Electron or Boron.

I’ve been curious about the CF vs SAT readings as well. Best I’ve been able to find is on this page: https://aqicn.org/sensor/pms5003-7003/ which breaks it down to:
cf1<30 ⇒ sat = cf1
cf1>100 ⇒ sat = cf1 * 2/3
cf1 in ∈ [30;100] ⇒ sat = 30 + cf1 * (cf1-30)/70 * 2/3

Keep in mind this is only for the PM2.5 size. My personal testing has confirmed the relationship holds for all 3 types but the thresholds are slightly different. I didn’t find any case where they diverge thus reading both had no real value to me. I was thinking of using it as a backup checksum but it didn’t help. Occasionally my sensor gets ‘stuck’ around a moderately high value regardless of the actual air quality and I have to power cycle the device to get it to read correctly again. It’s not a constant value either, it moves around a bit as if it were real. Perhaps that’s why the PurpleAir devices, which use PMS5003 sensors, actually put two of them in each device. I’ve ordered a 2nd sensor to explore other ways to detect when the readings get screwy.

I saw this on the Arduino forum and figured I would share since it may be helpful.

And this from another forum.

Hello @Fragma,

Thanks for the info. I have read that article, but I am still confused regarding what CF and SAT represents and how they differ physically from each other?

Also, which one should we use for outdoor/indoor monitoring?


I wasn’t able to figure out any further info other than the SAT value is the one we should be using. The data sheet says CF is only used in the factory.