Arduino, Sensoren, Z-Wave, Bluetooth und mehr - SmartHome.Work - Beratung, Projektierung, Test

Direkt zum Seiteninhalt

Particulate Matter Sensor SPS30 and Arduino

SmartHome.Work - Beratung, Projektierung, Test
Herausgegeben von in Sensors ·
Tags: SPS30sensor
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)

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



1 Kommentar
Durchschnittliche Bewertung: 115.0/5
Francescopiero Calzolari
2019-03-07 14:33:14
Good morning Michael Pruefer, I tried your program for sps30 on Arduino both Mega 2560 and Leonardo, but if I change, in Wire.h, define BUFFER_LENGTH 32 to 64 the readings become all nan, while if I leave 32 the first 5 readings are ok the 6 I'm not sure is ok and then I have 4 nan (if I leave the cycle at 60). Can you give me some advice to solve this problem?
Thanks in advance
Francescopiero Calzolari


Copyright 2018 Michael Prüfer
Copyright 2018 Michael Prüfer
Zurück zum Seiteninhalt