Hi neskweek,
Yesterday I've been experimenting again with the clash detection, because it still seems to be not as responsive as it should be. I looked at the code and also read the MPU6050 Manual, all about motion interrupts.
It seems there are only 4 parameters playing a roles:
These settings change the full scale range of the accelero/gyro (not yet in LSOS...). These should change the sensitivity of the saber because an LSB is scaled with full range.
// set the fll scale range of the gyro- and accelerometer respectively
mpu.setFullScaleGyroRange(0); //0: 250deg/s | 1: 500deg/s | 2: 1000deg/s | 3: 2000deg/s
mpu.setFullScaleAccelRange(0); //0: 2g | 1: 4g | 2: 8g | 3: 16g
Then there are the settings for the motion interrupt. The first one sets the threshold, but no idea how...I guess the number means LSB. But it's strange, with a setting of 10, we should hear clash triggering all the time even if we just shudder.
mpu.setMotionDetectionThreshold(10); // 1mg/LSB
mpu.setMotionDetectionDuration(1); // number of consecutive samples above threshold to trigger int
I experimented with following things (using 2 sabers both with DIYino):
- set mpu.setFullScaleAccelRange(0) and mpu.setFullScaleGyroRange(0) once to 0 and once to 3 (2 extreme values) -> no change in the clash detection, no tangible effect on other motion detection
- play with mpu.setMotionDetectionDuration(1) -> no change in clash detection
Funny thing is, my LED string saber is no (without any change) very responsive, even small taps will trigger clash (the right way!), while my new neopixel saber (using also DIYino) sometimes even fail to detect quite hard hits...I re-calibrated both MPUs and also tried with a sketch what they read, they read and are calibrated both perfectly.
So I feel we still do not fully understand how this motion interrupt feature works...although clash is by far the most important feature of a saber (besides the LEDs).
It is more a fundamental topic, not an immediate bug, but I did not find a better place to report/discuss.
Cheers: Andras