Introduction: GoPro Stabilizer Project - Arduino Nano

UPDATED: Revision 5 - iPhone 6, 7 and 8 carrier and bracket

This version includes 2 new parts to incorporate an iPhone 6, iPhone 7 and iPhone 8. These parts will limit rotations on multiple axes, but hey, it's now iPhone capable..

UPDATED: Revision 4

This version provides better stability and control, while starting to look like "The Machine" from the movie Contact...

This revision adds two features:

- added support and pivot bearing for Yaw axis along with a revised roll servo bracket to work with it (1 new printed part, one revised). The Yaw servo was taking quite a bit of load and deflecting adding quite a bit of shake, so this large C-shaped support tied to handle with a pivot bearing up top (same 625z bearing as used for pitch) keeps the Yaw axis aligned and removes slop and stress from the servo.

- added a push button to disable the Yaw servo and zero it, which effectively gives a method of pointing the camera where you want it (Yaw, or twist). When the button is pressed and released (and not aligned with the Yaw support), it will rotate the servo to align with the C-shaped Yaw support. If you align the Roll bracket with the Yaw support first, then press and hold the button, the Yaw servo is disabled and will stay put when released.

I've included the revised sketch that incorporates the push-button.

UPDATED: Revision 3

Added 3rd axis servo with some revised 3D printed bits. The revised printed parts also rotate all axes through the camera, providing for a more balanced operation. Tried to design some small pieces to add servo to R2 version, but didn't like it, so ended up with a revised case half (again), and the new Yaw servo bracket.

The same software "works" with a few changes; add Servo 3 in the same manner as the other two servos in the code. While it works, it doesn't yet work as you would expect, or at least the way I would expect, but it makes sense if you think about it. Twisting the handle (Yaw) does activate the Yaw servo to keep things pointed "forwards", but rotate 90 degrees and the Roll and Twist servos will effectively switch. Some more coding to counter this, or will have to add a toggle to rotate and re-centre the Yaw servo manually. Then it could be tweaked to get roll and pitch as expected.

UPDATED: Revision 2

-Revised the mechanical components to eliminate "bounce" with cantilevered camera. Revised geometry with bearing support opposite of servo.

- Provided an updated sketch that compensates for acceleration of chip. More advanced math now gets this close to usable. This is the code originally provided in woojay's post.

- Also includes an MPU6050 calibration sketch that is used to calibrate chip. (Thanks to Frank who provided working code in the comments of this page :

After Calibrated values inserted into revised sketch, gets you nearly done. A few small adjustments at end and you have a level starting point with good leveling.

This is a cheap, DIY Gyro stabilizer for GoPro camera. I wanted to put something like this together, as a standalone device using cheap components. This was inspired by Amazon browsing for Gyro stabilizers and by an Instructable by woojay. (

I modeled the components in Fusion 360 and printed the plastic bits with a Prusa i3 MK2 printer, in PLA.

Parts list:

- Arduino Nano

- MPU 6050 Gyro chip

- 9s Servos (180 deg sweep)

- AA bat (x4)

- battery terminal springs and terminals

- SPST switch for battery operation

- assorted 3D printed parts

- 625z bearing (qty:2)

The idea is to keep the circuits and batteries inside the handle and to keep the servos outside the handle. This way, I can modify the design to accept gimbal motors later on.

Step 1: Code


PlaneStabilization3Axis incorporates the pushbutton for Yaw axis control.


The MPU6050 calibration file will determine the offsets used in the PlaneStabilization file. A little tweaking to find the level starting point and it's now almost useable!

First part was to prototype it on breadboard, and that's pretty much as seen in woojay's Instructable. I started with the code in his link, but found there was a lot going on in the code. I wanted to start with something simpler, something I could work through and massage easily. I found some code on MakerBot site, from Ali Hamza ( and used that as a baseline.

Note that woojay's code will work with the same wiring, but some tweaking will be necessary. The code from woojay's post works great, once calibrated and balanced. It even has some clever functions: going over 90 degrees makes the camera migrate up or down, allowing an easy way to focus above or below horizontal plane.

It uses a few common libraries, like MPU605 and I2CDev. I had to fumble my way a bit to get libraries loaded and working, so bear in mind, I'm not a good resource for this part. I was able to quickly make changes to the Ali Hamza's code and started to refine it so that it basically works as intended.

I used some simple math to smooth things out and remove jitters. I also use some software limits to prevent the GoPro from running into the handle.

There is more tweaking to do, but I'm pretty happy that this works as well as it does with so little code. Adding one more servo for z axis takes very little, and some of the code is in place.

Step 2: Wiring


I added the Yaw control button, but haven't updated the wiring sketch yet. It merely incorporates a pushbutton with 5V to pin 7 for input. It needs a pull down resistor to ground to prevent input from floating.


To add the third servo, I added another wire on D9 (PWM) to drive the Yaw servo. An extra power and ground to drive the servo are the only other changes to drive the third servo.

I started with woojay's prototype wiring, and basically converted it for hard-wiring.

The battery half of the case is connected to the rest with a plugin terminal. The servos are plugged in the same way, with terminals wired to the Nano. This way I can separate the halves and replace servos easily.

I ran battery power to the Vin side by itself, and feed the MPU chip and the servos from the 5V pin on the board. That way the servos are getting consistent 5V power, regardless the power source (batteries or USB).

The battery terminals are taken from a cheap battery holder, and screwed into place using small screws, either machine or self tappers like provided with the servos.

Step 3: 3D Printed Parts

UPDATE 5: iPhone parts

Two parts to replace GoPro carrier and Roll bracket for GoPro. "iPhone clamp" and "iPhone Roll brkt". All other parts the same.


Yaw Bracket R2 replaces previous Roll servo support

Yaw Support is the new, large C-shaped bracket that screws to the handle and contains the bearing used to support the Yaw Bracket.


The Yaw Bracket and Case A R3 are new parts to add the third servo for Yaw. Added benefit is that all servos now act through the camera, which helps balance the rotating assembly.


The updated parts are appended R2.

I modeled the parts in Fusion 360 and printed them out on a Prusa i3 Mk2 out of PLA. Supports were used. Small pilot holes are in place wherever I used screws.

Step 4: Assembly

The wired Nano is installed vertically, with the USB port sticking down through the bottom of the handle. It is then pushed into place and locks into small recesses in the handle to keep it in place.

The MPU 6050 chip is slid into grooves horizontally, with the chips facing up. It really can go in any way, but you'd have to adjust the code to suit.

Servo 1 is installed into the top of case, using the small self threading screws supplied with it. Pay attention to the orientation of the servos. Servo 1 has the wiring pointing forwards. Servo 1 orientation is important as it is installed as shown to maintain clearance with the handle

The servo bracket is then installed onto servo 1. Servo 2 is then installed on the servo bracket.

The GoPro bracket is installed on Servo 2 and secured with the screws supplied.

Note that the printed parts that secure onto the splined Servo ends aren't perfect, even though they have 21 splines. I didn't have accurate drawings of the spline pattern, so they may require a bit of a push to get on, but once they do, they fit more like the original arms supplied with the servo.

The two case halves are screwed together using 4 small machine screws (I used 2-56 x 1/2), or the longer screws supplied with the servos.

The GoPro clamp needs to be opened up gently to accept the GoPro. Once installed, it should stay put.

Step 5: Fire It Up!


Notice how the original design has "bounce" due to the cantilevered mass of the GoPro. The revised design eliminates this. Also, the revised code is far superior.

Once you've got the code loaded up and tested out (before assembling, right?), plug it in to a USB cable or turn the switch on to run it off battery power.

The device will do a quick self test, where the servos will run a little cycle. After that, it should hopefully keep the camera close to level when you move around.

Have fun tweaking, and let us know if you've come up with improvements!