Wrong magnetic values with LIS3MDL
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-02-13 8:37 AM
Hello I don't understand why I get value aroung 1.3 Gauss ?
Configuration :
LIS3_CTRL_REG2 = 0x00; // Full scale +/- 4 G
LIS3_CTRL_REG1 = 0x1C; // ODR=80Hz, XY LowPower
LIS3_CTRL_REG4 = 0x00; // Z LowPower
LIS3_CTRL_REG3 = 0x00; // Continuous-conversion mode
LIS3_CTRL_REG5 = 0x40; // BDU = 1
and I receive :
LIS3_OUT_X_L = 0xEB
LIS3_OUT_X_H = 0xEE
=> MagX = 0xEEEB = -4373
LIS3_OUT_Y_L = 0x94
LIS3_OUT_Y_H = 0x07
=> MagY = 0x0794
= 1940
LIS3_OUT_Z_L = 0x4A
LIS3_OUT_Z_H = 0x1E
=> MagZ = 0x1E4A
= 7754
Magnetic calculation : Mg = sqrt ( MagX*MagX + MagY*
MagY +
MagZ*MagZ ) / 6842 = sqrt ( 83011245) / 6842
Mg = 9111,05 / 6842 = 1.33 Gauss ????
I get this value with 2 Lis3mdl and same code.
This result seems to be wrong ? Normaly I should get something around 0.5 Gauss isn't it ?
Is there anything bad in my logic ?
Thx for your help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-02-13 10:14 AM
The problem is probably in Hard Iron and Soft Iron error.
- Hard iron distortion arise from permanent magnets, magnetized iron or steel situated nearby the magnetometer. This distortion remain constant and in fixed location relative to magnetometer for all heading orientations. Hard iron effect add a constant magnitude field component along each axis of the magnetometer.
- Soft iron distortion arise from the interaction of the Earth’s magnetic field and a magnetically soft material surrounding the magnetometer sensor distorting the Earth’s magnetic field.
For proper measurement of magnetic filed you need to perform Hard Iron and Soft Iron calibration in your MCU.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-02-13 11:59 PM
Thanks Miroslav for this information.
Do you think that difference between what a get 1.3 G and something normal 0.5-0.4 G is not too big ?
Its also disturbing to get this with 2 lis3mdl device ? Strange no ?
Thx.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-02-14 2:39 AM
I really depends on the surroundings, if there is permanent magnets or magnetized steel or wire with high current it can create strong magnetic field.
You can try to move to different location and check if it has impact on your measurement.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-02-15 1:22 AM
I am not so sure that in our case we have troubles with the surroundings because we placed a second magnetometer (HMC5883L) in the system (5 cm arround) and the HMC5883L gives something looking good (0.5 Gauss).
Maybe a problem in our code ? If you want I can send a part of it ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-02-15 6:10 AM
Can you please collect data from X, Y, Z axis during multiple device rotation along, X, Y, Z axis and send it to me, so I can evaluate it.
You can also send the code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-02-15 11:00 AM
You can find the code (Mag.c) and the serial mag output.
The system with the 2 sensors is fixed. No mouvement.
Lis3mdl cfg : +/- 4G and Hmc5883 +/- 1.9G
Results:
Lis3mdl field : 1.41G and Hmc5883 field : 0.5 G
thx
________________ Attachments : Mag.c.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Hyvl&d=%2Fa%2F0X0000000bDv%2Fj9BosMGUarWJ4a2WReMq8mLteUK.liQmXx_kGbzTTxE&asPdf=falseserial output.txt.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Hyvb&d=%2Fa%2F0X0000000bDx%2FgIR.lyZThhRPyCt322b1GjVM2b6t3Hlpit4zl54YhvU&asPdf=false- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-02-16 3:44 AM
I checked your source code and I don't see any problem.
Unfortunately the file ''serial output.txt.zip'' is empty. To evaluate the sensor behavior I would really need datalog ofX, Y, Z values during multiple device rotation along, X, Y, Z axis.
It should look like this:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-02-20 12:54 AM
Hi Miroslav,
Sorry for the delay. We've busy this days.
We gone re checked our hardware and then take new records of X-Y-Z values.
I will inform you ...
