cancel
Showing results for 
Search instead for 
Did you mean: 

LIS3MDL magnetometer output becomes noisy after a bit

dburgt98
Associate II

Dear community,

I am trying to detect metalic objects (train axles) that are passing above two LIS3MDL sensors. 

For this purpose I am using LIS3MDL breakout boards from Pololu

What I notice is that often, what seems randomly, the signal becomes noisy during the data gathering process.

To provide an example, I have plotted the sensor's X-axis output in a graph.

In the left half of the graph you can see that the signal is normal, and in the right half you can see the signal become noisy.

Nothing really seems to  change in the external environment at the moment that this transition occurs. 

We see this in multiple datasets.

Screenshot 2024-02-08 130041.png

Has such behavior been seen before with this sensor? If so, what could be the cause of this and can it be fixed?

I will give a few details about my setup below:

  • LIS3MDL configuration:
    • Ultra-high performance mode
    • 155 Hz in continuous conversion mode.
    • Scale: 4 gauss
    • The VVD and Vin pins on the LIS3MDL are shorted together and connected to 3.3v.
    • There are two LIS3MDL breakout boards on the same I2C bus
      • For sensor A, the SDO pin is floating (for default I2C address)
      • For sensor B, the SDO pin connected to GND (for the purpose of an unique I2C address)
    • The breakout board has 1.5kOhm resistance/pull-up from SCL and SDA to VDD
    • INT, CS, DRDY pins are floating and not used.
  • The PCB is powered through 3x Saft LSH20 D lithium-thionyl chloride (Li-SOCl2), which are connected in parallel to increase battery capacity.
  • I2C bus speed initialized by master at 400KHz, whereas the LIS3MDL sensors are the slaves.
  • The master device logs the values to a SD card, which is how I gathered the data for plotting.
  • Before/after each train, the sensor is automatically started/configured and stopped by writing the appropriate registers. During the data gathering, no registers are updated. Only the STATUS and OUT registers are being read.
  • Sensor a is relatively close to the development board, only few centimeters away with on-PCB traces. The other one is connected via wires that are approx. 20cm long. At first I assumed the issue might be due to the long wires, but that does not explain why it occurs on the close sensor as well. 

 

Here are some environmental details:

  • The solution is outdoors in a waterproof enclosure (we have seen this issue occur both in summer and winter, so we dont assume outdoor temperature is the cause here)
  • The enclosure is mounted on the rail with light pot magnets, that are approx 15cm distance from the sensors, and directed away from the sensors. This might still cause a bias in the magnetic offset, but this is not a problem for the solution as we are more interested in the change of magnetic field between consecutive measurements, rather than a biased absolute value.
  • While the sensor is active, the sensor enclosure might vibrate a little bit. 

 

I have tried to replicate this issue in the lab tests. But soo far without success. 

 

Any assistance in this matter is highly appreciated.

 

Best regards,

 

Dirk

 

3 REPLIES 3
dburgt98
Associate II

Anyone has any idea ?

Federica Bossi
ST Employee

Hi @dburgt98 ,

Welcome to ST Community!

It seems that that type of noise is given by variable current near the sensor, also in external objects, this causes a magnetic vibration that is read by the sensor, or metallic or magnetic parts that vibrate. You can try to apply to the data a low pass filter function in the firmware to have a better signal data of sensor.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Dear @Federica Bossi 

Thank you very much for the feedback. I highly appreciate it.

Your observation makes sense as there might indeed be some magnetic vibrations caused by the train. I will look into the low pass filter.

Do you know if there is a logical explanation why this variable current only occurs after a handful of axles that pass the sensor, and not already for the first axles? I imagine that these could also cause the same magnetic vibrations.

For example, in one dataset there is no noise for the first 9 axles, but then it starts and remains for the remaining 100+ axles. The noise does not really stop once it has started. This observation is consistent for most datasets that I gathered with the sensor, except for the exact start moment of the noise, which is sometimes a bit earlier or later.

I also tried rebooting the sensor every 10s using the REBOOT bit in the CTRL2 register, and then re-write the appropriate configuration to registers, but this does not seem to prevent or resolve the noise.

 

Best regards,

Dirk