I'm using MPU9250 which has both accelerometer and gyroscope in a vehicle. What I want is to just know that if the vehicle is currently moving or not. I searched and find out that I can't get velocity easily so I skipped that but I was wondering how can I found movement with an IMU.

Edit: As @Duncan said, it seems that it cannot be examined with only IMU. I also have a GPS sensor in my device and having the speed value from GPS but it is not very accurate. For example, if the vehicle is stopped for 5 minutes I get variable speeds between 0 to 10.0 kmph and on the other hand getting the location as lat/long has about 20 meters error. So I can't really rely on it. I was wondering can I combine both GPS and IMU to find out if it is really moving or not? One solution that I came was relying on GPS speed but for spikes just check the accelerometer variations and if it is beyond a threshold, it means that it actually moved.

  • 1
    You can't measure velocity with an accelerometer and gyroscope.There is no way to tell if you are sitting still or traveling on a smooth road at 200kph when you start taking readings. Vibration is the only thing you can measure, and a parked car with a rough idle might show more vibration than a smoothly running car traveling at 100kph. There is really no way to tell. – Duncan C Jan 29 '19 at 18:42
  • @DuncanC Thanks, I've edited the question. – M. R. Jan 29 '19 at 20:08

You noted that your goal is to determine whether or not a vehicle is in motion. Because you are trying an IMU, I assume the device that needs to know this is on-board the vehicle.

There are many complicated ways to know this, such as using the acceleration data from the IMU to perform Inertial Dead Reckoning, this has the problem of temporal drift. A GPS has the issue of needing it's speed data to be filtered a bit to get rid of high-speed spikes.

But -- if you just need to know if the vehicle is moving or not, and if the vehicle has wheels, you can use an light detector, such as an IR emitter and IR receiver pair, along with a slitted disc attached to the wheel, and simply count when the last time the receiver was activated -- if beyond some threshold of time, then you assume the wheel is not turning, and thus that the vehicle is not moving. Or perhaps just use a light sensor and paint white and dark patterns on the wheel.

Or put a magnet on the wheel and place a hall effect sensor (magnet sensor) near where the magnet will pass. Count the pulses from the hall effect sensor.

If the vehicle is not a wheel-based vehicle, then you may have to rely on GPS or some other method, however.

  • 1
    Unless you know for certain that the vehicle is stationary when recording begins, you don't have a frame of reference for Inertial Dead Reckoning. You can't know if the vehicle is stationary or traveling at 100kph, as I mentioned in my comment. Also, with typical low cost accelerometer and gyroscope units, measurements are not accurate enough, and drift quickly swamps actual velocity calculations. – Duncan C Jan 29 '19 at 22:22
  • Indeed -- which is why my answer steered away from that and toward something more concrete. – jose can u c Jan 29 '19 at 22:27
  • You are right but, I can't add sensors. I don't need accurate accuracy and I need to solve this problem with only IMU and GPS. – M. R. Jan 30 '19 at 3:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.