# Micro-Satellite Systems Design, Integration, and Flight
## 4 Attitude Control System (ACS) Development
### Attitude Control
#### 4.3.3 The Controller Software
So, to make the CubeSat stable dynamically, the moment of inertia needs to be known well. See Equation (5) below. \[ \begin{array}{l}I_{x}\dot{\omega}_{x}+\big{(}I_{y}-I_{z}\big{)}\omega_{y} \omega_{z}=M_{x}\\ I_{y}\dot{\omega}_{y}+\big{(}I_{x}-I_{z}\big{)}\omega_{x}\omega_{z}=M_{y}\\ I_{z}\dot{\omega}_{z}+\big{(}I_{x}-I_{y}\big{)}\omega_{x}\omega_{y}=M_{z}\\ \end{array}  \tag{5}\]  
The SOLIDWORKS model was used to initially estimate the moment of inertia, but it did not account for many of the wires and other components that were hard to draw. Figure 34: Unrealistic convergence of Kane controller. To check the values obtained and assess their precision, a more accurate calculation was required. The moment of inertia was then calculated experimentally by measuring the pendulum motion of the CubeSat spinning around its axes. The experiment involved setting up a bifilar pendulum. The pendulum was made by hanging the CubeSat from two fishing lines at a height, h, from the hang point to the pivot point. The two fishing lines were spaced diagonally across the CubeSat at a distance, \(D\). Distance \(D\) was kept constant (the fishing lines were vertical). Figure 35 below shows the experiment setup. The setup in Figure 35 was used to give the CubeSat a small initial rotational displacement. The oscillations' period was computed. To reduce human error, the period of three successive oscillations was measured and then corrected (divided by 3). For more accuracy, the harmonic evaluation was repeated five times and averaged again. A final period was obtained. The CubeSat was spun around the other two axes, and the experiment was performed again. The periods were calculated around the other two axes. Equation (6) below shows the equation for the period of a bifilar pendulum. Note that Equation (6) is based on a small displacement angle. \[T=\frac{4\pi}{D}\cdot\sqrt{\frac{hI}{mg}} \tag{6}\]  
Deriving for the moment of inertia, Equation (7) is solved for the following:  
\[I=\frac{mgD^{2}T^{2}}{16\pi^{2}h} \tag{7}\]  
Using the known values of the CubeSat's mass, the separation distance, and the bifilar pendulum's length, the periods recorded allowed for the calculation of the moment of inertia in each of the principal directions. The inertia matrix was determined using the principal moments of inertia that were found. Since the alignment of the maximum principal axis of inertia was within 5 deg of the \(z\) axis, the off-diagonal elements were  
Figure 35: Moment of inertia testing setup [40]. (**a**) Diagram of setup; (**b**) Live picture of setup as tested. negligible and made zero. Equation (8) below shows the resulting inertia matrix. The units of the inertias are grams per squared millimeter. \[\left[ \begin{array}{cccc}2,109,759.45&0&0\\ 0&1,983,906.17&0\\ 0&0&2,308,281.50\\ \end{array} \right] \tag{8}\]  
The CAD estimated values are shown below. Refer to the values in Equation (9). \[\left[ \begin{array}{cccc}2,050,068.12&-1682.74&-1901.26\\ -1682.74&1,652,976.53&81,119.53\\ -1901.26&81,119.53&2,193,395.14\\ \end{array} \right] \tag{9}\]  
The calculated values are very close to the SOLIDWORKS predictions. The principal axis moments are the main factors that affect the CubeSat's behavior and have similar sizes. All the off-diagonal entries are much smaller in size by a factor of 20-100 times. Therefore, it can be reasonable to ignore them. The calculated principal moment values are all higher in proportion than the SOLIDWORKS ones. The difference is explained by the wires and other features that the SOLIDWORKS model does not include. The values derived from the experiment were always larger. Although the experimental values were 5-20% bigger, the difference was not big enough to be the only reason for the fast rise time shown in Figure 36. Therefore, the next verification was performed to check the magnification factor of the mu metal rod in the magnetic torque coils.