2017-05-15 09:45 AM
Hello,
I have the a question about LIS3MDL.
I have read
http://www.st.com/resource/en/datasheet/lis3mdl.pdf
and anhttp://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 #magnetometerSolved! Go to Solution.
2017-05-17 01:05 AM
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
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.
2017-05-15 10:38 AM
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
2017-05-16 01:44 PM
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?
2017-05-17 01:05 AM
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
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.
2017-05-17 03:38 AM
Thank You very much, that is what I've been looking for.