LSM303DLH Magnetic data question

Hello, I am working with the LSM303DLH connected to a ATmega2560.
Using Arduino, I downloaded Serial.PDE and everything seems to come up first time and communicate fine, but the data is not quite right.
THe accelerometer data looks good, as does the y axis and z axis of the magnetometer. The x axis is different. It will range from +160 to -350 counts and then report -4096 for about 1/3 of the rotation, then jump back to life at -350 and continue around the circle.
The data sheet says the max range is -2048 to 2047. Is this a setup issue or a bad sensor issue? I’ve included a screenshot of the data.


The magnetic field you are exposing the magnetometer to is overflowing it at its current sensitivity.

From the datasheet:

To avoid this, you can try decreasing the sensitivity.

- Ryan


I have the same problem, how do I decreasing the sensitivity?
The “heading” don´t work either but that is the same problem?

I’m using the “LSM303DLH library” and Arduino Uno.



If the magnetometer data is overflowing, the heading computation will not work. We have added a FAQ about this to the product page:

Please let us know if you still have questions not addressed by the FAQ.

- Ben