## 3 System Analysis
### Sensors Parameterization  
The Hall effect sensors produce a voltage related to the magnetic field they are inserted in. The voltages generated by both sensors have a portion related to the quiescent voltage they produce [25; 26], the influence of the current and, in the case of the position sensor, a portion related to the distance of the magnetic disc. The equations of the output voltages for the current and position Hall-effect sensors are of the form, respectively:  
\[e_{i}(t)=mf(i(t))+b, \tag{14}\]  
\[e_{z}(t)=\alpha+\beta g(z(t))+\gamma f(i(t)), \tag{15}\]  
where \(m\), \(b\), \(\alpha\), \(\beta\), \(e\), \(\gamma\) are the constants to be determined. To obtain the sensors constants, first, the quiescent voltages of the current and position sensors were measured as \(b=2.5220\) and \(\alpha=2.4829\) V, respectively. After the current and distance were increased in small steps in order to observe the variation of the respective output voltages, as shown in Figures 6 and 7. In both figures, the value of the quiescent voltages were removed, so that it facilitates the determination of the constants through regression. With the voltage data points of Figures 6 and 7 we used the Trendline option of Microsoft Excel to obtain the linear Equations (16) and (17), which translates the influence of the current on both current and position sensors, respectively:  
\[e_{ii}(t)=mf(i(t))=0.1447i(t), \tag{16}\]  
\[e_{zi}(t)=\gamma f(i(t))=0.3339i(t), \tag{17}\]  
Figure 6: Influence of the current on both sensors. Figure 7: Influence of the distance on the position sensor. where \(m=0.1447\) and \(\gamma=0.3339\) V/A. The expression for the influence of the distance on the position sensor was obtained as:  
\[e_{zz}(t)=\beta g(z(t))=4.4941\times 10^{-6}\frac{1}{z(t)^{3}}, \tag{18}\]  
where \(\beta=4.4941\times 10^{-6}\) Vm\({}^{3}\). In this case the current sensor does not suffer any influence by the movement of the disc. All regressions obtained a good R\({}^{2}\), 0.9988 for \(e_{ii}\), 0.9995 for \(e_{zi}\), and 0.9961 for \(e_{zz}\). Replacing the determined parameter values in (14) and (15), we arrive to the following equations for the output voltage of each sensor:  
\[e_{i}(t)=0.1447i(t)+2.5220, \tag{19}\]  
\[e_{z}(t)=2.4829+4.4941\times 10^{-6}\frac{1}{z(t)^{3}}+0.3339i(t), \tag{20}\]  
Because this system uses the 10 bits ADC of the ATMega2560, Equations (19) and (20) are converted to Analog-to-Digital Units (ADU), where 5 V corresponds to 1023 ADU, yielding:  
\[ADC_{i}(t)=29.569i(t)+516, \tag{21}\]  
\[e_{z}(t)=\alpha+\beta g(z(t))+\gamma f(i(t)), \tag{15}\]0  
where in order to facilitate the calculation, the distance was also converted from m to cm, and as such \(\beta\) is now 1090 ADUcm\({}^{3}\). Table 3 lists the converted constants corresponding to both sensors. With the sensor constants determined, we used the Solver tool from Microsoft Excel to optimize the constants. To obtain the Table 4, we placed the magnetic disc at different distances and applied enough voltage to the electromagnet to pull the disc up. \begin{table}
\begin{tabular}{c c c c c c c c} \hline \hline
**z (cm)** & **ADC\({}_{i}\) (ADU)** & **ADC\({}_{z}\) (ADU)** & **i\({}_{calc}\) (A)** & **z\({}_{calc}\) (cm)** & **z\({}_{optim}\) (cm)** & **| z-z\({}_{calc}\) | (cm)** & **| z-z\({}_{optim}\) 1 (cm)** \\ \hline
2.340 & 524 & 615 & 0.267 & 2.233 & 2.236 & 0.107 & 0.104 \\ \hline
2.670 & 530 & 599 & 0.461 & 2.725 & 2.703 & 0.055 & 0.033 \\ \hline
2.870 & 533 & 595 & 0.559 & 2.906 & 2.870 & 0.036 & 0.000 \\ \hline
3.150 & 538 & 594 & 0.721 & 3.115 & 3.055 & 0.035 & 0.095 \\ \hline
2.340 & 516 & 592 & 0.000 & 2.289 & 2.340 & 0.051 & 0.000 \\ \hline
3.150 & 516 & 543 & 0.000 & 3.084 & 3. The values of the ADC\({}_{i}\) and ADC\({}_{z}\) were measured at when the magnetic disc started to rise. Then, we calculated the current (i\({}_{calc}\)) corresponding to ADC\({}_{i}\) using Equation (21), and with those values, we calculated the distance (z\({}_{calc}\)) from Equation (22).