ok, i will buy a level-shifter,i will also buy a new 9 Degrees of Freedom Breakout.
I have many MS5803 sensor,i need only solder a new MS5803 on the Breakout board.
I use my own Breakout board for MS5803.
Everything is working, sow i dont think something is damaged yet.
Something in the library,somewhere that causes a wrong startup value for the magnetometer, I think,that to, but what.
In the code the calibration for the magnetometer is called. What happens if you set it to false ?
m_useMagCalibration = false;
I have now set it to false,but nothing happens,is the same.
I have remove nearly all of the code, ther is only MPU-9150 and OSD Max7456 left,in the Sketch.
#include <SPI.h> // OSD MAX7456
#include <MAX7456.h> // OSD MAX7456
#include <Wire.h> // MPU-9150
#include "I2Cdev.h" // MPU-9150
#include "MPU9150Lib.h" // MPU-9150
#include "CalLib.h" // MPU-9150
#include <dmpKey.h> // MPU-9150
#include <dmpmap.h> // MPU-9150
#include <inv_mpu.h> // MPU-9150
#include <inv_mpu_dmp_motion_driver.h> // MPU-9150
#include <EEPROM.h> // MPU-9150
// DEVICE_TO_USE selects whether the IMU at address 0x68 (default) or 0x69 is used
// 0 = use the device at 0x68
// 1 = use the device at ox69
#define DEVICE_TO_USE 0
MPU9150Lib MPU; // the MPU object
// MPU_UPDATE_RATE defines the rate (in Hz) at which the MPU updates the sensor data and DMP output
#define MPU_UPDATE_RATE (20)
// MAG_UPDATE_RATE defines the rate (in Hz) at which the MPU updates the magnetometer data
// MAG_UPDATE_RATE should be less than or equal to the MPU_UPDATE_RATE
#define MAG_UPDATE_RATE (10)
// MPU_MAG_MIX defines the influence that the magnetometer has on the yaw output.
// The magnetometer itself is quite noisy so some mixing with the gyro yaw can help
// significantly. Some example values are defined below:
#define MPU_MAG_MIX_GYRO_ONLY 0 // just use gyro yaw
#define MPU_MAG_MIX_MAG_ONLY 1 // just use magnetometer and no gyro yaw
#define MPU_MAG_MIX_GYRO_AND_MAG 10 // a good mix value
#define MPU_MAG_MIX_GYRO_AND_SOME_MAG 50 // mainly gyros with a bit of mag correction
#define MPU_LPF_RATE 40 // MPU_LPF_RATE is the low pas filter rate and can be between 5 and 188Hz
// Pin Mapping Of MAX7456 on Arduino Mega 2560
const byte osdChipSelect = 53;
const byte masterOutSlaveIn = 51;
const byte masterInSlaveOut = 50;
const byte slaveClock = 52;
const byte osdReset = 0;
MAX7456 OSD(osdChipSelect);
void setup()
{
SPI.begin();
SPI.setClockDivider(SPI_CLOCK_DIV2);
OSD.begin(MAX7456_COLS_P0,MAX7456_ROWS_P0,MAX7456_FULLSCREEN);
OSD.display();
OSD.setDefaultSystem(MAX7456_PAL);
Wire.begin();
Serial.begin(57600);
pinMode(23,INPUT); // VSYNC pin 23, On Arduino Mega 2560/ OSD MAX7456
//****************************************************************
//MPU-9150
while(PINA&2); // VSYNC pin 23/OSD MAX7456
MPU.selectDevice(DEVICE_TO_USE);
MPU.init(MPU_UPDATE_RATE, MPU_MAG_MIX_GYRO_AND_MAG, MAG_UPDATE_RATE, MPU_LPF_RATE); // start the MPU
while(PINA&2); // VSYNC pin 23/OSD MAX7456
}
//****************************************************************
//-----------------------------------------
void loop(){
MPU.selectDevice(DEVICE_TO_USE); // only needed if device has changed since init but good form anyway
if (MPU.read()) { // get the latest data if ready yet
MPU.printAngles(MPU.m_dmpEulerPose); // the Euler angles from the dmp quaternion
// MPU.printQuaternion(MPU.m_rawQuaternion); // print the raw quaternion from the dmp
// MPU.printVector(MPU.m_rawMag); // print the raw mag data
// MPU.printVector(MPU.m_rawAccel); // print the raw accel data
// MPU.printVector(MPU.m_calAccel); // print the calibrated accel data
// MPU.printVector(MPU.m_calMag); // print the calibrated mag data
// MPU.printAngles(MPU.m_fusedEulerPose); // print the output of the data fusion
}
}
Here is all libraries For MPU-9150,i have only Modified the MPU9150 CPP file,to work with OSD Max7456.
see attachment.
Here is a video of the working mpu-9150,on the third line on the screen , is mpu-9150 X-Y-Z
On the compass i have add.North,South,West,East--- (on Norwegian)
I have made some custom symbol for ROLL,PITCH.
Arrow up with F and degrees,mean Front is 20 degrees up.
Arrow down with F and degrees,mean Front is 20 degrees down.
Arrow down with V and degrees, mean left side is 20 degrees down.
Arrow down with H and degrees, mean right side is 20 degrees down..
libraries For MPU-9150.rar (73.6 KB)