Intro: 3D Printed 3-axis GoPro Gimbal
This is a tutorial for 3D printing, assembling, and calibrating a 3-axis gimbal. Specifically, this gimbal is used for a GoPro camera to allow for smooth and stable recording. The gimbal keeps the camera level by pivoting around it. An inertial measurement unit (IMU) records the pitch, yaw, and roll of the camera. Using three brushless motors placed on the 3 different axes around the camera, the gimbal moves the three separate motors to stabilize the camera by counteracting the changes in the pitch, yaw, and roll as measured by the IMU. When the IMU detects changes on these axes, the motors cancel it out. This is done using algorithms that can differentiate between deliberate camera movement and unwanted shake. Gimbals can be mounted to vehicles such as drones, where vibrations or other unexpected movements would make such shots unusable. Gimbals are also useful in photography, specifically when long range telephoto lenses are used: a gimbal rotates such a lens around its center of gravity, allowing for smooth adjustment while tracking moving subjects at a far distance.
USAQ Storm32 V1.31 32-Bit BGC 3-Axis Brushless Gimbal Controller Motor Driver with MPU6050
(x3) 2804-210Kv Brushless Gimbal Motor
3000mAh Super Polymer Rechargeable Battery 02 US Plug
- 9 Printed Pieces (files links under 'Printing the Parts' section)
(x4) M1 Bolt and Nut 12mm, (x4) M2 Bolt 8mm, (x4) M3 Bolt 4mm, (x2) M3 Bolt 6mm
Step 1: Printing the Parts
The mounting parts for this handheld gimbal are a combination of 3D printed parts designed by us and parts designed by Velocirotor in their thingverse page titled "Primbal V3." As explained earlier, one of the most crucial features of a gimbal is camera balance when the motors are off. Obtaining a well-balanced gimbal requires prototyping and testing mounts until the desired balance is achieved. Since the time frame of this project was constricted, we decided to use a previously designed and tested motor/camera mounting system.
The previously designed parts were made to be ultimately mounted on a drone, rather than a handle for holding. This is where we had to step in and design our own base and handle for the gimbal. We used the 3D modeling program Rhinoceros to design a mount for the base of the camera as well as a handle for holding the gimbal during use.
The first step is to print all of the parts, whose .STL files are all linked in the article. There are 8 parts in total, but only 6 unique parts, so make sure to print out two arms and two bolt spacers.
Step 2: Assembling the Gimbal - Yaw Motor
The fully assembled gimbal is pictured, with each part labeled according to its file name
After printing the parts and obtaining the screws, the first part of the assembly is to mount the motors onto the motor mounts.
First, screw the yaw motor onto the base using the 4mm screws. Make sure the motor is on the correct side of the base
Step 3: Assembling the Gimbal - Roll Motor
The second part of the assembly is installing the roll motor and roll motor arm.
First, you must remove the wires from the plastic housing by lifting up on the tabs using a flathead screwdriver or other small tool.
Then thread the wires through the hole in the side of the motor housing, as shown in the picture. Once the wires are through, you can insert the wires back into the housing.
After the wires are threaded through, seat the motor in the housing and screw in the back of the motor using two 4mm screws
Lastly, insert two 2mm screws into one of the bolt spacers and screw them into the yaw motor, through the roll motor arm(see picture).
Step 4: Assembling the Gimbal - Pitch Motor and Camera Mount
The third part of the assembly is installing the pitch motor, pitch motor arm, and the camera mount.
Repeat the roll motor procedure for inserting the pitch motor into the pitch motor arm
Like you did for the roll motor arm, mount the pitch motor arm onto the roll motor using the bolt spacer.
Step 5: Wiring the Motors
Wiring the motors is very easy. Following the wiring above (Mot0 is pitch, Mot1 is roll, Mot2 is yaw) plug the motors in. It doesn't matter the order of the 3 wires in each motor itself as the software will correct itself.
Step 6: Balancing and Calibrating the Gimbal
To calibrate our gimbal, we used software specifically designed to interface with the Storm32 board. The download link can be found here. On this website you can find a much more in-depth discussion of the Storm32, its settings and calibration procedure, but we will outline the process here.
Before you attach your Storm32 board and IMU to your gimbal, make sure that you do a 6-point calibration for both the IMU and the board. Pictured below is our setup to do the calibration. Make sure that you have some very level surface to do the calibration on and and some thing to keep it steady in 6 directions. A good video of the process can be found here. Essentially you will be going to the "Calibration Acc" tab, clicking "Run 6-point Calibration" and orienting your IMU/board in six directions and storing the values. Make sure that you only record the values once the sensors have settled. It is important to try and keep the sensors from any strong jolts or vibrations during this step or else you will have a poorly calibrated gimbal. Once you've made the calibrations, make sure to save them somewhere and write them to the board.
Now that your sensors are properly calibrated, you are ready to start setting up and tuning your gimbal. However, before you do any of the following steps, make sure that the gimbal is properly balanced. A properly balanced gimbal should not move from the position you initially placed it in, no matter how you twist or turn it or heavily shake it. We recommend disconnecting the motors, then balancing the roll axis first, then the pitch, and yaw last. balance on the yaw axis is the least important of them all so it can be more approximate. We found that with our design, the yaw axis balance could have been better, but that can be remedied by extending the length of the yaw arm.
Once your gimbal is balanced, reconnect the motors and open up the Storm32 GUI. Make sure that the IMU is properly reading values in the "Data Display" Window (pitch, yaw, roll values are updating as expected). We will now run the gimbal configuration tool and then tune our setup. Run the setup, making sure that it fully completes the process, the board will emit a loud beep then start vibrating when complete. Your gimbal is now operational and just needs to be tuned. If you were unable to complete the configuration steps, make sure that all of your motors are plugged into the correct ports, that they are all operational and that your power source has enough juice to power your motors (>10V). Also check that your balance is correct. If you still aren't completing the setup process, try adjusting your PID settings as outlined below and retry. You can skip to the PID step by de-selecting "step II" in the procedure. Other troubleshooting can be found on the Storm32 wiki.
Tuning the PIDs
Now we are going to set the PID values for each of the motors (Proportional Integral Derivative). Make sure to turn off the motors not currently being used. We suggest tuning pitch then roll then yaw. Navigate to the PID tab and turn all values (P,I and D) to zero. We will first set Vmax. You want Vmax to be as low as possible such that it can still cope with any forces you expect your gimbal to encounter (wind, swerves, etc.) but not be too strong and induce shaking or vibrations. This should be approximately good when the motor resists you moving it slightly, but doesn’t inhibit movement too much. Once you have set Vmax, we will now adjust the D values. We want to raise D as high as possible without introducing jitters, whining sounds or large vibrations. You’ll know when your D value is good when the camera smoothly snaps from one magnet alignment to another when you push on it. Make sure that you are always writing the changes to the board. After D we will move to the P value. The P value sets how much the camera should adjust to changes in its position, and again we want it to be as high as possible. To tune the P, make sure to set I to as low as possible without it being zero (5 or 30). When you’re adjusting P, you want a smooth transition from being moved away from the rest position back to the rest position. Make sure that there aren’t any jitters or high pitch whining sounds. You want a smooth transition. Finally we will raise the I value as high as possible without introducing shaking or vibrations. The I value will help the gimbal snap quickly back into position and respond to movements. With these tuned and done for each motor, you should now have a fully functioning gimbal. Once you’ve re-enabled all of the motors, make sure that you wait ~10 seconds for the setup process to run before moving it. After that, you will hear a loud beep meaning that the motors are running and the gimbal is operating.
Some good sources:
Step 7: Assembling the Gimbal - Controller Mounting
Finally, use a non-permanent(or permanent) adhesive to fix the controller board onto the platform in it's housing. Then slide the clips from the yaw motor mount over the controller housing/handle. Make sure the orientation matches that in the image, since the gaps in the housing are designed for specific sections of the controller.
You now have a fully assembled gimbal!
Step 8: Arduino Addendum
It is also possible to make a gimbal with an arduino, but this is a much more involved and laborious process. A good instructable on this, and the inspiration for our work can be found here. Instead we made several setups that show the versatility of the Arduino and how you can pair it with an IMU. The wiring for the lighting display can be found above, along with the code. We also made several other setups, such as a animated display of the 3d position and a rough gimbal made via 2 servo motors. Here are some useful links.
Interfacing Gyros with arduino - 3D data
Servo gimbal with arduino
Servo arduino intro