Anyone have any luck setting up freefall interrupts for the 6050? Looks like they've omitted (deleted?) all information about it in the register map and datasheet. From looking through Jeff's library and seaching the web, I've called the following functions from the MPU6050 library, but am getting pretty iffy free fall detection, more like crappy tap detection at best. Also, I see definitions for ...FF_COUNT_BIT and ...FF_COUNT_LENGTH values, but have no idea what writing to those registers does. Any thoughts?
Thanks,
Jon
accelgyro.setInterruptMode(1); // active low
accelgyro.setInterruptDrive(1); // open drain
accelgyro.setInterruptLatch(1); // latch until read
accelgyro.setInterruptLatchClear(1); // clear on any read
accelgyro.setIntDataReadyEnabled(false); // trigger interrupt on data ready
accelgyro.setIntFreefallEnabled(1);
accelgyro.setFreefallDetectionThreshold(0x10); //I've tried lots of different values here
accelgyro.setFreefallDetectionDuration(0x05); // and here!!
The whole code for my basic trial sketch is:
#include <Wire.h>
#include <MPU6050.h>
#include <I2Cdev.h>
int pin = 13;
volatile int state = LOW;
MPU6050 accelgyro; // Declare the instanced of the MPU6050
void setup()
{
Wire.begin();
Serial.begin(9600);
pinMode(pin, OUTPUT);
attachInterrupt(1, blink, RISING);
accelgyro.setInterruptMode(1); // active low
accelgyro.setInterruptDrive(1); // open drain
accelgyro.setInterruptLatch(1); // latch until read
accelgyro.setInterruptLatchClear(1); // clear on any read
accelgyro.setIntDataReadyEnabled(false); // trigger interrupt on data ready
//Free Fall interrupt
accelgyro.setIntFreefallEnabled(1);
accelgyro.setFreefallDetectionThreshold(0x10);
accelgyro.setFreefallDetectionDuration(0x05);
}
void loop()
{
}
void blink()
{
state = !state;
digitalWrite(pin, state);
Serial.println(" Free fall Detected");
}