@APH3X2N
It should work perfectly fine if you can find some servos that are strong enough to handle force.
You don't need to use a magnetometer an accelerometer and gyro should be fine.
Hallo Lauszus, Thanks so much for this great blog. I need ur help with something. I'm using itg 3200 and bma 180, I applied your code and it works fine but when rotating around roll for exaple with 90 degrees, the output reading is 70 and the same for pitch although before that, i was applying a comp filter (explained by starlino) and it was giving an output of 90 when rotating with 90 degrees. Do you have any idea what might be causing that?
Man, you are great , the problem was in this function:-
R = sqrt(pow(accXval,2)+pow(accYval,2)+pow(accZval,2));
accXangle = acos(accXval/R)*RAD_TO_DEG-90;
accYangle = acos(accYval/R)*RAD_TO_DEG-90;
I think it's not accurate or something as I was applying it in my old code and instead of (accXval/R), it was (Rxest/R) where Rxest is calculated using both acc and gyro readings. However, after I changed it with the one u sent me in the previous post, it worked so fine. Thank you so much.
Yup I noticed that :), but shouldn't I use the acc sensitivity in this function and for the Y angle as well :
double getXangle() {
double accXval = Accx-zeroValue[0];
double accZval = Accz-zeroValue[2];
double angle = (atan2(accXval,accZval))*RAD_TO_DEG;
return angle;
I mean would be like this: (4095 = sens in 2g range)
For instance if a=100 and b=500, then the angle would be:
atan(100/500)=11.31deg
Then if you divide both of them with the same constant (this could be the sensitivity) lets say it's 100. Then a=100/100=1 and b=500/100=5, so:
atan(1/5)=11.31deg
atan2 is used to get 360 resolution and is dealt within the function. See this wiki page: atan2 - Wikipedia
One of the most popular at the moment is the MPU-6050 from InvenSense: http://www.invensense.com/mems/gyro/mpu6050.html. I got a one as well and the performance is pretty good and you can also do a lot of advances stuff with it.
There is a breakout board available form Sparkfun: https://www.sparkfun.com/products/11028 and a lot of other places like ebay.
What is the Arduino that you used for this project and do you think that there would any problems with coding the gyro/accelerometer module that you used for a Nano v3.0?
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?
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°