cancel
Showing results for 
Search instead for 
Did you mean: 

Movement detection problems with IIS328DQ

Central SUPPORT
Senior II

I am designing a movement detector with the chip IIS328DQ (using INT1).

For the IIS328DQ registers configuration, I use the driver https://github.com/STMicroelectronics/STMems_Standard_C_drivers/tree/master/iis328dq_STdC

NOTE: User register configuration was included in original support request, but irrelevant here.

I can observe a lot of latency (5...15 seconds) between the move and its detection. But it's not an issue for me.

The problem is that sometimes a move isn't detected at all (no interrupt generation on the INT1 pin). My impression is that some movements are better detected than others.

Any suggestions what might be wrong?

NOTE: This question and answer originated from a customer support case which was handled by us. We regularly review support cases and add any helpful ones here for all to benefit from.

1 ACCEPTED SOLUTION

Accepted Solutions
Central SUPPORT
Senior II

To detect movement we recommend to use embedded wake-up feature.

Please see example configuration below:

1) write 0x27 to CTRL_REG1    // Turn on the sensor, enable X, Y and Z, ODR = 50 Hz

2) write 0x14 to CTRL_REG2    // High-pass filter enabled on data and interrupt1

3) write 0x10 to INT1_THS        // Threshold = 250 mg

4) write 0x00 to INT1_DURATION          // Duration = 0 s

5) read HP_FILTER_RESET     // Dummy read to force the HP filter to actual acceleration value (i.e. set reference acceleration/tilt value)

6) write 0x2A to INT1_CFG       // Configure desired wake-up event (X, Y and Z axis)

You can calculate LSb value of the threshold as follows:

LSb = FS/(2^7)

Example:

Full scale (FS) is set to +-2 -> LSb in INT1(2)_THS = 2/128 which is approx. 0.016 g.

So if I configure INT1_THS to 0x05, the threshold is equal to 5*0.016 = 0.08 g.

To calculate duration value you can use following formula:

Duration = N/ODR,

where N is content of the INT1_DURATION register.

Example:

ODR is set to 50Hz and INT1_DURATION = 0x05 => duration is 0.1 s.

Just a brief reminder what wakeup, threshold and duration actually mean:

Wakeup feature is to recognize when the acceleration applied along either the X, Y or Z-axis exceeds a preset threshold for defined duration (if the acceleration is above the threshold for defined duration, interrupt can be automatically generated by the sensor).

By the way, in order to detect “all�? shocks/movement you should try to increase ODR value.

View solution in original post

2 REPLIES 2
Central SUPPORT
Senior II

To detect movement we recommend to use embedded wake-up feature.

Please see example configuration below:

1) write 0x27 to CTRL_REG1    // Turn on the sensor, enable X, Y and Z, ODR = 50 Hz

2) write 0x14 to CTRL_REG2    // High-pass filter enabled on data and interrupt1

3) write 0x10 to INT1_THS        // Threshold = 250 mg

4) write 0x00 to INT1_DURATION          // Duration = 0 s

5) read HP_FILTER_RESET     // Dummy read to force the HP filter to actual acceleration value (i.e. set reference acceleration/tilt value)

6) write 0x2A to INT1_CFG       // Configure desired wake-up event (X, Y and Z axis)

You can calculate LSb value of the threshold as follows:

LSb = FS/(2^7)

Example:

Full scale (FS) is set to +-2 -> LSb in INT1(2)_THS = 2/128 which is approx. 0.016 g.

So if I configure INT1_THS to 0x05, the threshold is equal to 5*0.016 = 0.08 g.

To calculate duration value you can use following formula:

Duration = N/ODR,

where N is content of the INT1_DURATION register.

Example:

ODR is set to 50Hz and INT1_DURATION = 0x05 => duration is 0.1 s.

Just a brief reminder what wakeup, threshold and duration actually mean:

Wakeup feature is to recognize when the acceleration applied along either the X, Y or Z-axis exceeds a preset threshold for defined duration (if the acceleration is above the threshold for defined duration, interrupt can be automatically generated by the sensor).

By the way, in order to detect “all�? shocks/movement you should try to increase ODR value.

I have tried the above registers and seem there is no output at the INT1 pin when I tilted the device. Is the configuration correct?