Disable onboard Mag to use ext Mag

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

Disable onboard Mag to use ext Mag

Post by brewski »

Does anyone know if it is possible to disable the onboard Mag IC & connect an external Mag using I2C port?
Megapirates lets you do this but I don't see this option in Config.h of MW 2.3.

Cheers..B

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

Re: Disable onboard Mag to use ext Mag

Post by brewski »

Maybe I should move to software dev

waltr
Posts: 733
Joined: Wed Jan 22, 2014 3:21 pm
Location: Near Philadelphia, Pennsyvania, USA

Re: Disable onboard Mag to use ext Mag

Post by waltr »

Without a complete schematic its hard to say but it is possible.
The only way I know of that is a sure thing is to remove the on-board mag chip. Then wire the new mag onto the I2C bus.

If the new mag chip uses a different I2C address then just change the I2C mag address in the multiwii code.
You also need to ensure that the orientation of the new mag chip is correct and/or change the code to get the correct orientation.

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

Re: Disable onboard Mag to use ext Mag

Post by brewski »

I read that latest version of Megapirates you can disable onboard I2C Mag in Config.h & use an external I2C.
It would be great if someone could do the same with MW code.
I don't feel comfortable removing surface mount IC from my Crius AIOP. I'm guessing that chip &or board would be damaged in process.

copterrichie
Posts: 2261
Joined: Sat Feb 19, 2011 8:30 pm

Re: Disable onboard Mag to use ext Mag

Post by copterrichie »

Just thinking out loud here, if the MAG is connected via mpu6050 aux, you MAYBE able to remark that out in the def.h

Code: Select all

#define MPU6050_I2C_AUX_MASTER // MAG connected to the AUX I2C bus of MPU6050


and to set the MAG in the Config file.

Code: Select all

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

PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: Disable onboard Mag to use ext Mag

Post by PatrikE »

You can solve it by use a external Mag that use another I2C adress.
HMC5843 and HMC5883 use the same address and can not be combined.
APM have a solder jumper on the board.
You need to remove it from the board or cut some traces to disconnect it.

MAG3110 & AK8975 use totally different addresses and can be combined with the other.

copterrichie
Posts: 2261
Joined: Sat Feb 19, 2011 8:30 pm

Re: Disable onboard Mag to use ext Mag

Post by copterrichie »

If the MAG is connected via the mpu6050 AUX, then it is not connected on the main i2c bus, just disabling the aux master should do the trick. It will just sit there and draw power but not do anything.

PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: Disable onboard Mag to use ext Mag

Post by PatrikE »

copterrichie wrote:If the MAG is connected via the mpu6050 AUX, then it is not connected on the main i2c bus, just disabling the aux master should do the trick. It will just sit there and draw power but not do anything.

Would be wonderful if it was that easy.
But I tested on my AIO board direct and HMC5883 is still answering.. :(
Sorry it don't seem to work for me anyway.

copterrichie
Posts: 2261
Joined: Sat Feb 19, 2011 8:30 pm

Re: Disable onboard Mag to use ext Mag

Post by copterrichie »

PatrikE wrote:Would be wonderful if it was that easy.
But I tested on my AIO board direct and HMC5883 is still answering.. :(
Sorry it don't seem to work for me anyway.


Did you try remarking the following out for your board?

Code: Select all

#define MPU6050_I2C_AUX_MASTER // MAG connected to the AUX I2C bus of MPU6050

copterrichie
Posts: 2261
Joined: Sat Feb 19, 2011 8:30 pm

Re: Disable onboard Mag to use ext Mag

Post by copterrichie »

If the MAG is still answering, then it is connected directly to the i2c bus and not to the mpu6050 aux. :(

PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: Disable onboard Mag to use ext Mag

Post by PatrikE »

Yes i commented MPU6050_I2C_AUX_MASTER in def.h in CRIUS_AIO_PRO_V1 board defines.
I guess it's not connected thru I2C_AUX_MASTER then.
I have one more AIO but can't test it until tomorrow.

Or actually i think i have a V2 board.
http://www.rctimer.com/product_765.html
There may be some difference between them.

copterrichie
Posts: 2261
Joined: Sat Feb 19, 2011 8:30 pm

Re: Disable onboard Mag to use ext Mag

Post by copterrichie »

My mistake, it is not that easy. Here is some information from the datasheet, seem if the mpu6050 is not in the master mode, it is in the pass-thru and this explains why the MAG still answered up.

Sorry


Auxiliary I2C Serial Interface
The MPU-60X0 has an auxiliary I2C bus for communicating to an off-chip 3-Axis digital output magnetometer or other sensors. This bus has two operating modes:
 I2C Master Mode: The MPU-60X0 acts as a master to any external sensors connected to the auxiliary I2C bus
 Pass-Through Mode: The MPU-60X0 directly connects the primary and auxiliary I2C buses together, allowing the system processor to directly communicate with any external sensors.

PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: Disable onboard Mag to use ext Mag

Post by PatrikE »

Well it was worth a try..

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

Re: Disable onboard Mag to use ext Mag

Post by brewski »

Thanks for trying guys.
Just a thought- can Passthru on MPU6050 be disabled off so that Atmel 2650 can't receive data from the onboard Mag chip or are there only two modes to I2C setting?
Somehow MP are doing this as they run their code on same Crius AIOP & turn off onboard Mag with a line of code.

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

Re: Disable onboard Mag to use ext Mag

Post by brewski »

Hi Guys,

Finally found the answer by searching many forums. On my Crius AIOP V2 there are two jumper pads (SJ2 & SJ3) associated with the onboard mag chip.
Cutting the links totally removes Mag IC from !2C bus.
Cheers..B

Rusty105
Posts: 13
Joined: Thu Oct 31, 2013 4:09 pm

Re: Disable onboard Mag to use ext Mag

Post by Rusty105 »

brewski wrote:Hi Guys,

Finally found the answer by searching many forums. On my Crius AIOP V2 there are two jumper pads (SJ2 & SJ3) associated with the onboard mag chip.
Cutting the links totally removes Mag IC from !2C bus.
Cheers..B


And were you then able to use an external MAG on the I2C bus?


And which one did you use? I am going to put my GPS and MAG on a mast away from the noise, or as much as possible.

bao
Posts: 3
Joined: Sun Mar 23, 2014 1:34 am

Re: Disable onboard Mag to use ext Mag

Post by bao »

I came accross the same dilema ... too muche noise around the onboard mag on my mutiwii pro so i hacked of the onboard mag :o or should i say gently teased it of with a stanley blade :lol:

then i undefined this line in def.h (not config.h)
#define MPU6050_I2C_AUX_MASTER // MAG connected to the AUX I2C bus of MPU6050

Then defined my external mag in config.h like so

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

now i have an external mag on the multiwii pro (im not worried about not having the on board one as it was mainly a pain

pics

The onboard mag ...gone !!!

Image

The external mag and orientation plugged into the 3.3v i2c pins(this is the external mag https://www.sparkfun.com/products/10530 )

Image

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

Re: Disable onboard Mag to use ext Mag

Post by brewski »

Hi Rusty,
My ext mag board arrived today so I cut the SJ3 (RHS) track on Crius AIOP V2.
I then modified the MW 2.3 Navi b7 def.h (not config.h).
Under #if defined Crius_aiop_pro_V2_v1 uncomment (//) out line-
#define MPU6050 _12C _AUX_MASTER //MAG
Save & then upload to your FC.

Connect the ext Mag board to the I2C port ensuring that you have connected as follows provided your Mag board has on board 3.3 regulator-
Gnd- Black
+5(VCC)- Red
SDA- Yellow
SCL - Green

Calibrate Mag using MW Config ( 360 degrees in all axis) rotate mag board to ensure accurate using compass. Check that there are no I2C errors over at least 10 minutes.
From what I have read the ext Mag should be mounted as far away from magnetic fields as possible. This means as far from motors, DC cables to ESCs, distribution board & any steel screws or mounts as you can get. Commercial quads mount Mag board on legs or on mast. I'm guessing that they are right & will buy one of the masts I,ve seen on EBay. Could also mount GPS up there away from interference as well but pretty accurate already.

Norvaguy
Posts: 2
Joined: Sat Aug 09, 2014 1:01 am

Re: Disable onboard Mag to use ext Mag

Post by Norvaguy »

I have been successful in completely disabling the onboard mag. I am now trying to enable the mag on my uBlox 6M GPS module but cannot find the chip information. Does anyone happen to know this? Or how to get it working?

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

Re: Disable onboard Mag to use ext Mag

Post by brewski »

Norvaguy wrote:I have been successful in completely disabling the onboard mag. I am now trying to enable the mag on my uBlox 6M GPS module but cannot find the chip information. Does anyone happen to know this? Or how to get it working?


You should go to site where you bought it & look for specs. If HK look under Files Tab for the product. Besides finding out exactly what Mag IC it uses you also need to find out if I2C bus is running on 3.3 or 5V to match the port on your FC.

Norvaguy
Posts: 2
Joined: Sat Aug 09, 2014 1:01 am

Re: Disable onboard Mag to use ext Mag

Post by Norvaguy »

brewski wrote:
Norvaguy wrote:I have been successful in completely disabling the onboard mag. I am now trying to enable the mag on my uBlox 6M GPS module but cannot find the chip information. Does anyone happen to know this? Or how to get it working?


You should go to site where you bought it & look for specs. If HK look under Files Tab for the product. Besides finding out exactly what Mag IC it uses you also need to find out if I2C bus is running on 3.3 or 5V to match the port on your FC.


Thanks for the reply. I went and did more looking and stumbled across a picture that had the compass leads off the uBlox 6M plugged into the 3DR Telemetry port. That did the trick. I had been plugging it into a serial port the other times.

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

Re: Disable onboard Mag to use ext Mag

Post by brewski »

Any serial port will work provided you configure it in GPS settings in Config.h

mrchips
Posts: 3
Joined: Fri Sep 26, 2014 3:01 pm

Re: Disable onboard Mag to use ext Mag

Post by mrchips »

I have the MW Pro. Would onboard mag problems explain why my copter would rotate 5-10 degrees immediately upon take-off, even before it cleared the grass on the lawn? Or why the copter would do the opposite what the TX sticks do? The last two times I've flown this is what's happened. Something is wrong... I'm debating replacing the FC with a different controller. But after finding some other posts and reading this thread I'm thinking maybe I should just replace the gps with a UBLOX/Mag unit and disable the onboard mag. Thoughts?

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

Re: Disable onboard Mag to use ext Mag

Post by Arakon »

Are you flying with mag enabled? If so, simple test.. turn it off and see if it still happens.

mrchips
Posts: 3
Joined: Fri Sep 26, 2014 3:01 pm

Re: Disable onboard Mag to use ext Mag

Post by mrchips »

That's a good point Arakon. But I'm still attending the school of hard knocks so I use head free all the time (which means I need mag). If I try hard enough I can convince myself that is is the mag 'cause it's had some strange symptoms and they seem to be getting worse. Yesterday it took off straight, I had baro and head free turned on, I rolled it to the left 30 deg. maybe more, then tried to level it as it went speeding by but instead it rolled more to the left and into the ground. So now I'm waiting on parts again.

If the mag thought North was really South (with head free on) would that explain the reverse in the controls? This board has has some hard knocks.

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

Re: Disable onboard Mag to use ext Mag

Post by Arakon »

Generally, using an onboard mag means that the mag sensor is pretty close to the power wiring. The power wiring creates a magnetic field, which will confuse the mag, sometimes completely.
The more throttle, the stronger the interference.. which is why you see it rotate on takeoff.
And honestly, there is no "needing" headfree mode. How will you learn to fly properly otherwise?
Headfree is a nice idea, but there are a lot of things that can mess with the mag, and that will make headfree actually a lot worse than flying without it.
Same goes for baro, baro is nice for filming/mission mode or to fly FPV without having to worry about the ground, but it has no place in normal flying since it completely messes up throttle response in an emergency.

kilby
Posts: 76
Joined: Wed May 28, 2014 10:17 am

Post by kilby »

In the very early days head free can be useful if the beginner loses orientation you can hit head free mode and pulling back on the right stick beings it back home (seen it used on APM equipped quads like this)

Other than that I would say avoid it as will make it al lot harder to learn to fly the machine.

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

Re: Disable onboard Mag to use ext Mag

Post by brewski »

A Loiter type mode would be great for beginners. Just centre sticks & quad stays in place.

sismeiro
Posts: 173
Joined: Tue Feb 21, 2012 12:33 pm

Re:

Post by sismeiro »

kilby wrote:Other than that I would say avoid it as will make it al lot harder to learn to fly the machine.

+1

mrchips
Posts: 3
Joined: Fri Sep 26, 2014 3:01 pm

Re: Disable onboard Mag to use ext Mag

Post by mrchips »

Thanks for all the input! Yeah, learning to fly without mag is on my list now, you've convinced me. I'm still learning what NOT to do, it's been a steep and frustrating curve. Eventually I want to do aerial photography/filming so having mag and baro working well is something I'll want (I assume).

I'm leaning towards the Quanum LEA-6H from HK to replace the onboard mag. I hope that means I'll have better GPS too. Thoughts on this would be appreciated.

But hmm... maybe I could try flying without mag while I wait for the new one? It's easy to get disoriented though.

Hoppsan_84
Posts: 51
Joined: Thu Jul 10, 2014 2:13 pm

Re: Disable onboard Mag to use ext Mag

Post by Hoppsan_84 »

brewski wrote:A Loiter type mode would be great for beginners. Just centre sticks & quad stays in place.

Isn't That what PH is suposed to do.

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

Re: Disable onboard Mag to use ext Mag

Post by Arakon »

That's why you start out slow.. don't move it far away from you until you get a feeling for the directions. Small stick movements, unless you are racing, there's no need to ever push the stick far into one direction.

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

Re: Disable onboard Mag to use ext Mag

Post by brewski »

Hoppsan_84 wrote:
brewski wrote:A Loiter type mode would be great for beginners. Just centre sticks & quad stays in place.

Isn't That what PH is suposed to do.

From what I have read it is more. You can fly around and if sticks centred quad will hold position using current GPS position as well as hold height. Great for beginners & photography.

Post Reply