MPU6050 Arduino Project

In one of our previous Arduino project, we used a PIR motion sensor to detect movement. PIR sensors use infrared that is emitted by objects to detect movement. In this tutorial, we are going to use a MPU6050 sensor that has build-in accelerometer and gyroscope to detect movement.

The latter is often used in drones, balancing robots and other devices that need to measure position and angles.

We will have to use a few advanced techniques in order to increase the accuracy of the data extracted from the sensor. For the sake of simplicity, we will solely use the sensor here as a motion detector.

Let’s dive into the projet.

Parts needed


Make sure you do not make any confusion while purchasing the MPU6050, it is similar to the MPU9250. If you use the MPU9250, there is just no guarantee all will work fine. The color of the LED is not important, feel free to use any color.

Here is the schematic

The MPU6050 uses an I2C for communication, the SCL and SDA pins are connected on the analog pin 4 and 5.

I will suggest you use a breadboard to connect the MPU, it makes it easier.

When the connections are ready, we can upload the program to the Arduino. It reads data from the MPU6050 and displays them on the serial monitor. At the same time, it checks if the sum of the absolute value of the gyroscope reads is bigger than 0.2. If it does, it will power the LED.

Here is the screenshot of serial monitor.

And there we go! The sensor is very sensitive. It can even detect a slight shift in position as shown in the video below when I know at the table.

This can be the beginning of a very exciting project. Over to you and your imagination. Check out our other projects here.

You might also like:

Leave a Comment