Sensirion SPS30: how to install I2C driver/library?

Hello,

Has somebody already tried SPS30 I2C driver/library?

I can't figure what files to put into what folder and how to include library.
There are instructions but they seem to be too "generic" for me to understand.
Any help would be great.

I have been able to get many other libraries/drivers to work with no problem.

Thanks,
Tipo

Use the second or third method in the tutorial above, your choice.

Those methods don't work. I tried.

Please check SPS30 library before giving advice.

Normally Arduino IDE demands a certain way to handle downloaded libraries. The library can't have "sepcial demands".
I download the cipfiles to "Documents/Arduino". Then I use the library handler within the IDE, found in the "Sketch" tab. Include zip library…..

tipo1000:
Those methods don't work. I tried.

Please check SPS30 library before giving advice.

Advice? You asked for help for how to install a library. That's the help you got.

Okay, I so I just checked the SPS30 library. My advice now is to read the information contained within the repo because it is not a library, it is half the source code required to build the library. You also need this repo:

You will need a *nix machine to clone the repositories and build the appropriate library for either hardware or software based I2C and the target processor being utilized.

If you don't know how to build software per the instructions in the repo, perhaps you should ask the manufacturer to post pre-built libraries in Github so that users such as yourself can utilize their products.

@tipo1000

Did you find any solution to get this Sensirion library from their github work?

Has anyone managed to get this library working on arduino? If so can you please post a guide.

Did someone successfully get it working? I changed the hw_i2c_implementation according to their instructions and example but my compiler does neither find Arduino.h nor Wire.h.

Also in their example, there are instructions:

"copy

  • sht.h, shtxx.c, sht_common.h, sht_common.c, sensirion_i2c.h,
  • hw_i2c/configuration.h, hw_i2c/configuration_Arduino.cpp"

But I searched my whole hard drive for sht.h and am not able to find it.

EDIT: Okay, I got it working and its really damn easy... Just copy the arduino hw i2c implementation into the sps30_i2c folder. Then copy the sps30_i2c folder into the library folder and try to upload the example. Worked for me. The sensor is sending measurements!

I’m trying to get my SPS30 sensor working on a Particle Photon but the library is a mess.

Can you share your working library with me please so I can try to get it working based on what you currently have working?

Greate that You succeded! Have You sent this message to the old topic You started? Lots of people rubbed their minds….

anyone else gotten this to work? I keep getting errors when compiling?

Hi,

I have followed the instructions (on MacOS) and got a viable folder in my Arduino setup - almost :frowning:
On building this I get typedef conflicts because I have not adjusted sensirion_arch_config.h

Errors such as "previous declaration as 'typedef short unsigned int u16' typedef unsigned short u16"

I guess I could work through these one by one.

Anyone have a version of this file for one of the common Arduinos, ideally Leonardo?

Thx.

The correction to the supplied sensirion_arch_config.h was just:

//typedef uint16_t u16;
typedef short unsigned int u16;

now compiles on 3 arduinos I tried.

Enjoy

The project is not complete but its simple and works properly

Hi,
somebody got the SPS30 to work in I2C mode?
I have tried with ESP8266 (Wemos D1 mini) - but get only "probe failed"
I2C connection is fine, I get with I2C scanner the right address back.

Maybe somebody have an idea (or working sample)? :wink:

Thanks!
Michael

here is my file for i2c communication.

The problem, that i2c buffer is limited by 32 bytes and so not all the particle data is accessible.

Thanks!
I really forgot about the 32bytes ...

If you want you can change it in Wire.h:

#define BUFFER_LENGTH 64 (was 32)

(remember, it will take more RAM from your board...)

With this change even the original sketch from Sensirion is running (have not checked in detail in this time)

Thanks again!
Michael

Hello @kvital

Thanks for your example code is very helpful

I have one question for your example code

kvital:
Enjoy
SPS30/dust.ino at master · KVital/SPS30 · GitHub

The project is not complete but its simple and works properly

I thing something is wrong because after conversion to float I have only zeros

I using Arduino mega with two UARTs for testing

Read measured value
No error
0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
Read measured value
No error
0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
Read measured value
No error
0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00

This is data after loading to buffer

do {
buff[j] = Serial1.read();
j++;
} while (buff[j - 1] != 0x7e); //read data+checksum to the 0x7e

411C309A412DBCBB41379FFA413AB56A42832FB0429A47BD429C4CDD429C8450429C8ED3F292421BA7EF87E

Regards

Hi! You have just problem to float remapping
The first number is 9.761866 in ur sequence of data which is reasonable
you can try to convert other numbers here IEEE-754 Floating Point Converter
I think ur sensor works well, but there is some problem with remaping.

Are you able to receive the number concentrations and not only the mass concentrations? Sparkfun indicate in their description of the SPS30 sensor that it is limited to the mass concentrations when using I2C with the Arduino platform

Sensirion has written drivers for both the UART protocol and I2C. Unfortunately we’ve found the I2C is limited to only mass concentrations (not number concentrations) using the Arduino platform. So if you plan to use this sensor with an Arduino, use the UART interface. Both interfaces are described in their datasheet.