AnsweredAssumed Answered

LSM303D Interrupt threshold

Question asked by Fritjof Cavallin on Jun 7, 2018



I am using a LSM303D with a Adafruit Feather M0 and want to detect spikes in the magnetic fields, preferably for all the axes, and want to use interrupts.
I have the interrupts working when any of the axes goes above (or below) the given threshold value. The problem is that I need to detect spikes in either direction from the normal value (usually far from zero) of all the axes but the threshold only works around (based on) zero.
Currently, I use the offset parameters to make the values given by the magnetometer be around zero by default. Now I would like to set the threshold to lets say +-200 (as shown in the attached image) but from my testing it seems that the threshold does not take the offset into account and actually tests against the measured magnetic values.

Is there a way to set the offset so that all values are around zero and also use a threshold value that uses the offset so that I can detect when the values get above or below 200?