Hi all,(adsbygoogle = window.adsbygoogle || []).push({});

I've been trying to develop this excel macro for mapping out a train track and locating kinks.

It's been going well so far except that when the accelerometer is not exactly level with the ground, the acceleration due to gravity (9.8 m/s^2) is not only effective in the z-direction, but in the x and y as well since the whole co-ordinate system of the accelerometer is tilted.

Now, I have the x-tilt and the y-tilt angles and am trying to fix this problem.

Please have a look at the excel sheets I have attached. Starting from row 13 in B, C and D, I have the acceleration values in g (with 1g = 9.8m/s^w) and the tilt angles are in columns G and H.

I've thought about this for a while and came up with the following formulas for acceleration.

new_x_acceleration = old_x_acceleration + sin(x_tilt)

new_y_acceleration = old_y_acceleration + sin(y_tilt)

new_z_acceleration = sqrt (1 - (new_x_acceleration)^2 - (new_y_acceleration)^2)

These seem right but when I apply these formulas (run the calibrator macro i programmed replaces the originals) the values seem very implausible. They are on the order of 10^-16 or less.

Any thoughts on what I'm doing wrong?

**Physics Forums | Science Articles, Homework Help, Discussion**

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Calibration of a 3-Axis Accelerometer for fixing effect of gravity

**Physics Forums | Science Articles, Homework Help, Discussion**