Giter Club home page Giter Club logo

sensirion / embedded-uart-sps Goto Github PK

View Code? Open in Web Editor NEW
43.0 15.0 24.0 134 KB

Embedded UART Driver for Sensirion Particulate Matter Sensors - Download the Zip Package from the Release Page

Home Page: https://github.com/Sensirion/embedded-uart-sps/releases

License: BSD 3-Clause "New" or "Revised" License

Makefile 4.10% C 69.53% C++ 22.51% BitBake 3.86%
sensor sensirion particulates-sensors driver shdlc uart sps30 pm25 embedded sensirion-embedded-drivers

embedded-uart-sps's Introduction

embedded-uart-sps CircleCI GitHub license

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

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

Clone this repository

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

Repository content

  • embedded-uart-common submodule repository for common UART HAL
  • sps30 SPS30 driver

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-uart-common)

You only need to touch the following files:

  • sensirion_arch_config.h architecture specifics, you need to specify the integer sizes
  • sensirion_uart_implementation.c functions for UART communication Alternatively ready-to-use implementations are available in the sample-implementations folder

Building the driver

  1. Step into your desired directory (e.g.: release/sps30-uart)
  2. Adjust sensirion_arch_config.h if the <stdint.h> header is not available
  3. Implement necessary functions in *_implementation.c
  4. make

Getting Started on the Raspberry Pi 3

See docs/getting-started-on-the-raspberry-pi.md


embedded-uart-sps's People

Contributors

abrauchli avatar getpastthemonkey avatar jhahn96 avatar psachs avatar rnestler avatar utilebit avatar zifzaf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

embedded-uart-sps's Issues

Out-of-the Box Arduino Package

I have followed the instructions (on MacOS) and got a viable folder in my Arduino setup - almost :-(
On building this I get typedef conflicts, possibly because I have not adjusted sensirion_arch_config.h

Errors such as "previous declaration as 'typedef short unsigned int u16' typedef unsigned short u16"

If I delete the u16 typedef I get "sensirion_uart.h:61: error: unknown type name 'u16'"

Same issue on Leonardo, Mega and Uno.

Any suggestions pls?

SPS30 with STM32F401

Hi,
I have ported the code as per guidlines but as far my Knowledge Simple HALL_UART_RECEIVE would not work as the RX data size is not accurately known for each command and also the given library sends max data len to HAL , So i used HAL_UART_READtoIDLE which is solely for the given purpose but still get timeout error and does not receive any data

int16_t sensirion_uart_rx(uint16_t max_data_len, uint8_t* data) {
// TODO: implement
uint16_t actual_bytes=0;
HAL_StatusTypeDef status;
status = HAL_UARTEx_ReceiveToIdle(&huart2, data,max_data_len, &actual_bytes,1000);
switch(status) {
case HAL_OK:
printf("Status: HAL_OK\n");
break;
case HAL_ERROR:
printf("Status: HAL_ERROR\n");
break;
case HAL_BUSY:
printf("Status: HAL_BUSY\n");
break;
case HAL_TIMEOUT:
printf("Status: HAL_TIMEOUT\n");
break;
default:
printf("Status: UNKNOWN\n");
break;
}
//if(HAL_UART_Receive(&huart2, &data,max_data_len,HAL_MAX_DELAY)== HAL_OK)
if(status== HAL_OK)
{
return (int16_t)actual_bytes;
}
else
{
return -1;
}
}

Atmel SAM4S implementation

Hi I am struggling to get the sensor work with the Atmel Sam4s. I have verified UART comms works on a serial monitor and now connected the SPS30. I have also verified the serial communication is some how working because when i mess up the serial configuration the sensor int16_t sps30_probe(void); does not run.

Here are my observations.

First I run sps30_probe(). At some points it fails once but then it successfully probs.

I then set sps30_set_fan_auto_cleaning_interval_days which does not return an error and that is ok.

I then set sps30_start_measurement. Which reads ok. At this point I can hear the fan from the sensor.

The problem now comes on ret = sps30_read_measurement. To start with i get ret = -2 then next loop iteration i get ret = 0.

Can anyone help me please? Firstly to explain what is actually going on and secondly what i am doing wrong.

I am using the ASF library in Atmel Studio. The API is very easy to understand here http://asf.atmel.com/docs/latest/sam4c/html/group__buart__plc__group.html

Here is my main loop

int main (void)
{
    /* Insert system clock initialization code here (sysclk_init()). */

    sysclk_init();
    board_init();
    configUART();
    configTWI();
    adc_setup();
    SetupUART0();

    uint8_t uart0_i = 0, uart0_len;
    char uart0_buf[20];
    char ret_string[] = "";
    char pm_string[] = "";

    uint8_t len;
    char buf;

    struct sps30_measurement m;
    char serial[SPS30_MAX_SERIAL_LEN];
    const uint8_t AUTO_CLEAN_DAYS = 4;
    int16_t ret;

    while (sensirion_uart_open() != 0) {
        sendBTMessage("SEND 15 UART init failed\n\r");
        sensirion_sleep_usec(1000000); /* sleep for 1s */
    }

    sendBTMessage("SEND 15 UART opened\n\r");

    //sendBTMessage (" UART 1 Alive \n\r");
    /* Busy loop for initialization, because the main loop does not work without
     * a sensor.
     */
    while (sps30_probe() != 0) {
        sendBTMessage("SEND 15 SPS30 sensor probing failed\n\r");
        sensirion_sleep_usec(1000000); /* sleep for 1s */
    }

    sendBTMessage("SEND 15 SPS30 sensor probing successful\n\r");

    ret = sps30_set_fan_auto_cleaning_interval_days(AUTO_CLEAN_DAYS);
    if (ret) {
        sprintf(ret_string, "SEND 15 error %d setting the auto-clean interval\n\r", ret);
        sendBTMessage(ret_string);
    } else {
        sendBTMessage("SEND 15 fan stuff seem to be alright \n\r");
    }

    ret = sps30_start_measurement();
    if (ret < 0) {
        sendBTMessage("SEND 15 error starting measurement\n\r");
    } else {
        sendBTMessage("SEND 15 start measurement seem to be alright \n\r");
    }

    sendBTMessage("SEND 15 measurements started\n\r");


    /* Insert application code here, after the board has been initialized. */
    while (1) {
        sendBTMessage ("SEND 15 testing PM \n\r");

        ret = sps30_read_measurement(&m);
        sprintf(ret_string, "SEND 15 reading message ret %d \n\r", ret);
        sendBTMessage(ret_string);

        if (ret < 0) {
            sendBTMessage("SEND 15 error reading measurement\n\r");
        } else {
            if (SPS30_IS_ERR_STATE(ret)) {
                sprintf(ret_string, "SEND 15 Chip state: %u - measurements may not be accurate\n\r", SPS30_GET_ERR_STATE(ret));
                sendBTMessage(ret_string);
            }

            sprintf(pm_string, "SEND 15 measured values: 0.2f pm1.0, pm2.5 %0.2f, pm4.0 %0.2f, pm10.0 %0.2f, nc0.5 %0.2f, nc1.0 %0.2f, nc2.5 %0.2f nc4.5, %0.2f nc10.0, %0.2f typical particle size\n\r",
                    m.mc_1p0, m.mc_2p5, m.mc_4p0, m.mc_10p0, m.nc_0p5, m.nc_1p0,
                    m.nc_2p5, m.nc_4p0, m.nc_10p0, m.typical_particle_size);

            sendBTMessage(pm_string);

            sensirion_sleep_usec(1000000); /* sleep for 1s */
        }
    }
}

Here is my UART implementation.

int16_t sensirion_uart_select_port(uint8_t port) {
    return 0;
}

int16_t sensirion_uart_open() {
    return (buart_if_open(SERIAL_UART_0, 115200UL));
}

int16_t sensirion_uart_close() {
    return (buart_if_close (SERIAL_UART_0));
}

int16_t sensirion_uart_tx(uint16_t data_len, const uint8_t *data) {
    return buart_if_write (SERIAL_UART_0, data, data_len);
}

int16_t sensirion_uart_rx(uint16_t max_data_len, uint8_t *data) {
    return buart_if_read (SERIAL_UART_0, (uint8_t *) data, max_data_len);
}
void sensirion_sleep_usec(uint32_t useconds) {
    delay_us(useconds);
}

Problem with Arduino implementation

I am trying to implement the SPS30 on Arduino. I am using the sample code in embedded-uart-sps/sps30-uart/test_projects/Arduino/arduino_sps30_example/arduino_sps30_example.ino

I am getting conflicting declaration error as follows:

In file included from /home/dinesh/Arduino/libraries/embedded-uart-common/sensirion_uart.h:38:0,
from /home/dinesh/Arduino/libraries/embedded-uart-sps/sps30-uart/test_projects/Arduino/arduino_sps30_example/arduino_sps30_example.ino:33:
/home/dinesh/Arduino/libraries/embedded-uart-common/sensirion_arch_config.h:67:18: error: conflicting declaration 'typedef uint16_t u16'
typedef uint16_t u16;
^
In file included from /home/dinesh/arduino-1.8.7/hardware/arduino/avr/cores/arduino/Arduino.h:233:0,
from /home/dinesh/Arduino/libraries/embedded-uart-sps/sps30-uart/test_projects/Arduino/arduino_sps30_example/arduino_sps30_example.ino:31:
/home/dinesh/arduino-1.8.7/hardware/arduino/avr/cores/arduino/USBAPI.h:30:24: note: previous declaration as 'typedef short unsigned int u16'
typedef unsigned short u16;
^

Please help me in solving this error.

Distinguish between different SENSIRION_SHDLC_ERR_MISSING_STOP errors

We currently return SENSIRION_SHDLC_ERR_MISSING_STOP for three different error cases:

return SENSIRION_SHDLC_ERR_MISSING_STOP;

return SENSIRION_SHDLC_ERR_MISSING_STOP;

return SENSIRION_SHDLC_ERR_MISSING_STOP;

This makes it harder to diagnose errors. We should probably come up with two more error codes to use in these cases.

sps30_stop_measurement issuing the wrong command

First, thank you for providing this driver and implementation for the SPS30.

When the sps30_stop_measurement method in the sps30.c is called the SPS30 sensor's fan still runs and does not return to idle.

s16 sps30_stop_measurement() {
    u8 param_buf[] = SPS_SUBCMD_MEASUREMENT_STOP;

    return sensirion_shdlc_tx(SPS_ADDR, SPS_CMD_MEASUREMENT,
                              sizeof(param_buf), param_buf);
}

The sps30_stop_measurement method shown above sends a length of 1 and the stop command 0x00 as a sub-command to the sensirion_shdlc_tx method. The SPS30 datasheet for the stop command provides the following example frame for the stop command:

0x7E 0x00 0x01 0x00 0xFE 0x7E

This example frame uses the command 0x01 instead of 0x00 and since it does not have sub-commands it uses a length of zero. The current method does not send the example frame for MOSI described in the datasheet. For this reason, I believe this is a bug.

I was able to fix the bug by adding the constant:

#define SPS_CMD_STOP_MEASUREMENT 0x01

and modifying the method to be:

s16 sps30_stop_measurement() {
    return sensirion_shdlc_tx(SPS_ADDR, SPS_CMD_STOP_MEASUREMENT, 0, NULL);
}

Adafruit Feather 32u4 Bluefruit LE: Unable to receive data

Using the provided sample implementation sensirion_uart_implementation.cpp modified to use the hardware serial port Serial1 available on the Feather 32u4 platform and using typedef short unsigned int u16; in sensirion_arch_config.h , I've been able to get the sample code to compile, but unable to get sps30_probe() to return successfully.

The return value of sps30_probe() indicates a failure corresponding to the SENSIRION_SHDLC_ERR_MISSING_STOP error code. I've further isolated the origin of the error code to this section of sensirion_shdlc.c

if (max_data_len < rxh->data_len) {

I've also tried removing the RX and TX pins one at a time on the hardware side which resulted in the return value of sps30_probe() changing to a value corresponding to SENSIRION_SHDLC_ERR_MISSING_START in both cases (TX pin floating and RX pin floating, respectively).

Further, I've tested the SPS30 unit using a USB sensor bridge and the ControlCenter application. It appears to be functioning normally in this context.

Edit: I've managed to get the same SPS30 unit working with the sample code on a Raspberry Pi Zero W using the same JST connector and wires as I was using to connect the SPS30 to the Adafruit Feather board. I believe that should eliminate from primary consideration a hardware issue with regard to the JST connector, its attached wires, or the SPS30 unit itself. I had to remove the call to sps30_probe() to make the sample work, but all the other commands seemed to execute correctly, including sps30_get_serial() which is called by sps30_probe. I'm unsure why sps30_probe() was returning a non-zero value.

I'd appreciate suggestions for further troubleshooting steps.

uart-sps

Hello,

Sorry I'm a total beginner at raspberry pi.

I saw your code regarding the SPS30 sensor.
I installed your files as best I could

Unfortunately I don't get any values.

if I do "make" I get

pi@raspberrypi:~/sps30-uart-3.0.0 $ make
rm -f sps30_example_usage
cc -Os -Wall -fstrict-aliasing -Wstrict-aliasing=1 -Wsign-conversion -fPIC -I. -I. -I.  -o sps30_example_usage ./sensirion_arch_config.h ./sensirion_uart.h ./sensirion_shdlc.h ./sensirion_shdlc.c ./sps_git_version.h ./sps_git_version.c ./sps30.h ./sps30.c ./sensirion_uart_implementation.c ./sps30_example_usage.c
pi@raspberrypi:~/sps30-uart-3.0.0 $

but not any more.

sorry for my bad English
can you help me?

Voltage via UART?

So I'm wondering, if using UART with the sps30, does the voltage default to 5v or 3v3?
Looking at the data sheet I see the following:
TTL 5V and LVTTL 3.3V compatible

I assume that when I select to use the I2C protocol it defaults to 3v3 on the pin 2 and 3.
And that when I use the UART protocol it defaults to 5v.

Is this correct?

"arduino_sps30_example.ino" does not compile

I installed embedded-uart-sps following the instructions in the README file. I am using the arduino implantation from "sample-implementations/Arduino/sensirion_uart_implemenation.cpp" to compile the example arduino sketch and I am getting the following error:

"sensirion_uart_implementation.cpp:51:1: error: 'Uart' does not name a type
Uart Serial2 (&sercom1, PIN_UART_RX, PIN_UART_TX, SERCOM_RX_PAD_0,
^ "

I am using an Arduino Uno board.

I tried the linux version on my Raspberry Pi and it works fine.

Doubts regarding the mass concentration(ug/m3) of PM 10

sensiriondata

I ran the example provided for the linux host and got these values. I have doubts about the PM10 mass concentration reading. I don't understand why PM 10 value is smaller than PM 1, PM 2.5 and PM4?

The data sheet defines PM10 to be all particles between 0.3 to 10 um in diameter.

sensiriondatasheet

So, intuitively values of PM1 < PM2.5 < PM 4 < PM 10 right? Or am I missing something?

help wanted for SPS30 with UART communication

we are facing a critical issue with communication with SPS30 WITH PC
we were testing sps30 by connecting with docklight.
we have used usb to serial converter to command the sps30.
pin 1 was connected to poer supply +5vdc ,
pin 5 was connected to 0vdc.
pin4 was left open for UART,
pin 2 was connected to Tx of master (PC),
pin 3 was connected to Rx of master (pc).
From docklight v2.3 we had set the com port , 115200, 8N1 communication settings.
we have placed command in format of Hex codes i.e.
start command
Tx: 7E 00 00 01 02 F9 7E ,
Rx REPLY: 7E 00 00 01 02 F9 7E ,
Tx: 7E 00 00 00 FF 7E,
Rx REPLY: x: 7E 00 00 00 FF 7E ,
Tx: 7E 00 03 00 FC 7E ,
Rx REPLY: 7E 00 03 00 FC 7E ,
Tx: 7E 00 D3 00 2C 7E,
Rx REPLY: 7E 00 D3 00 2C 7E .
OVER ALL FAN IS ALSO NOT ROTATING PHYSICALLY..
could you pls guide us why sps30 is not giving response to our commands.
how to proceed further with sps30

Missing sample code for Feather 32u4 Arduino board

I removed the following lines from sensirion_uart_implementation.cpp as suggested in one of the issues.
Uart Serial2 (&sercom1, PIN_UART_RX, PIN_UART_TX, SERCOM_RX_PAD_0,
UART_TX_PAD_2);

And I changed Serial2 to Serial.
I am now getting the following error:
/home/dinesh/Arduino/sketch_jan09c/sketch_jan09c.ino: In function 's16 sensirion_uart_open()':
sketch_jan09c:71:32: error: 'PIO_SERCOM' was not declared in this scope
pinPeripheral(PIN_UART_TX, PIO_SERCOM);
^
sketch_jan09c:71:42: error: 'pinPeripheral' was not declared in this scope
pinPeripheral(PIN_UART_TX, PIO_SERCOM);
^
exit status 1
'PIO_SERCOM' was not declared in this scope

I am using a Feather 32u4 Arduino based board. Please help me solve these errors.

Sample for STM32 (HAL)

Hello,
For past few days, I am struggling with implementation on our STM32L0xx-based board. Can you please post some sample how to process data from the sensor using HAL libraries from ST ?

Thank you.

Output format is float values only — integer format not supported

Datasheet says an output format must be specified when starting the measurement with the “Start Measurement command”; 2 output formats are supported:

Measurement Output Format:
0x03: Big-endian IEEE754 float values
0x05: Big-endian unsigned 16-bit integer values

It seems this implementation supports only the float format today.

https://github.com/Sensirion/embedded-uart-sps/blob/master/sps30-uart/sps30.c#L40
#define SPS30_SUBCMD_MEASUREMENT_START { 0x01, 0x03 }

What is the benefit of receiving float values from the sensor? Datasheet says sensor precision is never better than 10 μg/m3. I.e. fractional digits in float values could be considered "unwanted" precision, and may not mean much.

Am I correct to understand the default float output format is in fact not more precise than integer format? And that, for all intents and purposes, float values should be rounded to integers?

"Datasheet SPS30 - Particulate Matter Sensor for Air Quality Monitoring and Control"

Mass concentration precision1,2 for PM1 and PM2.53 0 to 100 μg/m3 ±10 μg/m3
100 to 1000 μg/m3
Mass concentration precision1,2 for PM4, PM104 0 to 100 μg/m3 ±25 μg/m3
100 to 1000 μg/m3

Arduino example wrong #define

The Arduino example doesn't compile, as it is looking for:
if (SPS_IS_ERR_STATE(ret)) {
Which should be:
if (SPS30_IS_ERR_STATE(ret)) {
ie the 30 is missing off SPS

UART HAL Recieve

Hi,

I am trying to communicate the SPS30 with UART. I am able to transmit command using your driver files. for ex. if i send data for start measurement, i am able to hear the sensor switched on and running.
int16_t sensirion_uart_tx(uint16_t data_len, const uint8_t* data) {
uint16_t len;
len = UARTPuts(&gPM, (uint8_t*) data, data_len);
if(len == data_len)
return data_len;
return 0;
}

Problem. I have issue recieving the full frame from the sensor. During debugging, i recieive 0x7e and remaining 0s in the Rxbuffer. i recieve the char in a call back function from interrupt and copy the data into the buffer needed.

Callback function
void PM_ByteReceived(void){

char    c;
uint8_t status;

while (UARTReadable(&gPM))
{
	c = UARTGetc(&gPM, &status);
	//HAL_Delay(1000);

	if (status == 0)
	{
		PM_RxBuffer[receivedBytesPM++] = c;
		HAL_Delay(1000);
	}
}

}

from the usart implementation function
int16_t sensirion_uart_rx(uint16_t max_data_len, uint8_t* data) {

if(max_data_len == 0)
    return -1;

memcpy((uint8_t*)data, PM_RxBuffer, max_data_len);
return sizeof(data);

}

I recieve 7E and 0 and Uartreadable gets out of the loop in the callback function.
bool UARTReadable(sUART* uart)
{
if (uart->initialized)
{

uint8_t uartindex = FindUARTIndex(uart);

if (uartindex == 0xFF)
{
  return false;
}

return ((__HAL_UART_GET_FLAG(&uart->huart, UART_FLAG_RXNE) == true) || (overflowBuffer[uartindex].dataExist));

}
else
{
return false;
}
}

40: internal function argument out of range

For new development of telemetric particle counter we are looking into SPS30 and made some test software on PC to do the uart SHDLC protocol to communicate with the SPS30

For all commands sent to it, sps30 returns 40: internal function argument out of range status response. However, the command seems to be executed by the sensor. The fan actually switches on after start command, and off after stop command.

Is this an issue with the protocol or is it something internal in de sensor ?

Node MCU Implementation

Hi
I am trying to read out the values of the sps30 with an NodeMCU and the arduino IDE.

First I could not integrate the library as usual with the Sketch Zip Integrate function.
In the end I copied the files sps30-uart and embedded-uart-common into the arduino library folder and included them.

Now I am using the sps30_example.
I changed the sensirion_uart_implementation file adding the functions of the sample sensirion_uart_implementation.cpp: Here I did Not add

Uart Serial2 (&sercom1, PIN_UART_RX, PIN_UART_TX, SERCOM_RX_PAD_0,
              UART_TX_PAD_2);

void SERCOM1_Handler() {
  Serial2.IrqHandler();
}

because there are errors and I guess its not needed.

I changed the c file into an cpp file, otherwise the serial functions did not work and I removed some serial 2 to serial 1:

Here is the sensirion uart implementation version

/////////////////////////////////////////////////////////////////////////////////////////////

// needed for delay() routine
#include <Arduino.h>
#include "wiring_private.h" // pinPeripheral() function

#ifdef __cplusplus
extern "C" {
#endif

#include "sensirion_arch_config.h"
#include "sensirion_uart.h"

#define BAUDRATE 115200  // baud rate of SPS30
#define PIN_UART_RX 11
#define PIN_UART_TX 10
/*
 * INSTRUCTIONS
 * ============
 *
 * Implement all functions where they are marked with TODO: implement
 * Follow the function specification in the comments.
 */
 
 

 
 
/**
 * sensirion_uart_open() - initialize UART
 *
 * Return:      0 on success, an error code otherwise
 */
s16 sensirion_uart_open() {


    while (!Serial) {
        delay(100);
    }
    return 0;
}

/**
 * sensirion_uart_close() - release UART resources
 *
 * Return:      0 on success, an error code otherwise
 */
s16 sensirion_uart_close() {
    // TODO: implement x
	    Serial.end();
	
    return 0;
}

/**
 * sensirion_uart_tx() - transmit data over UART
 *
 * @data_len:   number of bytes to send
 * @data:       data to send
 * Return:      Number of bytes sent or a negative error code
 */
s16 sensirion_uart_tx(u16 data_len, const u8 *data) {
    // TODO: implement x
	    return Serial.write(data, data_len);
    return 0;
}

/**
 * sensirion_uart_rx() - receive data over UART
 *
 * @data_len:   max number of bytes to receive
 * @data:       Memory where received data is stored
 * Return:      Number of bytes received or a negative error code
 */
s16 sensirion_uart_rx(u16 max_data_len, u8 *data) {
    // TODO: implement
    s16 i = 0;

    while (Serial.available() > 0 && i < max_data_len) {
        data[i] = (u8)Serial.read();
        i++;
    }

    return i;
}

/**
 * Sleep for a given number of microseconds. The function should delay the
 * execution for at least the given time, but may also sleep longer.
 *
 * Despite the unit, a <10 millisecond precision is sufficient.
 *
 * @param useconds the sleep time in microseconds
 */
void sensirion_sleep_usec(u32 useconds) {
    // TODO: implement x
	    delay((useconds / 1000) + 1);
}

}
////////////////////////////////////////////////////////////////////////////////////////////

The Serial Monitor shows this message:

~ ⸮+~ probe failed
~ ⸮+~ probe failed
~ ⸮+~ probe failed

I connected the rx/tx to the rx/tx of the nodemcu and the vin to the power supply and ground to ground as written in the data sheet.

The Ventilator is not turning.

Do you have any recommendations?

Thank you very much in advance and best regards
Alex

sensor probing failed

HI
i am using stm32l4XX microcontroller to read the data from the sensor. It outputs sensor probing failed what could it possibly mean. Is it because of anything wrong with the data being sent or being received?

{7E}{00}{7D}{31}{43}{00}{AB}{7E}{7E}{00}{7D}{31}{43}{00}{AB}{7E} this one is the mosi out that i get from the sensor when is send wakeup instruction

Only getting NaN readings via UART on Raspberry Pi 3

I hooked up my SPS30 to the Raspberry Pi's GPIO UART pins, and followed the instructions, setting the serial port to /dev/ttyS0 (after disabling serial console in raspi-config).

Running sps30_example_usage, the sensor seems to be identified (indicated by the serial number, i think?), but only gives nan values, even though the fan seems to spin:

# ./sps30_example_usage
SPS30 sensor probing successful
SPS30 Serial: E33C9E11208D72B9
measurements started
measured values:
        nan pm1.0
        nan pm2.5
        nan pm4.0
        nan pm10.0
        nan nc0.5
        nan nc1.0
        nan nc2.5
        nan nc4.5
        nan nc10.0
        nan typical particle size

^C
(the nan reading s go on and on and on forever)

First measurement read in sps30_example_usage.c always fails

sps30_example_usage.c consistently fails to read the very first measurement, in my experience.

sps30-uart/sps30.h says:

sps30_start_measurement() - start measuring
Once the measurement is started, measurements are retrievable once per second
with sps30_read_measurement.

But sps30_example_usage.c calls sps30_start_measurement() right after sps30_start_measurement() -- the first time, without waiting one second before the call.

I propose moving the sleep call at
https://github.com/Sensirion/embedded-uart-sps/blob/master/sps30-uart/sps30_example_usage.c#L121
to line 95 instead, at the start of the loop.

With this change, all my measurements are consistently successful.

Support for Nano 33 BLE Sense

Hello all,
I'm trying to use the SPS30 PM sensor with a UART driver from this repository, however, I am new to this sensor and I don't know what to do in order to use the sensor on UART with the Nano 33 BLE Sense, which runs on an nRF52840 MCU. It communicates through the use of Serial1. functions. What steps do I need to perform in order to use the SPS with UART on this board. I tried using I2C, it works but my project uses much faster pull rates than i2c.
Regards
Guntas

SPS30 communication on uart

we are facing a critical issue with communication with SPS30 WITH PC
we were testing sps30 by connecting with docklight.
we have used usb to serial converter to command the sps30.
pin 1 was connected to poer supply +5vdc ,
pin 5 was connected to 0vdc.
pin4 was left open for UART,
pin 2 was connected to Tx of master (PC),
pin 3 was connected to Rx of master (pc).
From docklight v2.3 we had set the com port , 115200, 8N1 communication settings.
we have placed command in format of Hex codes i.e.
start command
Tx: 7E 00 00 01 02 F9 7E ,
Rx REPLY: 7E 00 00 01 02 F9 7E ,
Tx: 7E 00 00 00 FF 7E,
Rx REPLY: x: 7E 00 00 00 FF 7E ,
Tx: 7E 00 03 00 FC 7E ,
Rx REPLY: 7E 00 03 00 FC 7E ,
Tx: 7E 00 D3 00 2C 7E,
Rx REPLY: 7E 00 D3 00 2C 7E .
OVER ALL FAN IS ALSO NOT ROTATING PHYSICALLY..
could you pls guide us why sps30 is not giving response to our commands.
how to proceed further with sps30

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.