# Still Nicla Sense ME BSEQ data problems

**URL:** <https://forum.arduino.cc/t/still-nicla-sense-me-bseq-data-problems/1086863>\
**Category:** Nicla Sense ME\
**Created:** [February 6, 2023, 1:56pm UTC](https://forum.arduino.cc/t/still-nicla-sense-me-bseq-data-problems/1086863 "2023-02-06T13:56:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![emnullfuenf](https://avatars.discourse-cdn.com/v4/letter/e/73ab20/32.png) [@emnullfuenf](https://forum.arduino.cc/u/emnullfuenf)\
**Post date:** [February 6, 2023, 1:56pm UTC](https://forum.arduino.cc/t/still-nicla-sense-me-bseq-data-problems/1086863/1 "2023-02-06T13:56:21Z")

</div>

There are already answers about how to get BSEQ IAQ values by [increasing SENSOR\_DATA\_FIXED\_LENGTH in SensorTypes.h](https://forum.arduino.cc/t/nicla-sense-me-getting-air-quality-values/929865).

Unfortunately this only works for the LEGACY ID (115) and only for IAQ but not for the current one (171).

Is there any update on how to get the BSEQ data working with all values (including CO2)?

Here's the code i am using with the latest Arduino\_BHY2 library (1.0.6):

```cpp
#include "Arduino.h"
#include "Arduino_BHY2.h"

Sensor gas(SENSOR_ID_GAS);
SensorBSEC bsec(SENSOR_ID_BSEC); //_LEGACY);

void setup() {
  Serial.begin(115200);
  while (!Serial)
    ;

  BHY2.begin();
  gas.begin();
  bsec.begin();
}

void loop() {
  static auto printTime = millis();

  // Update function should be continuously polled
  BHY2.update();

  if (millis() - printTime >= 1000) {
    printTime = millis();
    Serial.println(String("gas: ") + String(gas.value(), 3));
    Serial.println(String("bseq: ") + String(bsec.toString()));
  }
}

```

Console output:

```cpp
14:54:58.375 -> gas: 10121.000
14:54:58.375 -> bseq: 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
14:54:58.407 -> 
14:54:59.398 -> gas: 10273.000
14:54:59.398 -> bseq: 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
14:54:59.398 -> 

```

---

<div class="post-metadata">

**Author:** ![emnullfuenf](https://avatars.discourse-cdn.com/v4/letter/e/73ab20/32.png) [@emnullfuenf](https://forum.arduino.cc/u/emnullfuenf)\
**Post date:** [April 2, 2023, 8:49am UTC](https://forum.arduino.cc/t/still-nicla-sense-me-bseq-data-problems/1086863/2 "2023-04-02T08:49:51Z")

</div>

I finally got it working. There were some details missing in the [previous suggestions](https://forum.arduino.cc/t/nicla-sense-me-getting-air-quality-values/929865https://forum.arduino.cc/t/nicla-sense-me-getting-air-quality-values/929865).

**Solution:**

1. Open the file /libraries/Arduino\_BHY2/src/sensors/SensorTypes.h in a text editor.
2. Change **both** following values to 30  
`#define SENSOR_DATA_FIXED_LENGTH (30)`  
`#define SENSOR_LONG_DATA_FIXED_LENGTH (30)`
3. Initialize the BSEC sensor in your Arduino code via the legacy ID  
`SensorBSEC bsec(SENSOR_ID_BSEC_LEGACY);`

**Code:**

```cpp
#include "Arduino.h"
#include "Arduino_BHY2.h"

Sensor gas(SENSOR_ID_GAS);
SensorBSEC bsec(SENSOR_ID_BSEC_LEGACY);

void setup() {
  Serial.begin(115200);
  while (!Serial)
    ;

  BHY2.begin();
  gas.begin();
  bsec.begin();
}

void loop() {
  static auto printTime = millis();

  // Update function should be continuously polled
  BHY2.update();

  if (millis() - printTime >= 1000) {
    printTime = millis();
    Serial.println(String("gas: ") + String(gas.value(), 3));
    Serial.println(String("bseq: ") + String(bsec.toString()));
  }
}

```

**Output:**

```cpp
21:55:54.075 -> gas: 11170.000
21:55:54.075 -> bseq: BSEC output values - iaq: 64 iaq_s: 42 b_voc_eq: 0.65 co2_eq: 568 accuracy: 1 comp_t: 27.25 comp_h: 29.08 comp_g: 4

```
