Important Cookie Information

This website uses absolutely necessary cookies. If you consent to the use of convenience cookies, please click “Yes, I agree.” By clicking on “Privacy Settings.” you can change this setting at any time and withdraw your given consent. Icon down see more You can find detailled information in our Privacy Policy Icon forward-right
Icon up see less

Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    Hub1 design guide

    100% helpful (1/1)

    Introduction

    This document is meant as a reference guide on how to design using Bosch Sensortec’s BHy1. BHy1 family includes two parts, one is BHA250 series, the other is BHI160 series.

    Selecting the right part


    The BHA250 contains part number: BHA250 and BHA250B. The BHA250/BHA250B is sensor hub which integrated Accelerometer. Figure1 shows the BHA250 laser marking.

    11.png

                                                                                                 Fig1

    The BHI160 contains part number: BHI160and BHI160B. The BHI160/ BHI160B is sensor hub which integrated IMU(ACC+Gyro). Figure2 shows the laser marking.

    12.png

                                                                                                     Fig2

    Common Characteristics

    Key features

    • 1xI2C(3.4MHz) Host Interface; 1xI2C(1MHz) Aux Interface; up to 3 GPIOs
    • 32-bit Floating-point; 96 KB ROM; 48 KB RAM
    • Max ODR is 400Hz

     Difference between products

    13.png                                                Table 1: Difference on BHA250 and BHI160

    14.png                                          Table 2: Accelerometer Parameter on BHA250 and BHI160

    15.png                                                       Table 3: BHI160 Gyroscope Parameter

     Available evaluation tools and software

    To best to evaluate the products from the BHy1 family is the following combination of evaluation tools:

    Reference design

    See Figure 3 for BHA250 schematic of a typical use-case.

    16.png

                                                                         Figure3  BHA250/BHA250B typical schematic

    Bill of materials:

    17.png

    Note: R3 and R4 are mandatory, even if no external sensor is attached.

    Layout recommendations

    Landing Pattern18.png

                                             Figure5: BHA250/BHA250B Landing Pattern19.png

                                                          Figure6: BHI160/BHI160B Landing Pattern

     Typical Layout

    20.png

                                                          Figure7: BHA250/BHA250B Layout

    21.png

                                                               Figure8: BHI160/BHI160B Layout

    Manufacturing notes

    22.png

    BHy1 on COINES

    COINES setup

    25.png

     

     

     

    Platform: Windows
    gcc: "C:\DiaSemi\SmartSnippetsStudio\Tools\mingw64_targeting32\bin\gcc.exe C:\TDM-GCC-64\bin\gcc.exe".
    [ MKDIR ] build
    [ CC ] bhy_activity_recognition.c
    [ CC ] ../../../../sensorAPI/bhy/src/BHy_support.c
    [ CC ] ../../../../sensorAPI/bhy/src/bhy_uc_driver.c
    [ CC ] ../../../../sensorAPI/bhy/src/bhy.c
    [ CC ] ../../../../sensorAPI/bhy/AppBoard_usb_driver/AppBoard_usb_driver.c
    [ MAKE ] coinesAPI
    [ MKDIR ] build
    [ CC ] coines.c
    [ CC ] comm_intf/comm_intf.c
    [ CC ] comm_intf/comm_ringbuffer.c
    [ CC ] comm_driver/usb.c
    [ CC ] comm_driver/legacy_usb/legacy_usb_support.c
    [ AR ] libcoines
    [ LD ] bhy_activity_recognition.exe
    Operation finished successfully
    

    Running on BHy1 shuttle board

    Connect with APP2.0 board (BHy1 Shuttle board) and compile the sample code (..\..\examples\c\bhy\rotation_vector),

    Click  to run and get the output on the console.

    Running example 'bhy_rotation_vector.exe' ...
    
    uploading RAM patch...
    
    W: 1.000 X: 0.000 Y: 0.000 Z: 0.000 
    
    W: 1.000 X:-0.000 Y: 0.000 Z: 0.000 
    
    W: 1.000 X:-0.000 Y: 0.000 Z: 0.000 
    
    W: 0.999 X: 0.005 Y: 0.018 Z: 0.000 
    
    W: 0.999 X: 0.005 Y: 0.018 Z: 0.000 
    
    W: 0.999 X: 0.005 Y: 0.018 Z: 0.000 
    
    W: 0.999 X: 0.005 Y: 0.018 Z: 0.000 
    

    BHy1 example code on COINES

    Activity recognition example

    Data parsing for activity recognition is available in COINES. The user can open the “bhy_activity_recognition.c” in COINES, compile and run. The output will be shown in the COINES console.

    The code is shown as below.

    /* @brief This API is used for parsing the activity recognition data from BHY
    *
    * @param[in] sensor_data: bhy data
    * @param[in] sensor_id: bhy id
    *
    * @return void
    *
    */
    void sensors_callback(bhy_data_generic_t * sensor_data, bhy_virtual_sensor_t sensor_id)
    {
    float temp;
    u8 index;
    /* Since a timestamp is always sent before every new data, and that the callbacks */
    /* are called while the parsing is done, then the system timestamp is always equal */
    /* to the sample timestamp. (in callback mode only) */
    temp = g_system_timestamp / 3200000.;
    
    for (index = 6; index <= 8; index++)
    {
    outBuffer[index] = floorf(temp) + '0';
    temp = (temp - floorf(temp)) * 10;
    }
    
    for (index = 10; index <= 12; index++)
    {
    outBuffer[index] = floorf(temp) + '0';
    temp = (temp - floorf(temp)) * 10;
    }
    /* if there are no changes then it will read X */
    outBuffer[22] = 'X';
    outBuffer[35] = 'X';
    outBuffer[48] = 'X';
    outBuffer[61] = 'X';
    outBuffer[74] = 'X';
    outBuffer[87] = 'X';
    
    /* '0' means "end of activity and '1' means start of activity */
    if (sensor_data->data_scalar_u16.data & 0b0000000000000001)
    outBuffer[22] = '0';
    if (sensor_data->data_scalar_u16.data & 0b0000000000000010)
    outBuffer[35] = '0';
    if (sensor_data->data_scalar_u16.data & 0b0000000000000100)
    outBuffer[48] = '0';
    if (sensor_data->data_scalar_u16.data & 0b0000000000001000)
    outBuffer[61] = '0';
    if (sensor_data->data_scalar_u16.data & 0b0000000000010000)
    outBuffer[74] = '0';
    if (sensor_data->data_scalar_u16.data & 0b0000000000100000)
    outBuffer[87] = '0';
    if (sensor_data->data_scalar_u16.data & 0b0000000100000000)
    outBuffer[22] = '1';
    if (sensor_data->data_scalar_u16.data & 0b0000001000000000)
    outBuffer[35] = '1';
    if (sensor_data->data_scalar_u16.data & 0b0000010000000000)
    outBuffer[48] = '1';
    if (sensor_data->data_scalar_u16.data & 0b0000100000000000)
    outBuffer[61] = '1';
    if (sensor_data->data_scalar_u16.data & 0b0001000000000000)
    outBuffer[74] = '1';
    if (sensor_data->data_scalar_u16.data & 0b0010000000000000)
    outBuffer[87] = '1';
    
    fprintf(stderr, "%s", outBuffer);
    /* activity recognition is not time critical, so let's wait a little bit */
    mdelay(200);
    }

     Gesture recognition example

    Data parsing for gesture recognition is available in COINES. The user can open the “bhy_gesture_recognition.c” in COINES, compile and run. The output will be shown in COINES console.

    In the example code, three gestures are enabled, which are “Glance, Pickup and Significant Motion”. The code is shown as below.

    /* @brief This API is used for parsing the activity recognition data from BHY
    *
    * @param[in] sensor_data: bhy data
    * @param[in] sensor_id: bhy id
    *
    * @return void
    *
    */
    void sensors_callback(bhy_data_generic_t * sensor_data, bhy_virtual_sensor_t sensor_id)
    {
    float temp;
    u8 index;
    /* Since a timestamp is always sent before every new data, and that the callbacks */
    /* are called while the parsing is done, then the system timestamp is always equal */
    /* to the sample timestamp. (in callback mode only) */
    temp = g_system_timestamp / 3200000.;
    
    for (index = 6; index <= 8; index++)
    {
    outBuffer[index] = floorf(temp) + '0';
    temp = (temp - floorf(temp)) * 10;
    }
    
    for (index = 10; index <= 12; index++)
    {
    outBuffer[index] = floorf(temp) + '0';
    temp = (temp - floorf(temp)) * 10;
    }
    
    sensor_id &= 0x1F;
    /* gesture recognition sensors are always one-shot, so you need to */
    /* re-enable them every time if you want to catch every event */
    bhy_enable_virtual_sensor(sensor_id, VS_WAKEUP, 1, 0, VS_FLUSH_NONE, 0, 0);
    
    switch (sensor_id)
    {
    case VS_TYPE_GLANCE:
    strcpy(&outBuffer[24], "Glance \r\n");
    break;
    case VS_TYPE_PICKUP:
    strcpy(&outBuffer[24], "Pickup \r\n");
    break;
    case VS_TYPE_SIGNIFICANT_MOTION:
    strcpy(&outBuffer[24], "Sig motion\r\n");
    break;
    default:
    strcpy(&outBuffer[24], "Unknown \r\n");
    break;
    }
    
    fprintf(stderr, "%s", outBuffer);
    fflush(stderr);
    }

    Gravity vector example

    Data parsing for gravity vector is available in COINES. The user can open the “bhy_gravity_vector.c” in COINES, compile and run. The output will be shown in COINES console.

    The code is shown as below.

    /* @brief This API is used for parsing the activity recognition data from BHY
    *
    * @param[in] sensor_data: bhy data
    * @param[in] sensor_id: bhy id
    *
    * @return void
    *
    */
    void sensors_callback(bhy_data_generic_t * sensor_data, bhy_virtual_sensor_t sensor_id)
    {
    float temp;
    u8 index;
    
    temp = sensor_data->data_vector.x / 8192.;
    outBuffer[3] = temp < 0 ? '-' : ' ';
    temp = temp < 0 ? -temp : temp;
    outBuffer[4] = floorf(temp) + '0';
    
    for (index = 6; index <= 8; index++)
    {
    temp = (temp - floorf(temp)) * 10;
    outBuffer[index] = floorf(temp) + '0';
    }
    
    temp = sensor_data->data_vector.y / 8192.;
    outBuffer[13] = temp < 0 ? '-' : ' ';
    temp = temp < 0 ? -temp : temp;
    outBuffer[14] = floorf(temp) + '0';
    
    for (index = 16; index <= 18; index++)
    {
    temp = (temp - floorf(temp)) * 10;
    outBuffer[index] = floorf(temp) + '0';
    }
    
    temp = sensor_data->data_vector.z / 8192.;
    outBuffer[23] = temp < 0 ? '-' : ' ';
    temp = temp < 0 ? -temp : temp;
    outBuffer[24] = floorf(temp) + '0';
    
    for (index = 26; index <= 28; index++)
    {
    temp = (temp - floorf(temp)) * 10;
    outBuffer[index] = floorf(temp) + '0';
    }
    
    fprintf(stderr, "%s", outBuffer);
    fflush(stderr);
    }

    Rotation vector example

    Data parsing for Rotation Vector is available in COINES. The user can open the “bhy_rotation_vector.c” in COINES, compile and run. The output will be shown in COINES console.

    The code is shown as below.

    /* @brief This API is used for parsing the activity recognition data from BHY
    *
    * @param[in] sensor_data: bhy data
    * @param[in] sensor_id: bhy id
    *
    * @return void
    *
    */
    void sensors_callback(bhy_data_generic_t * sensor_data, bhy_virtual_sensor_t sensor_id)
    {
    float temp;
    u8 index;
    
    temp = sensor_data->data_quaternion.w / 16384.;
    outBuffer[3] = temp < 0 ? '-' : ' ';
    temp = temp < 0 ? -temp : temp;
    outBuffer[4] = floorf(temp) + '0';
    
    for (index = 6; index <= 8; index++)
    {
    temp = (temp - floorf(temp)) * 10;
    outBuffer[index] = floorf(temp) + '0';
    }
    
    temp = sensor_data->data_quaternion.x / 16384.;
    outBuffer[13] = temp < 0 ? '-' : ' ';
    temp = temp < 0 ? -temp : temp;
    outBuffer[14] = floorf(temp) + '0';
    
    for (index = 16; index <= 18; index++)
    {
    temp = (temp - floorf(temp)) * 10;
    outBuffer[index] = floorf(temp) + '0';
    }
    
    temp = sensor_data->data_quaternion.y / 16384.;
    outBuffer[23] = temp < 0 ? '-' : ' ';
    temp = temp < 0 ? -temp : temp;
    outBuffer[24] = floorf(temp) + '0';
    
    for (index = 26; index <= 28; index++)
    {
    temp = (temp - floorf(temp)) * 10;
    outBuffer[index] = floorf(temp) + '0';
    }
    
    temp = sensor_data->data_quaternion.z / 16384.;
    outBuffer[33] = temp < 0 ? '-' : ' ';
    temp = temp < 0 ? -temp : temp;
    outBuffer[34] = floorf(temp) + '0';
    
    for (index = 36; index <= 38; index++)
    {
    temp = (temp - floorf(temp)) * 10;
    outBuffer[index] = floorf(temp) + '0';
    }
    
    fprintf(stderr, "%s", outBuffer);
    fflush(stderr);
    
    }

     Create customer example

    Customer can create their own case based on the sensor they used in the folder “examples”, for example, BHI160 Shuttle board, we can create a new folder “acc_gyro data output”

    1.png

    Create the file and copy “Makefile” from other bhy example(like gravity_vector)

    2.png

    Modify the Makefile                                          

    #CCE_Board_Definitions:BHI160;BHI160B;BHA250;BHA250B
    
    COINES_INSTALL_PATH ?= ../../../..
    
    EXAMPLE_FILE ?= acc_gyro data output.c
    
    SHUTTLE_BOARD ?= BHI160
    
    CFLAGS += -DBST_APPBOARD_VIA_USB -D$(SHUTTLE_BOARD) 
    
    include $(COINES_INSTALL_PATH)/examples/c/examples.mk
    

    Now, you can make, compile and run your own code via COINES.

    Further reads

                                    

    Version history
    Revision #:
    9 of 9
    Last update:
    ‎07-31-2019 01:30 PM
    Updated by:
    Community Moderator
     
    Contributors
    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