Sensirion / embedded-sps

Embedded i2c Driver for Sensirion Particulate Matter Sensors - Download the Zip Package from the Release Page
https://github.com/Sensirion/embedded-sps/releases
BSD 3-Clause "New" or "Revised" License
45 stars 15 forks source link
driver embedded i2c particulate-matter particulates-sensors sensirion sensirion-embedded-drivers sensor sps30

embedded-sps CircleCI GitHub license

This repository contains the embedded i2c driver sources for Sensirion's SPS product line.

If you just want to use the driver, it is recommended to download the release zip from https://github.com/Sensirion/embedded-sps/releases

The UART driver of the SPS is available in the embedded-uart-sps repository.

Arduino (i2c): https://github.com/Sensirion/arduino-sps

Clone this repository

git clone --recursive https://github.com/Sensirion/embedded-sps.git

Repository content

Hardware setup

Collecting resources

make release

This will create a release folder with the necessary driver files in it, including a Makefile. That way, you have just ONE folder with all the sources ready to build your driver for your platform.

Files to adjust (from embedded-common)

To adapt the driver to your platform, you only need to touch the following

and depending on your i2c implementation either of the following:

Building the driver

  1. Adjust sensirion_arch_config.h if you don't have the <stdint.h> header file available.

  2. Either use one of the provided sample implementations implement necessary functions in one of the *_implementation.c files described above (either in the hw_i2c or sw_i2c folder).

    To reuse a provided sample implementation you can specify it in a custom build configuration. For this adapt the file user_config.inc in the driver:

    user_config.inc for hardware i2c with dedicated i2c controller:

    CONFIG_I2C_TYPE=hw_i2c
    hw_i2c_impl_src = ${embedded-common}/hw_i2c/sample-implementations/linux_user_space/sensirion_hw_i2c_implementation.c

    user_config.inc for software i2c with bit-banging on GPIOs:

    CONFIG_I2C_TYPE=sw_i2c
    sw_i2c_impl_src = ${embedded-common}/sw_i2c/sample-implementations/linux_user_space/sensirion_sw_i2c_implementation.c
  3. Run make

  4. Run the compiled example usage with ./sps30_example_usage. Note that hardware access permissions (e.g. sudo) might be needed.


Please check the embedded-common repository for further information and sample implementations.