How to Connect MPU6050 to Arduino UNO

The MPU6050 is a commonly used sensor module that integrates a 3-axis accelerometer, a 3-axis gyroscope, and a temperature sensor in a single compact package. It is useful for beginners because it is relatively easy to use and provides accurate measurements of orientation, motion, and tilt angles. The MPU6050 can be interfaced with microcontrollers like Arduino, Raspberry Pi, and others using I2C communication protocol, making it ideal for hobby projects such as robot control, gaming, and quadcopter stabilization. Overall, the MPU6050 is a versatile sensor that can provide valuable data for a wide range of applications.

In this tutorial, I demonstrate how to connect it with the Arduino Uno and start getting readings. Thankfully with a series of libraries, it is relatively easy to do.

- Use Discount Code SHILLEHTEK for 30% Off!

Buy MPU6050 on ShillehTek

- Or buy it on Amazon

Buy MPU6050 on Amazon

The MPU6050 is a highly capable 6-axis motion tracking device, combining a 3-axis gyroscope and a 3-axis accelerometer on a single chip. It provides real-time motion data, which is essential for various applications in robotics, motion sensing, and interactive technology. Its versatility and functionality make it an invaluable component for hobbyists and professionals alike working on motion-related projects.

Recognizing the technical challenges that can come with micro-soldering delicate components, our MPU6050 modules at ShillehTek come pre-soldered. This not only saves you time and effort but also ensures that you get reliable and consistent performance right out of the box. Whether you're building your first project or a seasoned creator, our pre-soldered MPU6050 modules provide a convenient and hassle-free solution, letting you focus on the creative aspects of your projects.

Supplies

1-) MPU6050 Soldered

2-) Jumper wires

3-) Arduino UNO

4-) USB-A to B

Step 1-) Physical Setup

The connection is very simple. You only need four jumper wires exactly as shown in the diagram, these are the most popular pins when using the MPU6050. They are described as follows:

  • GND (Ground): This pin is connected to the ground of the circuit. It is used as the reference point for all other signals.
  • VCC (Voltage Supply): This pin is connected to the power supply of the circuit. It typically requires a 3.3V or 5V DC voltage to operate.
  • SCL (Serial Clock): This pin is used to synchronize the data transfer between the MPU6050 and the microcontroller. It is the clock signal for I2C communication.
  • SDA (Serial Data): This pin is used to transfer data between the MPU6050 and the microcontroller. It is the data signal for I2C communication.

    The MPU6050 has four additional pins that are less commonly used (not needed in this tutorial:

    • XDA (Auxiliary Serial Data): This pin is an additional data line for I2C communication. It can be used for connecting multiple I2C devices in a chain.
    • XCL (Auxiliary Serial Clock): This pin is an additional clock line for I2C communication. It can also be used for connecting multiple I2C devices in a chain.
    • ADO (Address Select): This pin is used to select the I2C address of the MPU6050. It can be connected to VCC or GND to change the default address of the device.
    • INT (Interrupt): This pin is used to generate an interrupt signal when specific events occur, such as motion detection or data ready. The microcontroller can be programmed to respond to these interrupts and take appropriate actions.

      Step 2-) Code Setup

      For the sake of this tutorial, I assume you already know how to connect to the Arduino UNO in the Arduino IDE, and of course, you have the Arduino IDE installed.

      • Connect to the board as follows (in the diagram), by going to the Tools tab and selecting the correct Board and Port.
      • Install the Adafruit MPU6050 library with all corresponding dependencies

      You can find the library manager on the left side of the Arduino IDE.

      • The code is easy, thankfully the library itself comes with a full-fledged example. Go to the File tab and go to Examples, scroll to Adafruit MPU6050

      Select the basic_readings.ino and upload it to Arduino with the upload button.

      If you did everything correctly you will get readings as follows:

      Congrats, you did a good job if you made it this far. If you lacked some context in this tutorial you can watch the video on Youtube. If you simply enjoyed these simple tutorials please like, comment, and subscribe to the channel!

      Create a free account to access full content.

      All access to code and resources on ShillehTek.

      Signup Now

      Already a member? Sign In

      Explore More on Our Blog

      Controlling an LED with a Snap Using the KY-037 Sound Sensor and Raspberry Pi

      Controlling an LED with a Snap Using the KY-037 Sound Sensor and Raspberry Pi

      Discover how to set up, code, and activate the LED based on detected sound with the Raspberry Pi...

      Getting Started with the KY-037 Sound Sensor and Raspberry Pi: Detecting Sound Using Python

      Getting Started with the KY-037 Sound Sensor and Raspberry Pi: Detecting Sound Using Python

      In this tutorial, I’ll guide you through setting up the KY-037 sound sensor with a Raspberry Pi using...

      How to Post to Reddit Using Python

      How to Post to Reddit Using Python

      Post to reddit automatically using a Python script.

      How to Create a Time-Lapse Video with a Raspberry Pi Camera

      How to Create a Time-Lapse Video with a Raspberry Pi Camera

      Learn how to make a timelapse with your Raspberry Pi in Python.

      How to Integrate the MPU6050 with the STM32 Blue Pill

      How to Integrate the MPU6050 with the STM32 Blue Pill

      Learn how to measure acceleration with the STM32 and the MPU6050 in the Arduino IDE.

      Getting Started with STM32 Blue Pill in Arduino IDE Using a USB to TTL Converter — Write Your First Program

      Getting Started with STM32 Blue Pill in Arduino IDE Using a USB to TTL Converter — Write Your First Program

      This comprehensive tutorial will guide you through the process of setting up and programming the STM32 Blue Pill...

      Automate Task Scheduling in AWS with Lambda, Step Functions, and CloudWatch

      Automate Task Scheduling in AWS with Lambda, Step Functions, and CloudWatch

      In this tutorial, I'll show you how to automatically schedule tasks in AWS at regular intervals using AWS...

      Implementing Google reCAPTCHA in a Simple React and Node.js App

      Implementing Google reCAPTCHA in a Simple React and Node.js App

      Learn how to protect your React applications from bots and spam with Google reCAPTCHA integration! This step-by-step tutorial...

      AWS Lambda Tutorial: Using Selenium with Chromedriver in Python

      AWS Lambda Tutorial: Using Selenium with Chromedriver in Python

      In this tutorial, I will guide you through the process of running Selenium with ChromeDriver inside an AWS...

      How to Connect MLX90614 Infrared Thermometer to Raspberry Pi Pico W: MicroPython Tutorial!

      How to Connect MLX90614 Infrared Thermometer to Raspberry Pi Pico W: MicroPython Tutorial!

      Learn how to use the MLX90614 with the Raspberry Pi Pico W and get infrared values in MicroPython.

      Back to blog

      Leave a comment

      Please note, comments need to be approved before they are published.