cancel
Showing results for 
Search instead for 
Did you mean: 

lsm330dl accelerometer output data problem

mengsophia
Associate II
Posted on July 03, 2012 at 06:04

i'm using the accelerometer in lsm330dl. but when i put the chip statically on the table, the xyz output i got from it is very strange,

 for x, it's always between 0.2-0.45

 for y, it's always around 1

 for z, it's always around 16

why? i didn't enable any interrupt, is there something wrong with my register setting?

#lsm330dl #accelerometer
6 REPLIES 6
mengsophia
Associate II
frankmeyer9
Associate II
Posted on July 03, 2012 at 08:19

...,the xyz output i got from it is very strange,

for x, it's always between 0.2-0.45 for y, it's always around 1 for z, it's always around 16 I guess you mean the calculated xyz values, using float. Could you post additionally some ''raw'' acceleromete values ? Your code contains :

ACCEL_Xf = ACCEL_X * 0.002 - ACCEL_Xbias; //divide the ACCEL values by 70 to get degrees per second

You copied that probably from the gyro code. Accelerometer output is not in deg. per second.
mengsophia
Associate II
Posted on July 04, 2012 at 05:25

sorry, i change the code, but forget to clear the comment.

i changed some register setting values, and uncomment the register 6, and the output seems meaningful.

but the z axis always show me 16, and when i flip it over, it shows me -16, i didn't find any clues  in the datasheet that i should divided by 16.

ACCEL_Zf = ACCEL_Z * 0.002/16.0     ( FS bit set to 01   , 2mg/digit)

when i 've done this, the output value looks corret, ie, when i turn it 60degrees, it shows me 0.5g, and all the axies are correct.  so strange.

frankmeyer9
Associate II
Posted on July 04, 2012 at 08:29

Admittedly I did not analyze your code in detail - I have no lsm330 to try anything.

But the results are generally meaningful. A significant z-axis output that turns negative when flipping over seems ok. When you tilt the board by 90 deg. in any direction, the corresponding axis should show an equivalent output.

I have read comments in other forums that describe the lsm330 as having a somehow noisy output, so the fluctuations of the other axes might be normal. As mentioned, I don't have any, so I can neither confirm nor refute.

The scaling is another problem, which should not be too difficult to solve if the readout code is working.

frankmeyer9
Associate II
Posted on July 04, 2012 at 15:22

The only thing I found was this source line, or better, definition:

#define ACCEL_VALUE_CTRL_REG4 0x98 //DISCONTINUES UPDATE#F0, LITTLE ENDIAN. 250 DPS, 4-WIRE

The value is reasonable (BDU, +-4g full-scale, 4-wire interface), but the comment is misleading and wrong. I assume the comment belongs to the CTRL_REG4_G value for the gyro part.

VALUE_CTRL_REG1 0x97 //ODR 1.344KHZ,

This is quite a high update rate. It makes sense for detection of rather fast movements.
mengsophia
Associate II
Posted on July 07, 2012 at 15:39

thanks for suggestions.