#### Bosch Sensortec Community

cancel
Showing results for
Did you mean:

## BMA253 principe of interrupt for any-motion detection Member

## BMA253 principe of interrupt for any-motion detection

Hi Bosch Sensortech Community,

I am working with the accelerometer BMA253.  My aim is to understand how to compute activity from the interrupt.

I will go for with two cases to clearify my aim and, finally, to understand the any-motion detection.

Let's say we have  the Acceleration measurement range equal to +/- 4g and the "slope_th" equal to 5 LSB and the "slope_dur" equal to 2. We start with the accelerometer on table in a rest position. We make one and only one mouvement during 1000mS and then we return to rest position. We suppose that this move creates a slope on Z-axis higher than the threshold for 320 mS and then the slope becomes lower than the threshold. Let's work with the two following scenarios :

• scenario 1  with bandwidth 7.81Hz (or Update Time equal to 64 ms) : for this scenario, we have the number of the slope samples, that are higher than the threshold, are 5 (the result of 320 ms divided by 64 ms is equal to 5). How can I do to get an integer equal to 5 ?
• scenario 2  with bandwidth 15.63Hz (or Update Time equal to 32 ms) : for this scenario, we have the number of the samples of the slope, that are higher than the threshold, are 10 (the result of 320 ms divided by 32 ms is equal to 10).How can I do to get an integer equal to 10 ?
Thanks
Tags (3)
4 REPLIES 4  Community Moderator

## Re: BMA253 principe of interrupt for any-motion detection

Hi,

Thank you for your question. BMA253 slope (or any-motion) interrupt uses the difference between two successive samples as input, which is the current sample minus the previous sample, the next sample minus the current sample, etc. When the difference or slope is beyond the slope_th threshold for the amount of slope_dur duration, the slope interrupt will be triggered. Once the condition is no longer valid, the slope interrupt will be cleared automatically.

For example, if you set slope_th to 5 LSB at +/-4g range, then it means the slope_th threshold is 5*7.81 = 39.05mg. If you set slope_dur to 2, then it means there should be 3 samples of the difference go beyond the slope_th in order to generate the slope interrupt. If you use 7.81Hz or 15.63Hz bandwidth, then it will be very difficult for BMA253 to generate slope interrupt. You should use 1000Hz bandwidth and/or change slope_dur to 0 meaning that whnever there is one sample of the difference goes beyond the slope_th, the slope interrupt will be generated.

In addition, the slope interrupt is sensitive to tapping motion, hitting motion or fast shaking motion, etc. If you wave the device in the air slowly, then you won't be able to see the slope interrupt because the difference is not too much. What you can do is monitor the rising edge or falling edge of the slope interrupt signal on one of the two interrupt output pins to count how many times the slope interrupt has been triggered. Member

## Re: BMA253 principe of interrupt for any-motion detection

Hi,

As far as I know, the any-motion interrupt has one, and only one, output which is "slope_int". The"no_slope_int" is based on other parameters than those used for the any-motion interrupt.

When you mentionned the "rising edge" or the "falling edge", does it seem possible to check the state of the interrupt for each new acceleration sample (for  each of the three axis) ? If yes, do I need to apply a timer, before monitoring the rising/falling edge, to wait that the interrupt output will be updated fo this new sample ?

Thanks !  Community Moderator

## Re: BMA253 principe of interrupt for any-motion detection

Hi,

Yes, any-motion (or slope) interrupt has the slope_int output. No-motion interrupt also uses the difference of two successive samples as input. But the logic is opposite compared to any-motion interrupt. When the differences are within the slo_no_mot_th threshold for the amount of duration time slo_no_mot_dur, then no-motion interrupt will be triggered. If any-motion event happens before the no-motion duration ends, then the no-motion duration timer will get reset and will start counting again as long as the difference is within the threshold again.

Back to any-motion interrupt, when the difference goes beyond the slope_th for the number of (slope_dur+1) samples, then slope interrupt will be triggered. If you map this interrupt to INT1 pin or INT2 pin, then the signal on that pin will go high. If the condition is no longer valid, the signal will go low automatically. This is so called rising edge and falling edge. However, counting the number of slope interrupts is not that helpful for real applications, because single even may trigger multiple pulses of the slope interrupt signal.

Please let us know what you really want to achive. We then may be able to give you more helpful suggestions. Also please let us know your email address and where you are located.

Thanks. Member

## Re: BMA253 principe of interrupt for any-motion detection

Hi,

Thank you for your reply. I understand better the any-motion process.

I put my email address and my location within my profile.

In fact, I would like to get more information about the movement that triggered the interrupt. One of the potential information, it could be the time duration of the movement. In my case, the value "slope_dur" is not higher enough because the human movements, like a step or stride, stayed longer than "4 samples" duration. Therefore, I want to compute the number of samples while the interrupt stayed High between a rising edge and the following falling edge. Such feature will help me to monitor the daily activity of a user of the accelerometer.

I understand the risk behind the presence of "a single event that may trigger multiple pulses of the slope interrupt signal". However, event with multiple pulses could be filtered thanks to the parameters, like "slope_th" (i.e. a higher value can reduce the probability that random events trigger the interrupt) , or to the post data processing through some conditions on the time duration of the movement.