2020-06-19 12:48 AM
Hi,
we are woeking on motion detection application using LIS3DH,we have done below register
settings but we are only getting interrupt on motion first time but after that we are not getting interrupt after reset also.once we are getting th einterrupt and checking the register INT1_SRC but its value we are getting is zero.can you please suggest register setting to detect motion,do we need to give some delay after any register setting.
reg[0] = CTRL_REG1; /* 10Hz, normal power mode, ZXY enable */ reg[1] = 0x27; err_code = i2c_lis3dh_write_data(reg, 2); reg[0] = CTRL_REG2; /* HP filter for INT1 */ reg[1] = 0x01; err_code = i2c_lis3dh_write_data(reg, 2); reg[0] = CTRL_REG3; /* IA1 enable */ reg[1] = 0x40; err_code = i2c_lis3dh_write_data(reg, 2); reg[0] = CTRL_REG4; /* scale 4g */ reg[1] = 0x10; err_code = i2c_lis3dh_write_data(reg, 2); reg[0] = CTRL_REG5; /* interrupt 1 pin latched */ reg[1] = 0x08; err_code = i2c_lis3dh_write_data(reg, 2); reg[0] = CTRL_REG6; /* change interrupt polarity, active low as requested */ reg[1] = 0x02; err_code = i2c_lis3dh_write_data(reg, 2); /* 64mg threshold,0x01 can be close to noise so the interrupt would be triggered by the noise */ reg[0] = INT1_THS; reg[1] = 0x02; err_code = i2c_lis3dh_write_data(reg, 2); reg[0] = INT1_DURATION; /* 0.5s to activate interrupt */ reg[1] = 0x05; err_code = i2c_lis3dh_write_data(reg, 2); reg[0] = INT1_CFG; /* OR, X,Y,Z higher than threshold */ reg[1] = 0x2A; err_code = i2c_lis3dh_write_data(reg, 2);
2020-07-03 03:34 AM
Hi @AKUMA.1 , when you write "motion detection", what do you exactly mean? Is it a classification of a motion pattern (difficult) or is it the detection of a particular event (threshold overrun)? In this case, I would suggest you to check the example C codes on Github, for example for the single tap detection (tap_single.c), and to compare your code and your settings to the one in the example. Btw, when you write:
/* 0.5s to activate interrupt */ reg[1] = 0x05;
Do you want to configure the INT1_DURATION parameter? Please consider that this register set the minimum duration of the Interrupt event to be recognized (so if you event is a spike of e.g. 1/ODR, you will not recognize it setting 05h), and that the duration steps and maximum values depend on the ODR chosen (p.43 of the datasheet).
Regards
2020-07-26 04:28 AM
Hi eleon,
we have some use cases for this accelerometer ,we are using it inside a band which we are wearing in hand.we want detect the orientation of band movement,how we can set the register to decide in which
direction hand is moved.
we have some more use cases
we want to detect touching of face and hadwash off movement using these accelorometer,is it possible to detect,we are wearing this accelorometer inside a band.
so on the basis of x,y and z movement of band can we detect the hand wash and face touching?