How to find local maximum & local Minimum for the Sensor X acceleration

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

How to find local maximum & local Minimum for the Sensor X acceleration

651 Views
sakthivelkuland
Contributor III

Hi,

I'm Using the FXTH871xD TPMS Sensor for my development, Now I need to measure the X & Z acceleration and trying to find the X Acceleration Maximum and Minimum points to Send the RF Data.

But I'm not facing some algorithm implementation for finding Max & Min Points.

Wheel is rotating at 100RPM, XZ Acceleration "TPMS_READ_DYNAMIC_ACCEL_X" & "TPMS_READ_DYNAMIC_ACCEL_Z" Called every 100ms.

Please refer my source code for finding MAX & MIN.

if((u16AccelX_SearchVal > u16LocalMax))
{

if(u16AccelX_SearchVal != u16LocalMax)
{
if((u16AccelX_SearchVal - u16LocalMax) > 4)
{
Fill_RFBUFFER(0);
vfnSendRFDataRead();
}
u16LocalMin = u16AccelX_SearchVal;
u16LocalMax = u16AccelX_SearchVal;
}
}
else if((u16AccelX_SearchVal < u16LocalMax))
{
if(u16AccelX_SearchVal != u16LocalMin)
{
if((u16LocalMin - u16AccelX_SearchVal) > 4)
{
Fill_RFBUFFER(0);
vfnSendRFDataRead();
}
u16LocalMax = u16AccelX_SearchVal;
u16LocalMin = u16AccelX_SearchVal;
}
}
else
{
//do nothing
}

Please let me know if anything missed in my source and if any other way of algorithm use to find. 

Please anyone help me to resolve this problems 

Thanks,

Sakthivel K

Labels (1)
Tags (1)
0 Kudos
2 Replies

406 Views
david_diaz
NXP Employee
NXP Employee

Hello,

Thank you for writing.

I would like to recommend the procedure that I implemented at a sample project for the MAG3110.

Please review the code below, I hope algorithm gives you an idea:

max_min.jpg 

After the I take 200 samples, now I have the max and min values for the variables above.

Please let me know if I misunderstood your question.

Best Regards,

David

0 Kudos

406 Views
sakthivelkuland
Contributor III

Thanks for your response with an example.

I have got an idea by looking at your code. My intention to implement the algorithm to find the Maximum and Minimum Position of X Acceleration when a wheel is rotating.  

If found the Maximum and Minimum position then I have to transmit the RD data to Control Board for auto-location.

I have some issue when I'm using  Inbuild Sensor Firmware routine to measure the DYNAMIC ACCELERATION function.

My Code:

u8OffSetZ = 7;

u8StatusAcq |= TPMS_READ_DYNAMIC_ACCEL_Z(0u,&u8OffSetZ,gu16UUMA);

if (u8OffSetZ < 7)

u16CompAccelZ = gu16UUMA[4u];

else

u16CompAccelZ = gu16UUMA[4u]+(u8OffSetZ-7)*256;

This code when I directly take out the values from UUMA Array is always greatest values even wheel has no motion.

Please help me to take out the RAW values from the UUMA Array. Because I'm trying to find the vehicle has motion detection or motionless conditions. using  Z acceleration.

I'm looking forward your valuable response. 

0 Kudos