We are using BMA400 based device inside a car and trying to detect if the car is in motion or stationary. There is a built-in API to detect the activity state:
bma400_get_steps_counted(&step_count, &activity, &bma_device)
The 'activity' variable returns 3 possible values: a) BMA400_STILL_ACT, b) BMA400_WALK_ACT and c) BMA400_RUN_ACT
The above solution appears to meet the requirements as case a) will mean 'stationary' while b) or c) will mean 'in-motion'. It works fine testing on my desktop, however, not while driving a car.
Can someone comment however to use this API while using the device inside a car? Maybe some configuration parameters? There are two sets of configuration options (24 register values, STEP_COUNTER_CONFIG) available for wrist and non-wrist scenarions. Already tried non-wrist option.
Appreciate help! Our preference is to utilize built-in APIs rather than coming up with our own customer algorithm using raw accelerometer axis values
a) BMA400_STILL_ACT, means the there is no steps detected, which may not means quiet.
b) BMA400_WALK_ACT and c) BMA400_RUN_ACT, means real human walking or running steps.
So far as i know your use case, the step counter may not be so suitable for detecting a car is in no motion.
here i would like to recommand the generic interrupt, which can be configured as detect:
1. the quiet/stationary of the car
2. continuous slope/vibration of a moving car
3. if placed in a proper position in the car, it might also possibly detect the vibration of the motor, given proper threshold and duration parameter to this function.
it is triky to use the proper parameters for this generic interrupt, which you need to fine tune them.
and you can also use the combination of step counter + generic interrupt.