in config.h i defined:
Code: Select all
#define QUADX
/*************************** independent sensors ********************************/
/* leave it commented if you already checked a specific board above */
/* I2C gyroscope */
//#define WMP
#define L3G4200D //warning sensor address changed in Sensors.ccp
/* I2C accelerometer */
#define LSM303DLx_ACC //warning sensor address changed in Sensors.ccp
/* I2C barometer */
#define BMP085 //same as BMP180
/* I2C magnetometer */
#define HMC5883 //same as LSM303DLx_MAG
in Sensors.ccp i modified:
Code: Select all
// ************************************************************************************************************
// I2C Accelerometer LSM303DLx
// ************************************************************************************************************
#if defined(LSM303DLx_ACC)
//#define LSM303DLx_ADDR 0x18
#define LSM303DLx_ADDR 0x19 //LSM303DLHC Address From Adafruit 10 DOF IMU
void ACC_init () {
delay(10);
i2c_writeReg(LSM303DLx_ADDR,0x20,0x27);
i2c_writeReg(LSM303DLx_ADDR,0x23,0x30);
i2c_writeReg(LSM303DLx_ADDR,0x21,0x00);
}
void ACC_getADC () {
i2c_getSixRawADC(LSM303DLx_ADDR,0xA8); //0x28+0x80 = 0xA8
ACC_ORIENTATION( ((rawADC[1]<<8) | rawADC[0])>>4 ,
((rawADC[3]<<8) | rawADC[2])>>4 ,
((rawADC[5]<<8) | rawADC[4])>>4 );
ACC_Common();
}
#endif
// ************************************************************************************************************
// ADC ACC
// ************************************************************************************************************
#if defined(ADCACC)
void ACC_init(){
pinMode(A1,INPUT);
pinMode(A2,INPUT);
pinMode(A3,INPUT);
}
void ACC_getADC() {
ACC_ORIENTATION( analogRead(A1) ,
analogRead(A2) ,
analogRead(A3) );
ACC_Common();
}
#endif
// ************************************************************************************************************
// I2C Gyroscope L3G4200D OR L3GD20H
// ************************************************************************************************************
#if defined(L3G4200D)
//#define L3G4200D_ADDRESS 0x69
#define L3G4200D_ADDRESS 0x6B //L3GD20H Address From Adafruit 10 DOF IMU
void Gyro_init() {
delay(100);
i2c_writeReg(L3G4200D_ADDRESS ,0x20 ,0x8F ); // CTRL_REG1 400Hz ODR, 20hz filter, run!
delay(5);
i2c_writeReg(L3G4200D_ADDRESS ,0x24 ,0x02 ); // CTRL_REG5 low pass filter enable
delay(5);
i2c_writeReg(L3G4200D_ADDRESS ,0x23 ,0x30); // CTRL_REG4 Select 2000dps
}
void Gyro_getADC () {
i2c_getSixRawADC(L3G4200D_ADDRESS,0x80|0x28);
GYRO_ORIENTATION( ((rawADC[1]<<8) | rawADC[0])>>2 ,
((rawADC[3]<<8) | rawADC[2])>>2 ,
((rawADC[5]<<8) | rawADC[4])>>2 );
GYRO_Common();
}
#endif
The results are not very good... the multiwiiconf application shows that the sensors are working with no i2c errors, but i noticed a strange behaviour comparing it to my friend's multiwii crius se board...When i rotate the imu around all three axis, right after that, i level the sensor on the table but the navigation ball won't be leveled immediately. It gives me the feeling that the Complementary or Kalman filter* gives more gravity to the gyroscope than the accelerometer data over time, So it looks like it drifted but after a while (5-10 seconds) the navigation ball comes to the right position. It feels like the accelerometer isn't working as it should. If i pitch or roll the imu board for about less than +or-45 degrees and leave the imu board at this angle the navigation ball starts to go at the horizon by it self. Did i missed something ? ... Could anyone help me please ???
Please note that the multiwii crius se board is not behaving like this(the Navigation ball is fast responsive and always precise on the pitch and roll of the circuit board orientation)
I attatched two pictures to show you multiwiiconf application results.
I have not tested this setup of flight controller on a quad yet because i still don't have the rest of my quadcopter's parts. Is there anyone brave enough to test it ??? Could it be an application visual error???