Dust Sensor - PMS 5003/6003/7003


Finally found a library for the SPS30 Dust Sensor :wink:

Nice. Looking forward to learn how that sensor perform.

That’s certainly one solution - but I see that it’s GPL. What I’ve been working on is Apache licensed so it won’t contaminate your whole project as GPL would.

Edit: And yes, I’ve been working on it for a while now. What I have already works with Serial but I haven’t delved into the I2C side yet. I can post what I have to Github sometime soon if there’s interest, but it’s in flux.

The guy said he is talking with Sensorion about the I2C issues now to get some things fixed with that.

It’s the most fully featured library I have come across so far so I’m giving it a go.

Share your code when you can.

I wasn’t aware of any I2C issues - I just haven’t implemented that.

Got it working finally with the help of the library creator.

He will update the GitHub library for others who want to use it with Particle Devices.


Wow… that’s great news @RWB.
I tried my best to get the library to compile on WebIDE yesterday, but it was over my head.

@Rftop Do you have the sensor now?

Sensor is impressively sensitive from initial testing.

The Github library has been updated with the latest changes.

You just need to do the following to get it working on a Photon/Electron:

NOTE 2: SerialPort1 is only enabled in case of MEGA2560 or ESP32 (with defined RX/TX before)

On some boards/IDE (like Particle Photon) Serial1 is available as well. To force-enable from the user sketch : set TX and RX pins BOTH to 8, before calling begin().

3.3.4 Exclude Software Serial communication code
In case software serial is not available for your board / IDE (causing compile errors) OR you want to save memory in sps30.h comment out the line: #define INCLUDE_SOFTWARE_SERIAL 1.

Also mention you in the ReadMe: Tested by Ryan Brown on a Sparkfun Photon RED board and the code should also work with the Photon, P1, and Electrons

1 Like

Yes Sir,
I’ve been itching to get one of these setup for battery power & S3B Mesh.

Sweet, let me know your experiences with it once you have it setup.

I should have this thing sending data to Losant later today, anxious to see how things look in a household and shop environment over the course of a full day.

paulvha’s updated SPS30 library appears to be working on a Photon, using Serial1, firmware 0.7.0.

I got the Sensor running and reporting to Losant along with Temp + Humidity + Voc + Co2 levels.

The spike was somebody using a vape pen around the sensor.


It’s also working on Boron LTE firmware 0.8.0-rc.27

1 Like

Nice. I ordered one today and will hook it up on a photon next week. Will run it next the hpm dust sensor from honeywell to be able to compare the measurements.

To be continued…


Looking forward to your test results.

The SPS30 library “incorrectly” reports PM10 Number Concentration [#/cm3] as Zero (0).

I believe both the Mass and Number Concentrations should increase (or stay the same) when moving up the Particulate Matter Size Scale (from PM1 to PM10), as each larger PM classification includes the concentrations from all sizes smaller than it.

PM10 >= PM4 >= PM2.5 >= PM1.0

Other than that, my SPS30 and the library appear to be working great.

This isn’t a huge concern for me, since Air Monitoring is usually PM2.5 and PM10 Mass Concentrations [μg/m3] for my Industrial Applications, as per the EPA.

The guy who wrote the library is talking with Sensirion about the PM 10 concentration being 0 always.

Voc Readings - powered by Losant https://app.losant.com/dashboards/599c9a05b36c040007c6e20c

I have been testing the sensor the last few days while running a Lazer Cutting machine and a CNC Milling machine cutting G10 fiberglass sheets as you can see in the graph above.

The Mass PM10 is not returning 0 for me it looks like.

I find the MASS readings most useful and things do not get as dusty as I was thinking.

The MASS usually shows more larger particles detected than the smaller PM1 sized particles. To me it looks like it’s working perfectly.

I love having the sensor along with Voc, temp, humidity, and Co2 since High Voc does not mean there is more particulates in the air.

Do you know of a good chart or graph for what levels are safe vs unsafe?

1 Like

I agree, Mass is more useful. The only thing not working is PM10 Number Concentration [#/cm3].

Air Quality Index (AQI) is more commonly used, since it’s nice pretty colors.
You want a 24 hour average for :

  • PM2.5 < 15 [μg/m3]
  • PM10 < 54 [μg/m3]

Here are the two AQI charts that reference the PM values:

1 Like

Thanks for the info.

How are you generating the 24hr average for PM2.5 and PM10?

I need to add this to my dashboard so it auto changes a image widget box based on the AIQ levels.

I currently just use a rolling average calculated from my backend (ThingSpeak) and not on the Photon, but the official method is quoted from HERE

To accurately reflect the current air quality, the multi-hour average used for the AQI computation should be centered on the current time, but as concentrations of future hours are unknown and are difficult to estimate accurately, EPA uses surrogate concentrations to estimate these multi-hour averages. For reporting the PM2.5, PM10 air quality indices, this surrogate concentration is a particular type of weighted average that provides more weight to the most recent air quality data when air pollution levels are changing.

The Wikipedia link also has the actual equation to calculate AQI.

Or you could just use a Switch/Case to determine the AQI Category based on this Chart:


The Answer is the “worst” AQI Category from either PM2.5 or PM10.

1 Like