cancel
Showing results for 
Search instead for 
Did you mean: 

LIS3MDL data interpretation

Legacy member
Not applicable
Posted on May 15, 2017 at 18:45

Hello,

I have the a question about LIS3MDL.

I have read

http://www.st.com/resource/en/datasheet/lis3mdl.pdf

and an

http://www.st.com/resource/en/application_note/dm00136626.pdf

, but have no idea, how to interpret the data according to chapter 3.3 Understanding magnetic data.

Maybe I am missing something, but it seems we are supposed to reverse engineer the data from the table? I can't see any equation as in ANs for another components.

Thank You,

David

#e-compass #magnetometer
1 ACCEPTED SOLUTION

Accepted Solutions
Miroslav BATEK
ST Employee
Posted on May 17, 2017 at 10:05

Please see table 3 in the datasheet, you can find there the sensitivity parameter. Sensitivity describes the relation between raw sensor output and the magnetic field intensity in gauss. The sensor output is linear: magnetic_intensity (in gauss) = raw_data / sensitivity

0690X000006071oQAA.png

You don't have to calculate the

boundaries, they are defined by the full scale +/- 4, 8, 12, 16 gauss. Even if the 16 bit register can cover higher values, the performance out of the full scale is not guaranteed.

View solution in original post

4 REPLIES 4
Posted on May 15, 2017 at 19:38

High-school level maths and computer studies comprehension is required.

Pair of bytes combine to create 16-bit signed number, this may then need to be shifted or scaled depending on your choice of settings.

For the +/- 4 gauss range, (double)x * (1.0 / 6842.0)

So for a 16-bit signed integer you have a range of +32767 to -32768, nominally +/-4.79

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Legacy member
Not applicable
Posted on May 16, 2017 at 20:44

Thank You, I figured that out later in the evening. I actually went on high-school  One of the things I learned there: a function is defined for example by an equation or a graph. I couldn't see any of that (related to my question) in the documents mentioned.

I am just disappointed that both datasheet and the AN don't provide the most valuable information, which is the following formula:

magnetic_flux_density = sensor_output / [count_per_gauss_constant]

where count_per_gauss_constant is probably

6842 for +/- 4 g range

3421 for +/- 8 g range

2280 for +/- 12 g range

1710 for +/- 16 g range

(all numbers are decimal).

The table itself is not much helpful, if you need to compute the constants on your own for all four ranges.

We can only assume that the sensor output is linear.

We need to compute the boundaries of the output on our own - (does the sensor still work near the boundaries?) 32767 output / 1710 counts_per_gauss means +/- 19,16 gauss range !?

Hope this helps someone else or even better, will be added to the datasheet (and the AN).

Could someone from ST, please, confirm all the information above?

Miroslav BATEK
ST Employee
Posted on May 17, 2017 at 10:05

Please see table 3 in the datasheet, you can find there the sensitivity parameter. Sensitivity describes the relation between raw sensor output and the magnetic field intensity in gauss. The sensor output is linear: magnetic_intensity (in gauss) = raw_data / sensitivity

0690X000006071oQAA.png

You don't have to calculate the

boundaries, they are defined by the full scale +/- 4, 8, 12, 16 gauss. Even if the 16 bit register can cover higher values, the performance out of the full scale is not guaranteed.

Legacy member
Not applicable
Posted on May 17, 2017 at 10:38

Thank You very much, that is what I've been looking for.