Roll and Pitch Axis Gimbal for GoPro Using Arduino - Servo and MPU6050 Gyro

Introduction: Roll and Pitch Axis Gimbal for GoPro Using Arduino - Servo and MPU6050 Gyro

This instructable was created in fulfilment of the project requirement of the Makecourse at the University of South Florida (

The goal of this project was to build a 3-axis Gimbal for GoPro by using Arduino nano + 3 servo motors + MPU6050 gyro/accelerometer. In this project, I controlled 2-axis (Roll and yaw) by using MPU6050 gyro/accelerometer, the third-axis(yaw) is controlled remotely and manually by the help of HC-05 and Arduino BlueControl app which is in Android App Store.

This work also includes all the 3D design files of mechanical components of Gimbal. I shared .stl files for easily 3D printing and 3D design files at the bottom.

At the beginning of my project, my plan was to build 3-axis gimbal with 3 brushless motors, because brushless motors are smooth and more responsive compare to servo motors. Brushless motors are used in high speed applications, so we can adjust the speed of motor buying ESC(controller). But to be able to use brushless motor in Gimbal project, I realised that I have to drive brushless motor like a servo. In servo motors, the position of motor is known. But in brushless motor, we do not know the position of motor, so it is a drawback of brushless motor which I could not figure it out how to drive it. At the end I decided to use 3 MG995 servo motors for the high torque required Gimbal project. I controlled 2 servo motors for roll and pitch axis by using MPU6050 gyro, and I controlled yaw axis servo motor by using HC-05 bluetooth and Android app.

Step 1: Components

The components which I used in this project ;

1- Arduino Nano (1 unit) (Micro usb)

2- MG995 Servo motors (3 units)

3- GY-521 MPU6050 3 axis Accelerometer/Gyroscope (1 unit)

4- HC-05 Bluetooth Module (To control yaw(Servo3) axis remotely)

4- 5V micro usb portable charger

Step 2: Implementing 3 Servo Motors + MPU6050 Gyro + HC-05

Servo Wiring

Servo1 (Roll) , Servo2 (Pitch) , Servo3(Yaw)

Servo motors have 3 wires : VCC(red), GND(brown or black) , PWM(yellow).

D3 => Servo1 PWM(yellow wire)

D4 => Servo2 PWM(yellow wire)

D5 => Servo3 PWM(yellow wire)

5V PIN of Arduino => VCC(red) of 3 servo motors.

GND PIN of Arduino => GND(brown or black) of 3 servo motors


MPU6050 gyro wiring

A4 => SDA

A5 => SCL

3.3 V PIN of Arduino => VCC of MPU6050

GND PIN of Arduino => GND of MPU6050


HC-05 Bluetooth wiring

D9 => TX

D10 => RX

3.3 V PIN of Arduino => VCC of HC-05 Bluetooth

GND PIN of Arduino => GND of HC-05 Bluetooth

Step 3: 3D Design and Functionality

I completed 3D design of Gimbal by taking reference of other Gimbals which is sold on the market. There are three main components which rotates with servo motors. I designed a GoPro mount which fits to its size.

The .step file of all 3D design is shared at bottom to enable editing easier.

Step 4: Control Mechanism

The main algorithm of my Gimbal project use Quaternion rotation which is alternative to Euler angles. I used helper_3dmath.h library as a reference to enable smooth movement by using Quaternion algorithm. Although Pitch axis response smooth, The roll axis lag to respond the stick movement. By using Quaternion algorithm, I was able to control Roll and Pitch servo motors. If you want to use yaw axis, you may need to use second MPU6050 just to control yaw axis. As an alternative solution, I configured HC-05 and controlled yaw axis remotely with android app by using buttons. In each press to push button, yaw axis servo rotates 10 degree.

In this project, the libraries which I had to import externally are as follows ;

1- I2Cdev.h // Used with wire.h to enable communication with MPU6050

2- "MPU6050_6Axis_MotionApps20.h" // Gyroscope library

3- <SoftwareSerial.h> // It allows to convert digital pins into RX and TX pins ( It is need for HC-05 bluetooth module)

4- <Servo.h>

5- <Wire.h> // It allows to communicate with I2C devices which use two data pins (SDA and SCL) =>MPU6050

The main code is created by Jeff Rowberg, and I modified it according to my project functionality and commented all functions in ino file.

1 Person Made This Project!


  • Raspberry Pi Contest

    Raspberry Pi Contest
  • Jewelry Challenge

    Jewelry Challenge
  • Fix It Speed Challenge

    Fix It Speed Challenge



2 years ago

I get these error messages.

Roll_Pitch_Axis_Gimbal:160:13: error: 'LED_PIN' was not declared in this scope
exit status 1
'LED_PIN' was not declared in this scope

What should I do?


Reply 2 years ago

You will not need LED_PIN. You can comment it out.

Screen Shot 2019-02-11 at 6.17.26 PM.png

2 years ago

kindly tell me where are the .stl files for 3D printed parts?? I was unable to find these files Sir.


Reply 2 years ago

Sorry it is my mistake. I will add stl files within a day

Pedro Castelani
Pedro Castelani

Tip 3 years ago

Hey, if this is your first instructable you might enter it into the First Time Author contest. Its in the contest section

Pedro Castelani
Pedro Castelani

3 years ago

What app are you using on the cellphone? I would like to build the project also

Pedro Castelani
Pedro Castelani

Reply 3 years ago

Thanks! I already built it but without the z servo and the bluetooth, just to make it simpler. I could add it later. Great Instructable!

DIY Hacks and How Tos

Great first Instructable. Thanks for sharing with the community.