In search of inspirion sps30 particle sensor UART code

Hi, I've been looking for example UART code for the SPS30 online for the arduino. I've found code that uses I2C, but not UART. I figure someone already knows of something that exists already and your help would be greatly appreciated.

Thank you!
Windell

Welcome to the forum

Where are you stuck ?

Set the baud rate of the sketch to match the device and when Serial.available() returns more than zero read the byte that is available

Depending on the board that you are using (which is it ?) you may need to use SoftwareSerial to connect to the device instead of the hardware Serial pins

NOTE : this assumes that the device has a TTL level serial interface and not RS232 or other more exotic variety of serial interface

The SPS30 datasheet describes the UART protocol in complete detail. It should not be a big problem to code your own UART interface, although it does involve coding the SHDLC protocol, or you could download the manufacturer's PC viewer software (not for Arduino).

Since the serial Baud rate is 115200 and cannot be changed, you will need to use a hardware UART. Software Serial won't work at that rate.

Edit: Sensirion posted this UART C code, which also handles the SHDLC protocol: GitHub - Sensirion/embedded-uart-sps: Embedded UART Driver for Sensirion Particulate Matter Sensors - Download the Zip Package from the Release Page

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.