Sensirion SPS30 Particulate Matter Sensor

I am attempting to use the Sensirion SPS30 Particulate Matter sensor with an Electron and the nvsense_SPS30 library found in the community libraries tab. I am using the I2C interface with SDA of the sensor connected to pin D0 and SDL of the sensor connected to pin D1. However, I keep receiving the same “SPS sensor probing failed” message, so I am unsure if I am connected to the right pins or if I need to initialize them in some way. Beforehand, I was able to successfully test the sensor using this code with an Arduino Uno so I do not believe this is a hardware issue. The sensor is supplied with 5V and the grounds are connected. Is there a recommended PM sensor that would work better with the Electron?

@jua23, based on the SPS30 datasheet, the sensor needs to be powered with 5v, sharing a common GND with the Electron. In addition, the I2C lines need to be pulled up to 3.3v using 4.7K to 10K ohm resistors. Finally, SEL pin on the SPS30 needs to be connected to GND to select the I2C interface.

Is this the configuration you have?

Yes, that is the configuration I have, minus the 10k ohm pull resistors. I have since added the pull resistors but I am still getting the same message.

I just realized that I did not include the nvsense_sps30 library with the sps30.ino program. However, when I did include nvsense_sps30 I got the following error: nvsense_SPS30.h: No such file or directory

And yes, that is the configuration I have, minus the 10k ohm pull resistors. I have since added the pull resistors but I am still getting the same message.

@jua23, you should run the following I2C scanner to see if it finds the SPS30.

Also, the include a library in the Web IDE you need to “attach” it by selecting it from the library list and then adding it to the target project file.

I ran the I2C scanner and it found a device at address 0x69, which is the address of the SPS30 sensor. I also already attached the library mentioned above by selecting it from the list and then adding it to the target project file.

So, the device can be found on the bus so this suggests a software issue. Can you share your code using the “Share this revision” button and posting the link here?

This is a link to my code: Particle Web IDE

@jua23, that SPS30 library is a bit of a mess. This line is meant to initialize software I2C, not the hardware I2C:

  sensirion_i2c_init();

Try replacing it with to see if it works.

  Wire.begin();

I replaced the sensirion_i2c_init() line with Wire.begin() but that did not work. Is there another particulate matter sensor that I could you that you would recommend?

@jua23, can you post a picture of your setup? The SPS30 also supports serial communications which is implemented by the other SPS30 library in the WebIDE.

Hi, @jua23—we used the PM5003 (PMS5003---Laser PM2.5 Sensor-Plantower Technology) with a Boron a few years ago. I selected this hardware because I believe it’s what the excellent PurpleAir network is using (e.g., New version of Plantower PMS5003 - Sensors - PurpleAir Community). I stopped playing with the sensor when I changed jobs, but I remember it being reasonably straightforward to set up on the Particle platform.

1 Like

You may also be interested in this post: Air Quality Wing

1 Like