6

I've bought this module

Kootek GY-521 MPU-6050 MPU6050 Module 3 Axis analog gyro sensors+ 3 Axis Accelerometer Module

My project will involve affixing this to a moving object, moving at velocities varying from 0.1 to 1.0 meters per second.

From what I understand, this module will allow me to infer rotation and acceleration, will I be able to derive velocity?

How much accuracy can I expect?

  • 3
    Attempting to integrate velocity from acceleration leads to integrating the error, ie, the error rapidly grows to the point where the result of the calculation is not so much "inaccurate" as "meaningless" – Chris Stratton Apr 6 '16 at 17:27
  • @ChrisStratton I'm pondering this as a replacement for my current prototype, which is a retractable string attached to a rotary encoder. Are you suggesting this is not feasible? – James Wierzba Apr 6 '16 at 17:32
  • I need to be accurate within at least 0.05 meters per second – James Wierzba Apr 6 '16 at 17:32
  • I don't think that will be possible. If my understanding of accelerometers is correct, they measure acceleration. Then you have a situation when the speed is constant. Acceleration = 0, according to Newton's laws. You would have to keep track of changes in acceleration then perform math to maintain the state. As Chris Stratton suggest, that will lead to keep integrating the error to the very likely situation of a meaningless value. Edit: however, I have never worked with an accelerometer before, so it can be possible at a certain extent. – fabrosell Apr 6 '16 at 18:52
6

The sensor in itself can't provide you the velocity. I have used it accelerometers in a couple of projects the easiest way to get the velocity is to constantly monitor acceleration changes and calculate velocity instantaneaously.

In order to do so follow these instruction. Pleas note that this is only 1 axis reading in actual case you will have to perform this for all three axis i.e. x,y and z.

I hope you are aware of the equation of motion (V = Vo + at)... The sensor will provide you value of acceleration at any given time. But acceleration can vary quite significantly during a huge time intervals so keep the time intervals 't' small. Lets say t = 10ms (depends on you). So calculate V after every 10ms intervale and this will give you current velocity at any given time. But what about Vo? As you know it is refered to as initial velocity so in the beginning it will be 0. Immediately after first reading when you are about to take second reading the Vo will change to the previous V calculated and hence forth.

This means Vo at any given interval is actually the V calculated in the previous interval.

I tried this method in my project when using accelerometer. hope it helps you as well.

  • Exactly. I forgot to add the Vo issue in my previous post. – fabrosell Apr 7 '16 at 12:50
  • How accurate was this? Did you verify or compare in some way? – James Wierzba Apr 7 '16 at 13:23
  • And yes, I can correctly assume start velocity of V0 = 0m/s, however it is possible that the object might get moving from 0 a,d then stay at some velocity, or close to it, and not accelerate very much. Will this be a problem? – James Wierzba Apr 7 '16 at 13:26
  • 1
    Well as long as your time delta's (intervals) are short enough that won't be a problem at all. Since this equation will provide you instantaneously velocity at any given time. If accelaration is zero at any given time that means velocity will be what it initially was. – Usama Zafar Apr 7 '16 at 19:43
  • 1
    @JamesWierzba As for how accurate. That totally depends on you accelarometer. I used a couple of them but they gave quite buggy values but they were the cheapest available. If you go for something solid then the results can me close to 100% precision. – Usama Zafar Apr 7 '16 at 19:45
4

I work with Arduino-based autopilot modules, which usually use similar sensors in addition to GPS data to maintain a reasonable estimate of its position/velocity/acceleration. If you were to add other sensors (i.e. a GPS) to your project, it might be worth looking into Extended Kalman Filters (https://github.com/simondlevy/TinyEKF), which are usually able to provide fairly accurate results.

If you're only using an accelerometer, EKF would probably be overkill, so you could look into other noise-reduction techniques. For example, using a weighted average of the last two readings:

// alpha is value between 0 and 1
acceleration = alpha * readAccelerationSensor() + (1 - alpha) * lastSensorReading

Another strategy to filter out noise would be to take multiple sensor readings at each time step and use the median value to integrate for velocity.

  • The total distance moved is no more than 1-2 meters in +Z direction so gps is no good. Are you suggesting taking 3 readings at a single point in time? Why? Is the hardware that unpredictable? – James Wierzba Apr 7 '16 at 13:25
  • 1
    Accelerometers in general are somewhat susceptible to noise from mechanical vibration of your device, so averaging the sensor readings would help to reduce the error from higher-frequency noise. Whether this is an significant issue will depend on your application (how much your device vibrates during normal operation, and how much precision you need from your velocity measurement). – naiello Apr 7 '16 at 14:38
2

I don't think that will be possible. If my understanding of accelerometers is correct, they measure acceleration. Then you have a situation when the speed is constant. Acceleration = 0, according to Newton's laws.

You would have to keep track of changes in acceleration then perform math to maintain the state. As @Chris Stratton suggest, that will lead to keep integrating the error to the very likely situation of getting a meaningless value.

However, I have never worked with an accelerometer before, so it can be possible at a certain extent.

It would be great to hear from someone who actually tried this.

0

I think that calculating the instantaneous velocity as described by Usama is the correct method so long as you can deal with the cumulative error. I would also suggest that you provide regular recalibration to deal with that (like a return to home).

However, if you are trying to calculate velocity the best method would be to use a gyroscope, not an accelerometer.

Gyroscopes were (are?) how submarines navigate underwater. To measure acceleration with gyro sensors it is of course the rate of change of the velocity. V = Vo + at and d = Vo.t + (a.t^2)/2 are your two most important formulas.

Which you choose depends upon your application. I would chose either based on whether my application is more likely to have constant velocity or frequently accelerating and decelerating. Maybe even have both...

I have not experimented with digital gyro sensors but note that there are a couple of Arduino shields available.

  • A gyro doesn't measure acceleration it measures rotation. – PimV Dec 19 '18 at 12:15
  • Rotation is by definition acceleration. A vector is speed plus direction. When you change either you are accelerating. So a gyro is measuring both speed and direction and giving you data in three dimensions. – Bryon Dec 19 '18 at 23:01
  • Gyros measure angular velocity not lineair velocity. When you accelerate a giro in a straight line you don't get any output. One gyro will only give you angular velocity in one direction (axis). – PimV Dec 21 '18 at 15:13
  • We will have to agree to disagree. Yes you are right about angular velocity - but it is angular in relation to the gravity of the earth. So any movement will record a change. That includes a straight line that is tangent to the earth or moves around the circumference in an arc. (I am not sure about how it works when moving in a straight line toward or away from the center of the earth’s mass.) – Bryon Dec 29 '18 at 23:04
  • Clarification - Texas Instruments supply solid state gyros that work in three dimensions and the application notes indicate that they can measure movement in any axis so moving directly along the line of the gravitational force must be possible. – Bryon Dec 29 '18 at 23:13
-1

Use to compass + accelerometer Use compass to eliminate g from the readings

  • 2
    Please expand upon your answer – Greenonline Oct 23 '18 at 18:00

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.