Bosch Sensortec Community

    Showing results for 
    Search instead for 
    Did you mean: 

    Nicla Sense Me BHY2

    Nicla Sense Me BHY2

    New Poster


    I am currently trying to utilize various sensors on the nicla board using it in 'standalone' mode. Since the BHY2 library only provides class implementations for a few sensors, I've written analogous implementations. For that I've used the go-webserver provided in "Unisense-Fw-0.4" as reference on how to read out the sensors. However, I am unsure whether or not I am reading out the data correctly. Could you confirm that implementation for reading the sensor data in the provided code inside "parser.go" works identical to the readout when using the methods inside "Arduino_BHY2\src\sensors\SensorTypes.h"?

    Furthermore, I have another question regarding  the data of the gas sensor specifically. The datasheet of the BME688 mentions the IAQ score and that raw data  is influenced by other parameters. Hence I'd like to know what kind of data I can expect of the method described above.

    I've included a file to further illustrate my approach. I am looking forward to your answers.


    Best regards,


    5 REPLIES 5

    Community Moderator
    Community Moderator

    Hello phagosome,

    Some information needs your confirmation:

    1.Hardware board:Nicla Sense ME

    2.Which sensor types you wanted to read data? You could list them.

    3.Did you refer arduino example code from here?

    I am trying to read out humidity, pressure and gas sensor data.

    I am refering to examples found here and to code we received via mail as part of the "Bosch Sensortec IoT Innovation Challenge". I hope that cleared things up. I appreciate your help!

    Hi Phagosome,

    Sorry for the late reply, I hope you already have found the solution to reading new sensor data. But I will also the solution here. The key is that we need to add the new sensor we want as a new class to our code.

    For example, we want to enable the humidity sensor and print out the humidity values using the Standalone.ino example under Arduino/libraries/ARDUINO_BHY2/examples directory.

    Step1: In Standalone.ino, declare the humidity object, enable the humidity sensor, and print out the humidity value. SENSOR_ID_HUM is the sensor ID of the humidity sensor. You may find the compelete listing of all the avaliable sensors that can be enabled in Arduino/libraries/ARDUINO_BHY2/src/sensors/SensorID.h


    Step2: Now create the humidity sensor class. Add header file SensorHumidity.h under Arduino/libraries/ARDUINO_BHY2/src/sensors directory. May well refer to the SensorTemperature.h header file as reference. Be careful the scaling factor for humidity is different from temperature data.


    Step3: Include the SensorHumidity.h header file to Arduino/libraries/ARDUINO_BHY2/Arduino_BHY2.h.


    Step4: Add the humidity parse function in Arduino/libraries/ARDUINO_BHY2/src/sensors/DataParser.cpp. For differrent sensors with strutures the parsing can be different, but for humidity sensor parsing, there requires only read out a 16bit signed integer multiplying the scale factor, which is the value of 1. Also declare the function in the header file Arduino/libraries/ARDUINO_BHY2/src/sensors/DataParser.h.



    Step5: Upload the Standalone.ino project to Nicla board, open the tools->Serial Monitor to view our log. Gentle breath into the Nicla board, we should see a rise in the humidity output value.






    Your second question regarding IAQ and raw environment data can be influenced by other factors. Mainly that in BME sensor, the temperature infomation is used to compensate other parameters. This compensation has already done in the BHI260 sensor, so host side does not need to worry about compensating.