Control program for the senirion sps30 particle matter sensor (I²C interface)
- Raspberry Pi (Zero/w)
- Sensirion SPS30
- Raspbian Stretch Lite (version: Nov 2018)
activate i2c with the raspi-config
sudo raspi-config
enter rapsi config menu navigate to 5. Interfacing Options
go to P5 I2C and enable it
double check the config.txt
in /boot/config.txt
Add the correct clock rate for 200kHz.
(NOTE: rPI clock speed is CPU bound and very inaccurate so i set it to 230000)
dtparam=i2c_arm=on
dtparam=i2c_arm_baudrate=230000
NOTE: powering off the PI before connect the cables to the GPIO.
NOTE: i2c is not suitable for long wirings keep the wires as short as possible (not longer than 10cm / 4inches)
install i2c-tools via apt:
sudo apt update
sudo apt install i2c-tools
after that, check if the sensor is reachable:
i2cdetect -y 1
the output should look like this:
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- 69 -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
0x69 is the i2c address from the sps30 - sensor
- libcurl-dev
we just need the <curl/curl.h>
sudo apt-get install libcurl4-openssl-dev
execute the build script
./build
The final binary is ./bin/sps30
[TODO: add more here]