I too got excited about the recent development of the brushless direct drive gimbals, pioneered by AlexMos. So far, all DIY or commercial solutions (I know about) are for cameras of the GoPro size or larger, but I was interested in building a gimbal for cameras of the key chain type, i.e. a micro brushless gimbal. I did encounter, however, various problems, and so I went into trying to understand better the brushless direct drive. My considerations and results please find below.
1. Basic experimental observations
2.1. Three-phase motor model, 2.2. Sinusoidal motor drive, 2.3. Direct-drive motor model, 2.4. Gimbal model
3. Typical cases and comparison to experiment
3.1. Static behavior, 3.2. Small angle behavior, 3.3. Behavior at constant speed
4. Model estimation and validation
Appendix A.1, A.2
1. Basic experimental observations
As a first step towards a micro gimbal I investigated several motors for their suitability, and I ended up with the PS2 Slim disc drive motor. It needs to be rewound and slightly remodeled (for details on the motor see here). Using this motor and a keychain camera I made a 1-axis gimbal for testing. Three observations I found key to better understand the brushless direct drive:
(1) Static angle deflection
If the motor is driven such as to hold a certain position, but a mechanical torque is applied to it, then the motor will turn somewhat to avoid the torque. If the torque is removed the motor will return to its original position. The stiffness, with which the motor reacts to a torque, is the stronger the larger the applied voltage. If, however, the torque becomes too large then the motor will snap into a new minimum position. It’s like scraping with a stick across a washboard, where the height of the ripples is given by the voltage and the period by the number of motor poles.
These observations are of course totally expected and easily understood; they characterize the static behavior. The motor stiffness determined by this experiment is an important motor parameter.
(2) Oscillatory step response
If the motor is driven such as to hold a certain position, and the gimbal is first deflected (by e.g. tapping it with a finger) but then released, then the motor will return to its original position within a certain time. For my gimbal setups, the motor returns with a pronounced oscillatory behavior. The gimbal (motor+mount+camera) is thus characterized as an under-damped second-order process.
The gimbal oscillation frequency and damping coefficient are important motor parameters, characterizing the dynamic behavior.
(3) Locking into oscillations at large drive speeds
If the motor is driven such as to rotate at a fixed speed, then the motor can get into a situation where it doesn’t move forward anymore but oscillates permanently around a certain position. For this to happen the speed has to be above a threshold speed. The oscillation frequency is the faster and the amplitude the smaller the larger the nominal drive speed is. This non-advancing oscillatory state can be reached by e.g. taping the camera to hold, or by trying to speed up the motor too fast.
These observations indicate that the gimbal system is highly non-linear. They came as a surprise to me, and it had in fact been these findings, and my desire to understand them, which triggered all the work presented here :-).
This video shows phenomenon (3):
I have also build a 1-axis test gimbal using a EMax CF2822 (12n14p, rewound 75 turns, 15 Ohms) and a Lumix (ca. 150g) camera, for which I made also observations (1) and (2) [I did not check for (3)].
The starting point for the theory of the brushless direct drive is the observation, that the brushless motor is essentially used as a 3-phase synchronous motor, and is driven by applying a 3-phase sinusoidal voltage to the phases. I won’t go into this here; I assume that this is well understood by the reader.
2.1. Three-phase motor model
The following motor model can be found in any introductory text on 3-phase motors:
The angle denotes the electrical angle of the motor’s rotor. It is related to the mechanical angle via the number of motor pole pairs : . With the transformation the equations read:
with Eq. (2.4)
with Eq. (2.5)
And with the transformation one obtains:
Instead of the representation I found it more convenient to express the equations using a complex notation, (I haven’t seen this done in the literature I found on the web, but it’s probably quite standard). It results in
2.2. Sinusoidal motor drive
Next we have to describe the sinusoidal motor drive, which is simple enough. The motor drive applies three voltages to the motor, with amplitudes . The angle determines the position at which the motor is supposed to be, and it is our control variable for moving the motor. The applied voltages lead to currents, which may however not be in phase with the voltages, and hence are characterized by another angle . In complex notation we obtain:
2.3. Direct-drive motor model
Using Eq. (2.13) our motor is thus described by
where I have set in order to be more consistent with usual notation of motor parameters. For our purposes we may simplify Eqs. (2.14) and (2.15), since the motor will never be driven at high rotation speeds, and hence . We arrive at the direct-drive motor model:
2.4. Gimbal model
Finally we have to take into account the mechanical properties of the motor and the camera attached to it. The mechanical dynamics of both can be described by a moment of inertia , and some friction:
Please note that I have used here the electrical rotation angle, and not the mechanical angle. I will assume in the following. We thus arrive at the equation of motion:
which is that of a driven damped non-linear oscillator ( is the drive). The sine-type non-linearity is well known from the physical pendulum, and we will strongly profit from the results available for it. We thus write also
3. Typical cases and comparison to experiment
Having established the model for the direct-drive gimbal, Eqs. (2.18) and (2.19), we can discuss some typical situations. In fact, we can consider now exactly those three cases presented in Chapter 1.
3.1. Static behavior
The direct-drive motor model Eq. (2.16) neatly explains observations (1). When a not too large torque is applied to the motor, a difference occurs between position as commanded by the motor drive and actual position of the motor. Moreover, the lag is the more pronounced the larger the torque. The stiffness at small torques is given by
which emphasized the relevance of the parameter . If the torque is too large, the motor will slip, since the sine function is bounded.
3.2. Small angle behavior
If the difference between commanded angle and motor position is small we may approximate the sine in Eqs. (2.18) or (2.19), which leads to the damped driven harmonic oscillator:
Notably, the strength of the drive is not an independent variable, but is given by the oscillation frequency itself. From this equation we may derive the transfer function
showing that the gimbal represents a second order process. It may be over-damped then (which is good for control) or under-damped then (which is harder for control).
As expected, the resonance frequency increases (i.e. the system becomes faster) with increasing voltage amplitude (stronger motor) as well as with decreasing moment of inertia (gimbal/camera easier to turn). Interestingly, since somewhat unexpected, the system becomes less damped with higher voltages, which may explain why for a given setup smaller voltages yield a better gimbal performance (as control is easier).
For my micro and Lumix test gimbals I observe strongly under-damped oscillations in a step response experiment [observation (2) in Chapter 1], i.e., the parameters are unfortunately such that is quite small.
3.3. Behavior at constant speed
This case is, from an intellectual point of view, most interesting. I found it convenient to switch to the new variable , which can be regarded as the phase lag. Then Eq. (2.19) becomes
Driving the motor at constant speed corresponds to , implying and . With damping neglected, which is sufficient for grasping the general behavior, we arrive at
Hence, the phase lag behaves like a non-linear oscillator, with a standard sine-type non-linearity. We immediately infer two different solutions:
(1) For small phase lags or , oscillates harmonically with frequency : (see e.g. this animation). That is, the motor advances with speed , but with harmonic oscillations superimposed: . The amplitude , or energy of the pendulum, is small for small speeds, but increases with speed. In the video shown in Chapter I the superimposed oscillations are observed as a sort of stuttering at intermediate speeds (below the threshold speed).
(2) The pendulum may be excited strongly, such that it permanently overturns (see e.g. this animation). The phase lag hence advances constantly with a non-harmonic periodic function superimposed: , where is non-trivially obtained. Hence, the motor is not advancing but oscillates around a fixed position: . The amplitude of the oscillation decreases with larger energy of the pendulum or speed .
The crossover between the two regimes occurs at the point there the pendulum has just enough energy to complete a full swing (see e.g. this animation) (in the phase space diagram this is the separatix), and which situation occurs is controlled by the energy of the pendulum. The energy in turn is roughly determined by the square of the speed, .
These findings explain nicely all observations (3) in Chapter 1.
4. Model estimation and validation
Using the micro gimbal test setup I recorded the step response for four different voltages. More precisely, the motor was driven using the L6234 driver IC at 3S, and the H bridges of the L6234 were driven with PWM signals with 8 bit resolution at 8 kHz. The different voltages were set via different maximal PWM duty cycles. Vmax = 100 e.g. corresponds to a duty cycle of 100/256. A step of amplitude „100“ was applied, which corresponds to a 100/252 * 60° = 23.8° mechanical turn of the gimbal. The angle was determined by integrating the gyro signal (MPU6050) taken every 1 ms, the angle value was however recorded „only“ every 5 ms. The gyro setting was DLPF 256, FS 1000, SR 0. I repeated the measurements several times and found good reproducibility. The curves for the four voltages Vmax = 200, 100, 50, and 25 are shown in the following diagram. The step occured at time t = 0.
The oscillatory response corresponding to a highly under-damped second-order process is clearly observed. Furthermore, the above trends are clearly seen: The higher the voltage the larger the frequency and the smaller the damping. Taking into account that the derived model is also able to reproduce observations (1) and in particular observations (3) described in Chapter 1, we can conclude that the model captures the behavior of the real gimbal quite well, at least on a semi-quantitative level.
Quantitatively, some discrepancies are observed. The damped oscillations are reasonably but not perfectly fitted by a damped harmonic oscillator; the period shifts somewhat during the relaxation, and the damping is not perfectly exponential. This can be, however, due to many reasons, e.g. the friction model is too simplistic, the non-linearity is not of sine-type e.g. due to cogging torque moments, or the process is higher-order. Also, a step of „100“ or 23.8° might be too large for the considered linear regime to hold (I might repeat the measurements for smaller steps, but I find the above results convincing enough). To give some numbers, the resonance frequency decreases from ca. 12 Hz at Vmax = 200 to ca. 7 Hz at Vmax = 25, and the damping increases from ca. 0.04 to ca. 0.15.
The step responses do not settle at 23.8° for the larger voltages. I was suspecting that this comes from the limited gyro bandwidth, which introduces integration errors. I am not sure about it, however.
For the test gimbal with the Emax CF2822 and Lumix camera I obtained very similar data, only that the frequencies are generally somewhat smaller, it is ca. 7 Hz at Vmax = 200. The same trends are however observed.
The above results demonstrate the challenges in controlling direct-drive gimbals using PID controllers. The process is rarely strongly over-damped, where the transfer function could be approximated by a model with a dominating time constant. In contrast, the process is nearly critical or even strongly under-damped as in the case of my micro and Lumix test gimbals, and tuning is much „harder“ since a complex or nearly complex pair of poles needs to be compensated for instead of only one real pole. This implies that the conventional rules for tuning PID controllers do not apply, and that the feedback loop is quite sensitive to parameter variations. Using a parameterization of the P, I, D values which is better adapted to oscillatory second-order plants might simplify the tuning process.
A.1. DC motor direct drive
It is interesting for comparison to look also briefly at the situation of a direct drive using an ordinary (brushed) DC motor. The DC motor equations are
and the mechanical properties are described as before by Eq. (2.17), i.e.
where again was set. One thus arrives at the equation of motion
This is again a second-order differential equation, corresponding to second-order transfer functions, as for the brushless drive. However, despite the seeming similarity, the two cases are quite different. First, the equation of motion and/or transfer function for the DC drive refers to angular speed , while those for the brushless drive refer to angular position . Second, it is intrinsically linear. Finally, the second-order nature of Eq. (A.4) comes from taking into account the effects of inductance , which is usually negligible because of and/or using PWM. Accordingly, for the same reasons as in chapter 2.3, the appropriate equation of motion for describing a DC motor driven gimbal is in fact
and the transfer function with respect to the angular position reads
This is a second-order process as for the brushless direct-drive gimbal, but with the crucial difference that the resonance frequency is zero. That is, the DC motor direct-drive method is intrinsically over-damped.
A.2. Torque controlled direct drive
The discussion of the DC motor direct drive in chapter A.1 suggests another interesting situation of a direct drive. Usually, a DC motor is controlled via the applied voltage, as in chapter A.1. However, it may also be driven by controlling the current . As Eq. (A1.2) shows, this essentially corresponds to controlling the torque, which is applied to the gimbal. This case is also described by Eqs. (A1.1), (A1.2), and (A1.3), but now the transfer function as function of current (and not of voltage ) is of relevance. Assuming again one directly obtains the equation of motion
and the transfer function
. Eq. (A2.2)
Note, in contrast to the voltage-controlled DC motor direct drive a low-frequency assumption was not necessary; the results hold here for all frequencies. Besides that, one obtains also an over-damped second-order process with zero resonance frequency . Hence, controlling the current or torque, respectively, should be an attractive approach for direct drive gimbals.
Clark Transformation, , and Inverse
Combined Clark-Park Transformation, , and Inverse