This repository contains a simple guide and example code for interfacing the MPU6050 accelerometer and gyroscope sensor with an Arduino Uno board.
To successfully interface the MPU6050 with Arduino Uno, you'll need the following:
- Arduino Uno board
- MPU6050 sensor module
- Jumper wires
- Arduino IDE (Integrated Development Environment) installed on your computer
- Connect the
VCC
pin of the MPU6050 to the5V
pin on the Arduino Uno. - Connect the
GND
pin of the MPU6050 to theGND
pin on the Arduino Uno. - Connect the
SDA
pin of the MPU6050 to theA4
pin (analog pin 4) on the Arduino Uno. - Connect the
SCL
pin of the MPU6050 to theA5
pin (analog pin 5) on the Arduino Uno.
Make sure to power off the Arduino Uno before making any connections.
- Install the Arduino IDE on your computer if you haven't already.
- Open the Arduino IDE.
- Go to File -> Examples -> MPU6050 -> Examples -> MPU6050_DMP6. This will open the example code for using the MPU6050 sensor.
- Connect your Arduino Uno board to your computer using a USB cable.
- In the Arduino IDE, go to Tools -> Board and select Arduino Uno.
- Select the appropriate Port under Tools -> Port to which your Arduino Uno is connected.
- Click the Upload button to compile and upload the code to your Arduino Uno board.
Once the code is successfully uploaded to your Arduino Uno, open the Serial Monitor in the Arduino IDE by clicking on the magnifying glass icon in the top right corner of the IDE. Set the baud rate to 115200.
You should see the sensor readings (accelerometer and gyroscope) being displayed in the Serial Monitor. You can move the sensor around to see the values change.
Feel free to modify the example code according to your requirements. You can explore other example sketches provided by the MPU6050 library to access different functionalities of the sensor.
For more information about the MPU6050 and its functionalities, you can refer to the following resources:
This project is licensed under the MIT License. Feel free to use and modify the code as per your needs.
Please note that this is a basic readme file and you may need to refer to additional resources or documentation for more advanced implementation and troubleshooting.