Dust Sensor - PMS 5003/6003/7003


Hello @Rftop,

I am working to get the Boron to work with sps30 using UART.
Would it be possible for you to share how you did it ?


@Pinak, I have not tried the recent versions of the Library.

What I did for V1.0 on a Photon:
Created 2 new “tabs” in my WebIDE project and copied SPS30.cpp and SPS30.h from Github.

I used one of the Example .ino’s with :


#include "sps30.h"
#define TX_PIN 8
#define RX_PIN 8
#define DEBUG 0
SPS30 sps30;

The Library is documented well.


Hi. I am having trouble using the files from the github (https://github.com/paulvha/sps30) with a particle electron using I2C. Could someone who has gotten it working on a particle device help me out and possible upload the files an includeable library like the one made for the SCD30?


Welcome to the Particle community.

I’ve had better luck using the SPS30 with UART than with I2C.

I’ll try to post my modifications to the library and a test app in the morning.


FWIW the HPMA115S0 is a decent dust sensor. The PM10 usually aligns with what the value of the PM2.5 value is. (I’ve never seen them diverge) It’s configured via UART. I posted about it here on the forum if you need a good starting point.


any update on that library?


Wow. What you’ve done here is great with the visualization, etc. This is precisely the application I am looking at this sensor for as well (shop readings).

@RWB Have you posted about your project separately? Could you walk me through it?
I understand your SPS30 reports data to the Photon over UART…but how are you getting it into the Losant?

What’s a good, cost responsible place to publish data from a device like this?


Losant is good but in my instance I cannot get what I need at a reasonable price. I have therefore used Thingsboard.io CE version (open source and free) on an Ubuntu 18.04 server on a simple low cost dedicated PC and have had great success. YMMV


Losant’s free service has allowed me to do everything I have ever wanted for more than a year now. See if they still provide sandbox accounts and you should be good to go, I haven’t found anything else that is near as nice for no charge.


@worldburger Grafana’s interface is pretty if you are looking for a free alternative. I know SORACOM has a “free” hosted version. (you need to use their data pipeline though :cry: )

I actually self-host my instance using InfluxDB as the backend. It’s been running since early April in one capacity or another. If you’re not afraid of a little bit of Docker dev ops you can get it up and running quick. Plus it integrates nicely with Particle Webhooks. :grin:


Dear Eugene,

I red the forum and saw you got it working on a raspberry. Could you be so kind to share the code with me…there is limited documentation of the sps30 and python. I want to built this for our lab at the university of twente in Enschede, The Nederlands, as we are using fumed silica…

I hope you are willing to share the code,

Thanks in advance,

Kind regards,

Andries van Swaaij


Hi Andries,

I used the Sensirion sample implementation code from their Github. Here is what you need to do get it working on a raspberry pi running Linux.

  1. Pull the code from their repo:
    “$ git clone https://github.com/Sensirion/embedded-uart-sps.git
  2. Run: “$ make release”
  3. cd into the release directory and then replace the “sensirion_uart_implementation.c” file with the one in “sample-implementations/linux/sensirion_uart_implementation.c”
    “$ cd release/sps30-uart-3.0.0”
    “$ sudo rm sensirion_uart_implementation.c”
    “$ sudo mv sample-implementations/linux/sensirion_uart_implementation.c ./”
  4. Plugin the Sensirion SPS30 sensor using the USB cable from the dev kit into your raspberry pi. By default, it should appear under /dev/ttyUSB0 if you do not have anything else plugged into your USB ports of your raspberry pi.
  5. Compile the code
    “$ sudo gcc *.c -sps30”
    6 Run your program
    “$ sudo ./sps30”

This is what basically worked for me. Let me know if you any issues with the steps laid out above.




Hi, I am new to Particle devices and I am working with the PMS 5003 sensor on Boron and trying to output air quality values on my computer from Workbench. I have tried to run several of the codes from this thread on my computer but there were none that have successfully worked for me.

I decided to just go back to the basics and obtain raw data values and move forward from there but I am not sure what the next steps are.

//Just Reading Bits From the PMS 2.5 5003


//int PMSsignal = D10; //voltage signal from PMS
int val = 0;

int analogValue = 0;    // variable to hold the analog value

int incomingByte = D10; // for incoming serial data

void setup() {
  Serial1.begin(9600); // opens serial port, sets data rate to 9600 bps

void loop() {
  // send data only when you receive data:
  if (Serial1.available() > 0) {
    // read the incoming byte:
    incomingByte = Serial1.read();

    // say what you got:
    Serial.print("I received: ");
    Serial.println(incomingByte, HEX);

This rudimentary code reads out a series of 5 raw values every second I was wondering if you have an idea on how to proceed from here or helpful pointers on some code I may have missed along the way. It seems that Photon/Electron codes from previous posts do not work with Boron if I am not utilizing the internet/LTE features. Thanks for your support!

@ScruffR @ilak2k


@RWB Found this thread and got the sps30 sensor for my home project. but getting negative pm values sometimes. In the particle cloud console, they dont show as negative values but when i send it via mqtt to a db, it shows as negative there. Also shows as negative values on the oled screen connected to the argon. Any ideas how to fix this? My values also look very low.




Hard telling without seeing the code that’s causing this.



Here is my code . Looks like perhaps, the sensor is not being given enough time to read the values. The values on oled screen also shows as -1. I am not a programmer at all but have tried to figure this out. Any help to fine tune this will be appreciated. Thanks

Layout help with ethernet featherwing

This seems to be the place to ask this question:
I have an SPS30, and got the library from: paulvha / sps30

I have everything hooked up and just trying to run the sample program with the library using a MEGA with UART. It reads out the mass concentrations with reasonable values but just reads 0’s for the number concentration values and the average. It also never reads a product name or article code in the header (but I can much less about this). Does anyone know why this is? I have not edited the code or the libraries at all, but would really like to have the number concentrations.

Thanks in advance.


Try commenting out the #define INCLUDE_I2C 1 line. I remember this worked for me when I was using a photon.


What is the final code then, please


Great, that worked! (but I had to try a couple of times since editing the .h file with multiple versions of the library installed gave compile issues).