Jump to content
I2Cdevlib Forums

Free Fall interrupts


Recommended Posts

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");
}
Link to comment
Share on other sites

  • 5 years later...

Have you been able to work this out? I need a program for school that gives me an interrupt when a person with this sensor attached to his waist falls, and only when it gives an interrupt does it have to read sensor values. I can't however find a solution for this, was hoping you could help.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...