Introduction: Connecting MPU6050 With ESP32
In this project, i am going to interface MPU6050 sensor with ESP32 DEVKIT V1 board.
MPU6050 is also known as 6 axis sensor or 6 degree of freedom(DOF) sensor. Both accelerometer and gyrometer sensors are present in this single module. Accelerometer sensor give output readings in terms of force applied on object due to gravity and gyrometer sensor give output in terms of angular displacement of the object in clockwise or anticlockwise direction.
MPU6050 sensor use SCL and SDA line of ESP32 DEVKIT V1, therefore, we will be using wire.h library in the code for I2C communication. We can attach two MPU6050 sensors with same SCL and SDA lines at address 0x68 and 0x69 with ESP32 DEVKIT V1.
Step 1: Components Required
1. ESP32 DEVKIT V1 board - https://amzn.to/3iXiWN1
2. MPU6050 sensor - https://amzn.to/361uCLk
3. Jumper wires - https://amzn.to/3iqdBxM
4. Breadboard(optional) - https://amzn.to/3kdp4Rt
5. Arduino IDE software
Setting up your Arduino IDE before uploading code in ESP32 is very important : - https://www.instructables.com/id/Setting-Up-Ardui...
Step 2: Circuit Schematic
Circuit Schematic will be different for different ESP 32 board so take care of Pins you are connecting
ESP32 --> MPU6050 Pins
VIN(5V) --> VCC
GND --> VCC
SCL(GPIO22) --> SCL
SDA(GPIO21) --> SDA
Step 3: Code
Steps to follow while uploading code in ESP32 board
1. Click on upload.
2. If no error. At the bottom of Arduino IDE, when we get message Connecting ...,...,
3. Press Boot button on ESP 32 board till you get the message done uploading.
4. After you code is uploaded successfully. Press enable button to restart or start code uploaded on ESP32 board.