1
\$\begingroup\$

Has anyone used the IMU-3000 with an attached accelerometer? I am creating a system which interfaces the IMU-3000 and attached ADXL345 (IMU Fusion board from SparkFun) with an Arduino board to do all the computations about a projectile in motion and output values to an LCD. I was just looking for how to read the various axis individually since it all comes through the same pin. Does anyone know the commands for that in Arduino? I am very new so if I am sounding stupid please just help me understand.

\$\endgroup\$
  • \$\begingroup\$ WOW thank you so much. I'm excited to compile this and give it a shot when I get home. Also, thanks for showing me how to turn the bytes into integers as I didn't know how to do that either. This has shed some serious light on what was otherwise too daunting a task to know where to start! \$\endgroup\$ – user3631 Mar 28 '11 at 14:56
2
\$\begingroup\$

The IMU-3000 uses the I2C bus to communicate with the Arduino. The I2C bus is a simple serial protocol (much like the way you talk to the Arduino from your PC) that utilizes an single line that works in both directions.

In order to use the I2C bus, you need to include the Wire.h library that comes standard with the Arduino. You can then implement the protocol outlined in the datasheet to get the specific values that you want.

Here is a rough example of what I'm talking about. This code is untested, but it should give you the general flow of what you are trying to do on the Arudino. Once you have the low-level reading done, you can start to implement filters to smooth your data and get it into the format you need for your application.

#define GYRO 0x69 // gyro I2C address
void setup()
{
    Wire.begin();
    // Do other gyro stuff here, sample rate, max speed, power management
    // From datasheet, set power management to internal oscillator
    Wire.beginTransmission(GYRO); //Device Address
    Wire.send(0x3E); //Register Address
    Wire.send(0x00); // Value
    Wire.endTransmission();
}

void main()
{
    // A quick read example, temperature, gyro x,y,z
    Wire.beginTransmission(GYRO);
    Wire.send(0x1B); //Register Address TEMP_H
    Wire.endTransmission();

    Wire.beginTransmission(GYRO);
    Wire.requestFrom(GYRO,6); // Read 8 bytes
    int ii = 0;
    while(Wire.available())
    {
        buff[ii] = Wire.receive();
        ii++;
    }
    Wire.endTransmission;

    //Combine bytes into ints
    int temperature = buff[0] << 8 | buff[1];
    int gyro_x = buff[2] << 8 | buff[3];
    int gyro_y = buff[4] << 8 | buff[5];
    int gyro_z = buff[6] << 8 | buff[7];
}
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy