Page 1 of 1

Getting an External Mag to Work?

Posted: Tue Apr 07, 2015 2:11 am
by seikurou
Using a HobbyKing All in One Flight Controller.
http://www.hobbyking.com/hobbyking/store/__31138__Multiwii_and_Megapirate_AIO_Flight_Controller_w_FTDI_ATmega_2560_V2_0.html
Piled with this GPS+MAG combo from Banggood.
http://www.banggood.com/CRIUS-NEO-GPS-MAG-V2-NEO-7M-Module-With-Compass-p-951898.html

GPS is working fine, but I can't get the I2C compass to work.

This is what I have done:

Taken out the onboard mag.

config.h

Code: Select all

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

I believe I have selected the right mag as the Banggood mag is an "L883"

def.h

Code: Select all

#if defined(CRIUS_AIO_PRO_V1) 
  #define MPU6050
  #define HMC5883
  #define MS561101BA
  #define ACC_ORIENTATION(X, Y, Z)  {imu.accADC[ROLL]  = -X; imu.accADC[PITCH]  = -Y; imu.accADC[YAW]  =  Z;}
  #define GYRO_ORIENTATION(X, Y, Z) {imu.gyroADC[ROLL] =  Y; imu.gyroADC[PITCH] = -X; imu.gyroADC[YAW] = -Z;}
  #define MAG_ORIENTATION(X, Y, Z)  {imu.magADC[ROLL]  =  X; imu.magADC[PITCH]  =  Y; imu.magADC[YAW]  = -Z;}
  //#define MPU6050_I2C_AUX_MASTER // MAG connected to the AUX I2C bus of MPU6050

Undefined the last line.

The SDA from the I2C mag is on the SDA of the I2C port on the flight controller, SCL to SCL.

I have noticed that solely rotating the flight controller gives random readings in the GUI, and solely rotating the external mag also gives random readings in the GUI.

Any ideas would be appreciated.

Re: Getting an External Mag to Work?

Posted: Tue Apr 07, 2015 6:31 am
by Leo
Just in case you didn't forget something: http://www.multiwii.com/forum/viewtopic.php?f=6&t=6079

Re: Getting an External Mag to Work?

Posted: Tue Apr 07, 2015 8:32 pm
by NNagib
Hi, I have problems with external compass too. My setup is: DroFly V3 (doesn't have internal compass) + Ublox NEO-M8N + external compas HMC5983, all from drotek.fr. When I upload multiwii, compass is locked and shows 93 degrees all the time. It can't be calibrated using EZ-GUI, for example. However, it is possible to calibrate it using wingui (sometimes). After successful calibration, it works well.
Unfortunately, using the latest multiwii 2.4 I can not calibrate it at all (it is locked all the time to 93 degrees). Now I use 2.3 version for DroFly (the board has SD card slot for datalogging).
Any ideas what is the reason for such a problem?

Thanks!