Tilted Horizon – the technical background and profound solution

Joined
May 30, 2018
Messages
3
Reaction score
7
Age
24
Hey folks,

like many of you I had issues with tilted horizon. Not finding the right answers and next to no technical background of the gimbal whatsoever on the internet I set to work. Here’s my story:

When my (used) P3P arrived, the gimbal protector was loose in the box and when I first started the Phantom up there was a major tilt, auto calibration only helped to a certain point and it was lost after every restart. The problem and the fix were quite easy and known to most people after a few minutes on Google: Opening the back cover of the roll axis and rotating the shaft using tape covered pliers to line up the flat perfectly and horizontally with the camera. This will also solve many “Gimbal motor overload” errors, just like the realignment of the yaw axis after an impact. The roll arm is connected to the motor via a magnetic lock. If you can’t turn the shaft without using a lot of force, try pulling the motor and the roll arm apart a little. After the adjustments make sure the lock sits nice and tight by pressing the two parts together. If you can now rotate the shaft against the roll arm without using a lot of force (this was the case for me and it kept misaligning during transport even with the gimbal protector) there is probably some grease from the bearing on the shaft inside the hole of the roll motor. Use rubbing alcohol to clean both parts of the locking assembly. The lock should be super tight now. If it isn’t you can still use glue, but I try to avoid that if possible.

Still, the main problem persisted: a tilted horizon, not constant (that could also easily be corrected for in the App, using C2 + Camera wheel or best by aligning the motor shaft correctly as described above) but changing, depending on the aircraft orientation.

Fixes that are commonly discussed and I have tried:

- Cold IMU-Calibration

- Gimbal calibration

- Compass Calibration

- Gimbal calibration

In that order with testing after the first gimbal calibration and the compass calibration. That didn’t change a thing, it even seemed a little worse after. I think that these things are at most part of the problem will rarely solve the problem alone. So I did some digging, reverse engineering and some tests and here’s what I found out:

There are exactly three sets of sensors that are used for gimbal positioning: The aircraft’s IMU including the compass, a gyro in the camera itself (camera gyro) and rotary positions sensors on the gimbal motor shafts (shaft sensors) which are potentiometers or in case of the yaw axis a magnetic rotary position sensor (Melexis MLX90316 BCG combined with a washer-shaped magnet on the motor shaft, next to the sensor, not above as it is supposed to be according to the datasheet). As for the gyro in the camera, I’m sure that it is one, however even after hours of searching I couldn’t find the product name of the sensor (see the image, if some knows the name please let me know).

Camera_Board.JPG


I found that there are two control mechanisms for the gimbal which I will call a short-term one and a long-term one.

The short-term control corrects the camera orientation immediately to keep the camera pointed in the desired direction. The corresponding gyroscope is on the back of the camera sensor. TEST (well, a way to find out): If the aircraft or main gimbal control board are moved while tilt motor control board is not connected to the shaft and not being tilted, the short-term correction still occurs. If neither the potentiometer position nor the orientation of the board (theoretically a sensor on there is possible) are used, there must be a sensor in the camera board. A look inside proves that (see the images). Although the abbreviation MPU is generally used for “microprocessor unit” it is also used for “motion processing units” by InvenSense/TDK that are commonly used in these kinds of application. Also, the mounting with no components near it points in that direction which is probably done to avoid interference with other components.

The long-term control evaluates the orientation of the camera, determined only through the shaft sensors, relative to the aircraft IMU orientation. In this highly smoothed/dampened process the IMU orientation is regarded as a true value. From this, assuming the main gimbal control board, providing the connection to the aircraft via the silicone dampeners, is on average level, the corresponding correct positions of the axes (shaft sensors) are calculated. Deviations are corrected. This is probably done because the camera gyro is not super precise and stable over a long period of time. Assuming that it will drift over time makes it necessary to perform these corrections. TEST: If you tilt the main gimbal controller with the aircraft staying in place, you see the camera slowly tilt the same way. Bending the landing gear a little to turn the compass will make the camera slowly yaw in the same direction. Even moving a magnet about 30 cm away from the compass will only affect the camera yaw, not the roll or pitch.

Knowing the basics, the causes of problems based on the physical setup of the Phantom can be derived:

First, a small thing: Depending on how far up or down the roll (tilt) motor board is positioned, there can be a small gap between the flat of the motor shaft and the flat in the potentiometer. The center position of the camera is determined during startup using this potentiometer. If there is a slight misalignment due to the play in the potentiometer, the camera can be tilted. It can also cause slight tilting from one side to the other the entire time the gimbal is turned on. This can be easily fixed by placing a piece of scotch tape, that is cut to the correct size perfectly, on the flat of the shaft. The board itself is also loose but it shouldn’t move too much during normal operation as the ribbon cable on the side usually pulls it into one position.

The compass has generally no impact on the camera tilt angle as it is only responsible for yaw as I described above. However, those tests were done with a correct calibration and after the aircraft was started up. If the compass is somehow misaligned with the aircraft from the beginning, that can cause problems similar to the one I’ll describe next.

Let’s get to the bigger influences: The axes need to be physically aligned to be accurately parallel to the ones of the aircraft. If this is not the case it will cause false positioning of some or even all axes, with tilt being the most undesirable one. This comes from that long-term control I described. Let’s consider the tilt: Assuming the actual yaw angle of the gimbal was rotated to the right 90 degrees relative to the shaft sensor zero position and by that also to the aircraft’s IMU, rolling the aircraft left, say 30 degrees, will first be counteracted correctly by the short-term control pitching 30 degrees down. But then the aircraft knows that in its current position there should be a 30-degree roll and no pitch, so it will slowly force the camera to that position. The horizon is now 30 degrees tilted. Of course, the misalignment won’t be that big, so the tilt will be much smaller. I have conducted tests misaligning the yaw axis relative to the motor shaft and the effect can be seen very well. The influence if the yaw axis misalignment is the strongest, since the other two axes depend on it.

The extent of the tilting problem on a Phantom is therefore mainly directly proportional to the misalignment of the axes, especially the yaw axis. The quality of the alignment straight from the factory is statistically distributed so there are many people with very slight tilts, most of whom will never notice it, and there are people, like many of you reading these lines, who do notice it and might have a major tilt. Also, any hard impacts on the gimbal such as a crash or transportation without gimbal guard will enhance the problem.

The alignment: The roll axis alignment is already covered in the beginning of the post and should be done thoroughly. The yaw axis especially needs to be aligned very well. A first tell of that not being the case is the camera looking to the side and not straight forward. The yaw axis is held in place by a hex set screw that is sitting on the flat of the motor shaft. First you should make sure that this is actually the case and there is no misalignment by just loosening the set screw, moving the shaft relative to the yaw arm a little bit and retightening it. A quick way of making small adjustments is using thin wire and placing it between the screw and the shaft on one side of the screw. The set screw should be fastened as tight as it was before. I found that using copper wire doesn’t allow that because it gets deformed quickly. In that case it is advisable to use Loctite or a similar product on the screw to make sure it won’t come loose.

The automatic gimbal calibration only seems to have an effect on the tilt and only within a certain range. Smaller tilt misalignments can be corrected and actually seem to be saved permanently while large misalignments are lost after restart like it was the case for me initially. It won’t correct the yaw misalignment of gimbal and aircraft that I described above. If you adjust your roll you should definitely do a gimbal calibration afterwards. I would also recommend doing one after any realignments since it doesn’t seem to make anything worse and there can be some influences by one alignment to another one.


To Summarize:

The reason for a changing tilted horizon is a misalignment of the gimbals axes and the aircraft.

The Fix: Aligning all systems correctly, in this order:

IMU-Calibration: This is most likely not required, just check the sensor state on a level surface. If the x, y and z values of the gyroscope and acceleration are below approximately 0,03 the IMU should be just fine.

Compass-Calibration: Just do one.

Align the roll axis (aircraft off, of course).

Do a gimbal auto calibration, power off, power on, check the result.

If there is some camera tilting happening when you pitch the aircraft forwards or backwards and hold it in that position, align the yaw axis.

Do a gimbal auto calibration, power off, power on, check the result. Repeat if needed.


This post was obviously inspired by having problems with tilted horizon but it also wouldn’t have happened with the correct starting point which was this post:

Gimbal horizon roll problem [SOLVED BY NOT IMU CAL]

I have also posted most of this post over there.

I think it would be great for the community if someone could transfer the information from this post to the Phantom 4. I think the system on the P4 will be quite similar, but it should be tested first.


Best regards

Henrik
 
Joined
Apr 3, 2016
Messages
373
Reaction score
119
Age
64
Thanks for the details Henrik ...
 
Joined
Sep 14, 2014
Messages
199
Reaction score
49
A very nice writeup and I will respond back with my results after I apply this methodology to my P4P.
 
Joined
May 30, 2018
Messages
3
Reaction score
7
Age
24
Hey Folks,


here's a little follow-up on my original post.

As I described, the long-term control assumes that the gimbal main control unit, providing the connection to the aircraft via the silicone dampeners, is on average level. If, however, the aircraft is moved horizontally very quickly or has to fight strong wind, it will tilt quite a bit. Depending on the dampeners, the drop protectors and the wind, this will cause the gimbal main controller to tilt relative to the aircraft a little which will cause the horizon to tilt the same angle as this relative tilt. For me this effect is pretty minor, but it is worth mentioning.

One thing I forgot to mention is that there are three hall sensors on each gimbal motor, placed on the round pcb. They are used by the motor controller as feedback but not for the general gimbal control that I described above, at least not on the P3.

The reason I remembered this was because I looked into the P4’s gimbal, using videos on the Internet of people taking it apart. From what I could see, there is still a sensor in the camera assembly (on that cut-out portion of the pcb with gel on it, probably for vibration reduction, maybe also thermal stabilization to reduce thermal drifts; if you have a picture of the chip where you can see the case markings please send it to me, I'm very interested which sensor they use). There are no external potentiometers near the motors. On the motor ribbon cables there are the standard three power leads going straight to the coils and five low-power leads for Vcc, GND and three times signal of the three hall sensors. These are used to measure the relative position of the motor. To get an adequate angular resolution, they will be used as analog sensors. They generally cannot provide an absolute position since the combined signal of the three sensors is only definite within one revolution of the motor. The motors can’t be turned more than one revolution, and even if they could, it wouldn’t make a difference, since only the position within that one revolution is relevant for this application. From this I assume that all of what I posted about the P3’s control mechanisms is valid for the P4 with the hall sensors replacing the P3’s potentiometers on the P4. Mechanically this does make a big difference, though, since it seems like there are no adjustable connections or parts. This does probably increase the overall durability, but when there is a misalignment or bad calibration there is not much you can do mechanically. One option would be to be to replace the motor of the axis that is malfunctioning and hope that the physical alignment of magnets and hall sensors is close enough to the one the controller expects. For the yaw axis, which contributes most to a tilted horizon, you might be able to adjust the orientation at the vibration dampening system.

I think for those people whose gimbal can’t be fixed by doing a gimbal calibration, it might be worth it to see what can be done mechanically and post it here.

Best regards

Henrik
 
Joined
Sep 6, 2018
Messages
1,373
Reaction score
821
Age
55
Location
Canada
Excellent post! I've noticed that ever so slightly on my P3P. Very well written and i know exactly what to do now thank you!
 
Joined
Oct 17, 2016
Messages
69
Reaction score
8
Location
Indianapolis, IN
Hey folks,

The alignment: The roll axis alignment is already covered in the beginning of the post and should be done thoroughly. The yaw axis especially needs to be aligned very well. A first tell of that not being the case is the camera looking to the side and not straight forward. The yaw axis is held in place by a hex set screw that is sitting on the flat of the motor shaft. First you should make sure that this is actually the case and there is no misalignment by just loosening the set screw, moving the shaft relative to the yaw arm a little bit and retightening it. A quick way of making small adjustments is using thin wire and placing it between the screw and the shaft on one side of the screw. The set screw should be fastened as tight as it was before. I found that using copper wire doesn’t allow that because it gets deformed quickly. In that case it is advisable to use Loctite or a similar product on the screw to make sure it won’t come loose.

Henrik

The gimbal on my P3P has always pointed 3-4 degrees left of straight ahead. I have checked the set screw on the motor shaft and it is tight. I read your post about using thin wire but the space between the set screw and the flat of the motor shaft seems unlikely that a piece of wire would allow for proper adjustment. I need more explaining of what you mean.
 
Joined
Apr 28, 2019
Messages
2
Reaction score
0
Age
32
Hey folks,

like many of you I had issues with tilted horizon. Not finding the right answers and next to no technical background of the gimbal whatsoever on the internet I set to work. Here’s my story:

When my (used) P3P arrived, the gimbal protector was loose in the box and when I first started the Phantom up there was a major tilt, auto calibration only helped to a certain point and it was lost after every restart. The problem and the fix were quite easy and known to most people after a few minutes on Google: Opening the back cover of the roll axis and rotating the shaft using tape covered pliers to line up the flat perfectly and horizontally with the camera. This will also solve many “Gimbal motor overload” errors, just like the realignment of the yaw axis after an impact. The roll arm is connected to the motor via a magnetic lock. If you can’t turn the shaft without using a lot of force, try pulling the motor and the roll arm apart a little. After the adjustments make sure the lock sits nice and tight by pressing the two parts together. If you can now rotate the shaft against the roll arm without using a lot of force (this was the case for me and it kept misaligning during transport even with the gimbal protector) there is probably some grease from the bearing on the shaft inside the hole of the roll motor. Use rubbing alcohol to clean both parts of the locking assembly. The lock should be super tight now. If it isn’t you can still use glue, but I try to avoid that if possible.

Still, the main problem persisted: a tilted horizon, not constant (that could also easily be corrected for in the App, using C2 + Camera wheel or best by aligning the motor shaft correctly as described above) but changing, depending on the aircraft orientation.

Fixes that are commonly discussed and I have tried:

- Cold IMU-Calibration

- Gimbal calibration

- Compass Calibration

- Gimbal calibration

In that order with testing after the first gimbal calibration and the compass calibration. That didn’t change a thing, it even seemed a little worse after. I think that these things are at most part of the problem will rarely solve the problem alone. So I did some digging, reverse engineering and some tests and here’s what I found out:

There are exactly three sets of sensors that are used for gimbal positioning: The aircraft’s IMU including the compass, a gyro in the camera itself (camera gyro) and rotary positions sensors on the gimbal motor shafts (shaft sensors) which are potentiometers or in case of the yaw axis a magnetic rotary position sensor (Melexis MLX90316 BCG combined with a washer-shaped magnet on the motor shaft, next to the sensor, not above as it is supposed to be according to the datasheet). As for the gyro in the camera, I’m sure that it is one, however even after hours of searching I couldn’t find the product name of the sensor (see the image, if some knows the name please let me know).

View attachment 99475

I found that there are two control mechanisms for the gimbal which I will call a short-term one and a long-term one.

The short-term control corrects the camera orientation immediately to keep the camera pointed in the desired direction. The corresponding gyroscope is on the back of the camera sensor. TEST (well, a way to find out): If the aircraft or main gimbal control board are moved while tilt motor control board is not connected to the shaft and not being tilted, the short-term correction still occurs. If neither the potentiometer position nor the orientation of the board (theoretically a sensor on there is possible) are used, there must be a sensor in the camera board. A look inside proves that (see the images). Although the abbreviation MPU is generally used for “microprocessor unit” it is also used for “motion processing units” by InvenSense/TDK that are commonly used in these kinds of application. Also, the mounting with no components near it points in that direction which is probably done to avoid interference with other components.

The long-term control evaluates the orientation of the camera, determined only through the shaft sensors, relative to the aircraft IMU orientation. In this highly smoothed/dampened process the IMU orientation is regarded as a true value. From this, assuming the main gimbal control board, providing the connection to the aircraft via the silicone dampeners, is on average level, the corresponding correct positions of the axes (shaft sensors) are calculated. Deviations are corrected. This is probably done because the camera gyro is not super precise and stable over a long period of time. Assuming that it will drift over time makes it necessary to perform these corrections. TEST: If you tilt the main gimbal controller with the aircraft staying in place, you see the camera slowly tilt the same way. Bending the landing gear a little to turn the compass will make the camera slowly yaw in the same direction. Even moving a magnet about 30 cm away from the compass will only affect the camera yaw, not the roll or pitch.

Knowing the basics, the causes of problems based on the physical setup of the Phantom can be derived:

First, a small thing: Depending on how far up or down the roll (tilt) motor board is positioned, there can be a small gap between the flat of the motor shaft and the flat in the potentiometer. The center position of the camera is determined during startup using this potentiometer. If there is a slight misalignment due to the play in the potentiometer, the camera can be tilted. It can also cause slight tilting from one side to the other the entire time the gimbal is turned on. This can be easily fixed by placing a piece of scotch tape, that is cut to the correct size perfectly, on the flat of the shaft. The board itself is also loose but it shouldn’t move too much during normal operation as the ribbon cable on the side usually pulls it into one position.

The compass has generally no impact on the camera tilt angle as it is only responsible for yaw as I described above. However, those tests were done with a correct calibration and after the aircraft was started up. If the compass is somehow misaligned with the aircraft from the beginning, that can cause problems similar to the one I’ll describe next.

Let’s get to the bigger influences: The axes need to be physically aligned to be accurately parallel to the ones of the aircraft. If this is not the case it will cause false positioning of some or even all axes, with tilt being the most undesirable one. This comes from that long-term control I described. Let’s consider the tilt: Assuming the actual yaw angle of the gimbal was rotated to the right 90 degrees relative to the shaft sensor zero position and by that also to the aircraft’s IMU, rolling the aircraft left, say 30 degrees, will first be counteracted correctly by the short-term control pitching 30 degrees down. But then the aircraft knows that in its current position there should be a 30-degree roll and no pitch, so it will slowly force the camera to that position. The horizon is now 30 degrees tilted. Of course, the misalignment won’t be that big, so the tilt will be much smaller. I have conducted tests misaligning the yaw axis relative to the motor shaft and the effect can be seen very well. The influence if the yaw axis misalignment is the strongest, since the other two axes depend on it.

The extent of the tilting problem on a Phantom is therefore mainly directly proportional to the misalignment of the axes, especially the yaw axis. The quality of the alignment straight from the factory is statistically distributed so there are many people with very slight tilts, most of whom will never notice it, and there are people, like many of you reading these lines, who do notice it and might have a major tilt. Also, any hard impacts on the gimbal such as a crash or transportation without gimbal guard will enhance the problem.

The alignment: The roll axis alignment is already covered in the beginning of the post and should be done thoroughly. The yaw axis especially needs to be aligned very well. A first tell of that not being the case is the camera looking to the side and not straight forward. The yaw axis is held in place by a hex set screw that is sitting on the flat of the motor shaft. First you should make sure that this is actually the case and there is no misalignment by just loosening the set screw, moving the shaft relative to the yaw arm a little bit and retightening it. A quick way of making small adjustments is using thin wire and placing it between the screw and the shaft on one side of the screw. The set screw should be fastened as tight as it was before. I found that using copper wire doesn’t allow that because it gets deformed quickly. In that case it is advisable to use Loctite or a similar product on the screw to make sure it won’t come loose.

The automatic gimbal calibration only seems to have an effect on the tilt and only within a certain range. Smaller tilt misalignments can be corrected and actually seem to be saved permanently while large misalignments are lost after restart like it was the case for me initially. It won’t correct the yaw misalignment of gimbal and aircraft that I described above. If you adjust your roll you should definitely do a gimbal calibration afterwards. I would also recommend doing one after any realignments since it doesn’t seem to make anything worse and there can be some influences by one alignment to another one.


To Summarize:

The reason for a changing tilted horizon is a misalignment of the gimbals axes and the aircraft.

The Fix: Aligning all systems correctly, in this order:

IMU-Calibration: This is most likely not required, just check the sensor state on a level surface. If the x, y and z values of the gyroscope and acceleration are below approximately 0,03 the IMU should be just fine.

Compass-Calibration: Just do one.

Align the roll axis (aircraft off, of course).

Do a gimbal auto calibration, power off, power on, check the result.

If there is some camera tilting happening when you pitch the aircraft forwards or backwards and hold it in that position, align the yaw axis.

Do a gimbal auto calibration, power off, power on, check the result. Repeat if needed.


This post was obviously inspired by having problems with tilted horizon but it also wouldn’t have happened with the correct starting point which was this post:

Gimbal horizon roll problem [SOLVED BY NOT IMU CAL]

I have also posted most of this post over there.

I think it would be great for the community if someone could transfer the information from this post to the Phantom 4. I think the system on the P4 will be quite similar, but it should be tested first.


Best regards

Henrik
What do you mean by "Line up the flat perfectly and horizontally with the camera."? Can you show us a picture or video? I think this is exactly what I need to do but i don't quite understand. My gimbal (roll motor) is not keeping a level horizon - Video
 
Joined
May 30, 2018
Messages
3
Reaction score
7
Age
24
Hi Guys,

somehow notifications for new answers don’t seem to work for me. So I’m sorry for my very late reply.

As for the alignment of the yaw axis, this is quite a fiddly task. The strategy is basically to put something between the screw and the flat of the motor shaft. Normally, when you tighten the screw, it will cause the flat to be perpendicular to the screw. Now you have to put something between the two, that changes this angle. That “something” can be pretty much anything that satisfies two conditions: it must have the correct geometry to cause the desired change of the angle AND it must not change its geometry when you tighten the set screw properly. To be perfectly honest, I don’t remember what I ended up using and I can’t see inside the gap to find out. I really don’t want to open the system back up since it works very well now and I don’t want to mess that up. I still think that the correct amount of thin copper wire placed on one half of the flat is a good approach that is available to most people. You will have to take into account that it will be deformed once the screw is tightened, but although this is fiddly it can be done. Using Locktite on the screw is advisable. An alternative to copper wire would be to make a tiny wedge out of aluminum or even steel, that does requires some manual skill though.

One last thought on the yaw axis: When I was working on my P3P at my desk, I noticed that it was “looking to the side” a few degrees most of the time, but sometimes to the left and sometimes to the right. This effect depends on the direction and the speed the aircraft was rotated (yaw) before it was set down on the table. This can be explained by a hysteresis in the long-term control of the yaw axis. That can be caused either by the sensor itself or the control algorithm. This effect has to be considered when adjusting the axis. Otherwise you will just keep adjusting a “changing misalignment” which will drive you crazy. The best method is probably: slowly yaw the aircraft in one direction and set it down. Note the remaining yaw error of the camera. Now repeat the process turning the other direction. The adjustment should cause the mean error to be zero (the mean orientation of the camera perfectly forwards). However, the real test that tells you whether the tilted horizon is fixed, is to roll and pitch the aircraft (simply sitting on a table) and make sure the horizon doesn’t tilt.

All of what I just explained are just details of my original post. All steps should be taken in the order that I explained there.

The (very easy) alignment of the roll axis can be found in several YouTube videos, like this one:


Best regards
Henrik
 

New Threads

Members online

Forum statistics

Threads
141,080
Messages
1,453,050
Members
102,900
Latest member
Ozzyjim