Help- Compass deviates with increased motor current

My compass decreases its reading as much as 90 degress with take-off motor power (high current).  It does this both on an APM 2.5 and an APM1 board.  I've moved the APM board to the secnd deck in the stack and the deviation is only 10 degress, but stll present.  I've been testing with nothing connected to the APM but a RX to try to isolate the problem. 

I have a stock 3DR-A frame with 880kv motos and a Attoilot 90A current sensor.  Stock 3DR power distribution board.

Obviously this is an issue with just my set up.   Could it be a bad power distribution board?  Current draw seems to be as expected (~28A in hover).  Can the placement of the Auttopilot current sensor cause a mag field that can affect the APM's magnetometer? 

Has anybody seen this issue before?

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Replies

  • Just wanted to tie off this thread for the benefit of others.

    After mounting an external compass to the top plate of my quad and performing a few other magnetic interference reducing steps, my quad now fly’s perfectly.  No more compass interference with increasing motor power.  Yea!  Now, my quad stability and loiter performance is a beautiful thing to watch.  The Arducopter developers rock big time!   Thank you!

    I’ve included a picture of the top plate of my quad with the external compass and GPS mounted.

    Configuring the external compass is easy, but there are a few little tricks.  I am using an APM 2.5, which has an external I2C connector.  For the APM 2.0 and APM 1.4 boards, you will have a few extra steps, not described here.    The steps for an APM 2.5 board are:

    1)   Purchase a HMC5883L magnetometer breakout board – I bought mine from 3DR, but I assume the one from Sparkfun will work.   Make sure the 3DR board is set to use 3.3volts (the APM 2.5’s I2C port uses 3.3 volts, not 5 volts).  You will have to modify the 3DR board because it is shipped from 3DR with the 5 volt jumper set.

    2)    Looking at the included picture entitled “APM 2.5 compass modification”, cut the jumper trace in the middle of the APM 2.5 board.  This disables the SDA line to the board’s internal magnetometer, rendering it inert.

    3)    The APM 2.5 I2C connector needs a 4 pin DF13 connector.  I bought a 19cm DF13 4 connector from 3DR and cut off one end.  I then stripped and tinned the four wires. 

    4)  Connect the DF13’s 4 wires to the compass breakout board.  You could use a connector if you like, but I soldered the wires directly to the board for one less connection to fail.  Note that the wires will not be one to one.  Pin 1 on the DF13 connector will not go to pin 1 of the compass board.  The cable I received from 3DR had one red wire and three black wires.  Substitute your wire colors accordingly.  Solder the wires as follows:

    Red wire on end of connector (+3.3v) goes to the VCC (or +3.3v) pad on the compass board (see labels on board for location).  This is the wire closest to the interior on the APM 2.5 board.

    Wire next to red wire (SCL) goes to the SCL pad on the compass board.

    Wire next to wire next to red wire (SDA) goes to the SDA pad on compass board.

    Black wire on end of connector (ground) goes to ground pad on compass board.  This is the wire closest to the edge of the APM 2.5 board.

    5)  Mount the compass board on the top plate of your quad. I used double sided foam to mount the board.  The orientation of the board matters.  I mounted the board “components up with pins forward”.  Note which direction you mount the board – you will need to modify the software with this orientation. 

    6)  Modify, compile and load the software for your compass board orientation.  You must be able to load software from the Arduino IDE to complete this step.  In “APM_Config.h”, you will find a commented out statement like:

    //#define MAG_ORIENTATION     AP_COMPASS_COMPOENTS_DOWN_PINS_FORWARD

    For my situation, I added the following statement just below the commented out statement above as follows:

    #define MAG_ORIENTATION     AP_COMPASS_COMPOENTS_UP_PINS_FORWARD

    You can find a list of all possible orientations for the MAG_ORIENTATION flag in the “AP_Compass_HMC5843.h” library, including orientations for both the 3DR and Sparkfun boards.

    7)  If this is the first time loading software from the IDE, make sure the following statement is uncommented:

    #define CONFIG_APM_HARDWARE    APM_HARDWARE_APM2

    8)  Save, Compile and Upload the modified software

    9)  Test the compass board and have fun flying with a now stable compass!

    Assuming I didn’t forget a step, this should be all there is to it.  Good luck.

    Quad_Top_View.jpg

    APM Compass Modification.jpg

  • Success - sort of.

    Well, I learned what everyone knew.  I relocated an external 3DR magnetometer to the top plate of the 3DR frame using the APM 2.5’s external I2C connector and it works great (no surprise).  No compass deviation with full throttle and props on. 

    I say this is sort of success because I still believe the internal APM magnetometer should have worked in the stock 3DR frame – as it does for thousands of other users.   Makes me wonder how many people have this problem and don’t realize it.

    I tried everything I could think of to isolate the source of the interference.  I tried single ESC/motor combinations (maybe one was bad), moved the ESCs out on each arm and shortened the ESC to motor wires as much as possible (maybe the ESC to motor wires were interfering as they exited the arm near the PDB) and a few other ideas.  All with no luck.    The only thing that worked is to use an external compass on the top plate. 

    Chris, I couldn’t find wiki instructions on how to hook up an external magnetometer to an APM2.5 and configure the software to use the external device.  I can generate a wiki page if you like.

     

  • Somewhere, someone will have a graduate study based on this subject.

    There is modelling software for mag field analysis. I have the AttoPilot sensor but its location is very close to the battery. The battery is at the bottom of the quad.

    On the other hand, I run an arming harness from the +DC Main to the top deck and back down to the PDB

    That lead almost certainly affects the mag sensor but I have'nt paid any attention to the issue.

    I work on MRI systems. Mag fields and I are very familiar. It is possible to attenuate the field affects by shimming with high mu steel, but in the case of an aircraft, it would only add weight. Not a desirable situation.

    Ships actually used wiring and power supplies to null out the residual fields of all the steel in them. I guess the killer solution is a variable supply that would null out the motor wiring fields actively.

    That solution is certainly a graduate level project.

    -=Doug

  • Why would you be at a loss? We know about this, there are about 100 threads on the subject. High DC currents make a magnetic field (exactly how your motors spin). The only way to counteract is to increase distance between the offending wires and the mag sensor. Also, twisting the wires together can reduce but not fully eliminate the effect (same reason CAT5 cable has twisted pairs). Magnetic field decreases (squared) by distance. Thus, moving a wire a 1/2 inch has a major effect. Moving it an inch can nearly reduce the field to nothing.

    No, you cannot "shield" the APM either, somebody tried that and obviously it didn't work. The equivalent of blocking all light to a light sensor.

    Again. moving the High current wires (not the signal wires) will make a difference. When you added the current sensor, you changed the high current wiring path and thus that's what is causing the inteference. This isn't a design flaw in the APM, it's the way you built the machine.

    Sorry if I come off as harsh, just trying to get the point across. If the magnetometer can sense field stregth of the earth to determine orientation, it most certainly can detect the current of 4 motors running through a single wire. Remember the current is additive at the battery wires to the power distro board, so if one motor draws 8 Amps, then times 4 that's 32 AMps minimally to hover (very conservative numbers). 32 Amps is more than enough power to be stronger than the earth's magnetic field over a short distance. Just move the current sensor and fat wiring either lower to below the bottom plate, or far left or right away from the magenetometer and avoid any loops in those high current wires.

  • No ideas? 

    I'm troubleshooting this problem and would like to use the CLI compass test while the motors are running.  Has anyone done this?

    Other than that, I'm at a loss as to why my compass deviates with increased motor current.  I'm using all 3DR stock parts, so if it were a design flaw, many would have the issue.  Right? 

     

This reply was deleted.

Activity