Position calculations with accelerometer