paulvha / sps30

Sensirion SPS30 driver for ESP32, SODAQ, MEGA2560, UNO,UNO-R4 ESP8266, Particle-photon on UART OR I2C coummunication
GNU General Public License v3.0
66 stars 27 forks source link
arduino-uno bme280 ds18x20 esp32 esp8266 mega2560 particle-photon sensirion sensor sodaq sps30 uno uno-r4-wifi

Sensirion SPS30

===========================================================

A program to set instructions and get information from an SPS30. It has been tested to run either UART or I2C communication on ESP32, MEGA2560, ESP8266, UNO, Due, nRF52840 and Apollo3. In the meantime many other boards have been added to the test as well as extended interface options. (see below)
A detailed description of the options and findings are in SPS30.odt

Getting Started

As part of a larger project I am looking at analyzing and understanding the air quality. I have done a number of projects on air-sensors. This is a version of a working driver + examples. More work continues to happen to create examples and compare against other sensors.

A word of warning: the SPS30 needs a female plug of ZHR-5 from JST Sales America Inc. I have not been able to find a good source for that and was glad to buy the Sparkfun version (https://www.sparkfun.com/products/15103) which does include a cable with this plug.


May 2019 : there is also a library available for Raspberry Pi (https://github.com/paulvha/sps30_on_raspberry)
January 2023 : there is also SPS30 BLE-peripheral, BLE-central and Android BLE-APP (https://github.com/paulvha/apollo3/tree/master/ArduinoBLE_special)

Prerequisites

Examples 4, 5, 7, 8, 10, 15 and 16 have a dependency on other libraries. Documented in sketch.

Software installation

Obtain the zip and install like any other

Program usage

Program options

Please see the description in the top of the sketch and read the documentation (odt)

Communication channel selection

From the start I had decided to take an embedded communication channel setup. This made it much easier for the user to select and have the right setup for Serial or I2C. It was initially tested on an UNO, MEGA, ESP32, ESP8266, Due (1.4.4) and works well. Overtime code has been adjusted to support more boards with different pin-outs based on user request and feedback. Given the large number of new boards that continue to hit the market, with different pin-outs, as well as boards with multiple I2C channels, I have decided to add the option for the user provide the communication channel also differently. This means the user will perform in the sketch the initialization of the channel (serial or I2C) and provide that to the SP30 library. Example12 (for serial communication) and Example13 (for I2C communication) has been added to demonstrate the usage. The embedded approach, and thus backward compatibility, continue to be available.

Versioning

Version 1.4.17 / October 2023

Version 1.4.16 / Janaury 2023

Version 1.4.15 / January 2023

version 1.4.14 / May 2022

version 1.4.13 / January 2022

version 1.4.12 / October 2021

version 1.4.11 / July 2021

version 1.4.10 / February 2021

version 1.4.9 / October 2020

version 1.4.8 / October 2020

version 1.4.7 / September 2020

version 1.4.6 / September 2020

version 1.4.5 / August 2020

version 1.4.4 / July 2020

version 1.4.3 / June 2020

version 1.4.2 / May 2020

version 1.4.1 / May 2020

version 1.4 / April 2020

version 1.3.10 / April 2020

version 1.3.9 / February 2020

version 1.3.8 / January 2020

version 1.3.7 / December 2019

version 1.3.6 / September 2019

version 1.3.5 / May 2019

version 1.3.4 / April 2019

version 1.3.3 / March 2019

version 1.3.2 / February 2019

version 1.3.1 / February 2019

version 1.3.0 / February 2019

version 1.2.1 / February 2019

version 1.2 / January 2019

version 1.1.0 / January 2019

version 1.0.1 / January 2019

version 1.0 / January 2019

Author

License

This project is licensed under the GNU GENERAL PUBLIC LICENSE 3.0

Acknowledgments

Make sure to read the datasheet from Sensirion, March 2020 version.

In case you are new to electronics and wonder about pull-up resistors for I2C, see below (thanks to Shane Diller)

Uno and SP30

June 2021, Input from CCDZAPPER:

This is not an issue - just a note to help others that may have damaged or lost the flimsy cable with the ZHR-5 connector. It is available inexpensively on eBay: https://www.ebay.com/itm/114551266422 Make sure you pick the correct type, which is 1.25mm 5 Pin. (10 Sets JST SH 1.0 ZH 1.5 PH 2.0 XH 2.5 Housing Connector Female Male Wire)

October 2021: Input from Urs Utzinger

Reducing the I2C speed to 50K instead of 100K improves longer time stability.

October 2021 : Input from Nkea

I also found another compatible connector. I also recommend buying spare crimp contacts as they are very small and fragile. Needs a crimp tool. I use a Connector Pliers model PA-09 by Engineer I had from other works. It may be useful if special lengths are needed of there is no stock on JST ones

Housing: https://www.mouser.es/ProductDetail/Wurth-Elektronik/648005113322?qs=%2Fha2pyFaduguH2zIpdkgUWxmzUvrTES979PXEupx7lQusLC5mK%2FQfQ%3D%3D

crimp contacts https://www.mouser.es/ProductDetail/Wurth-Elektronik/64800113722DEC?qs=%2Fha2pyFaduguH2zIpdkgUUfd6dp6pTTujW8FuBzdSDO2pxvJN95p5w%3D%3D