×

SparkFun Electronics will be closed in observance of memorial day on Monday, May 29th. We will resume normal business hours on Tuesday, May 30th. Any orders placed after 2pm Mountain Time on Friday, May 26th will process and ship out on Tuesday, May 30th.

Member #397993

Member Since: January 13, 2013

Country: United States

  • I am using the MMA8452Q Triple Axis Accelerometer Breakout on a breadboard circuit that is connected to a mini-Bully PIC24HJ64GP502 (no longer sold by Spark Fun) to detect motion of the board. As long as my MMA8452Q is situated in a horizontal plane when I download its code from the PIC24 microcontroller, it seems to work fine (i.e., the I1 pin outputs a 3.3 volt signal when the breadboard is moved, and it outputs zero volts when motionless). However, if the MMA8452Q is not situated in a horizontal plane during downloading of its code, it does not function appropriately (i.e., the I1 pin constantly outputs 3.3 volts whether there is motion of the breadboard or not). This is important because my application circuit will eventually be connected to my wrist when first activated, and then worn throughout the night while I sleep (I just need to know when motion occurs, not any of the characteristics of the motion).

    I have set the MMA8452Q’s registers thus:

    write2I2C1(MMA8452Q_ADDR, FF_MT_CFG, 0x78); // ELE=0, OAE=1, ZEFE=1, YEFE=1, XEFE=1 write2I2C1(MMA8452Q_ADDR, FF_MT_THS, 0x8F); // DBCNTM=1, THS[6:0]=15 threshold=(15)x(0.063g)=0.945g write2I2C1(MMA8452Q_ADDR, FF_MT_COUNT, 0xFF); // 0xFF=255(decimal), ODR=800Hz, debounce time=(1.25/1000)x(255)=0.319 second write2I2C1(MMA8452Q_ADDR, CTRL_REG1, 0x04); // ODR=800HZ, LNOISE=1, F_READ=0, ACTIVE=0 (STANDBY mode) write2I2C1(MMA8452Q_ADDR, CTRL_REG2, 0x00); // disable SELF TEST, disable RESET, OVERSAMPLING MODE (Normal), disable auto-SLEEP write2I2C1(MMA8452Q_ADDR, CTRL_REG3, 0x08); // enable FF_MT wake up, IPOL=0(interrupt polarity=active low), enable PUSH PULL write2I2C1(MMA8452Q_ADDR, CTRL_REG4, 0x04); // disable auto SLEEP/WAKE interrupt, enable FF_MT interrupt write2I2C1(MMA8452Q_ADDR, CTRL_REG5, 0x04); // FF_MT interrupt output signal assigned to INT1 pin of MMA8452Q write2I2C1(MMA8452Q_ADDR, CTRL_REG1, 0x05); // now place MMA8452Q (accelerometer) in ACTIVE mode to detect motion

    Can anyone advise me as to how to get the MMA8452Q to work properly no matter its spatial orientation when initially programmed by the microcontroller?

    Thanks

No public wish lists :(