Hello,
I want to use the Motion Detection Interrupt to wake my board from sleep mode. Ideally, this should happen in low-power Cycle Mode. I see the the MOT_DET interrupt if I am operating w/o the cycle bit set (PWR_MGT_1:5), but when I enable the bit, no MOT_DET interrupt.
I have tried all 4 Cycle Mode frequencies with no interrupt generated in any of them.
Also, I get no data in the FIFO when operating in Cycle Mode. Is this correct?
Questions:
1) Do motion detect interrupts (or FF or ZDet for that matter) work in Cycle Mode?
2) If they do, what setting am I missing?
3) Is it correct behavior for the FIFO to not be accumulating data in Cycle Mode?
My code looks like:
...
...
print 'MPU6050 present at address 0x%02X' % sensor.find()
sensor.enableMDT()
sensor.runLowPower(20)
while True:
byte_count=sensor.getFIFOCount()
print 'MPU6050 Active: FIFO count = %d INT_STAT=0x%02X' % (byte_count, sensor.getIntStatus()
if byte_count>=24:
try:
#thisData=sensor.readFIFO(byte_count)
#data+=thisData
# print thisData
pass
except:
sensor.resetFIFO()
if sensor.isMotionDetected():
print 'Motion detected'
sleep(0.10)
...
def enableMDT(self):
# Configure motion detection
self.write (PWR_MGMT_2, 0xC7) # Make sure accels are enabled.
self.write (INT_PIN_CFG, 0xA0) # Make it a push/pull latch, active LO.
self.write (INT_ENABLE, 0x40) # Enable motion detect interrupt
self.write (MOT_THR, 0x01)
self.write (MOT_DUR, 0x01)
self.write (MOT_DETECT_CTRL, 0x03)
print 'Motion detection enabled'
def runLowPower(self, samplingRate):
# Set the sampling rate
self.write (CONFIG, 0x04) # Disable FSYNC and set digital filter to 21Hz, no FSYNC
self.write (PWR_MGMT_1, 0x28) # Enter Cycle Mode, disable Temp, and use internal osc.
self.write (PWR_MGMT_2, 0x07) # Enable only the accel axes and set LP SR to 1.25Hz
self.resetFIFO() # Resets the contents of the FIFO.
self.write (FIFO_EN, 0x08) # Push accel data into FIFO.
self.clearFIFO()
self.cycleMode = 1
print 'Beginning low power accel sampling.'