Bosch Sensortec Community

    Showing results for 
    Search instead for 
    Did you mean: 
    Sort by:
    ‎07-19-2019 07:28 AM
    Sensor data type Double precision floating point version and Integer version are two states regarding compensation functions for temperature and pressure. The 24 bit pressure/temperature raw data is split and stored in three consecutive registers from 0x04 to 0x06 and 0x07 to 0x09 respectively. From API side, static double compensate_temperature and static int64_t compensate_temperature are used to compensate the raw temperature data and return the compensated temperature data in integer data type. Pressure sensor drift Used to represent errors in measured values. Basically, two drifts will appear on the sensor: one is solder drifts, and the other is long term drift.  Pressure sensor TCO (Offset temperature coefficient) The offset temperature coefficient is the change in the pressure signal introduced by a change of the temperature. The smaller for TCO value, the smaller the dependence on temperature. Two conditions need to be considered for offset temperature coefficient from pressure 700-1100hPa.  Pressure/temperature OSR (Oversampling) Oversampling is the process of sampling a signal at a sampling frequency significantly higher than the Nyquist rate. The rate of oversampling can be 1, 2, 4, 8, 16, and 32. Increasing the value of oversampling, then will get longer testing time, lower ODR, lower noise and larger power consumption. The default value for oversampling setting is 0x02 in register 0x1C for pressure and temperature measurement, bit 2..0 is for pressure measurement and bit 5..3 is for temperature measurement. In API, using int8_t set_forced_mode_with_osr and int8_t set_normal_mode to configure the oversampling values. The table below shows the recommended setting of oversampling.  Signal Filter for pressure/temperature This is a sliding filter which is aim to reduce the noise from the received signal. The filter coefficient can be set to 0 (bypass mode), 1, 3, 7, 15, 31, 63, and 127. In addition, it suppresses the disturbance in the output data without causing additional interface traffic and processor work load. The output of a next measurement step is filter using the following formula. The “CONFIG” Register 0x1F control the IIR filter coefficients view from bit 3...1. The default value for “CONFIG” is 0x00. Sensor time 3 bytes sensor time is split and stored in three consecutive registers which are 0x0C, 0x0D and 0x0E. Each register contain 8 bit sensor time data. Pressure accuracy This feature is used to represent how much accuracy can be achieved within the certain pressure range.  Two criteria as shown below  Data FIFO This is a 512 bytes FIFO (first-in-first-out) data buffer with feature used to enable data collecting in the FIFO. The register “FIFO_CONFIG_1” register contains the FIFO frame content configuration from bit 4…0.  The default value for “FIFO_CONFIG_1” is 0x02.  Configuring and reading FIFO data from API using the function int8_t configure_and_get_fifo_data. Data Interrupt Allow to signal certain events to the host processor. Different event can be mapped to the interrupt pin, which all are processed with a logical OR. The available interrupts are listed below and can be read in the “INT_STATUS” register” Bit 0, 1, and 3 are used to represent the interrupt status and is cleared after reading in register.  The function static int8_t get_int_status can be used to get the interrupt status from the sensor in API. Interrupt configuration can be set in the “INT_CTRL” register in 0x19. Bit 0, 1, 2, 3, 4 and 6 are used. The function static void fill_fifo_int_ctrl in API used to fill the FIFO interrupt control settings. More BMP388 sensor information can check from the following website .    
    View full article
    ‎06-19-2023 10:55 PM
    The last few years have seen a remarkable increase in the number of use cases involving barometric pressure sensors in consumer electronics devices such as smartphones, tablets, wearable devices, and various home appliances. Barometric pressure sensors have been used for ambient air pressure measurement for several decades, however, recent developments and improvements in both these sensors and the devices in which they are installed have paved the way to superior performance and lower costs. The barometric pressure sensor has found its place across a wide range of products, no longer limited to traditional "weather stations". Today’s barometric pressure sensors are so incredibly accurate that they can determine altitude to within just a few centimeters. This, coupled with low-cost manufacture, has made these sensors the mainstays for motion tracking, enabling what had previously been solely the realm of science fiction. This paper will describe the two primary types of technologies used for pressure sensors, capacitive and piezoresistive, and subsequently, focus on several applications and key requirements.
    View full article
    ‎08-14-2019 10:25 AM
     Selecting the right part The BMP series of pressure sensor contains 2 products: BMP280 and BMP388. Table 1 shows an overview of the features.                                                     Table 1: Overview of the products in this family Key features LGA with metal lid package SPI or I2C interface Built-in IIR filter.  Differences between products The main differences in the BMP product family are in the thickness of the package, and the overall performance of the MEMS element. BMP388 offers higher performance in a smaller package compared to BMP280. See the complete list of differences in Table 2.                                                                                             Table 2: Differences between BMP product family members Available evaluation tools and software To best to evaluate the products from the BMP family, we recommend the following combination of evaluation tools: COINES Desktop software (Windows version &Linux version & MacOS) Development Desktop Software Application board 2.0 BMP280 shuttle board BMP388 shuttle board Reference design Figure 1 shows a complete schematic of a typical use case.                                                                                           BMP280                                                                                        BMP388                                                        Figure 1: Exemplary Reference design   Bill of materials                                             Table 3: Bill of materials Layout recommendations Because the BMP sensor family contains tiny mechanical structure inside the package, care must be taken during the layout phase to ensure the best performance. The complete handling and soldering guide can be found on the Bosch Sensortec’s website. BMP28x Handling, soldering & mounting instructions BMP380 Handling,soldering & mounting instructions In addition to the attached guidelines, see below for the typical manufacturing procedure for the BMP388 pressure sensor. Landing Pattern                                                                                          BMP280                                                                                      BMP388                                                          Figure 2: Recommended landing pattern Typical Layout                                                                                                   BMP280                                                                                           BMP388                                                                          Figure 3: Typical layout Manufacturing notes                                                               Table 4: Manufacture recommendation First power-on After powering on the sensor for the first time, the initial specs would be tested for communication with the device. This can be done simply by reading the chip identification code in the register 0xD0 (BMP280) 0x00 (BMP388). See below for the expected values:                                                          Table 5: Chip IDs of the BMP product family Here is some sample code on how to perform this test, based on the BMP388 , using the COINES software as the host. /*! * @brief This internal API is used to check the bmp388 sensor chip ID * * @param[in] void * * @return void * */ static void init_bmp3(void) { int8_t rslt; rslt = bmp3_init(&bmp3Dev); if (rslt == BMP3_OK) { printf("BMP3 Initialization Success!\n"); printf("Chip ID 0x%X\n", bmp3Dev.chip_id); } else { printf("Chip Initialization failure !\n"); exit(COINES_E_FAILURE); } } How to read sensor data  Here is some sample code on how to read sensor data, based on the BMP388, using the COINES software as the host /*! * @brief This internal API is used to read the streaming data in a while loop and * print in console. * * @param[in] void * * @return void */ static void read_sensor_data(void) { int times_to_read = 0; while (times_to_read < 200) { bmp3_get_sensor_data(BMP3_ALL, &bmp3_comp_data, &bmp3Dev); printf("T: %.2f, P: %.2f \n", (bmp3_comp_data.temperature / 100.), (bmp3_comp_data.pressure / 100.)); fflush(stdout); coines_delay_msec(10); times_to_read = times_to_read + 1; } }  Sample code The complete sample code shown above can be compiled and executed from the COINES installation directory (by default, C:/COINES under Windows), from the following subfolder: \examples\c\bmp3 Usage The COINES installation provides sample code on how to turn on the sensor, configure it and read out the pressure data. COINES\v1.0\examples\c\bmp3 Sample code /*! * @brief Main Function where the execution getting started to test the code. * * @param[in] argc * @param[in] argv * * @return status * */ int main(int argc, char *argv[]) { int16_t rslt; struct coines_board_info board_info; init_bmp3_sensor_driver_interface(); rslt = coines_open_comm_intf(COINES_COMM_INTF_USB); if (rslt < 0) { printf("\n Unable to connect with Application Board ! \n" " 1. Check if the board is connected and powered on. \n" " 2. Check if Application Board USB driver is installed. \n" " 3. Check if board is in use by another application. (Insufficient permissions to access USB) \n"); exit(rslt); } rslt = coines_get_board_info(&board_info); if (rslt == COINES_SUCCESS) { if (board_info.shuttle_id != BMP3_SHUTTLE_ID) { printf("! Warning invalid sensor shuttle. This application will not support this sensor \r\n" "1.Check the sensor shuttle \r\n" "2.Reset the board \r\n"); exit(COINES_E_FAILURE); } } init_sensor_interface(); /* after sensor init introduce 200 msec sleep */ coines_delay_msec(200); init_bmp3(); read_sensor_data(); coines_close_comm_intf(COINES_COMM_INTF_USB); return EXIT_SUCCESS; Further reads Datasheets: BMP280 Datasheet BMP388 Datasheet Application notes: BMP388 self-test Handling, soldering and mounting instructions BMP280 HSMI BMP388 HSMI
    View full article
    ‎04-27-2022 09:44 AM
    Selecting the right part BMA456 is 16bit, digital, triaxial acceleration sensor with intelligent on-chip motion triggered interrupt features optimized for wearable and hearable applications. BMA456 support different advanced features via different configure file. Table 1 shows an overview of the features. Parameter BMA456 Digital resolution 16bit Range and sensitivity +/-2g: 16384LSB/g +/-4g: 8192LSB/g +/-8g: 4096LSB/g +/-4g: 2048LSB/g Zero-g offset(typ.) +/-20mg Noise density(typ.) 120µg/√Hz Bandwidths 5Hz …684Hz Interfaces SPI & I2C, 2 x digital interrupt pins Supply voltage VDD: 1.62 to 3.6V VDDIO: 1.2 to 3.6V LGA package(mm3) 2.0 x 2.0 x 0.65 Feature/Interrupts Step Counter/Step detector (optimized for wearables) Activity recognition: running, walking, still Tilt on wrist Tab/Double Tab Any-motion/No-motion High-g/ low-g Table 1: Overview BMA456 features Common characteristics The main characteristics of this product family are: Key features: 2.0 x 2.0 mm² size Pin to pin compatibility with all other 2.0 x 2.0 accelerometers from Bosch Sensortec SPI or I²C interface Configurable range from ±2G to ±16g Configurable output data rate up to 1.6kHz Integrated 1kB FIFO Auxiliary I²C interface for connecting external magnetometer, including data synchronization Built-in smart interrupt controller, with features such as step-counter which offers high performance for all wearing positions, including wrist-worn. BMA456 parameters BMA456 offers higher performance and stability in a smaller package. See the complete description in Table 2. Parameter BMA456 Units Height 0,65 mm Digital resolution 16 bits Zero-g offset (typ.) ±20 mg Noise density (typ.) 120 µg/√Hz TCO (X&Y axis) 0.2 mg/K TCO (Z axis) 0.35 mg/K TCS 0.005 %/K Cross Axis Sensitivity 0.5 % Table 2: BMA456 parameter value Available evaluation tools and software To best to evaluate the products from the BMA456 family, we recommend the following combination of evaluation tools: COINES Desktop software Application board 3.0 Sensor Shuttle board BMA456 Shuttle board. Layout recommendations Because the BMA4xy sensor family contains tiny mechanical structure inside the package, care must be taken during the layout phase to ensure the best performance. The complete handling and soldering guide can be found on the Bosch Sensortec's website. First power-on After powering the sensor for the first time, the initial specs would be to test for communication with the device. This can be done simply by reading the chip identification code in the register 0x00. See below for the expected values: Device Chip ID BMA456 0x16 Table 3: Chip IDs of the BMA4xy product family Here is some sample code on how to perform this test, based on BMA456, using the COINES software as the host. /*!  * @brief This internal API is used to initializes the bma456 and verify the  *communication by reading the chip id.  *  * @param[in] void  * @return void  *  */ static void init_comm_test_bma456(void) {     int8_t rslt;                    struct bma4_dev bma456dev = { 0 };       rslt = bma4_interface_init(&bma456dev, BMA4_I2C_INTF, BMA45X_VARIANT);     rslt = bma456_init(&bma456devbma425dev);     if (rslt == BMA4_OK)     {         printf("BMA456 Initialization Success!\n");         printf("Test #1: Communication. PASSED. Chip ID 0x%x\n", bma456dev.chip_id);     }       else     {         char err_string[255];         printf("BMA456 Initialization Failure!\n");                                        if (BMA4_E_INVALID_SENSOR == rslt)         {              sprintf(err_string, "Test #1: Communication. FAILED. Expected Chip ID: 0x%x. Received 0x%x\n",\                             BMA456_CHIP_ID, bma456dev.chip_id);         }         else         {              sprintf(err_string, "Test #1: Communication. FAILED. No response from the sensor.");         }                                        coines_exit_error(err_string);     }     coines_delay_msec(100); } How to test the sensor's functionality The BMA4xy series of accelerometers feature a fully integrated and motionless self-test procedure on the ASIC itself. When the self-test is triggered, the accelerometer uses electric fields to physically move the electrodes in all directions, senses the deflection and compares it with the expected output. Therefore, the built-in self-test features is the recommended way to test the sensor's functionality. Here is some sample code on how to perform this self-test, based on BMA456, using the COINES software as the host. /*!  * @brief This internal API is used to test if the sensor is working by triggering the self-test.  *  * @param[in] void  * @return void  *  */ static void function_test_bma456(void) {     uint16_t rslt;     uint8_t testrslt;       rslt = bma4_perform_accel_selftest(&testrslt, &bma456dev);                    if ( 0 != rslt ) coines_exit_error("Test #2: Functionnality. FAILED. Unknown communication error\n");                if ( BMA4_SELFTEST_PASS == testrslt ) {         printf("Test #2: Functionnality. PASSED. Sensor self-test successful\n");     } else {         printf("Test #2: Functionnality. FAILED. Sensor self-test failed\n");     }                } How to test the sensor's performance There are 2 performance parameters that can easily be tested with the device motionless: offset and noise. See below for the typical values of the sensors. Note: Typical values are defined as ±1σ, which means that we expect 68.3% of sensors to fall within these values. Min/Max values are defined as ±3σ, which means 99.7% of sensors shall be within these values. Parameter BMA456 units Offset ±20 mg Noise 120 µg/√Hz Table 4: Typical performance of BMA456 For the offset, the test procedure is quite simple. With the device in a known position, such as a flat surface, calculate the average value for each axis, and substract the expected output (e.g. 0G, 0G, +1G) from the data. The result is the offset of the sensor. Here is some sample code on how to perform this test, based on BMA456, using the COINES software as the host. /*! Average value calculation */ double x_avg_mg=0; double y_avg_mg=0; double z_avg_mg=0; for (int i=0; i<1000; ++i) {     double xval, yval, zval;     /* ( 'datapoint' * '4G' * '2' * '1000mg') / ('scaling factor for 16 bits') */     xval = (((double)sens_data[i].x) * 4. * 2. * 1000) / pow(2,16);     yval = (((double)sens_data[i].y) * 4. * 2. * 1000) / pow(2,16);     zval = (((double)sens_data[i].z) * 4. * 2. * 1000) / pow(2,16);                                    x_avg_mg += xval / 1000.;     y_avg_mg += yval / 1000.;     z_avg_mg += zval / 1000.; }                /*! Offset Calculation */ double x_off_mg=x_avg_mg - X_REST_POSITION_MG; double y_off_mg=y_avg_mg - Y_REST_POSITION_MG; double z_off_mg=z_avg_mg - Z_REST_POSITION_MG;                if( OFFSET_THRESHOLD_MG > x_off_mg && OFFSET_THRESHOLD_MG > y_off_mg && \                                OFFSET_THRESHOLD_MG > z_off_mg ) {     printf("Test #3: Performance. Offset. PASSED: X=%4.1lfmg Y=%4.1lfmg Z=%4.1lfmg Threshold <\        %4.1lf\n",       x_off_mg, y_off_mg, z_off_mg, OFFSET_THRESHOLD_MG); } else {     printf("Test #3: Performance. Offset. FAILED: X=%4.1lfmg Y=%4.1lfmg Z=%4.1lfmg Threshold <\ %4.1lf\n", x_off_mg, y_off_mg, z_off_mg, OFFSET_THRESHOLD_MG); } The noise calculation is a bit more complicated. First, subtract the offset from each datapoint. The RMS value can be calculated as the square root of the arithmetic mean of the squares of the noise values.  x_rms = sqrt[1/n( x_1^2 + x_2^2 + .... + x_n^2)] Since the noise value is affected by the bandwidth of the digital filter, we need to convert it back to noise density with the following formula. Note: this applied only to a second order filter noise_density = noise_RMS/[sqrt(1.22 x bandwidth)] Here is some sample code on how to perform this test, based on BMA456, using the COINES software as the host. /*! RMS Noise Calculation */ double x_rms_noise_mg=0; double y_rms_noise_mg=0; double z_rms_noise_mg=0; for (int i=0; i<1000; ++i) {     double xval, yval, zval;     /* ( 'datapoint' * '4G' * '2' * '1000mg') / ('scaling factor for 12 bits') */     xval = (((double)sens_data[i].x) * 4. * 2. * 1000.) / pow(2,16);     yval = (((double)sens_data[i].y) * 4. * 2. * 1000.) / pow(2,16);     zval = (((double)sens_data[i].z) * 4. * 2. * 1000.) / pow(2,16);                                    x_rms_noise_mg += pow(xval - x_avg_mg,2) / 1000.;     y_rms_noise_mg += pow(yval - y_avg_mg,2) / 1000.;     z_rms_noise_mg += pow(zval - z_avg_mg,2) / 1000.; }                /* rms noise is the square root of the arithmetic mean of the squares of the noise values */ x_rms_noise_mg = sqrt(x_rms_noise_mg); y_rms_noise_mg = sqrt(y_rms_noise_mg); z_rms_noise_mg = sqrt(z_rms_noise_mg);                /*! RMS Noise to RMS noise density convertion */ /* noise density = RMS noise  / sqrt ( 1.22 * bandwidth) */ /* BMA456 has 40.5Hz bandwidth at 100Hz normal mode */   double x_noise_dens_ug = 1000 * x_rms_noise_mg / sqrt(1.22 * 40.5); double y_noise_dens_ug = 1000 * y_rms_noise_mg / sqrt(1.22 * 40.5); double z_noise_dens_ug = 1000 * z_rms_noise_mg / sqrt(1.22 * 40.5);   if( NOISE_THRESHOLD_MG > x_noise_dens_ug &&                                NOISE_THRESHOLD_MG > y_noise_dens_ug &&                                NOISE_THRESHOLD_MG > z_noise_dens_ug ) {     printf("Test #3: Performance. Noise. PASSED: X=%4.1lfug/sqrt(Hz) Y=%4.1lfug/sqrt(Hz) \ Z=%4.1lfug/sqrt(Hz) Threshold < %4.1lf\n", x_noise_dens_ug, y_noise_dens_ug, z_noise_dens_ug,\ NOISE_THRESHOLD_MG); } else {     printf("Test #3: Performance. Noise. FAILED: X=%4.1lfug/sqrt(Hz) Y=%4.1lfug/sqrt(Hz) \   Z=%4.1lfug/sqrt(Hz) Threshold < %4.1lf\n", x_noise_dens_ug, y_noise_dens_ug,\ z_noise_dens_ug,NOISE_THRESHOLD_MG);   } Calibrating the sensor The first question to ask concerning calibration is whether it is required for the intended application. Accelerometer calibration mainly consists of calibrating the accelerometer's offset. The main impact for this is in tilt-sensing application, where the offset will induce an error in the measurement of the horizon. The accelerometer comes from the factory pre-trimmed, but the soldering process and PCB bending due to assembly can vary the offset, therefore it is preferable to calibrate the accelerometer after assembling the device into the device housing. Pre- and post-calibration accuracy     Sample code The calibration procedure is outlined in the inline calibration application note. Here is some sample code on how to perform this calibration, based on BMA456, using the COINES software as the host. Note : Although the concept is the same, the BMA4xy family of accelerometers does not include a built-in offset calculation on the ASIC. Since the offset are calculated inside of the Sensor API itself, it allows for a much more flexible target position.  rslt = bma456_init(&bma456dev); if (rslt == BMA4_OK) {     printf("BMA456 Initialization Success!\n"); } else {                  coines_exit_error("BMA456 Initialization Failure!\n"); } coines_delay_msec(100); rslt = bma456_write_config_file(&bma456dev); /* Enable the accelerometer */ rslt = bma4_set_accel_enable(BMA4_ENABLE, &bma456dev); /* Set the accel configurations */ struct bma4_accel_config accel_conf = { 0 }; accel_conf.odr = BMA4_OUTPUT_DATA_RATE_50HZ; accel_conf.bandwidth = BMA4_ACCEL_NORMAL_AVG4; accel_conf.perf_mode = BMA4_CIC_AVG_MODE; accel_conf.range = BMA4_ACCEL_RANGE_8G; rslt = bma4_set_accel_config(&accel_conf, &bma456dev); dev.delay_us(20000, dev.intf_ptr);                         if (rslt == BMA4_OK) {     /* Set accel foc axis and it's sign (x, y, z, sign)*/ struct bma4_accel_foc_g_value g_value_foc = { 0, 0, 0, 0 };       rslt = bma4_perform_accel_foc( &g_value_foc, &bma456dev);                          if (rslt == BMA4_OK) {         printf("BMA456 perform FOC successful!\n");         /* Delay after performing Accel FOC */         dev->delay_us(30000, bma456dev ->intf_ptr);         /*! calculates the offset after compensation */         rslt = bma4_read_regs(BMA4_OFFSET_0_ADDR, data_array, 3, & bma456dev);         printf("Post-calibration offset : X=%4.1lfmg Y=%4.1lfmg Z=%4.1lfmg", data_array[0],\                data_array[1], data_array[3]);     } else {                  coines_exit_error("Unknown communication error. Exiting...\n");     } } Once the offsets are determined, they can be written into the NVM so that the sensor automatically compensates for the soldering offset even after physically removing the power. Here is some sample code on how to save calibration data to NVM, based on BMA456, using the COINES software as the host. /*!  * @brief This internal API is used to update the nvm content  *  * @param[in] void  * @return void  *  */ static void bma456_update_nvm(void) {     uint16_t rslt;     uint8_t data;       /* unlocks the NVM for writing */     data = 0x02;     bma4_write_regs(0x6A, &data, 1, &bma456dev);                    /* makes sure the BMA456 is not executing another command */ do {         rslt = bma4_read_regs(BMA4_STATUS_ADDR, &data, 1, &bma456dev);         if ( 0 != rslt ) coines_exit_error("Unknown communication error. Exiting...\n");     } while ( 0 == (data&0x10) );                    /* performs the writing of the NVM */     rslt = bma4_set_command_register( 0xA0,  &bma456dev);     if ( 0 != rslt ) coines_exit_error("Unknown communication error. Exiting...\n");                        /* wait for the command to be completed */ do {         rslt = bma4_read_regs(BMA4_STATUS_ADDR, &data, 1, &bma456dev);         if ( 0 != rslt ) coines_exit_error("Unknown communication error. Exiting...\n");     } while ( 0 == (data&0x10) );                    /* locks the NVM writing */     data = 0x00;     bma4_write_regs(0x6A, &data, 1, &bma456dev); }   Further reads Datasheets: BMA456 Datasheet Application notes: Inline calibration of accelerometers Handling, soldering and mounting instructions, Accelerometers HSMI  
    View full article
    ‎04-01-2021 10:22 AM
    Please find attached the two white papers for our BHI260AP self-learning AI sensor: White paper: Me, myself and AI How the new self-learning AI sensor pesonalizes your home workout Fitness tracking is presently experiencing a huge upswing in popularity. The market for fitness trackers and step counters has surged by 65% year-on-year [1], with just the Fitbit platform alone claiming nearly 30 million active users [2]. Current activity tracking devices have demonstrated the huge market potential of this segment and have laid the groundwork for next-generation AI-enabled devices to take centre stage as individual fitness tracking goes mainstream. White paper: Swim like a fish with Artificial Intelligence Combining AI and sensors to create a new generation of intelligent wearables Artificial intelligence (AI) is rapidly becoming a natural and integral part of our everyday lives – working silently and unnoticed in the background. AI makes sense of the multitude of data streaming in from various sensors to deliver detailed and precise insights, which have the potential to increase the utility of virtually all electronic devices on the market today. This defining technology can accurately determine whether the user of a device is walking, running, sitting, sleeping – or even swimming in real-time. This article explores how sensors synergize with AI in wearables to deliver valuable information to users – even in demanding environments like swimming pools.
    View full article
    Top Contributors