8

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?

James Wierzba
  • 229
  • 1
  • 3
  • 9

5 Answers5

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.

usamazf
  • 196
  • 1
  • 6
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.

naiello
  • 91
  • 1
1

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.

fabrosell
  • 216
  • 1
  • 2
  • 9
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.

Bryon
  • 101
-1

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