[SOLVED] an i2c imu displaying info on an i2c oled

Hi there,

looking for enlightenment in a situation where I want to use two devices on the same i2c bus.
I am able to use either of the devices alone.
I am unable to scan the bus and locate the id’s(http://playground.arduino.cc/Main/I2cScanner).
Any help is welcomed (wiring/sample project)
picture attached

mpu6050: http://playground.arduino.cc/Main/MPU-6050
0.96 oled: http://divshare.com/download/25084925-403

Don't use XDA and XCL.

I don't know about that display. Is it a real I2C display ? Some of those displays are not very compatible with I2C. Which library are you using for the display ? Is that compatible with the Arduino I2C (Wire) library ?

Connect everything to the same I2C bus (the SDA and SCL from the Arduino board).
Try the U8Glib for the display : Google Code Archive - Long-term storage for Google Code Project Hosting.


problem solved, at least I can get raw data :slight_smile:
code and picture for further reference.

#include <Wire.h>
#include "U8glib.h"

// Display
U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NO_ACK); // Display which does not send AC
// IMU
const int MPU=0x68;  // I2C address of the MPU-6050
int16_t AcX,AcY,AcZ,Tmp,GyX,GyY,GyZ;

void setup(){
  Wire.write(0x6B);  // PWR_MGMT_1 register
  Wire.write(0);     // set to zero (wakes up the MPU-6050)

void loop(){
  Wire.write(0x3B);  // starting with register 0x3B (ACCEL_XOUT_H)
  Wire.requestFrom(MPU,14,true);  // request a total of 14 registers
  AcX=Wire.read()<<8|Wire.read();  // 0x3B (ACCEL_XOUT_H) & 0x3C (ACCEL_XOUT_L)     
  AcY=Wire.read()<<8|Wire.read();  // 0x3D (ACCEL_YOUT_H) & 0x3E (ACCEL_YOUT_L)
  AcZ=Wire.read()<<8|Wire.read();  // 0x3F (ACCEL_ZOUT_H) & 0x40 (ACCEL_ZOUT_L)
  Tmp=Wire.read()<<8|Wire.read();  // 0x41 (TEMP_OUT_H) & 0x42 (TEMP_OUT_L)
  GyX=Wire.read()<<8|Wire.read();  // 0x43 (GYRO_XOUT_H) & 0x44 (GYRO_XOUT_L)
  GyY=Wire.read()<<8|Wire.read();  // 0x45 (GYRO_YOUT_H) & 0x46 (GYRO_YOUT_L)
  GyZ=Wire.read()<<8|Wire.read();  // 0x47 (GYRO_ZOUT_H) & 0x48 (GYRO_ZOUT_L)

  do {
    u8g.setPrintPos(0, 20); 
    u8g.print(" ");
    u8g.print(" ");
  } while( u8g.nextPage() );

Nice 8)

The MPU-6050 is able to connect internally the SDA to XDA and SCL to XCL, but I think it has to be enabled with a command.