# Modeling and Control of a DC Motor Coupled to a Non-Rigid Joint
## 2 Proposed Models
### DC Motor and Worm Gearbox Model  
Along this subsection, the generic model for a DC motor will be presented, which is equivalent to the motor-gearbox system. Also, taking into account that some hardware tests must be performed to estimate some parameters, they will also be detailed. Despite what was mentioned in previous paragraph, all the tests were performed with the gearbox coupled to the motor, in order to obtain a reliable model of the motor+gearbox system.  
Taking into account the above mentioned considerations, the motor model is further described using the equations associated with it. These are present all over the literature associated with DC motors, so no references will be presented to specific publications. Thus, the general model of a DC motor is as follows:  
\[v_{i}(t)=R\cdot i(t)+L\cdot\frac{di}{dt}+E_{v} \tag{1}\] \[E_{v}=k\cdot\omega(t)\] (2) \[\frac{d\omega}{dt}=\frac{1}{J}\cdot(T_{m}-B_{v}\cdot\omega(t)-T_{ q})\] (3) \[T_{m}=k\cdot i(t) \tag{4}\]  
where \(v_{i}\) is the voltage applied to the system (V), \(i\) is the electrical current (A), \(R\) the resistance (\(\Omega\)), \(L\) the inductance (H), and \(E_{v}\) the Back Electromotive Force (V). This force is obtained through the second presented equation, where \(k\) is the motor constant, and \(\omega\) the angular speed (rad/s). In Equation (3), \(J\) represents the moment of inertia (kg\(\cdot\)m\({}^{2}\)), \(T_{m}\) the motor torque (N\(\cdot\)m), obtained by the fourth equation, \(B_{v}\) the viscous friction coefficient (N\(\cdot\)m\(\cdot\)s) and \(T_{q}\) (N\(\cdot\)m) the static friction torque. The model used for the static friction \(T_{q}\) assumes that the \(T_{q}=T_{m}\) while \(T_{m}<T_{q\_max}\). This explains the existence of the motor dead zone, which is a non-linear element of the model. Despite this, it is neglected, since otherwise it will turn the system into a non-linear one, and as one can see from the first Figure presented in Section 4, the dead zone is almost nonexistent.  
In the Laplace domain, the system can be represented as:  
\[v_{i}(s)=R\cdot i(s)+s\cdot L\cdot i(s)+k\cdot\omega(s) \tag{5}\] \[J\cdot s\cdot\omega(s)=k\cdot i(s)-B_{v}\cdot\omega(s) \tag{6}\]The transfer function of the system will then be:  
\[\frac{\omega(s)}{v_{l}(s)}=\frac{k}{(s\cdot J+B_{v})\cdot(R+s\cdot L)+k^{2}} \tag{7}\]  
Adjusting some variables, to facilitate its later use in the estimation of some parameters, it becomes:  
\[\frac{\frac{k}{J\cdot L}}{s^{2}+s(\frac{R}{L}+\frac{B_{v}}{J})+(\frac{R\cdot B _{v}+k^{2}}{J\cdot L})} \tag{8}\]  
There are some hardware tests that allow to estimate some unknown motor constants, like \(R,k,B_{v}\) and \(T_{q}\). These tests are simple to perform and consist on:  
* _Powering the motor with multiple pre-known values of supply voltage, allowing it to reach the steady-state_--This test consists in powering the motor with several different pre-known supply voltages and measure the angular speed \(\omega\) at the steady-state throughout the process;
* _Input a voltage step to the motor terminals_--This test consists in powering the motor with a voltage step and obtain its response to this signal, to verify which model suits the best to the tested model.