title: Differentiate between braking and accelerating on Android
body: <p>I am trying to write an app that needs to be able to tell if a vehicle is accelerating or breaking. In this sense I used the accelerometer in the phone. At the moment I managed to isolate and subtract the gravitational pull of the earth from my readings and I am using a noise variable to ignore minor changes (smaller than 10^-2).</p>
  
  <p>In order to compute the acceleration relative to the ground I am using the following formula sqrt(Lx^2+Ly^2+Lz^2), where Lx represents the linear acceleration along the x-Axis in m/s^2.</p>
  
  <p>My problem is: How do I differentiate between braking and accelerating, as my final acceleration value will always be greater than 0. Also I need this to work even if the vehicle accelerates -> maintains speed -> brakes/accelerates some more. Is my reasoning wrong? Have I made some false assumptions? Would another way be better? The phone I am using for development also has a gravity sensor and a gyroscope.</p>