I'd like to calculate the compass bearings but I have an interogation on what is LSB data and how to find it with my phidget spatial 3/3/3 basic
This is an exemple I found on how to use a magnetometer to calculate the compass headings. If you could help me on the LSB thing it would really help.
Calculate the real Gauss value for the X and Y axes from the amount of LSBs returned where the LSB value by default is 0.48828125 mG, resulting in 2048 LSBs per Gauss.
xGaussData = xDataLSB∗0.48828125 mG
yGaussData = yDataLSB∗0.48828125 mG
Calculate the direction D by first checking to see if the X Gauss data is equal to 0 to prevent divide by 0 zero errors in the future calculations. If the X Gauss data is 0, check to see if the Y Gauss data is less than 0. If Y is less than 0 Gauss, the direction D is 90 degrees; if Y is greater than or equal to 0 Gauss, the direction D is 0 degrees.
If the X Gauss data is not zero, calculate the arctangent of the Y Gauss and X Gauss data and convert from polar coordinates to degrees.
D = arctan(yGaussData/xGaussData)∗(180/π)
If the direction D is greater than 360 degrees, subtract 360 degrees from that value.
If the direction D is less than 0 degrees, add 360 degrees to that value.
The compass heading can then be determined by the direction value D:
If D is greater than 337.25 degrees or less than 22.5 degrees – North
If D is between 292.5 degrees and 337.25 degrees – North-West
If D is between 247.5 degrees and 292.5 degrees – West
If D is between 202.5 degrees and 247.5 degrees – South-West
If D is between 157.5 degrees and 202.5 degrees – South
If D is between 112.5 degrees and 157.5 degrees – South-East
If D is between 67.5 degrees and 112.5 degrees – East
If D is between 0 degrees and 67.5 degrees – North-East