Accelerometer (Acc), Gyroscope (Gyro) and Magnetometer (Mag) sensors (components) have their own coordinates. By default BHA and BHI are configured to ENU axis convention (East-North-Up), as commonly used in consumer electronic devices. It is usually obtained by the integration of Accelerometer (Acc), Gyroscope (Gyro) and Magnetometer (Mag) sensors readings.
The ENU coordinate system is defined as a direct orthonormal basis where:
x points east and is tangential to the ground.
y points north and is tangential to the ground.
z points towards the sky and is perpendicular to the ground.
Users can download the BHI/BHA firmware from Bosch Sensortec Website. All firmware’s coordinates are the same. Figure 2(left) shows the coordinate of the BHI/BHA shuttle board. Cares must be taken that the direction of BHI/BHA and Magnetometer sensor must follow the BHI/BHA shuttle board when customer do the PCB placement. Figure 2(right) shows the direction of BHI/BHA and Magnetometer on the shuttle board.
It is the easiest and best way that customer can reuse the same coordinate of BHI/BHA shuttle board on their product. It is possible to change the coordinate based on customer definition. This document is to tell the customer the way how to do the axis-remapping on their products.
Draw all the coordinates on the paper. Figure 3 shows an example.In Figure 3, it is highly recommended to follow the placement on the BHI160 shuttle board, if the user do not want to pay more effort on it.
If you are using a standard Bosch sensor, their coordinates follow the right-handed coordinate principle (Figure 4). You can apply it to find the sensor axes when it placed on the board.
When the sensors axes orientation are different to the board, we need to convert it to the board coordinate by following formula:
[X Y Z] is the board coordinate
[Xs Ys Zs] is the sensor coordinate
(C0… C8) is the orientation matrix.
The coefficient has three possible value: 1, 0 and -1.
1 --- Two axes are paralleled and have same direction
-1 --- Two axes are paralleled and have opposite direction
0 --- Two axes are perpendicular
If we have a board shown in Figure 3. On this board, there are a BHI160 and a BMM150. The dots on the sensor indicate their coordinates. You can try to find the coordinates and write the orientation matrix. Table 1shows the result.
Orientation matrix:
Cs = (0 -1 0 1 0 0 0 0 1),
Basic configuration
When customer follow the requirement (components placement), so only one matrix is needed for the sensor(A,M,G). Users can configure the axes before enable the BHI160/BHA250 by editting the remapping matrix in its .c file.
The following code is content of the accelerometer_remapping_example.c in the API. Use this as a reference to update your matrix accordingly.
The matrix can also be edited within the product API which is available on GitHub:
https://github.com/BoschSensortec/BHy1_driver_and_MCU_solution
int main(void)
{
u8 array[ARRAYSIZE], *fifoptr, bytes_left_in_fifo=0;
u16 bytes_remaining, bytes_read;
bhy_data_generic_t fifo_packet;
bhy_data_type_t packet_type;
BHY_RETURN_FUNCTION_TYPE result;
s8 mapping[9] = {0};
s8 mapping_all[9] = {0 -1 0 1 0 0 0 0 1}; // new mapping matrix, example on Figure3
… …
/* config mapping matrix, it is not necessary to change mapping matrix if its orientation is aligned with the board */
bhy_get_mapping_matrix(PHYSICAL_SENSOR_INDEX_ACC,mapping); // get current ACC mapping matrix
bhy_set_mapping_matrix (PHYSICAL_SENSOR_INDEX_ACC,mapping_all); // set new mapping matrix in the fw
bhy_get_mapping_matrix(PHYSICAL_SENSOR_INDEX_ACC,mapping); // check if the matrix is set successfully
… …
bhy_get_mapping_matrix(PHYSICAL_SENSOR_INDEX_GYRO,mapping); // get current GYRO mapping matrix
bhy_set_mapping_matrix (PHYSICAL_SENSOR_INDEX_GYRO,mapping_all); // set new mapping matrix in the fw
bhy_get_mapping_matrix(PHYSICAL_SENSOR_INDEX_GYRO,mapping); // check if the matrix is set successfully
… …
bhy_get_mapping_matrix(PHYSICAL_SENSOR_INDEX_MAG,mapping); // get current MAG mapping matrix
bhy_set_mapping_matrix (PHYSICAL_SENSOR_INDEX_MAG,mapping_all); // set new mapping matrix in the fw
bhy_get_mapping_matrix(PHYSICAL_SENSOR_INDEX_MAG,mapping); // check if the matrix is set successfully
If the sensor placement is not followed the Shuttle Board, the user can configure matrix for each sensor.
In this configuration, customer can place the sensor on the board as they need(no need to follow the chip placement on shuttle board).
int main(void)
{
u8 array[ARRAYSIZE], *fifoptr, bytes_left_in_fifo=0;
u16 bytes_remaining, bytes_read;
bhy_data_generic_t fifo_packet;
bhy_data_type_t packet_type;
BHY_RETURN_FUNCTION_TYPE result;
s8 mapping[9] = {0};
s8 mapping_ACC[9] = {0 -1 0 1 0 0 0 0 1}; // new mapping matrix, example on Figure3
s8 mapping_GYRO[9] = {0 -1 0 1 0 0 0 0 1}; //
s8 mapping_MAG[9] = {0 -1 0 1 0 0 0 0 1}; // can be different
… …
/* config mapping matrix, it is not necessary to change mapping matrix if its orientation is aligned with the board */
bhy_get_mapping_matrix(PHYSICAL_SENSOR_INDEX_ACC,mapping); // get current ACC mapping matrix
bhy_set_mapping_matrix (PHYSICAL_SENSOR_INDEX_ACC,mapping_ACC); // set new mapping matrix in the fw
bhy_get_mapping_matrix(PHYSICAL_SENSOR_INDEX_ACC,mapping); // check if the matrix is set successfully
… …
bhy_get_mapping_matrix(PHYSICAL_SENSOR_INDEX_GYRO,mapping); // get current GYRO mapping matrix
bhy_set_mapping_matrix (PHYSICAL_SENSOR_INDEX_GYRO,mapping_GYRO); // set new mapping matrix in the fw
bhy_get_mapping_matrix(PHYSICAL_SENSOR_INDEX_GYRO,mapping); // check if the matrix is set successfully
… …
bhy_get_mapping_matrix(PHYSICAL_SENSOR_INDEX_MAG,mapping); // get current MAG mapping matrix
bhy_set_mapping_matrix (PHYSICAL_SENSOR_INDEX_MAG,mapping_MAG); // set new mapping matrix in the fw
bhy_get_mapping_matrix(PHYSICAL_SENSOR_INDEX_MAG,mapping); // check if the matrix is set successfully
For more details and technical support with respect to the product API the *.h file and the MCU porting please refer to the Bosch Sensortec documents “MCU Driver Porting Guide” and “Interfacing Reference Code from Generic Driver” for BHA and/or BHI placed within the section “Application notes”, available onhttps://www.bosch-sensortec.com/bst/support_tools/downloads/overview_downloads
After the orientation matrix has been updated, you need to check whether the remapping is successful.
You can read the uncalibrated data of the sensors to check if the remapping is successful. Please define the coordination of the board (XBOARD, YBOARD, ZBOARD) first.
If you use BHI160, the axes of Acc and Gyro are same.
In Bosch product, a Gyro axis direction can be found by your right hand. Move your four fingers follow the rotation direction to make a fist and the thumb will be pointing to the positive axis like Figure 5 (This is similar to right-hand crew rule).
1.Enable Mag uncalibrated data and only log the first three data;
2.Rotate the board in following steps and record the output data:
If
Then the remapping is correct.
Dear all,
instead of remap, does anyone knows how to change the reference axes of this Nicla sense me board, because the mount position changed.....if I just do remap, there will have the data jamp..because the orientation limitation.
thanks a lot.