First, special thanks to Brian Stigall and his video on YouTube showing how to do this. I figured it would be helpful to make the commands used easily accessible and to be copied and pasted.
Just an obligatory disclaimer that I am not responsible for any damages that may result to your equipment including PC, drone, or other devices that could be affected by these scripts. Please understand what you are doing and how these tools work before just running commands on your PC and/or your drone. This worked well for my DJI Spark and it should work for other drones that do not have Gimbal Calibration in their Go Fly App. Documentation related to the DJI Firmware Tools can be found on the github page here: https://github.com/o-gs/dji-firmware-tools/blob/master/README.md
If you find yourself with a tilted or drifting horizon or basically a gimbal that just won’t stay level this will be your fix. Below you will read what happened to me and the steps that were able to successfully fix the problem.
I recently lost a propeller (aftermarket set) about 3 seconds after take off and my Spark took off at an angle and lodged straight in a tree. I recovered my bird and upon inspection 2 of my other propellers had damage but otherwise appeared fine so I went to Amazon and ordered some Genuine DJI Spark Propellers. You can get them from Amazon by clicking here.. My current propellers at the time were an aftermarket set along with some aftermarket spares. I have seen other people have a lot of luck with aftermarket propellers, but it is no longer worth it to me to risk an expensive drone by saving $5 on propellers.
A few days later I received the new genuine propellers, installed them, and while I was doing my pre-flight checks I noticed that my camera wasn’t level. I adjusted the gimbal roll for my first time ever and it appeared level. After take off everything was still level however I quickly noticed after getting to my desired location to record some footage that my gimbal was out of level again. I adjusted it again and soon learned that after any yaw or roll movements that my gimbal was not going back to level and during extended roll movements I could watch the tilt grow more and more! I landed my Spark and returned to my place where I could do a good IMU calibration and compass calibration as those were some suggestions I found in my initial search. I then did some motions with the Spark in my hand and found the issue was still happening. I hunted the Go Fly App for the ability to do the gimbal calibration which some other model DJI Drones appear to have, but had no luck finding it with the Spark. I posted to Reddit asking for suggestions and was directed to the video by Brian linked to at the beginning of this post.
Needless to say it worked and wanted to give back and document in writing for those that like to follow written directions. Below you will find the procedure to calibrate the gimbal for a DJI Spark and likely other DJI drones that do not have the option in the DJI App. I don’t wish this problem on anyone, but if you happen to find yourself with it hopefully this will help. The DJI Firmware Tools are written in Python which is a high level programming language and can be used on any major operating system such as Windows, Linux, or even Mac. The instructions below are for Windows but they can easily be adopted for other operating systems.
Download the Python 3.7.0 installation linked above. Any version of Python 3 should work, but 3.7.0 is documented and linked to for this tutorial. I chose to install Python with a ‘Custom Installation’ to C:\DJI\python\ and Add Python to environment variables which allows it be ran by just typing ‘python’ in the command line. Python is easy to run because you just type ‘python’ however I used a short path C:\DJI for all of these extractions so that it is easy to navigate to from the command line which we will be doing shortly.
The pyserial archive is a .tar.gz file. This is a tarball archive (.tar extension) with GNU Zip (.gz extension) which is basically a different type of zip archive that Windows does not natively support. Because of this you will need to use 7zip, which is linked above, or another compatible utility to extract the pyserial files. After installing 7zip or another compatible tool just open the pyserial-3.4.tar.gz file. Because of the way .tar.gz files are archived you will go through a few folder levels before you get to the actual needed content folder. I extracted the meat and potatoes of pyserial to C:\DJI\pyserial
I extracted the DJI Firmware Tools folder dji-firmware-tools-master contents using 7zip to C:\DJI\firmware-tools Make sure you review the README.md file to understand what these tools do and how they operate!
Place your Spark on a level surface, power it on, and connect via a Micro USB cable to the port beside of your SD Card slot. There is no need to connect the controller.
To find the COM port your USB connection is using press the Win+X keys (The ‘Win’ key or Windows Key is usually between Ctrl and Alt on the left side of your keyboard with the Windows logo on it) to open the Power Users menu and select Device Manager. Expand the Ports (COM & LPT) section and you should see USB Serial Device (COM#). If there are multiple devices you can disconnect and reconnect the Spark to see which device disappears and reappears. Note the COM port number because you will need it later. You can now close the Device Manager.
Now we need to open an Administrator Command Prompt or PowerShell Session. Press Win+X keys to open the Power Users menu and select Command Prompt (Admin) or Windows PowerShell (Admin) and accept the User Account Control warning about making changes to your device.
Once you are in Command Prompt or PowerShell we need to navigate to the pyserial folder we just extracted and install pyserial. to do this use these commands. If you extracted to a different folder you will need to substitute that folder in the commands below.
cd c:\DJI\pyserial
python setup.py install
Now for the moment of truth! We need to navigate to the DJI Firmware Tools folder and execute the commands to get our gimbal recalibrated. Staying in the Administrator Command Prompt or PowerShell session we will now run the following commands to calibrate.
cd c:\DJI\firmware-tools
python comm_og_service_tool.py com3 SPARK GimbalCalib JointCoarse
python comm_og_service_tool.py com3 SPARK GimbalCalib LinearHall
During each of the the comm_og_service_tool.py commands your gimbal will bounce around and then hopefully finish with a Summary ending in “result: Pass”.
Hopefully your calibration was successful. Disconnect the Micro USB and connect your remote along with your phone or tablet. Your picture should now be level. I attempted some motions with the drone in my hand and everything looked good. Next I preformed my pre-flight check and took it up for a quick test flight to verify everything was working as it should and let out a big sigh of relief.
Special thanks again to Brian Stigall and the kind folks on Reddit who pointed me in the right direction.
20 Comments
Hi it will woking wit mavic zoom
Probably, but no guarantees.
Do you think this will work for a phantom with a yaw motor swap or gimbal esc swap? The Phantom series usually require you to swap out the casing but if you have to switch the esc board (which is calibrated to the magnets in that yaw motor) it won’t work as only DJI can calibrate the gimbal with the new motor or esc (they have a utility that they will not share since it’s has proprietary information in it) . I currently have a P4 that keeps showing an overload and I think the esc may be the culprit and the calibration option available does not seem to fix the problem I am trying to prevent replacing the entire gimbal.
Hi Kevin,
Unfortunately I don’t see anything in the readme file for the DJI Firmware Tools which can be found here: https://github.com/o-gs/dji-firmware-tools/blob/master/README.md
If you have any luck please come back and share your solution.
Hello kevin, thank you for your explanation.
I could do it with my mac with some changes.
I used “terminal” for execute the command “python3 setup.py install” to install the pyserial.
In the other hand i type in terminal “ls /dev/tty.*” to establish de name that mac used to my spark.
Then the command i used in the folder “dji-firmware-tools-master” was “./comm_og_service_tool.py /dev/tty.usbmodem2415 -vv SPARK GimbalCalib JointCoarse”. You will have to change the “usbmodem2415” part for your own spark identification.
The second command is “./comm_og_service_tool.py /dev/tty.usbmodem2415 -vv SPARK GimbalCalib LinearHall”. Remember to change the “usbmodem2415” for your own.
I hope this will helpful.
Hello. Please help, I have a Mac osx system! How does calibration work on a Mac? Can you give me a link to that? thank you very much
Enrique gave these instructions in another comment:
Hey Peter, Instead of the Windows version of Python you would use the Mac version. A full guide for installing Python 3 is here: https://docs.python-guide.org/starting/install3/osx/
Once you have Python 3 you just replace the Windows paths I have with the correct paths for where you extract the files on your Mac. The DJI tools work through Python so once you have Python operating you can use the DJI tools.
I did with my Spark Calibration and system show:” Calibration time exceeded; calibration must have ended. Summary: took 22.6 sec; received 233 reports; result:UNSURE”
Did you try multiple attempts at calibration?
Yes, 3-4 times and result same
It sounds like you have some mechanical problems within the gimbal and may require repair or replacement.
What do we replace the “SPARK” with in the command when using it with the mavic pro? Thanks
MAVIC PRO: WM220
MAVIC 2: WM240
MAVIC 2 ENTERPRISE: WM245
MAVIC 2 ENTERPRISE DUAL: WM246
MAVIC MINI: WM160
MAVIC AIR: WM230
MAVIC AIR 2: WM231
MATRICE 100: MAT100
MATRICE 200: MAT200
MATRICE 600: MAT600
INSPIRE 1: WM610
INSPIRE 2: WM620
AGRAS MG-1: MG1
AGRAS MG-1S: MG1S
SPARK: WM100
OSMO X3: WM610_FC350*
OSMO X5: WM610_FC550
Hello
I have issue with mavic 2 pro
Gimbal motor overloaded
Sorry, I don’t have a 2 Pro and I’m not familiar with troubleshooting. May I suggest trying reddit.com/r/DJI
Mavic mini does not appear as a USB Serial Port. What could be the reason for this? When I connect the Mavic mini via USB it shows up as WM160 Disk drive. How can I overcome this problem? If I overcome this problem, I will have a chance to try Gimbal Calibration. Thank you.
Does it appear like this with the MicroSD removed?
Same here. Already removed the SD-Card, tried different cables and PCs/Macs.
– https://github.com/444A49/minifindings
It looks like you will have to try what is suggested here to get it to go into serial mode. Looks like it would be easier to do on Linux though.