cancel
Showing results for 
Search instead for 
Did you mean: 

LSM303DLHC IS NOT WORKING IN PROPER WAY

srinu_svr
Associate
Posted on March 18, 2014 at 13:57

we are  working with lsm303dlhc compass sensor and  interfacing with lpc3250. we are using linux kernel version 2.6.34. and have taken driver codes (accelerometer and magnetometer) from your site. its working only one particular direction with 0 to 360 degrees angles. remaning directions its giving only 250 to 360 degrees angles only. i mentioned below what are calculations are using

accelValue[0]= accx/sqrt((accx*accx)+(accy*accy)+(accz*accz));

    accelValue[1]= accy/sqrt((accx*accx)+(accy*accy)+(accz*accz));

  pitch = asin(-accelValue[0]);

  roll = asin(accelValue[1]/cos(pitch));

xh = magx * cos(pitch) + magz * sin(pitch);

  yh = magx * sin(roll) * sin(pitch) + magy * cos(roll) - magz * sin(roll) * cos(pitch);

 heading = 180*atan2(yh,xh)/PI;

so, i request you can give me any suggestion for this problem and what are aspects need to take for solve this problem
0 REPLIES 0