Use accelerometer and magnetometer