cancel
Showing results for 
Search instead for 
Did you mean: 

LSM303AH -1G/1G Unexpected Output, Less than 90 degrees

wb346
Associate II

Hello,

I am having issues with my acceleration data being output from my LSM303AHTR. I have configured it for 2G Full scale making the "sensitivity" 0.061mg/lsb.

I have tested two LSM303AH chips on two of our custom PCBs. I am getting similar results on both chips, but I am not getting the same exact values on both chips.

I evaluated all axis at +Gravity, -Gravity, and 0 Gravity. All of the expected 0 Gravity values are being seen, however, I am getting less than 90 degrees for positive and negative 1G positions.

My method for obtaining degrees from counts follows. I believe it is correct because it works for other projects' accelerometers:

Register Value * Sensitivity = mg
G = mg*1000
arcsin(G)

We can abstract out my method for obtaining degrees and just focus on counts. The issue still remains. When I am reading an axis that has full gravity exposure, I should be getting +/- 16,383 counts.

For X +1G I am getting -16,900 counts, which converts to 90 degrees, but this is slightly off scale.
For X -1G I am getting -15,750 counts, which converts to -75 degrees.
For Y +1G I am getting 15,750 counts, which converts to 75 degrees (just like X -1G).
For Y -1G I am getting -16,080 counts, which converts to -75 degrees.
For Z +1G I am getting 16,550 counts, which converts to 90 degrees, but this is slightly off scale.
For Z -1G I am getting -17,000+ counts which is greatly off scale.

Regarding my code, it is very specific and wouldn't make sense to anyone. I am shifting the MSB 8 bits and OR'ring it with LSB and stuffing that into a Signed Int. Again, we can talk about the conversion process, but all that really matters are the Counts I'm reading, which are not what is expected.

It's worth noting that I am very familiar with how this chip works because I am accustomed to using LIS2DS12 which is essentially the same as LSM303 except it doesn't have a magnetometer built in. 

Any help is appreciated.
Thank you.


10 REPLIES 10

I was able to create an alternative heading vector using the atan2() equation mentioned in the last section of that document. 

wb346_0-1689089485801.png

For people in future world, just plug in your mg values for x, y, and z where it uses Gx, Gy, and Gz respectively.
This will output radians, and you can convert to degrees by multiplying by 180/pi (57.296).

I appreciate your help.