TAP CONFIGURATION FOR MMA8451Q

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

TAP CONFIGURATION FOR MMA8451Q

2,140 Views
harry2220
Contributor II

Hi,

                   In my application I am using MMA8451Q Accelerometer, I need to enable all the 3 Axis and when there is change in any of the axis i need to get an interrupt, its my acctual need. So, i have configured orientation , FreeFall , Motion , Vibration But could not get the desired output as per my need. I went through AN 4072, Tap Detection all axis , will it full my requirement..?

                   In motion and vibration registers i couls not able to enable all the axis .. even after correcting the OFFSET Calibration Reg. could i know Why. As i dont have much Knowledge on  Accelerometer. Please give some Guidance So, That i go further.

Labels (2)
17 Replies

1,143 Views
anthonyduhamel
NXP Employee
NXP Employee

Hello Harry,

Your actual need seems to be a Motion Detection right?

I suggest you to use (only) the Transient Detection with High-Pass Filter feature embedded into the MMA8451Q:

Capture.PNG

The high-pass filter will remove all acceleration offsets as the 1-g earth gravity.

Anthony

1,143 Views
harry2220
Contributor II

Hai Anthony,

                              Thanks for reply, yeah my actual need is to detect motion , but when the accelerometer is moving very slowly i could not get interrupt.

/* Threshold Setting Value for the Motion detection of > 0.063g */

  u8RegVal = 0x01;

  i2cWrite (0x1C,0x17, u8RegVal);

  /* 50Hz /20 ms (steps) = 2.5 = 2 counts */

  u8RegVal = 0x03;

   i2cWrite (0x1C, 0x18, u8RegVal);

i have put very least values But Still , it could not identify the small movement . in my application it has to detect even a small change .

0 Kudos

1,143 Views
anthonyduhamel
NXP Employee
NXP Employee

Hello Sunny,

Did you get an interrupt when you're moving quickly the accelerometer? If not, you probably forgot to configure CTRL_REG3,4 and 5.

Let me know.

Anthony

0 Kudos

1,143 Views
harry2220
Contributor II

Yeah , I could get if i move Quickly. i am bit confused in this registers could i get clarity about this

Register 0x26: PULSE_TMLT Pulse Time Window 1 Register

4.4 Register 0x27: PULSE_LTCY Pulse Latency Timer Register

4.5 Register 0x28: PULSE_WIND Second Pulse Time Window Register

what is Relation between Registers, Help me out i am much confused.

Motion_Detection()

{

RegVal = 0xC7;

  /* Set Sample Rate at 50Hz */

  RegVal = CTRL_REG1_ODR_50HZ;

  i2cWrite (SS_BSP_ACC_MMA8451Q_ADDRESS,CTRL_REG1, RegVal);

as per position of the Accelerometer i am enabling the X,Y,Z Axis.

any two axis i could enable not all 3.

RegVal = 0x01;

  i2cWrite (MMA8451Q_ADDRESS,0x17, RegVal);

u8RegVal = 0x03;

i2cWrite (MMA8451Q_ADDRESS,0x18, RegVal);

}

Trans_Detection()

{

as per position of the Accelerometer i am enabling the X,Y,Z Axis.

any two axis i could enable not all 3.

RegVal = 0x01;

  i2cWrite (MMA8451Q_ADDRESS,0x1F, RegVal);

u8RegVal = 0x03;

i2cWrite (MMA8451Q_ADDRESS,0x20, RegVal);

}

0 Kudos

1,143 Views
harry2220
Contributor II

Hai Anthony,

                                   As per my need I hope Single/ Double tap Detection will help me out. I went through AN4702, In Tap detection i can enable all 3 Axis , and can enable Tap Interrupt to detect minimal changes i hope, Could you please tell me could i go for it. As i am new to this Accelerometer i am bit confused. Thanks for you reply and help.

0 Kudos

1,143 Views
anthonyduhamel
NXP Employee
NXP Employee

AN4072 describes all register values you need to enable the Single/Double Tap Detection  page 15.

Anthony

0 Kudos

1,143 Views
harry2220
Contributor II

Hai Anthony,

                              Thanks for Your reply, Yeah I have configures CNTRL_Reg 3,4,5 to get an interrupt and I have done configurations given in AN4072, but no result. Like as you have told me to enable the High Pass Filter. I have done , but Its not effective. Actually I have to configure in such a way that if i slowly move the device i should get an interrupt. Please tell me how could i do it. I configured registers for tap detection as give in the An4072, is there any thing to change. Please suggest me

0 Kudos

1,143 Views
harry2220
Contributor II

Hai Anthony,

                              I went through the Below link

Using Accelerometer in Windows* Style App and a Case Study of Tap Detection | Intel® Developer Zone

In the Figure 2 and 3 as they have read the minimal tap changes , in the save way even i need to detect the change of Axis. Please tell me how could i do it. Please ref the link.

0 Kudos

1,143 Views
anthonyduhamel
NXP Employee
NXP Employee

Hello,

Sorry but I'm a little bit confused... Do you need a motion detection OR a tap detection OR both? Can you share with me you configuration (I mean the code to initialize the MMA8451Q)?

Quick configuration for the motion detection:

RegisterValueComment
CTRL_REG1 (0x2A)0x00Set the MMA8451 into STANDBY MODE
CTRL_REG2 (0x2B)0xXXYou chose
CTRL_REG3 (0x2C)0x40Enable Transient function on an INT pin / INT active low/ Push-Pull
CTRL_REG4 (0x2D)0x20Enable Transient function
CTRL_REG5 (0x2E)0x20INT pin routed on INT1 pin (can be changed to 0x00 if INT2  pin)
TRANSIENT_CFG (0x1D)0x1EINT flag latched/ Enable 3axis detection/ HPF linked to the Transient function
TRANSIENT_THS (0x1F)0xXXDepends on the sensitivity needed for detection (0.063g/LSB)
TRANSIENT_COUNT (0x20)0xXXNumber of TRANSIENT events catched after send interrupt
HP_FILTER_CUTOFF (0x0F)0xXXSelect the filter cutoff here
CTRL_REG1 (0x2A)0b00XXX001Replace XXX by the needed data rate / Put the device into ACTIVE MODE

Anthony

0 Kudos

1,143 Views
harry2220
Contributor II

Hai Anthony,

                                   Thanks For your reply, My actual need is to get an Interrupt if the Accelerometer is slowly moved , it may be motion or trans or Tap, But i should a interrupt when any small change in any axis. please Guide me how could i do it but i have do it interrupt mode not in poling method by reading the X,Y &Z values .You suggest me in which method i should in go.I could get an Interrupt when i move the Accelerometer fast but slow if i do it i could not get That's the problem . Please tell me how could i get it

0 Kudos

1,143 Views
anthonyduhamel
NXP Employee
NXP Employee

Use the TRANSIENT feature. Configure the MMA8451Q as I explained above in the table, in the same order.

Anthony

0 Kudos

1,143 Views
harry2220
Contributor II

Yeah, Anthony i have done in same but no expected results.

On Thu, Feb 18, 2016 at 6:32 PM, anthonyduhamel <

0 Kudos

1,143 Views
harry2220
Contributor II

Hai Anthony,

Please Look at this code

i2cWrite (MMA8451Q_ADDRESS, CTRL_REG1, 0x00);

i2cWrite (MMA8451Q_ADDRESS, CTRL_REG2, 0x09);

i2cWrite (MMA8451Q_ADDRESS, CTRL_REG3, 0x40);

i2cWrite (MMA8451Q_ADDRESS, CTRL_REG4, 0x20);

i2cWrite (MMA8451Q_ADDRESS, CTRL_REG5, 0x20);

i2cWrite (MMA8451Q_ADDRESS, 0x1D, 0x1E);

i2cWrite (MMA8451Q_ADDRESS, 0x1F, 0x01);

i2cWrite (MMA8451Q_ADDRESS, 0x20, 0x03);

i2cWrite (MMA8451Q_ADDRESS, 0x0F, 0x00);

i2cWrite (MMA8451Q_ADDRESS, CTRL_REG1, 0x1C);

As you have told i have configures in the same way.

i could get an interrupt if i move quick, but i could not get interrupt if i move slowly the accelerometer.

0 Kudos

1,143 Views
anthonyduhamel
NXP Employee
NXP Employee

Reset TRANSIENT_COUNT (0x20) register to 0.

The CTRL_REG1 value you used is very strange, 0x1C = 0b0001 1100  --> the LSB bit is reset so the sensor is in standby mode. You have to set this bit at the end...

So I suggest to replace the last line by

i2cWrite (MMA8451Q_ADDRESS, CTRL_REG1, 0x21); // ODR=50Hz / Active Mode

Anthony

0 Kudos

1,143 Views
harry2220
Contributor II

Hai,

                              I tried both configurations, but could not get an interrupt for slow in the sense (very slowly) movement. If Moves quickly its perfectly working. I as per Customer requirement i have to configure for slow Movement detection. Could you help in this way.

0 Kudos

1,143 Views
anthonyduhamel
NXP Employee
NXP Employee

Hi,

Unfortunalty, you probably reached the MMA8451Q limitation. The minimum motion dectection theshold is 0.063g. If you want to detect acceleration under this value with the embedded feature, it is not possible.

The last thing you can try is to change the high-pass filter cut-off. For slow motion detection it could help.

i2cWrite (MMA8451Q_ADDRESS, 0x0F, 0x03);

You can also increase the data rate to 800Hz and check if it's better, but not sure

i2cWrite (MMA8451Q_ADDRESS, CTRL_REG1, 0x01);

Anthony

0 Kudos

1,143 Views
anthonyduhamel
NXP Employee
NXP Employee

What do you mean by no expected results? Did you obtain an interrupt?

I can help you anymore if you're not more explicit.... So please put clearly what you've been tested.

Put your full code for the Transient detection configuration you tried, I will take a look at..

Anthony

0 Kudos