Information from orientation sensors such as gyroscopes and magnetometers can be used for various applications such as positioning and tracking, activity and gesture identification, and so on. However, gyroscopes require frequent calibration to correct for errors due to factors such as bias, scaling and misalignment. These factors may vary with temperature making a one-time calibration ineffective. A common calibration technique is to detect when the device is at rest and calibrate the sensors. This calibration technique may, however, require a relatively long time to complete. Another sensor, a magnetometer, is sensitive to local magnetic fields, that are common in indoor environments, and can provide incorrect orientation.