Getting displacement from accelerometer data with Core Motion
stackoverflow.com