Dust Sensor - PMS 5003/6003/7003

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.

1 Like

@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:

3 Likes

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.

Thanks,

Eugene

1 Like

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

SYSTEM_MODE(MANUAL);

//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() {
	Cellular.off();
  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

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

1 Like

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.
RMT

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

Hi
What is the final code then, please
Pedro

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).

Thanks!

Hi all.

I will admit to be a complete novice with programming but wanted to tinker with the BME280 and the SPS30 particle sensor.

I’ve followed the work of paulvha and have tried compiling his code (SPS30.ino, printf.h, sps30.cpp and sps30.h) from Example1_sps30_BasicReadings for my particle photon but get a number of undefined reference errors

undefined reference to “SPS30::GetErrDescription(unsigned char, char*, int)”

Unfortunately, despite more that a bit of trial and error I’m simply not up to solving this problem. I’ve got a long way to go

I’d appreciate some help so I can start playing around with this device as I learn!

Thanks

Cory

I guess you are using Web IDE, right?
Can you provid a SHARE THIS REVISION link to have a look at your project - e.g. whether it is setup correctly.

Wow this is so neat! Since I’m so new, I won’t be surprised if I’ve got something wrong. I’ve been able to get simple things to work but this is just a tick more complicated.

https://go.particle.io/shared_apps/5e6087fd36717d000b1b41d3

This was an easy fix.
You cannot have a sps30.ino file along side an sps30.cpp file.
The .ino preprocessor will convert that into an sps30.cpp file consequently overwriting/hiding the other file.

Just rename the sps30.ino to something like test.ino and you’ll be set.

I really appreciate your help! It looks like its working. So much for me to learn yet!

Thanks

1 Like

Looking for a bit of additional help. I’ve been able to compile Example 1 (Thanks Scruff) but still having problems connecting to the device. The sps30 device has been wired to connect by I2C (with pull up resistors) and when I run an I2C scan I get:

I2C device found at address 0x69 !

So I assume that I have things wired correctly and when I execute the code I get:

Trying to connect
could not probe / connect with SPS30.

I have also tried wiring for a serial connection and updated the .ino file with the following based on earlier comments in this thread

#define TX_PIN 8
#define RX_PIN 8

When I try to run the code I get the same

Trying to connect
could not probe / connect with SPS30.

It’s clearly possible that I have missed some other required modification to the code

https://go.particle.io/shared_apps/5e652fcea3793e000c66430c

If anyone could help with some additional insights for troubleshooting I’d appreciate it!

Cory

Hi,

Continuing to work with the SPS30 and having success with serial and I2C. Wanted to now extend to the sketch to the dual device SPS30/BME280 (pauvha Example 5). I’m running into compile challenges related to the BME280.

dual_sensor.ino:255:12: ‘class BME280’ has no member named ‘setI2CAddress’
dual_sensor.ino:257:16: ‘class BME280’ has no member named ‘beginI2C’

As I’m still learning, I think that this is related to the SparkFunBME280.h library that is included. But I don’t know how to resolve. Can anyone who’s been able to get this sketch to run, let me know what I may be missing?
+++++++++++++++++++++++++++++++++++++++++++++++++++++++
I’ll answer my own question here.

Just realized that by grabbing the SparkFunBME280.h library from github and including it rather than associating to the library supported by the IDE was the trick!

Looks like I’m running

In March 2020 Sensirion has released a new version of the SPS30 datasheet. It shows that over the past year (or so) it has slip-streamed new firmware with new functions ( like sleep, wakeup, device status) as well as update / more information to existing functions. The SPS30 library (https://github.com/paulvha/sps30) has been updated to version 1.4. It does not only solve a couple of issues but mainly takes these new changes into account. Depending on the firmware level on your SPS30 you can take advantage of them.

2 Likes

@paulvha Thanks for keeping us updated!

Hello,

can everyone help me pleas.
i testet SPS30 sensor but when i make release becom this error:

pi@raspberrypi:~ $ make release
make: *** No rule to make target ‘release’. Stop.

thank you
mike