Accelerometer Performance


#1

Hi there. I’ve noticed that the accelerometer registration of motion is extremely hit-or-miss: If I move it in any direction, it only detects the motion maybe 20% of the time. It’s collision detection is always spot on, though: if I tap the PropBoard, the motion always registers.

I’m wondering if this might have to do with the accelerometer’s power requirements. I’m currently using 4 AAA batteries as a power source; perhaps this doesn’t provide enough power to continually power the accelerometer, resulting in poor performance? Or perhaps my accelerometer is defective? Help would be much appreciated.

I can upload a video if that would help.


#2

Hi @Joecool,

The power for the accelerometer is already regulated on-board. Accelerometer responsiveness depends mostly in the parameters passed to functions like configTransient.

You can try different settings for the swing of the demo code like, for example, replacing the line:

Motion.configTransient(AxisAll, 0.1f, 120, MotionInterrupt2);

with

Motion.configTransient(AxisAll, 0.5f, 50, MotionInterrupt2);

that works OK in my saber build.

The configTransient function configures the accelerometer sensitivity for transients, that are used to trigger swings.
The configPulse function configures the sensitivity for pulses, that are used to trigger hits/clashes.


#3

Holy cow, it works perfectly now! Thank you so much, Ivan!