MPU-6050 acc values reversed?

Post Reply
jhitesma
Posts: 36
Joined: Wed Nov 20, 2013 5:41 pm

MPU-6050 acc values reversed?

Post by jhitesma »

I've been running a MW2.3 quad using an Arduino Mega 2560 with WMP/NK since they were all parts I had laying around the house letting me build a FC for zero cost out of pocket. It worked well enough I added a BMP085 and HMC5883L and ordered a NEO-6M GPS as well. It's all been working well. But I can't leave well enough alone and ordered myself a MPU-6050 breakout off ebay as well.

As luck would have it I crashed the quad and smashed my mega 2560 so I've been flying off a pro-mini with just the WMP/NK while I wait for a replacement Mega2560 and my MPU-6050 to arrive. Well, they showed up late last week and over the weekend I was able to fire up the soldering iron and wire it all up. I'm using a sparkfun LLC between the Mega2560 and the 3 3.3v sensors.

My config has the lines for the three appropriate sensors uncommented with I2C running at 400kHz and internal pullups disabled. Seems to be working well and I don't get any I2C errors. But the values I'm seeing for acc are the inverse of what I was expecting. The roll/pitch indicators and artificial horizon in the official GUI and the windows GUI all respond correctly. The 3dish representation of the quad in the gui is all wonky...but to be honest it's always been wonky for me so I'm not too terribly concerned about that. The biggie is the inverted acc values that have me concerned about putting this actually on my quad.

Going by this: http://www.multiwii.com/faq#How_should_ ... directions

TILT the MULTI to the RIGHT (left side up):
MAG_ROLL, ACC_ROLL and GYRO_ROLL goes up
MAG_Z and ACC_Z goes down


But when I tilt to the right the MAG_ROLL, and GYRO_ROLL go up. But the ACC_ROLL goes down.

Same for pitch, when I tilt it forward MAG and GYRO go up, but ACC does down.

Is this normal for the MPU-6050 or do I need to change something in a config somewhere like ACC_ORIENTATION?

jhitesma
Posts: 36
Joined: Wed Nov 20, 2013 5:41 pm

Re: MPU-6050 acc values reversed?

Post by jhitesma »

Did some more testing and realized that it's actually pitch and roll seem reversed on the ACC and yaw seems backwards on the Gyro. The inverted looking results on the acc were because I was looking at what was labeled "PITCH" and "ROLL" in the GUI and assuming they were actually the PITCH and ROLL data. The Gyro yaw being backwards I can't figure out at all. Am I really just going to have to override these in the config? Just kind of surprised that it isn't done as part of the:
#define MPU6050 //combo + ACC

config and trying to figure out what else I may be missing. I can't see how this could be due to mounting since the gyro and acc are in the same physical chip...

jhitesma
Posts: 36
Joined: Wed Nov 20, 2013 5:41 pm

Re: MPU-6050 acc values reversed?

Post by jhitesma »

I ended up just taking a look in defs.h and seeing how some of the IMU boards set things up. Based on that I added this to my config:

#define ACC_ORIENTATION(X, Y, Z) {imu.accADC[ROLL] = -Y; imu.accADC[PITCH] = X; imu.accADC[YAW] = Z;}
#define GYRO_ORIENTATION(X, Y, Z) {imu.gyroADC[ROLL] = -X; imu.gyroADC[PITCH] = -Y; imu.gyroADC[YAW] = -Z;}
#define MAG_ORIENTATION(X, Y, Z) {imu.magADC[ROLL] = Y; imu.magADC[PITCH] = -X; imu.magADC[YAW] = -Z;}

And now everything is reading correctly and all of the displays are dead on.

Can't believe the difference between the Wii parts and the MPU-6050! Before I had to drop my P down to 1.8 or lower to avoid wobbles. Now it flies both more stable and more agile on the stock PID's than it did on my tuned settings before! What a difference a few years in component technology makes!

Post Reply