Using the 6-directional movement recognition from LSM303D

I am using an Arduino Pro Mini with a LSM303D to a project and would like to know more about the 6-directional movement recognition of the interrupt generator. I searched for it and found a similar topic (Design q's: LSM303 sleep-to-wakeup, and inertial interrupts) but the link that would help me is broken. I can already handle the AND/OR operations, the threshold and the duration configuration, but when I configure this 6-directional movement recognition, i just get 0 value from the status register IG_SRC1.

I understand a bit of what it does, but I have no idea on how to configure it.


There is other problem too: I thought that the Y high and Y low events were like that: if acceleration_y > threshold , YHIGH would be true; and if acceleration_y < -threshold, YLOW would be true. Finally, if -threshold > acceleration_y > threshold, then both are false.

What occurs in my board is: if |acceleration_y| > threshold, YHIGH is true; and if |acceleration_y| < threshold, YLOW is true. Is there any configuration in which my initial thought is true?

My register configuration is:

CTRL1 = 0x57;
CTRL2 = 0X00;
CTRL3 = 0x20;
IG_CFG1 = 0x08;
IG_THS1 = 0x24;
IG_DUR1 = 0x04;


Hi, Davi.

The location of the app note PDF changed on ST’s site; I found it again here. (I also updated the link in the old post you were looking at. For future reference, the app note is AN3308.) Section 7 (p. 27-29) is the one of interest.

As for your second question, I think your understanding of the high/low interrupts is correct when 6-directional recognition is not enabled. It looks like enabling 6D recognition might provide the behavior you’re looking for.

- Kevin

Hi, Kevin.

Thanks for the help!
Unfortunately, though, I believe I am still misunderstanding something here.
I am trying to work with the thresholds on the Y axis, so I am setting the registers like this

writeReg(CTRL2, 0x00); writeReg(CTRL1, 0x57); writeAccReg(IG_CFG1, 0b01001100); writeAccReg(IG_THS1, 0b00000001); writeAccReg(IG_DUR1, 0b00000000); writeAccReg(CTRL3 , 0b00110000);

When I try printing the status as shown bellow, I always get 0. I even tried changing the threshold and duration bytes, still 0.

What I am I missing here?

I am sorry to bother you again with such a minor mistake: I was not rebooting the device after turning on the 6D recognition. I put the configuration, rebooted the device and it worked properly. Thank you again for the help.