Bosch Sensortec Community

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

    BHI260AP sensor with BMP390 to get pressure and temperature sensor data and convert to altimeter

    BHI260AP sensor with BMP390 to get pressure and temperature sensor data and convert to altimeter

    AN22
    Member

    Hi, 

    I am working on BHI260AP bosch shuttle board 3.0 which have on baord BMP390 barometer. 

    I have update the firmware (firmware/BHI260AP/Bosch_Shuttle3_BHI260_aux_BMM150_BMP390_BME688.fw.h) of BHI260AP to get pressure sensor and temperature data.

    I am using below API to parse the sensor data, 

     

     

    void bhy2_parse_temperature_celsius(const uint8_t *data, bhy2_float *temperature)
    {
        /* 1 LSB = 1/100 degC */
        float scale_factor = (float)1 / 100;
    
        *temperature = (float)BHY2_LE2S16(data) * scale_factor;
    }
    
    void bhy2_parse_humidity(const uint8_t *data, bhy2_float *humidity)
    {
        float scale_factor = (float)1;
    
        *humidity = data[0] * scale_factor;
    }
    
    void bhy2_parse_pressure(const uint8_t *data, bhy2_float *pressure)
    {
        /* 1 LSB = 1/128 Pa */
        float scale_factor = (float)1 / 128;
    
        *pressure = (float)BHY2_LE2U24(data) * scale_factor;
    }

     

     

    I am facing issue in clarification in conversion of sensor data,  this api i found from bhy2_parse.c file. here
    1) Currently i am getting "1005.523438" using above API but not sure about the unit, is it Pa or hPa ?
    2) From BHI260AP data sheet for BHY2_SENSOR_ID_TEMP_WU payload is 3 byte but i am getting 5 byte, is it correct or not? 
         How should i convert raw data into temperature if it is 5 byte?

    3) What parameter should i pass in below API to get the relative altitude? There is no virtual sensor id is available to get altitude. 

     

    void bhy2_parse_altitude(const uint8_t *data, bhy2_float *altitude)

     


    Anyone can please help me to resolve the query.?

    Regards.

     

    4 REPLIES 4

    BSTRobin
    Community Moderator
    Community Moderator

    Hi AN22,

    You can refer to the following function in https://github.com/boschsensortec/BHY2-Sensor-API/blob/master/examples/bhy2cli_ble/bhy2cli_callbacks... to parse temperature, humidity, pressure sensor data.

    bhy2_fifo_parse_callback_t bhy2_get_callback(uint8_t sensor_id)
    {
    ...
    case BHY2_SENSOR_ID_HUM:
    case BHY2_SENSOR_ID_HUM_WU:
    callback = parse_scalar_u8;
    break;
    case BHY2_SENSOR_ID_TEMP:
    case BHY2_SENSOR_ID_TEMP_WU:
    callback = parse_s16_as_float;
    break;
    case BHY2_SENSOR_ID_BARO:
    case BHY2_SENSOR_ID_BARO_WU:
    callback = parse_u24_as_float;
    break;
    ...
    }

    Hi, 

    Thank you providing information. 

    I have checked the git link that you have shared and find the parse API. but not getting Unit for specifi data like Pa or hPa and data size of paramter in return callback function. 

        scaling_factor = sensor_details->scaling_factor;
        parse_flag = sensor_details->parse_flag;
    
        data = BHY2_LE2U24(callback_info->data_ptr);
    
        time_to_s_ns(*callback_info->time_stamp, &s, &ns, &tns);
    
        if (parse_flag & PARSE_FLAG_STREAM)
        {
            DATA("SID: %u; T: %lu.%09lu; %f\r\n", callback_info->sensor_id, s, ns, (float)data * scaling_factor);
        }
        else
        {
            if (parse_flag & PARSE_FLAG_HEXSTREAM)
            {
                stream_hex_data(callback_info->sensor_id, s, ns, callback_info->data_size - 1, callback_info->data_ptr);
            }
        }



    Can you please provided input in below query? it would be helpful.  
    BHI260AP shuttle 3.0 output raw data is not matching as per datasheet.

    1) Currently i am getting "1005.523438 to 1011" using above API but not sure about the unit, is it Pa or hPa ? 
    2) From BHI260AP data sheet for BHY2_SENSOR_ID_TEMP_WU payload is 3 byte but i am getting 5 byte, is it correct or not? 
         How should i convert raw data into temperature if it is 5 byte?

    3) What parameter should i pass in below API to get the relative altitude? There is no virtual sensor id is available to get altitude. 

    void bhy2_parse_altitude(const uint8_t *data, bhy2_float *altitude)


     

    BSTRobin
    Community Moderator
    Community Moderator

    Hi AN22,

    Which BHI2 sensor API you used?

    And could you provide your source code for check? Or record FIFO data for check?

    BSTRobin
    Community Moderator
    Community Moderator

    Hi AN22,

    1.Please refer to the following replies for your questions.

    1) Currently i am getting "1005.523438" using above API but not sure about the unit, is it Pa or hPa ?

    --> It is hPa.

    2) From BHI260AP data sheet for BHY2_SENSOR_ID_TEMP_WU payload is 3 byte but i am getting 5 byte, is it correct or not? 
         How should i convert raw data into temperature if it is 5 byte?

    -->Payload of BHY2_SENSOR_ID_TEMP_WU is 5 bytes and only 3 bytes are used: 1byte sensor id and 2 bytes temperature data. (The value of temperature has updated to uint32_t in the latest release)

    3) What parameter should i pass in below API to get the relative altitude? There is no virtual sensor id is available to get altitude. 
    void bhy2_parse_altitude(const uint8_t *data, bhy2_float *altitude)
    --> This API cannot be used because no VirtAltitude is supported in current fw.

    2.We also upload example code which parse temperature, humidity, pressure, gas sensor data for your reference.

     

    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