Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 
    SOLVED

    Nicla Sense Me BHY2

    phagosome
    New Poster

    Nicla Sense Me BHY2

    Hello,

    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,

    Sean

    5 REPLIES 5
    BSTRobin
    Community Moderator

    Re: Nicla Sense Me BHY2

    Hello phagosome,

    Some information needs your confirmation:

    1.Hardware board:Nicla Sense ME
    https://docs.arduino.cc/hardware/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? https://www.arduino.cc/en/Tutorial/BuiltInExamples

    phagosome
    New Poster

    Re: Nicla Sense Me BHY2

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

    I am refering to examples found here https://docs.arduino.cc/tutorials/nicla-sense-me/cheat-sheet 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!

    Chrisbao
    Member

    Re: Nicla Sense Me BHY2

    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

    Chrisbao_0-1630482125486.png

    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.

    Chrisbao_1-1630482474826.png

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

    Chrisbao_2-1630482847783.png

    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.

    Chrisbao_3-1630483138690.png

    Chrisbao_5-1630483223720.png

    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.

     

    Chrisbao_7-1630483481656.png

     

     

     

    Chrisbao
    Member

    Re: Nicla Sense Me BHY2

    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.

    Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist