Trybotics Logo

Controlling of Servo Motor with Arduino and MPU6050 © GPL3+

DESCRIPTION

Components

Connections

Check the attach diagram for connections

Note: You can also connect SDA and SCL pins of MPU6050 to A4 and A5 pin of Arduino respectively.

Programming

Include the attached library in your arduino IDE, then upload the code in your Arduino board.

Note

Check the video for complete understanding and subscribe our channel for more.

Thank You.

Description:

Description:

Components

Connections

Check the attach diagram for connections

Note: You can also connect SDA and SCL pins of MPU6050 to A4 and A5 pin of Arduino respectively.

Programming

Include the attached library in your arduino IDE, then upload the code in your Arduino board.

Note

Check the video for complete understanding and subscribe our channel for more.

Thank You.

Description:

MPU6050 LibraryC/C++
No preview (download only).
Code for ProjectC/C++
//[email protected]
//https://www.youtube.com/watch?v=Cvtr3LKdqvk


#include <GY6050.h>           //library for GYRO 
#include <Wire.h>
#include <Servo.h>

Servo myservo;  // create servo object to control a servo


int X = 0;
int Y = 0;
GY6050 gyro(0x68);              //to save GYRO data


void setup() {

  Wire.begin();            //initializing GYRO
  gyro.initialisation();
  delay(100);
  myservo.attach(9);
}

void loop() {
  X = map(gyro.refresh('A', 'X'), -90, 90, 0, 180);                //mapping the gyro data according to angle limitation of servo motor 
  Y = map(gyro.refresh('A', 'Y'), -90, 90, 0, 180);
  myservo.write(Y);                                               //movement of Y axis will control servo
 delay(15);

}

Description:

Circuit Digram
Servompu dqznm44jks


YOU MIGHT ALSO LIKE