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

      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.

      Raspberry Pi Pico/Pico W Free Simulator

      Raspberry Pi Pico/Pico W Free Simulator

      Discover how to simulate Raspberry Pi Pico projects using Wokwi, a free online simulator for Arduino and MicroPython....

      Interfacing the MPU6050 with Raspberry Pi Pico W in C++

      Interfacing the MPU6050 with Raspberry Pi Pico W in C++

      Interface with the MPU6050 using the Raspberry Pi Pico W in C++.

      How to Write your First C++ Program on the Raspberry Pi Pico W

      How to Write your First C++ Program on the Raspberry Pi Pico W

      Write your first C++ Program on the Pico W in a few simple steps.

      How to Use ThingSpeak with the Raspberry Pi Pico W

      How to Use ThingSpeak with the Raspberry Pi Pico W

      Learn how to create a real-time environmental monitoring system with the Raspberry Pi Pico W and ThingSpeak!

      How to Use ADS1115 with the Raspberry Pi (Part 1)

      How to Use ADS1115 with the Raspberry Pi (Part 1)

      Discover how to expand your Raspberry Pi projects by integrating the ADS1115 ADC for precise analog signal reading....

      How to Install Pip Packages in AWS Lambda Using Docker and ECR

      How to Install Pip Packages in AWS Lambda Using Docker and ECR

      Learn how to streamline AWS Lambda deployments by using Docker and Amazon Elastic Container Registry (ECR) to package...

      Create Tabular Product Descriptions on Your Shopify Store

      Create Tabular Product Descriptions on Your Shopify Store

      Enhance your Shopify store's product pages with our comprehensive guide on implementing tabular descriptions. Learn how to add a...

      Back to blog

      Leave a comment

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