Sensirion SPS30 Particulate Matter Sensor - how to use with Arduino
The original sample program https://github.com/Sensirion/embedded-sps need for I2C a buffer of min. 60bytes, that's why most Arduino test implementations will not work at first.
Solution:
Change in Wire.h the following line: #define BUFFER_LENGTH 64 (was 32 before)
Additional:
If you have a twi.h in your installation - change here too: #define TWI_BUFFER_LENGTH 64 (was 32 before)
If you have a twi.h in your installation - change here too: #define TWI_BUFFER_LENGTH 64 (was 32 before)
Then use the attached small program for testing.
If you cannot change the line - you can read out the first 5 values only - see in source code the marked line.
Use instead of the 60 bytes the 30 bytes option.
You will get the right values after some minutes of self calibration.
If any questions tell me ;)
Sample file: sps30-i2c-mini.ino