blckdmp Posted June 5, 2013 Report Share Posted June 5, 2013 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"); } Quote Link to comment Share on other sites More sharing options...
blckdmp Posted June 7, 2013 Author Report Share Posted June 7, 2013 Found the old version of the datasheet with more interrupt information. Much more useful than the current one!! Thanks to Jeff for the detailed register map also. Think I can muddle my way through this now. Jon Old datasheet for MPU 60X0 http://www.cdiweb.com/datasheets/invensense/PS-MPU-6000A.pdf Quote Link to comment Share on other sites More sharing options...
Jeff Rowberg Posted June 8, 2013 Report Share Posted June 8, 2013 I'm glad to hear that! I haven't actually worked with freefall detection at all, so I wouldn't be able to provide much help myself. I hope you are able to find some help in the older datasheets. Quote Link to comment Share on other sites More sharing options...
Tom1235 Posted April 15, 2019 Report Share Posted April 15, 2019 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.