Skip to main content
Explorer
February 22, 2024
Solved

ASM330LHH imu sensor

  • February 22, 2024
  • 5 replies
  • 5974 views

hello,

i have few basic Question regarding accelerometer sensor.

1. accelerometer data coming from imu sensor that is 2's compliment data, so should i receive this data in signed integer or unsigned integer? 

2. i want to know whatever raw data is coming from this sensor resgistors of accelerometer that is mg/LSB or only g ? if it is mg/LSB then how i can covert into g (refer ±2g)?

3. formula of convert g into (-180° to 0 to 180°) ?

please refer below attached  code or screenshorts

    This topic has been closed for replies.
    Best answer by Federica Bossi

    Hi @semiconductor_user ,

    You get the raw data in LSB, then you multiply it by the sensitivity 0.061 mg/LSB and you will get the data in mg.

    If you need the output in g you need to divide them by 1000.

    5 replies

    Visitor II
    February 22, 2024

    The raw data from the accelerometer is typically provided in units of gravitational force (g) per LSB (least significant bit). To convert this to g, you simply divide the raw data by the appropriate sensitivity factor. For example, if the accelerometer has a sensitivity of ±2g and the data is in mg/LSB, you would divide the raw data by the sensitivity factor to get the value in g. Converting gravitational force (g) to angles (-180° to 0° to 180°) requires understanding the orientation and direction of the sensor. The accelerometer measures acceleration due to gravity along its axes.

    You can also consider using BOSCH's BMI088. If you continue using the ASM330LHH IMU sensor, you can also make a breakout board for your convenience.

    https://www.pcbway.com/project/shareproject/BMI088_IMU_I2C_Breakout.html

    Explorer
    February 23, 2024

    so right now working on ±2g sensitivity if i want to sensitivity factor 

    sensitivity factor = 4g/1024 (g/lsb)

    sensitivity factor =  0.00390625 (g/lsb)

    g = raw value / 0.00390625

    is it right calculation?

    if i am wrong then please explain through example with formula and still i don't know raw value recevice in signed int or unsigned int.

    parameter is ±2g fs and ORD selection is 12.5 hz

    i already sent my code in previous qus check there.

    Explorer
    February 26, 2024

     

     
     please give reply it's very usefull for me.
     
     
     
     
    Technical Moderator
    February 26, 2024

    Hi @semiconductor_user ,

    Please refer to the DS12374, at page 14 you find the sensitivity for each full scale to be used to obtain the outputs in g or dps.

    FedericaBossi_0-1708932586137.png

     

    Explorer
    February 26, 2024

    that i know what is sensitivity factor of ±2g full scale, it is 0.061 but how to use this 0.061.

    my Questions is,

    1.whatever data i'm getting as raw value that is mg/Lsb or g ?

    2.if raw value is mg/LSB so what is a formula for conversion from mg/LSB to g ?

     

    Technical Moderator
    February 26, 2024

    Hi @semiconductor_user ,

    You get the raw data in LSB, then you multiply it by the sensitivity 0.061 mg/LSB and you will get the data in mg.

    If you need the output in g you need to divide them by 1000.

    Explorer
    February 27, 2024

    i explain what calculation i'm using check below and correct it

    /* veriable declaration */

    sint16_t raw value = 0;  // sint16_t : signed short int 

    float Phy_Xaxis = 0; 

    while (1) {
    {
    this API tx spi data and rx spi data 
    Lpspi_Ip_SyncTransmit(&MASTER_EXTERNAL_DEVICE, OutX_L_A_Tx, OutX_L_A_Rx, 2, TIMEOUT);

    }

    Raw_Xaxis = (sint16) ((OutX_H_A_Rx[1] << 8) | OutX_L_A_Rx[1]); // OutX_H_A_Rx[1] is x axis output variable

    Phy_Xaxis = (float) ((Raw_Xaxis * 0.016) / 1000); 

    Phy_Xaxis output is showing changing beetween 0.01 to 0.099 somthing is it right ?

    Technical Moderator
    February 27, 2024

    Hi @semiconductor_user ,

    It's difficult to say if 0.01 to 0.099 is right because I don't know the position of your board. Can you put it on your desk and measure the outputs? I need the value of the three axis.

    Explorer
    February 28, 2024

    hi .@Federica Bossi , 

    thank you for help, finally i got output data using your calculation

    now i want know how to test output data whether it is accurate or corrupt data. so please share praticle method.

     

     

    Technical Moderator
    March 1, 2024

    Hi @semiconductor_user ,

    I'm glad you solved it. Can you make a new post explaining this question better?