One of the neat side-projects I’ve been playing with is building a homebrew quad-rotor helicopter based on the MultiWii Copter project’s firmware. My initial build uses a Micro Quad / Fun-Sized Quad laser-cut frame from Blue Sky R/C and a Bob’s Quads Super Simple Shield flight computer, which is a very simple (as the name suggests) PCB that breaks out the required pins from a SparkFun Arduino Pro Mini for the RC receiver, sensors, and ESCs.
My first flight controller used a Nintendo Wii Motion Plus gyro board, but I recently purchased and built up a second FC using a 10-DOF IMU from eBay. For anyone who wants to follow in my footsteps, you an buy your own here (though I can’t guarantee that eBay link will be around forever).
I had a bit of difficulty working out the proper orientation for the sensors in the MWC code, so I’m posting my config.h’s defines here:
#undef INTERNAL_I2C_PULLUPS
#define L3G4200D
#define ADXL345
#define ADXL345_ADDRESS 0x53
#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;}
Note that I’m using the DEV 20120622 version of MWC; these defines ought to work on other post-2.0 Developer snapshots as well, but you may need a different I2C address for 2.0 and earlier due to a change in how MWC handles I2C addresses.
I’ve included a photo of the quad, to reference when working out the orientation of my board relative to these defines: the orange props are forward, and the IMU board is situated with the barometric pressure sensor towards the front, and the components facing up.
Don’t forget to add I2C pull-up resistors, since the IMU does not include them on-board. Using the Super Simple Shield, I just ran 3.5k resistors between the SDA and SCL lines and VCC. Also note that in my defines above, I’m using #undef INTERNAL_I2C_PULLUPS because the ATMega328′s internal pull-ups don’t play nicely with the I2C standard, and can lead to some nasty communications issues.
With this setup, the quad is flying well. I have some magnetometer glitches to sort out, though. Who’d have thought? Putting a sensitive device that measures magnetic fields within 5″ of four brushless motors might be a dicey proposition.