New HK_MultiWii board. Help with def.h?

Post Reply
xoxota
Posts: 37
Joined: Mon Aug 27, 2012 12:21 am

New HK_MultiWii board. Help with def.h?

Post by xoxota »

Hi all,

I just received this new board, and wanted to get a sanity-check on my new defines in config.h and def.h. Basically, I did a best-guess based on other configs. I don't actually have a schematic or anything, just the specs. From the site:
ITG3205 Triple Axis Gyro
BMA180 Accelerometer
BMP085 Barometer
HMC5883L Magnetometer


So I did this in config.h:

Code: Select all

#define HK_MultiWii_328P


And this in def.h:

Code: Select all

#if defined(HK_MultiWii_328P ) 
  #define ITG3200
  #define HMC5883
  #define BMA180
  #define BMP085
  #define ACC_ORIENTATION(X, Y, Z)  {accADC[ROLL]  = -X; accADC[PITCH]  = -Y; accADC[YAW]  =  Z;}
  #define GYRO_ORIENTATION(X, Y, Z) {gyroADC[ROLL] =  Y; gyroADC[PITCH] = -X; gyroADC[YAW] = -Z;}
  #define MAG_ORIENTATION(X, Y, Z)  {magADC[ROLL]  =  X; magADC[PITCH]  =  Y; magADC[YAW]  = -Z;}
  #define MPU6050_EN_I2C_BYPASS // MAG connected to the AUX I2C bus of MPU6050
  #undef INTERNAL_I2C_PULLUPS
#endif


Thing is, the board comes loaded with a version of MultiWii_2_1 that appears to work fine for my config (QuadX). So before I go overwriting it forever with no hope of recovery (*gulp*), I just wnated to get someone with more experience in the sketch side of things to take a look. Any opinions?

thanks,

xoxota
Posts: 37
Joined: Mon Aug 27, 2012 12:21 am

Re: New HK_MultiWii board. Help with def.h?

Post by xoxota »

Okay, well, I took the leap and flashed it. And of course everything stopped working ;-). The HK docs are completely wrong for this board. I ended up with something like this:

Code: Select all

#if defined(HK_MultiWii_328P )
  #define I2C_SPEED 400000L
  #define ITG3200
  #define HMC5883
  #define BMA180
  #define BMP085
  #define ACC_ORIENTATION(X, Y, Z) {accADC[ROLL]  = -X; accADC[PITCH]  = -Y; accADC[YAW]  =  Z;}
  #define GYRO_ORIENTATION(X, Y, Z) {gyroADC[ROLL] =  Y; gyroADC[PITCH] = -X; gyroADC[YAW] = -Z;}
  #define MAG_ORIENTATION(X, Y, Z) {magADC[ROLL]  =  X; magADC[PITCH]  =  Y; magADC[YAW]  = Z;}  //pitch / roll / yaw good. Heading off by 90 CCW
  #undef INTERNAL_I2C_PULLUPS
#endif


Mag pitch roll and yaw are reacting properly (ie turning with the board). Unfortunately, the MAG_ORIENTATION is off by 90 degrees (ie: When the board faces North,multiWiiConf says it's facing West). Otherwise, everything works fine. Does anyone have any bright ideas for turning my mag orientation by 90 degrees?

EDIT: Okay, I recalibrated the Mag, and now it's only off by 45 degrees (as though It's in QUADP instead of QUADX geometry).

SO CLOSE! I only one of you knowledgable gurus could help me get across the finish line!!!

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

Re: New HK_MultiWii board. Help with def.h?

Post by PatrikE »


justk1w1
Posts: 62
Joined: Fri Jun 29, 2012 2:31 pm

Re: New HK_MultiWii board. Help with def.h?

Post by justk1w1 »

After you have checked the settings as above, make sure that you set the Mag Declination in the config.h file. Also make sure that you are not close to any major magnetic influences ( monitors, TV, power supplied, etc).

xoxota
Posts: 37
Joined: Mon Aug 27, 2012 12:21 am

Re: New HK_MultiWii board. Help with def.h?

Post by xoxota »



Yep, first thing I checked. Everything looked fine, except the Compass heading was off by 45 degrees. Turned out I was the one who was off by 45 degrees (figured this out when I saw that Roll and Pitch were also behaving oddly). Once I rotated the board to it's correct mounting orientation, everything looked fine. That'll teach me to do these things without coffee in me.

The final settings I arrived at for this board were:

Code: Select all

#if defined(HK_MultiWii_328P )
  #define RCAUXPIN12
  #define I2C_SPEED 400000L
  #define ITG3200
  #define BMA180
  #define BMP085
  #define HMC5883
  #define ACC_ORIENTATION(X, Y, Z) {accADC[ROLL]  = -X; accADC[PITCH]  = -Y; accADC[YAW]  =  Z;}
  #define GYRO_ORIENTATION(X, Y, Z) {gyroADC[ROLL] =  Y; gyroADC[PITCH] = -X; gyroADC[YAW] = -Z;}
  #define MAG_ORIENTATION(X, Y, Z) {magADC[ROLL]  =  X; magADC[PITCH]  =  Y; magADC[YAW]  = Z;}
  #undef INTERNAL_I2C_PULLUPS
#endif


Thanks for the help!

Post Reply