MPU6050 1-Axis Gimbal
In this project, we will be building a "1 - Axis Gimbal with an MPU6050." After you plug your Arduino into a power source, keep the sensor on a leveled surface for a few seconds for more accurate results. Now if you move the sensor clockwise the roll values from the MPU6050 will decrease and the servo position will increase and when you move the sensor counter-clockwise the roll values from the MPU6050 will increase the servo position will decrease. This allows the servo to always stay level on the roll axis.
This project can still be improved.
Supplies
The components needed to make the project are:
MPU6050 Wiring
Connect the MPU6050 as following:
Arduino >> MPU6050
GND >> GND
5V >> VCC
A4 >> SDA
A5 >> SCL
INT >> D2
Servo Wiring
Connect the Servo as following:
Arduino >> Servo
GND >> GND
5V >> VCC
Signal >> D4
Uploading the Program
Open the program on Arduino IDE. Once it is open, you will have to download the "MPU6050" library from electronic cats. After that, you can download the servo library. Compile the sketch to see if it is clear of error and upload it. After uploading the program, the servo will rotate to zero degrees and then back. Open serial monitor to see the reading for the roll and servo position.
For more information about this, please visit my Patreon:
https://www.patreon.com/acedinventor
Testing the Project
Connect the Arduino Nano to a power source to see if the project is up and running. The servo will rotate to zero degrees before returning to its original position. Before you begin checking the sensor, make sure it is on a leveled surface for a few seconds. Now, rotating the sensor clockwise causes the servo to rotate counterclockwise, and rotating the sensor counterclockwise causes the servo to rotate clockwise. This helps the servo to hold the surface level at all times. You may also attach a small object to the servo, such as a button, and rotate it clockwise and counterclockwise. You'll notice that the object does not fall off.
If there is still something you don't understand, you can comment down below.