Page tree
Skip to end of metadata
Go to start of metadata

Offsets of MPU

Every MPU9150 Unit has different Offsets. This means that every time when the MPU chip of the Quadrocopter needs to be replaced it is necessary to calculate the new Offsets of this chip.

To do this, theres is a sketch in the repository named "MPU6050_calibration". This sketch was written to work with the MPU6050 but it works fine with the 9150 as well.
After you placed the new MPU9150 chip on the copter and added the wireing you need to bring the Quadcopter in a balanced position. Use a water level on the top of the motors to check this.
As soon as the copter is leveled, you upload the calibration sketch to the arduino and start the serial terminal.
Just follow the instructions the sketch is giving to you and after it finished it gives all six offsets as outputs. Integrate these Offsets into the MPUHandler.ino code and you are clear to use the new MPU9150 chip.

Add the Offsets here:

MPUHandler.ino
    // supply your own gyro offsets here, scaled for min sensitivity
    mpu.setXGyroOffset(1); 
    mpu.setYGyroOffset(3); 
    mpu.setZGyroOffset(-14); 
    mpu.setXAccelOffset(-1445);
    mpu.setYAccelOffset(-604); 
    mpu.setZAccelOffset(1295); 

 

It is possible to raise the accurancy of this sketch by lower the value of the variables acel_deadzone and giro_deadzone:

MPU6050_calibration.ino
///////////////////////////////////   CONFIGURATION   /////////////////////////////
//Change this 3 variables if you want to fine tune the skecth to your needs.
int buffersize=1000;     //Amount of readings used to average, make it higher to get more precision but sketch will be slower  (default:1000)
int acel_deadzone=8;     //Acelerometer error allowed, make it lower to get more precision, but sketch may not converge  (default:8)
int giro_deadzone=1;     //Giro error allowed, make it lower to get more precision, but sketch may not converge  (default:1)

 


During the process it could happen that this sketch stops for an unknown reason. This happens even more often, if you work with a raised accurancy. Just restart the arduino and give it another try.

  • No labels