Modding miniPro FC to external mag/GPS and setup

Post Reply
sherlock
Posts: 8
Joined: Fri Oct 17, 2014 9:57 pm

Modding miniPro FC to external mag/GPS and setup

Post by sherlock »

I am doing the external mag mod on a witespy MultiWii PRO Mini Flight Controller running version 2.3.

From what I understand I need to disable the L883 mag that is mounted on the FC by cutting pin 16 SCL and pin 1 SDA. I have also read that only cutting SDA is ok.
Image



My GPS/MAG unit has 6 pins: 4 are for the GPS/rx/tx/power that plug into serial port 2 and the other two are marked SCL and SDA. My presumption would be that these two pins (SCL and SDA) are the mag output and should plug into the corresponding pins marked SCL and SDA at the bottom of the FC. Would that be correct?
Is this the 12c port that I have been reading about or is this something else?

Image

Image

Making sure that external mag is oriented towards front of aircraft. In my case the top of GPS pic is front.


The last change would be to the code on config.h and def.h:

Change this line in def.h (not config.h)
#define MPU6050_I2C_AUX_MASTER // MAG connected to the AUX I2C bus of MPU6050
change that line to:
//#define MPU6050_I2C_AUX_MASTER // MAG connected to the AUX I2C bus of MPU6050

Then define external mag in config.h :

/* I2C magnetometer */
//#define HMC5843
#define HMC5883
//#define AK8975
//#define MAG3110

Are these instructions correct?

brewski
Posts: 483
Joined: Tue Apr 29, 2014 12:04 am
Location: Cleveland Qld Australia

Re: Modding miniPro FC to external mag/GPS and setup

Post by brewski »

Spot on. I mounted my ext 5883 on a CF post out front so well away from any fields, metal etc. You can also put a high Intensity LED or white ball on end to help with orientation.

sherlock
Posts: 8
Joined: Fri Oct 17, 2014 9:57 pm

Re: Modding miniPro FC to external mag/GPS and setup

Post by sherlock »

Hi Brewski,

Thanks for the nod. I have been following your progress now for a while; reading alot of posts and in doing so have learned about my quad/GPS integration.

I have tonight scheduled to mod my setup. Hopefully this will install smoothly (that would be a first) and we shall see what happens.

sherlock
Posts: 8
Joined: Fri Oct 17, 2014 9:57 pm

Re: Modding miniPro FC to external mag/GPS and setup

Post by sherlock »

Well I removed the onboard mag ( tried cutting the pins but ended up ripping the entire mag chip off the board); and after some trial and error I finally found a sketch that would work for my case. I am getting a good GUI on the pitch/roll/yaw and the gps is working strong. The 12c is connected at scl and sca and it appears to be seeing a signal with no 12c error code. However, the external mag renders backwards--meaning if I mount the gps/mag upright it fights itself back to a screwy direction. If I turn the gps/mag unit upside down it appears to be in sync to rotation, however, by pitching down or rolling the quad creates a screwy and spinning mag heading as seen in the GUI. What to do?

Arakon
Posts: 196
Joined: Thu Jul 17, 2014 2:22 pm

Re: Modding miniPro FC to external mag/GPS and setup

Post by Arakon »

You'll have to mess with the #define FORCE_MAG_ORIENTATION(X, Y, Z) setting in the config.

sherlock
Posts: 8
Joined: Fri Oct 17, 2014 9:57 pm

Re: Modding miniPro FC to external mag/GPS and setup

Post by sherlock »

I thought of that too. I looked at every single line in config.h and saw the entry you pointed out....however, I am not certain how to modify that code to accept my configuration. Any ideas?

Arakon
Posts: 196
Joined: Thu Jul 17, 2014 2:22 pm

Re: Modding miniPro FC to external mag/GPS and setup

Post by Arakon »

Try changing X to -X on the mag line only.

sherlock
Posts: 8
Joined: Fri Oct 17, 2014 9:57 pm

Re: Modding miniPro FC to external mag/GPS and setup

Post by sherlock »

I was on that very track when you wrote--thanks for the lead earlier. Here's what I have done so far:

The board I am using appears to recognize this designation in def.h:

#if defined(FREEIMUv043) || defined(MICROWII)
I commented this out by the slashes
//#define MPU6050_I2C_AUX_MASTER // MAG connected to the AUX I2C bus of MPU6050
determined that this line of code worked:
changed this:
#define MAG_ORIENTATION(X, Y, Z) {imu.magADC[ROLL] = Y; imu.magADC[PITCH] = -X; imu.magADC[YAW] = -Z;}
to this:
#define MAG_ORIENTATION(X, Y, Z) {imu.magADC[ROLL] = -Y; imu.magADC[PITCH] = -X; imu.magADC[YAW] = Z;}

After trial and error (the change and see method) of code changes to the mag line Quad now has correct compass rotation and orientation. North appears to be at front of GPS/mag unit where connectors are, therefore, technically that unit is 90 degrees out. However, if it works that's better; I would prefer the cables to run that way. I will test to see if that is in correct operation. At first look it appears that all other sensors seem to be registering properly in both Conf and GUI. However, rolling quad to right 45 degrees results in a 20 degree change in compass heading. Pitching quad down 45 degrees results in a 20 degree change in heading. I will confirm this rolling/pitching/heading change tomorrow after I fully calibrate and test. Change in yaw results in linear change to heading with no pitch/roll fluctuation. I flew it today in horizon (without mag, baro, or gps activated) and it flies stable; no apparent problems with the flight controls. I seem to be in the right airspace. More testing will tell.
Image

Post Reply