Accelerometer tilt error correction

3D trigonometry is your friend (!) You have a 3-axis accelerometer so you have the full 3D vector to play with. Determine the direction of maximum oscillation by taking some measurements and then you just have to resolve in that direction thereafter by taking the vector dot-product.

Say your oscillation is in a direction given by x=50, y=7, z=-4, then you just calculate:

product = (50.0x +7.0y - 4.0z) / sqrt (5050 + 77 + 44)

to get a single number representing the acceleration in that particular direction.