AltIMU-10 v4 accelerometer

Hello,

I was interfacing accelerometer with BeagleBone Black and i had met some problem with z value.

This is the connection diagram:
*Sorry there is a misplace pin, I was using the I2C_2 and i forgot to make change in diagram.

This is how i place my sensor:

This is my coding.
accelerometer-final (7.8 KB)

This is the output of my data:
read_x_accelemeter: -0.0220947
read_y_accelemeter: -0.0171509
read_z_accelemeter: -0.879822

read_x_accelemeter: -0.0174561
read_y_accelemeter: -0.0222168
read_z_accelemeter: -0.882446

read_x_accelemeter: -0.0202026
read_y_accelemeter: -0.0230103
read_z_accelemeter: -0.881958

read_x_accelemeter: -0.020874
read_y_accelemeter: -0.0244751
read_z_accelemeter: -0.874268

read_x_accelemeter: -0.0368652
read_y_accelemeter: -0.0360107
read_z_accelemeter: -0.872253

read_x_accelemeter: -0.0203857
read_y_accelemeter: -0.0255737
read_z_accelemeter: -0.878906

Is that normal to have such value for z as i think it should have shown approximately
x=0
y=0
z=-1

There is a huge different between the z value.

Hello.

Yeah, that is a little strange. That output looks almost normal for the LSM303D, except I would expect the magnitude of the acceleration vector to be closer to 1 g. The code you attached also seems strange; I took a quick look and though I did not determine what could be the source if the issue, it looks like within that single file there are two different versions of your program, one of which is incomplete. If this is not what you are actually using, can you post the script you are using?

Also, if you have access to an Arduino, you might consider running the Serial example of our LSM303 library. If the values obtained in that way make sense, the issue is likely with your code.

-Jon

Thank you for the fast reply. I’m sorry that i don’t have any access on Adruino.

Can you explain more on this, I don’t quite get it.

For the program i used, i have been using Ubuntu to code on BeagleBone Black. The library i use is BlackLib. Once again, thanks for the kind respond. =)

The file you attached (accelerometer-final) seems to be messed up around line 132. Could you try posting your code again?

-Jon

Sorry, i found that i uploaded the messed up file.
Here is the corrected version.

accelerometer-final (3.2 KB)

We do not see anything obviously wrong with your code. If you need your accelerometer data to be more accurate, you should try getting readings with the sensor in different orientations to see if an offset or scaling needs to be applied.

-Jon

Ok noted. Thanks for the help.