Skip to content

[AE-197] Newly added sensor IDs do not print values to terminal #114

Open
arduino/docs-content
#1481
@aliphys

Description

@aliphys

Description of defect

As part of #85 , new sensor IDs have become avaliable for use on the Nicla Sense ME. These include the following:

  SENSOR_ID_KLIO                     = 112,  /* KLIO output */
  SENSOR_ID_PDR                      = 113,  /* PDR output */
  SENSOR_ID_SWIM                     = 114, /* SWIM output */
  SENSOR_ID_BSEC2_COLLECTOR          = 116,  /* BSEC 2.x raw data collector for AI training */
  SENSOR_ID_BSEC2                    = 117,  /* BSEC 2.x gas classifier output */
  SENSOR_ID_HMC                      = 120, /* HMC output */
  SENSOR_ID_OC                       = 121, /* OC output */
  SENSOR_ID_NOC                      = 122, /* NOC output */
  SENSOR_ID_OCE                      = 123, /* OCE output */
  SENSOR_ID_NOCE                     = 124, /* NOCE output */

To test the features, I modified this sketch by @marqdevx as follows:

Test Sketch

/*
Sketch that new sensor IDs with four classes, requesting  5 samples of each
With Putty, log the Serial output as a .txt
@author: Pablo Marquínez, Modified by Ali Jahangiri
*/

#include "Arduino_BHY2.h"

/*
Sensor
SensorXYZ 
SensorQuaternion
SensorOrientation
SensorBSEC
SensorActivity
*/
int sensors[] = {112, 113,114, 116, 117, 120, 121, 122, 123, 124};
Sensor* ptrSensor;

int sensorsBSEC[] = {112, 113,114, 116, 117, 120, 121, 122, 123, 124};
SensorBSEC* ptrSensorBSEC;

int sensorsBSEC2[] = {112, 113,114, 116, 117, 120, 121, 122, 123, 124};
SensorBSEC2* ptrSensorBSEC2;

int sensorsBSEC2Collector[] = {112, 113,114, 116, 117, 120, 121, 122, 123, 124};
SensorBSEC2Collector* ptrSensorBSEC2Collector;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  while (!Serial)
    ;

  delay(10000);
  BHY2.begin();

  delay(1000);

  checkSensors();
  checkSensorsBSEC();
  checkSensorsBSEC2();
  checkSensorsBSEC2Collector();

  Serial.println("--------");
  Serial.println("END");
}

void loop() {
  // put your main code here, to run repeatedly:
}

void checkSensors() {
  Serial.println("-------");
  Serial.println("Checking type Sensor");
  int listLength = sizeof(sensors) / sizeof(sensors[0]);
  for (int checkID = 0; checkID < listLength; checkID++) {
    ptrSensor = new Sensor(sensors[checkID]);
    ptrSensor->begin();

    Serial.print("\tChecking ");
    Serial.println(sensors[checkID]);
    for (int i = 0; i < 3; i++) {
      BHY2.update();
      Serial.println(String("\t\tSample n") + String(i) + String(" ") + ptrSensor->toString());
      delay(20);
    }

    ptrSensor->end();
  }
}

void checkSensorsBSEC() {
  Serial.println("-------");
  Serial.println("Checking type SensorBSEC");
  int listLength = sizeof(sensorsBSEC) / sizeof(sensorsBSEC[0]);
  for (int checkID = 0; checkID < listLength; checkID++) {
    ptrSensorBSEC = new SensorBSEC(sensorsBSEC[checkID]);
    ptrSensorBSEC->begin();

    Serial.print("\tChecking ");
    Serial.println(sensorsBSEC[checkID]);
    for (int i = 0; i < 3; i++) {
      BHY2.update();
      Serial.println(String("\t\tSample n") + String(i) + String(" ") + ptrSensorBSEC->toString());
      delay(20);
    }

    ptrSensorBSEC->end();
  }
}

void checkSensorsBSEC2() {
  Serial.println("-------");
  Serial.println("Checking type SensorBSEC2");
  int listLength = sizeof(sensorsBSEC2) / sizeof(sensorsBSEC2[0]);
  for (int checkID = 0; checkID < listLength; checkID++) {
    ptrSensorBSEC2 = new SensorBSEC2(sensorsBSEC2[checkID]);
    ptrSensorBSEC2->begin();

    Serial.print("\tChecking ");
    Serial.println(sensorsBSEC2[checkID]);
    for (int i = 0; i < 3; i++) {
      BHY2.update();
      Serial.println(String("\t\tSample n") + String(i) + String(" ") + ptrSensorBSEC2->toString());
      delay(20);
    }

    ptrSensorBSEC2->end();
  }
}

void checkSensorsBSEC2Collector() {
  Serial.println("-------");
  Serial.println("Checking type SensorBSEC2Collector");
  int listLength = sizeof(sensorsBSEC2Collector) / sizeof(sensorsBSEC2Collector[0]);
  for (int checkID = 0; checkID < listLength; checkID++) {
    ptrSensorBSEC2Collector = new SensorBSEC2Collector(sensorsBSEC2Collector[checkID]);
    ptrSensorBSEC2Collector->begin();

    Serial.print("\tChecking ");
    Serial.println(sensorsBSEC2Collector[checkID]);
    for (int i = 0; i < 3; i++) {
      BHY2.update();
      Serial.println(String("\t\tSample n") + String(i) + String(" ") + ptrSensorBSEC2Collector->toString());
      delay(20);
    }

    ptrSensorBSEC2Collector->end();
  }
}

In this test sketch, the sample IDs {112, 113,114, 116, 117, 120, 121, 122, 123, 124} are called via the Sensor, SensorBSEC, SensorBSEC2 and SensorBSEC2Collector classes. In all cases, a null output is given.

Full Serial Output
-------
Checking type Sensor
        Checking 112
                Sample n0 Data value: 0.000

                Sample n1 Data value: 0.000

                Sample n2 Data value: 0.000

        Checking 113
                Sample n0 Data value: 0.000

                Sample n1 Data value: 0.000

                Sample n2 Data value: 0.000

        Checking 114
                Sample n0 Data value: 0.000

                Sample n1 Data value: 0.000

                Sample n2 Data value: 0.000

        Checking 116
                Sample n0 Data value: 0.000

                Sample n1 Data value: 0.000

                Sample n2 Data value: 0.000

        Checking 117
                Sample n0 Data value: 0.000

                Sample n1 Data value: 0.000

                Sample n2 Data value: 0.000

        Checking 120
                Sample n0 Data value: 0.000

                Sample n1 Data value: 0.000

                Sample n2 Data value: 0.000

        Checking 121
                Sample n0 Data value: 0.000

                Sample n1 Data value: 0.000

                Sample n2 Data value: 0.000

        Checking 122
                Sample n0 Data value: 0.000

                Sample n1 Data value: 0.000

                Sample n2 Data value: 0.000

        Checking 123
                Sample n0 Data value: 0.000

                Sample n1 Data value: 0.000

                Sample n2 Data value: 0.000

        Checking 124
                Sample n0 Data value: 0.000

                Sample n1 Data value: 0.000

                Sample n2 Data value: 0.000

-------
Checking type SensorBSEC
        Checking 112
                Sample n0 BSEC output values - iaq: 0   iaq_s: 0   b_voc_eq: 0.00   co2_eq: 0   accuracy: 0   comp_t: 0.00   comp_h: 0.00   comp_g: 0

                Sample n1 BSEC output values - iaq: 0   iaq_s: 0   b_voc_eq: 0.00   co2_eq: 0   accuracy: 0   comp_t: 0.00   comp_h: 0.00   comp_g: 0

                Sample n2 BSEC output values - iaq: 0   iaq_s: 0   b_voc_eq: 0.00   co2_eq: 0   accuracy: 0   comp_t: 0.00   comp_h: 0.00   comp_g: 0

        Checking 113
                Sample n0 BSEC output values - iaq: 0   iaq_s: 0   b_voc_eq: 0.00   co2_eq: 0   accuracy: 0   comp_t: 0.00   comp_h: 0.00   comp_g: 0

                Sample n1 BSEC output values - iaq: 0   iaq_s: 0   b_voc_eq: 0.00   co2_eq: 0   accuracy: 0   comp_t: 0.00   comp_h: 0.00   comp_g: 0

                Sample n2 BSEC output values - iaq: 0   iaq_s: 0   b_voc_eq: 0.00   co2_eq: 0   accuracy: 0   comp_t: 0.00   comp_h: 0.00   comp_g: 0

        Checking 114
                Sample n0 BSEC output values - iaq: 0   iaq_s: 0   b_voc_eq: 0.00   co2_eq: 0   accuracy: 0   comp_t: 0.00   comp_h: 0.00   comp_g: 0

                Sample n1 BSEC output values - iaq: 0   iaq_s: 0   b_voc_eq: 0.00   co2_eq: 0   accuracy: 0   comp_t: 0.00   comp_h: 0.00   comp_g: 0

                Sample n2 BSEC output values - iaq: 0   iaq_s: 0   b_voc_eq: 0.00   co2_eq: 0   accuracy: 0   comp_t: 0.00   comp_h: 0.00   comp_g: 0

        Checking 116
                Sample n0 BSEC output values - iaq: 0   iaq_s: 0   b_voc_eq: 0.00   co2_eq: 0   accuracy: 0   comp_t: 0.00   comp_h: 0.00   comp_g: 0

                Sample n1 BSEC output values - iaq: 0   iaq_s: 0   b_voc_eq: 0.00   co2_eq: 0   accuracy: 0   comp_t: 0.00   comp_h: 0.00   comp_g: 0

                Sample n2 BSEC output values - iaq: 0   iaq_s: 0   b_voc_eq: 0.00   co2_eq: 0   accuracy: 0   comp_t: 0.00   comp_h: 0.00   comp_g: 0

        Checking 117
                Sample n0 BSEC output values - iaq: 0   iaq_s: 0   b_voc_eq: 0.00   co2_eq: 0   accuracy: 0   comp_t: 0.00   comp_h: 0.00   comp_g: 0

                Sample n1 BSEC output values - iaq: 0   iaq_s: 0   b_voc_eq: 0.00   co2_eq: 0   accuracy: 0   comp_t: 0.00   comp_h: 0.00   comp_g: 0

                Sample n2 BSEC output values - iaq: 0   iaq_s: 0   b_voc_eq: 0.00   co2_eq: 0   accuracy: 0   comp_t: 0.00   comp_h: 0.00   comp_g: 0

        Checking 120
                Sample n0 BSEC output values - iaq: 0   iaq_s: 0   b_voc_eq: 0.00   co2_eq: 0   accuracy: 0   comp_t: 0.00   comp_h: 0.00   comp_g: 0

                Sample n1 BSEC output values - iaq: 0   iaq_s: 0   b_voc_eq: 0.00   co2_eq: 0   accuracy: 0   comp_t: 0.00   comp_h: 0.00   comp_g: 0

                Sample n2 BSEC output values - iaq: 0   iaq_s: 0   b_voc_eq: 0.00   co2_eq: 0   accuracy: 0   comp_t: 0.00   comp_h: 0.00   comp_g: 0

        Checking 121
                Sample n0 BSEC output values - iaq: 0   iaq_s: 0   b_voc_eq: 0.00   co2_eq: 0   accuracy: 0   comp_t: 0.00   comp_h: 0.00   comp_g: 0

                Sample n1 BSEC output values - iaq: 0   iaq_s: 0   b_voc_eq: 0.00   co2_eq: 0   accuracy: 0   comp_t: 0.00   comp_h: 0.00   comp_g: 0

                Sample n2 BSEC output values - iaq: 0   iaq_s: 0   b_voc_eq: 0.00   co2_eq: 0   accuracy: 0   comp_t: 0.00   comp_h: 0.00   comp_g: 0

        Checking 122
                Sample n0 BSEC output values - iaq: 0   iaq_s: 0   b_voc_eq: 0.00   co2_eq: 0   accuracy: 0   comp_t: 0.00   comp_h: 0.00   comp_g: 0

                Sample n1 BSEC output values - iaq: 0   iaq_s: 0   b_voc_eq: 0.00   co2_eq: 0   accuracy: 0   comp_t: 0.00   comp_h: 0.00   comp_g: 0

                Sample n2 BSEC output values - iaq: 0   iaq_s: 0   b_voc_eq: 0.00   co2_eq: 0   accuracy: 0   comp_t: 0.00   comp_h: 0.00   comp_g: 0

        Checking 123
                Sample n0 BSEC output values - iaq: 0   iaq_s: 0   b_voc_eq: 0.00   co2_eq: 0   accuracy: 0   comp_t: 0.00   comp_h: 0.00   comp_g: 0

                Sample n1 BSEC output values - iaq: 0   iaq_s: 0   b_voc_eq: 0.00   co2_eq: 0   accuracy: 0   comp_t: 0.00   comp_h: 0.00   comp_g: 0

                Sample n2 BSEC output values - iaq: 0   iaq_s: 0   b_voc_eq: 0.00   co2_eq: 0   accuracy: 0   comp_t: 0.00   comp_h: 0.00   comp_g: 0

        Checking 124
                Sample n0 BSEC output values - iaq: 0   iaq_s: 0   b_voc_eq: 0.00   co2_eq: 0   accuracy: 0   comp_t: 0.00   comp_h: 0.00   comp_g: 0

                Sample n1 BSEC output values - iaq: 0   iaq_s: 0   b_voc_eq: 0.00   co2_eq: 0   accuracy: 0   comp_t: 0.00   comp_h: 0.00   comp_g: 0

                Sample n2 BSEC output values - iaq: 0   iaq_s: 0   b_voc_eq: 0.00   co2_eq: 0   accuracy: 0   comp_t: 0.00   comp_h: 0.00   comp_g: 0

-------
Checking type SensorBSEC2
        Checking 112
                Sample n0 BSEC2 output values (%) - gas[0]: 0   gas[1]: 0   gas[2]: 0   gas[3]: 0   accuracy: 0

                Sample n1 BSEC2 output values (%) - gas[0]: 0   gas[1]: 0   gas[2]: 0   gas[3]: 0   accuracy: 0

                Sample n2 BSEC2 output values (%) - gas[0]: 0   gas[1]: 0   gas[2]: 0   gas[3]: 0   accuracy: 0

        Checking 113
                Sample n0 BSEC2 output values (%) - gas[0]: 0   gas[1]: 0   gas[2]: 0   gas[3]: 0   accuracy: 0

                Sample n1 BSEC2 output values (%) - gas[0]: 0   gas[1]: 0   gas[2]: 0   gas[3]: 0   accuracy: 0

                Sample n2 BSEC2 output values (%) - gas[0]: 0   gas[1]: 0   gas[2]: 0   gas[3]: 0   accuracy: 0

        Checking 114
                Sample n0 BSEC2 output values (%) - gas[0]: 0   gas[1]: 0   gas[2]: 0   gas[3]: 0   accuracy: 0

                Sample n1 BSEC2 output values (%) - gas[0]: 0   gas[1]: 0   gas[2]: 0   gas[3]: 0   accuracy: 0

                Sample n2 BSEC2 output values (%) - gas[0]: 0   gas[1]: 0   gas[2]: 0   gas[3]: 0   accuracy: 0

        Checking 116
                Sample n0 BSEC2 output values (%) - gas[0]: 0   gas[1]: 0   gas[2]: 0   gas[3]: 0   accuracy: 0

                Sample n1 BSEC2 output values (%) - gas[0]: 0   gas[1]: 0   gas[2]: 0   gas[3]: 0   accuracy: 0

                Sample n2 BSEC2 output values (%) - gas[0]: 0   gas[1]: 0   gas[2]: 0   gas[3]: 0   accuracy: 0

        Checking 117
                Sample n0 BSEC2 output values (%) - gas[0]: 0   gas[1]: 0   gas[2]: 0   gas[3]: 0   accuracy: 0

                Sample n1 BSEC2 output values (%) - gas[0]: 0   gas[1]: 0   gas[2]: 0   gas[3]: 0   accuracy: 0

                Sample n2 BSEC2 output values (%) - gas[0]: 0   gas[1]: 0   gas[2]: 0   gas[3]: 0   accuracy: 0

        Checking 120
                Sample n0 BSEC2 output values (%) - gas[0]: 0   gas[1]: 0   gas[2]: 0   gas[3]: 0   accuracy: 0

                Sample n1 BSEC2 output values (%) - gas[0]: 0   gas[1]: 0   gas[2]: 0   gas[3]: 0   accuracy: 0

                Sample n2 BSEC2 output values (%) - gas[0]: 0   gas[1]: 0   gas[2]: 0   gas[3]: 0   accuracy: 0

        Checking 121
                Sample n0 BSEC2 output values (%) - gas[0]: 0   gas[1]: 0   gas[2]: 0   gas[3]: 0   accuracy: 0

                Sample n1 BSEC2 output values (%) - gas[0]: 0   gas[1]: 0   gas[2]: 0   gas[3]: 0   accuracy: 0

                Sample n2 BSEC2 output values (%) - gas[0]: 0   gas[1]: 0   gas[2]: 0   gas[3]: 0   accuracy: 0

        Checking 122
                Sample n0 BSEC2 output values (%) - gas[0]: 0   gas[1]: 0   gas[2]: 0   gas[3]: 0   accuracy: 0

                Sample n1 BSEC2 output values (%) - gas[0]: 0   gas[1]: 0   gas[2]: 0   gas[3]: 0   accuracy: 0

                Sample n2 BSEC2 output values (%) - gas[0]: 0   gas[1]: 0   gas[2]: 0   gas[3]: 0   accuracy: 0

        Checking 123
                Sample n0 BSEC2 output values (%) - gas[0]: 0   gas[1]: 0   gas[2]: 0   gas[3]: 0   accuracy: 0

                Sample n1 BSEC2 output values (%) - gas[0]: 0   gas[1]: 0   gas[2]: 0   gas[3]: 0   accuracy: 0

                Sample n2 BSEC2 output values (%) - gas[0]: 0   gas[1]: 0   gas[2]: 0   gas[3]: 0   accuracy: 0

        Checking 124
                Sample n0 BSEC2 output values (%) - gas[0]: 0   gas[1]: 0   gas[2]: 0   gas[3]: 0   accuracy: 0

                Sample n1 BSEC2 output values (%) - gas[0]: 0   gas[1]: 0   gas[2]: 0   gas[3]: 0   accuracy: 0

                Sample n2 BSEC2 output values (%) - gas[0]: 0   gas[1]: 0   gas[2]: 0   gas[3]: 0   accuracy: 0

-------
Checking type SensorBSEC2Collector
        Checking 112
                Sample n0 timestamp: 00   temp: 0.00   pressure: 0.00   hum: 0.00   gas: 0.00   gas_index: 0

                Sample n1 timestamp: 00   temp: 0.00   pressure: 0.00   hum: 0.00   gas: 0.00   gas_index: 0

                Sample n2 timestamp: 00   temp: 0.00   pressure: 0.00   hum: 0.00   gas: 0.00   gas_index: 0

        Checking 113
                Sample n0 timestamp: 00   temp: 0.00   pressure: 0.00   hum: 0.00   gas: 0.00   gas_index: 0

                Sample n1 timestamp: 00   temp: 0.00   pressure: 0.00   hum: 0.00   gas: 0.00   gas_index: 0

                Sample n2 timestamp: 00   temp: 0.00   pressure: 0.00   hum: 0.00   gas: 0.00   gas_index: 0

        Checking 114
                Sample n0 timestamp: 00   temp: 0.00   pressure: 0.00   hum: 0.00   gas: 0.00   gas_index: 0

                Sample n1 timestamp: 00   temp: 0.00   pressure: 0.00   hum: 0.00   gas: 0.00   gas_index: 0

                Sample n2 timestamp: 00   temp: 0.00   pressure: 0.00   hum: 0.00   gas: 0.00   gas_index: 0

        Checking 116
                Sample n0 timestamp: 00   temp: 0.00   pressure: 0.00   hum: 0.00   gas: 0.00   gas_index: 0

                Sample n1 timestamp: 00   temp: 0.00   pressure: 0.00   hum: 0.00   gas: 0.00   gas_index: 0

                Sample n2 timestamp: 00   temp: 0.00   pressure: 0.00   hum: 0.00   gas: 0.00   gas_index: 0

        Checking 117
                Sample n0 timestamp: 00   temp: 0.00   pressure: 0.00   hum: 0.00   gas: 0.00   gas_index: 0

                Sample n1 timestamp: 00   temp: 0.00   pressure: 0.00   hum: 0.00   gas: 0.00   gas_index: 0

                Sample n2 timestamp: 00   temp: 0.00   pressure: 0.00   hum: 0.00   gas: 0.00   gas_index: 0

        Checking 120
                Sample n0 timestamp: 00   temp: 0.00   pressure: 0.00   hum: 0.00   gas: 0.00   gas_index: 0

                Sample n1 timestamp: 00   temp: 0.00   pressure: 0.00   hum: 0.00   gas: 0.00   gas_index: 0

                Sample n2 timestamp: 00   temp: 0.00   pressure: 0.00   hum: 0.00   gas: 0.00   gas_index: 0

        Checking 121
                Sample n0 timestamp: 00   temp: 0.00   pressure: 0.00   hum: 0.00   gas: 0.00   gas_index: 0

                Sample n1 timestamp: 00   temp: 0.00   pressure: 0.00   hum: 0.00   gas: 0.00   gas_index: 0

                Sample n2 timestamp: 00   temp: 0.00   pressure: 0.00   hum: 0.00   gas: 0.00   gas_index: 0

        Checking 122
                Sample n0 timestamp: 00   temp: 0.00   pressure: 0.00   hum: 0.00   gas: 0.00   gas_index: 0

                Sample n1 timestamp: 00   temp: 0.00   pressure: 0.00   hum: 0.00   gas: 0.00   gas_index: 0

                Sample n2 timestamp: 00   temp: 0.00   pressure: 0.00   hum: 0.00   gas: 0.00   gas_index: 0

        Checking 123
                Sample n0 timestamp: 00   temp: 0.00   pressure: 0.00   hum: 0.00   gas: 0.00   gas_index: 0

                Sample n1 timestamp: 00   temp: 0.00   pressure: 0.00   hum: 0.00   gas: 0.00   gas_index: 0

                Sample n2 timestamp: 00   temp: 0.00   pressure: 0.00   hum: 0.00   gas: 0.00   gas_index: 0

        Checking 124
                Sample n0 timestamp: 00   temp: 0.00   pressure: 0.00   hum: 0.00   gas: 0.00   gas_index: 0

                Sample n1 timestamp: 00   temp: 0.00   pressure: 0.00   hum: 0.00   gas: 0.00   gas_index: 0

                Sample n2 timestamp: 00   temp: 0.00   pressure: 0.00   hum: 0.00   gas: 0.00   gas_index: 0

--------

It is expected that some form of output is avaliable to the users. Otherwise, sensor IDs cannot be used as specified in the Nicla Sense ME cheatsheet:

The IDs to address the sensors both through ESLOV and WebBLE are as follows:

Target(s) affected by this defect ?

Nicla Sense ME.

Toolchain(s) (name and version) displaying this defect ?

Uploaded latest firmware and compiled with library commit 40437b6

What version of Mbed-os are you using (tag or sha) ?

4.0.8

What version(s) of tools are you using. List all that apply (E.g. mbed-cli)

How is this defect reproduced ?

Running the example sketch provided.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: imperfectionPerceived defect in any part of project

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions