AnsweredAssumed Answered

Setting MMA8451 HPF

Question asked by Chris Hedenberg on Dec 21, 2016
Latest reply on Dec 23, 2016 by Tomas Vaverka

I'm trying set the high pass filter, and followed some of the instructions in the notes and using the arduino package already created. It works a bit, but when I lay the accelerometer flat I'm still getting some of the gravity effect (about half) in my data. I've tried to configure the settings to choose different cutoffs, but still no luck. I've seen that others on this site have nearly eliminated the effect of gravity. Here's a snapshot of my output and then my code taken, or adapted, from arduino code:

 

Output

         x,            y,            z
-1.29526,-4.54898, 1.33836
-1.29047,-4.54180, 1.31442
-1.29047,-4.54898, 1.30723

 

 

Set data rate to 2G with HPF default cutoff:

 

 uint8_t reg1 = readRegister8(MMA8451_REG_CTRL_REG1);
writeRegister8(MMA8451_REG_CTRL_REG1, 0x00); // deactivate
writeRegister8(MMA8451_REG_XYZ_DATA_CFG, 0b00001 & 0x13);
writeRegister8(MMA8451_REG_CTRL_REG1, reg1 | 0x01); // activate

 

Set data rate to 800Hz:

 

uint8_t ctl1 = readRegister8(MMA8451_REG_CTRL_REG1);
readRegister8(0x0F);
writeRegister8(MMA8451_REG_CTRL_REG1, 0x00); // deactivate
writeRegister8(0x0F, 0x00);
ctl1 &= ~(0b111 << 3); // mask off bits
ctl1 |= (0b000 << 3);
writeRegister8(MMA8451_REG_CTRL_REG1, ctl1 | 0x01); // activate

 

Set HPF:

 

uint8_t reg1 = readRegister8(MMA8451_REG_CTRL_REG1);
writeRegister8(MMA8451_REG_CTRL_REG1, 0x00); // deactivate
writeRegister8(MMA8451_REG_HPF, 0x03);
writeRegister8(MMA8451_REG_CTRL_REG1, reg1 | 0x01); // activate

Outcomes