cancel
Showing results for
Did you mean:

# ASM330LHH imu sensor

Associate III

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

1 ACCEPTED SOLUTION

Accepted Solutions

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.

10 REPLIES 10
Senior II

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

Associate III

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.

Associate III

ST Employee

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.

Associate III

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 ?

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.

Associate III

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] << 😎 | 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 ?

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.