Pages: 1 ... 23 24 [25] 26 27 ... 37   Go Down
Author Topic: Guide to gyro and accelerometer with Arduino including Kalman filtering  (Read 297927 times)
0 Members and 2 Guests are viewing this topic.
Los Angeles
Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Lauszus,

Like the many others, I got my IMU working by studying at lot of your hard work, just wanted you to know that I really appreciate it!
I have a question, with the project I'm working on - I need to filter out the accel data that is affecting the
Kalman output such as when the IMU is under accel in any of the 3 axis. For example while placing the IMU
on a rotating platform, the addition of of the X or Y accel vectors start to affect the roll
and pitch angles. What do you recommend to eliminate these bias errors for when the IMU is not stationary and under accel/decel?

-futureM
Logged

Denmark
Offline Offline
Sr. Member
****
Karma: 10
Posts: 287
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

@futureM
That's the whole purpose of the Kalman filter. If you are not satisfied with the performance as it is right now, then you have to tune the values.
See my blog for more information: http://blog.tkjelectronics.dk/2012/09/a-practical-approach-to-kalman-filter-and-how-to-implement-it/
Logged

Austria
Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Lauszus,

I'm working with the Quaternion Values getting from the DMP of the MPU6050. i've some problems to get a full 360° Range.
Maybe you have a hint to convert the DMP Quaternion Values to Degrees. Normally the calculation is based on the Sensitivity Scale Factor for both Gyro and Accel. I'm correct?
But i'm getting one fusion Value of the Gyro and Accel. So i don't now how to convert this to a 360° Range ....

Why do you not use the DMP Values like Quaternion?
Is it better to work with raw Vaules and Kalman Filter?

With atan2 i should get the 360°:
 mpu.dmpGetQuaternion(&q, fifoBuffer);
 Serial.print((atan2(q.y,q.z)+PI)*RAD_TO_DEG);

but if i move the MPU6050 90° i get on the Serial only 70°

many Thanks!
« Last Edit: January 15, 2013, 07:48:54 am by triplenox » Logged

Denmark
Offline Offline
Sr. Member
****
Karma: 10
Posts: 287
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

@triplenox
I have never used the DMP on the MPU-6050 before as I thought it were a bit overkill as I usually only need the angle in one of the axis.

You can't use atan2 or anything like that on Quaternions!

To use Quaternions see the following recourses:
Logged

morocco
Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hello , i'm working on the same subject , and it's my first time i use the ARDUINO uno AND the IMU 6050s ,
i'm a beginner, now i try to finish the mechanical par ,
it'is possible to give my the full code, because it's a subject that i must give to the school , and the mechanical part it took a lot of time to built,
please i wayit for somewone to help my.
and thank you four your solidarity
Logged

Denmark
Offline Offline
Sr. Member
****
Karma: 10
Posts: 287
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

@aziz-qessate_arduino
Hi,

I can't write all the code for you, but for now take a look at this example code I wrote: https://github.com/TKJElectronics/Example-Sketch-for-IMU-including-Kalman-filter/blob/master/IMU6DOF/MPU6050/MPU6050.ino
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So here's the issue I'm running into. I'm using Lauszus' code to try and set up a self stabilizing camera system. Although what I am finding is that the kalAngleX value is greatly effected by any acceleration in the z axis. If I shake the MPU6050 up and down the servo just goes crazy. When I hook it up to the bike the bumpiness of the road basically ruins it. I though that was the whole point of kalman filtering was to minimize this?
Logged

Offline Offline
Faraday Member
**
Karma: 62
Posts: 3031
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You have run into the fundamental problem,  that no scheme based on accelerometers can
distinguish between movement acceleration and gravity acceleration.
Logged

Denmark
Offline Offline
Sr. Member
****
Karma: 10
Posts: 287
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

@ezikiel12
You have to tune the Kalman filter. See my blog post on how to do so: http://blog.tkjelectronics.dk/2012/09/a-practical-approach-to-kalman-filter-and-how-to-implement-it/
The problem is that you are trusting the measurements from the accelerometer too much.

Or you could try to tune a complimentary filter to start with.

@michinyon
That's the whole point of the filter smiley-wink
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 72
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

How if i connect IMU to my Arduino Board using I2C ? How to read and filter it?
Logged

Denmark
Offline Offline
Sr. Member
****
Karma: 10
Posts: 287
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

See this code I wrote a while back: https://github.com/TKJElectronics/Example-Sketch-for-IMU-including-Kalman-filter/blob/master/IMU6DOF/MPU6050/MPU6050.ino for the MPU6050

And here is some code for the ITG3205/ITG3200 gyroscope and ADXL345 accelerometer: https://github.com/TKJElectronics/Example-Sketch-for-IMU-including-Kalman-filter/blob/master/IMU6DOF/ITG3205_ADXL345/ITG3205_ADXL345.ino
« Last Edit: January 28, 2013, 08:40:59 am by Lauszus » Logged

Offline Offline
Faraday Member
**
Karma: 62
Posts: 3031
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
That's the whole point of the filter

Well no.  The whole point of the filter is dealing with noise.  The problem of distinguishing true acceleration from the effect of gravity on the sensor remains.  I've yet to see a convincing implementation of the Kalman filter approach which considers more than one dimension.
Logged

Indiana
Offline Offline
Jr. Member
**
Karma: 1
Posts: 61
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
That's the whole point of the filter

Well no.  The whole point of the filter is dealing with noise.  The problem of distinguishing true acceleration from the effect of gravity on the sensor remains.  I've yet to see a convincing implementation of the Kalman filter approach which considers more than one dimension.

You should look at the FreeIMU's implentation of MARG orientation fusion algorithm.  I am using a modified version of this and it seems to work well.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@Lauszus
Thanks for your guide.
I'm working with an MPU6050 for my balancing robot project. But the model required yaw measurement. I wonder if the MPU6050 is capable of measure the yaw accurate enough or it needs additional magnetometer. Please help smiley-grin
Logged

Indiana
Offline Offline
Jr. Member
**
Karma: 1
Posts: 61
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@Lauszus
Thanks for your guide.
I'm working with an MPU6050 for my balancing robot project. But the model required yaw measurement. I wonder if the MPU6050 is capable of measure the yaw accurate enough or it needs additional magnetometer. Please help smiley-grin

It can do short term yaw measurements just fine, but it drifts over time.  So if you just need to know incremental yaw measurements during yaw events it will work fine. However if you are using to it maintain a specific orientation for extended periods of time, it will not work well unless you integrate a magnetometer.
Logged

Pages: 1 ... 23 24 [25] 26 27 ... 37   Go Up
Jump to: