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

      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...

      SSH Into Raspberry Pi with Tailscale VPN

      SSH Into Raspberry Pi with Tailscale VPN

      Effortlessly access and manage your Raspberry Pi from anywhere using Tailscale's secure mesh VPN.

      Send Email with Lua and the ESP32

      Send Email with Lua and the ESP32

      In this tutorial, we delve into sending emails with the ESP32-S3 using Lua, focusing on the Xedge IDE's built-in SMTP...

      How to Code with Lua on ESP32 with XEdge32

      How to Code with Lua on ESP32 with XEdge32

      Learn how to set up Xedge32 and start coding on the ESP32-S3 with Lua programming!

      Stream Audio From Raspberry Pi to Local Computer

      Stream Audio From Raspberry Pi to Local Computer

      Discover the simplicity of streaming live audio directly from a USB microphone connected to your Raspberry Pi to...

      SSH Raspberry Pi via Cell Phone

      SSH Raspberry Pi via Cell Phone

      This beginner-friendly guide will walk you through remotely controlling your Raspberry Pi using SSH through your cell phone.

      Remotely Control Raspberry Pi via SSH from External Network

      Remotely Control Raspberry Pi via SSH from External Network

      Learn how to SSH into your Raspberry Pi from any network. This is critical in IoT since you can control...

      Stream Video from Raspberry Pi Camera to YouTube Live

      Stream Video from Raspberry Pi Camera to YouTube Live

      Learn how to stream to YouTube from a Raspberry Pi Camera.

      Back to blog

      Leave a comment

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