Convert raw data to tilt angle value

Discuss mobile apps for Texas Instruments products.
Posts: 5
Joined: 18:53, 01 Jul 2015

Convert raw data to tilt angle value

Postby robypez » 21:02, 04 Jul 2015

Hello, I'm creating my app.
I obtain with your api from the sensortag some value +/- 2.5, but I need to convert these value to degree. I want to check the tilt angle...

Any idea?


Posts: 58
Joined: 16:13, 28 May 2014

Re: Convert raw data to tilt angle value

Postby ardiri » 02:14, 09 Jul 2015

the tilt raw value should be between -1.0 and +1.0

you would need to understand what the raw data values actually mean; there is a good discussion of this on another forum: ... gyrometer/

you will need to figure out if the relationship between 0 and +1 and -1 and 0 are linear in nature and map them to an angle between 0 and 90. maybe you can start a logging of raw values.. with different degree increments.. either find a pattern; or use a lookup table to convert the raw data into angles. there was a similar discussion on stack overflow which may shed some better light into how to map between raw and angles. ... elerometer

Code: Select all

float calcInclinationAngle(int iDataPos)
  float xVal = fAccel[0][iDataPos];
  float yVal = fAccel[1][iDataPos];
  float zVal = fAccel[2][iDataPos];
  float pitch = 0;
  //Pitch in radians
  pitch = atan2(xVal, sqrt(pow(yVal,2)+pow(zVal,2)));
  //Pitch in degrees
  pitch = pitch * 180/PI;
  return pitch;

you need to make sure the raw values are between -1.0 and +1.0 - if you are receiving other values you'll need to map them to this range.
// Aaron
Chief Technology Officer
Evothings AB

Return to “Texas Instruments”

Who is online

Users browsing this forum: No registered users and 1 guest