Tutorial to Interface GY-85 IMU 9DOF Sensor With Arduino

13,600

12

5

Introduction: Tutorial to Interface GY-85 IMU 9DOF Sensor With Arduino

Description

GY-85 IMU 9DOF Sensor that has nine (9) axis which are three (3)-axis gyroscope, triaxial accelerometer and three (3)-axis magnetic field. Communication with the HMC5883L, ITG3205 and ADXL345 is simple and all done through an I2C interface. The power and 2-wire interface pins are all broken out to a 0.1" pitch header. Uses famous HMC5883L, ITG3205 and ADXL345 magnetometer chips. Supports 3.0V to 5.0V IO levels on I2C SCL and SDA pins.

Specification:

  1. Power supply :3V - 5V
  2. IO Voltage Level: 3V - 5V
  3. Communication : IIC communication protocol,fully compatible with the 3-5V System and circuit contain LLC

Step 1: Step 1: Materials Preparation

In this tutorial, you will need :

1. Arduino Uno Board and USB Cable.

2. GY-85 IMU 9DOF Sensor

3. Jumper Wires

4. LCD 16X2

5. Breadboard

6. 10K Potentiometer

7. Push Button

8. Arduino IDE Software

Step 2: Step 2: Pin Description

VCC : Power supply
GND : GND power

SCL: I2C Clock Input

SDA : I2C Data IO

DRDY: Data Ready Output

Step 3: Step 3: Pin Connection

Connect GY-85 IMU 9DOF Sensor to Arduino Uno Board as following :

  • 3.3V to +5V
  • GND to GND
  • SCL tO A5
  • SDA to A4

Connect LCD to Arduino Uno Board as following :

  • VSS to +5V
  • VDD to GND
  • RS to 12
  • RW to GND
  • E to 11
  • D4 to 5
  • D5 to 4
  • D6 to 3
  • D7 to 2
  • A/VSS to +5V
  • K/VDD to GND

Connect 10K Potentiometer to LCD as following (refer image for potentiometer pinout) :

  • GND to GND
  • Data to v0
  • VCC to +5V

Step 4: Step 4: Connect Arduino to Computer

After complete your circuit, connect your Arduino Uno Board to your computer via USB Cable. You can see that your LCD will on.

Step 5: Step 5: Sample Source Code

You may download the sample source code and open it on your Arduino IDE. Choose the correct board and port. Then, upload your Code into your Arduino Uno Board.

Step 6: Step 6: Library

You have to download these libraries before uploading the sample source code into your Arduino IDE to allow Arduino to communicate with LCD and GY-85 IMU 9DOF Sensor. Download the ZIP file below > Open Zip File > Extract to your Arduino Uno Library folder. Refer the image above for your references.

Step 7: Step 7: Result : Serial Monitor and Serial Oscilloscope

This GY-85 IMU 9DOF Sensor come with result as following:

  1. when device rotate around it's X-axis, X-axis remain the same while the other two axis changed.
  2. when device rotate around it's Y-axis, Y-axis remain the same while the other two axis changed.
  3. when device rotate around it's Z-axis, Z-axis remain the same while the other two axis changed.

Moreover, this GY-85 IMU 9DOF Sensor will also provide the result of Roll Degree, Pitch Degree as well as Heading Degrees.

Step 8:

Be the First to Share

    Recommendations

    • Organization Contest

      Organization Contest
    • Micro:bit Contest

      Micro:bit Contest
    • Rocks, Gems, and Stones Speed Challenge

      Rocks, Gems, and Stones Speed Challenge

    5 Comments

    0
    Fritzgeraldrr1
    Fritzgeraldrr1

    9 months ago

    I did, but I have many errors with acc, compass and gyro definitions.:
    /Users/Fritzgerald/Downloads/Arduino_MARG_GY-85/Arduino_MARG_GY-85.ino: In function 'void setup()':
    Arduino_MARG_GY-85:37:3: error: 'acc' was not declared in this scope
    acc.powerOn();
    ^~~
    Arduino_MARG_GY-85:38:3: error: 'compass' was not declared in this scope
    compass = HMC5883L();
    ^~~~~~~
    /Users/Fritzgerald/Downloads/Arduino_MARG_GY-85/Arduino_MARG_GY-85.ino:38:3: note: suggested alternative: 'class'
    compass = HMC5883L();
    ^~~~~~~
    class
    Arduino_MARG_GY-85:44:38: error: 'Measurement_Continuous' was not declared in this scope
    error = compass.SetMeasurementMode(Measurement_Continuous); // Set the measurement mode to Continuous
    ^~~~~~~~~~~~~~~~~~~~~~
    Arduino_MARG_GY-85:61:5: error: 'gyro' was not declared in this scope
    gyro.readGyro(&gx,&gy,&gz);
    ^~~~
    /Users/Fritzgerald/Downloads/Arduino_MARG_GY-85/Arduino_MARG_GY-85.ino:61:5: note: suggested alternative: 'gy'
    gyro.readGyro(&gx,&gy,&gz);
    ^~~~
    gy
    Arduino_MARG_GY-85:76:3: error: 'gyro' was not declared in this scope
    gyro.init(ITG3200_ADDR_AD0_LOW);
    ^~~~
    /Users/Fritzgerald/Downloads/Arduino_MARG_GY-85/Arduino_MARG_GY-85.ino:76:3: note: suggested alternative: 'gy'
    gyro.init(ITG3200_ADDR_AD0_LOW);
    ^~~~
    gy
    Arduino_MARG_GY-85:76:13: error: 'ITG3200_ADDR_AD0_LOW' was not declared in this scope
    gyro.init(ITG3200_ADDR_AD0_LOW);
    ^~~~~~~~~~~~~~~~~~~~
    /Users/Fritzgerald/Downloads/Arduino_MARG_GY-85/Arduino_MARG_GY-85.ino:76:13: note: suggested alternative: 'ITG3200_DLPF'
    gyro.init(ITG3200_ADDR_AD0_LOW);
    ^~~~~~~~~~~~~~~~~~~~
    ITG3200_DLPF
    /Users/Fritzgerald/Downloads/Arduino_MARG_GY-85/Arduino_MARG_GY-85.ino: In function 'void loop()':
    Arduino_MARG_GY-85:85:3: error: 'acc' was not declared in this scope
    acc.readAccel(&ax, &ay, &az); //read the accelerometer values and store them in variables x,y,z
    ^~~
    Arduino_MARG_GY-85:98:25: error: 'compass' was not declared in this scope
    MagnetometerRaw raw = compass.ReadRawAxis();
    ^~~~~~~
    /Users/Fritzgerald/Downloads/Arduino_MARG_GY-85/Arduino_MARG_GY-85.ino:98:25: note: suggested alternative: 'class'
    MagnetometerRaw raw = compass.ReadRawAxis();
    ^~~~~~~
    class
    Arduino_MARG_GY-85:111:3: error: 'gyro' was not declared in this scope
    gyro.readGyro(&gx,&gy,&gz);
    ^~~~
    /Users/Fritzgerald/Downloads/Arduino_MARG_GY-85/Arduino_MARG_GY-85.ino:111:3: note: suggested alternative: 'gy'
    gyro.readGyro(&gx,&gy,&gz);
    ^~~~
    gy
    Se encontraron varias bibliotecas para "ADXL345.h"
    Usado: /Users/Fritzgerald/Documents/Arduino/libraries/ADXL345
    No usado: /Users/Fritzgerald/Documents/Arduino/libraries/Accelerometer_ADXL345
    exit status 1
    'acc' was not declared in this scope

    Errors MARG_GY_85.png
    0
    h0tm
    h0tm

    2 years ago

    Thank you for this detailed tutorial. But there is a problem the source code file isn't opening can u re-upload it please

    0
    Mingjun Sun
    Mingjun Sun

    2 years ago

    source code is defekt

    0
    Fishercat715
    Fishercat715

    Question 3 years ago on Step 7

    What does the display show?, can you give a video?