\documentclass[12pt]{article}
\usepackage{fancyhdr}
\usepackage[top=3cm, bottom=3cm, left=3cm, right=3cm]{geometry}
\usepackage[pdftex]{graphicx}
\title{6.302: Magnetic Levitation Design Project}
\author{Tony Hyun Kim}
\date{\today}

\setlength\parindent{0.0in}
\setlength\parskip{0.1in}
\begin{document}

\maketitle

\section{Introductory Overview}

We have assembled and compensated a feedback-based magnetic levitation (``maglev'') device. Figure \ref{fig:intro} shows a cartoon schematic of the mechanical layout, alongside an actual photograph of our system.
\begin{figure}[ht]
	\begin{center}
		\includegraphics[scale=0.4]{intro.PNG}
	\end{center}
	\caption{\label{fig:intro}(Left) A cartoon schematic of the magnetic levitator. (Right) A photograph of the actual apparatus. The magnet is inside the levitated box, which also contains some counterweights.}
\end{figure}

The position of the levitated object (containing a small neodymium magnet) is determined by the Hall-effect sensor mounted at the bottom of the solenoid. The sensor output is processed by the accompanying circuit, which in turn drives the solenoid with the goal of stabilizing the position of the levitated object. A block diagram of this feedback network is shown in Figure \ref{fig:block_diag}.
\begin{figure}[ht]
	\begin{center}
		\includegraphics[scale=0.6]{feedback_block.PNG}
	\end{center}
	\caption{\label{fig:block_diag}Block diagram representation of the magnetic levitation device. The voltage input was utilized only in the characterization of the device.}
\end{figure}

We now point out some unique features of our device:
\begin{enumerate}
	\item The solenoid (and its chassis) and the drive electronics are machined as two separate parts, which are connected by a standard DB-9 connector. This arrangement minimizes clutter.
	\item The drive electronics is contained in an attractive case, which has a DB-9 port for communication with the solenoid/sensor, a BNC input port for the $+15$V power source, and an LED power indicator.
	\item The drive electronics has a DPDT switch that swaps the orientation of current flow through the solenoid. This feature was very handy in the initial construction of the maglev.
\end{enumerate}
In other words, we have spent some time preparing a nice packaging for the maglev. My product will be submitted to the 6.302 ``most artistic'' competition, where I take ``artistic'' to mean a clean, ``industrial look-and-appeal''. Figure \ref{fig:elec_box} shows photos of the maglev electronic box.
\begin{figure}[ht]
	\begin{center}
		\includegraphics[scale=0.4]{elec_box.png}
	\end{center}
	\caption{\label{fig:elec_box}Front and rear panels of the maglev electronic box. Features include LED power indicator, BNC $+15$V power input, DB-9 connector to communicate to solenoid/sensor, solenoid polarity DPDT switch.}
\end{figure}

\section{Theory of magnetic levitation}

We present a brief summary of magnetic levitator theory, which guided our compensator design strategy. The discussion follows that found in the 6.302 course notes\cite{lundberg2009}, in particular pp. 76-79.

The levitated object is acted on by two forces: gravity, and the magnetic force from the solenoid. The gravitational force is important in determining the large-signal operating point of the levitation, but is not relevant for the small-signal analysis. 

For the small-signal analysis, let $x_b$ represent the levitation position, and $i_m$ be the current through the solenoid. The small-signal dynamics is captured by the following differential equation:
\begin{equation}
	m\ddot{x_b}=k_X x_b - k_I i_m
	\label{eqn:diffeq}
\end{equation}
where $m$ is the mass of the object, and $k_X$ and $k_I$ are constants. This differential equation can be easily transformed into a transfer function:
\begin{equation}
	\frac{X_b(s)}{I_m(s)} = -\frac{k_I}{ms^2-k_X}.
	\label{eqn:tf}
\end{equation}

We conclude: The (open-loop) maglev is a two-pole system with poles at $s = \pm \sqrt{\frac{k_X}{m}}$.

\section{Characterization of the basic system}

The electronic signal chain is as follows: 
\begin{itemize}
	\item The SD495 Hall-effect sensor, mounted at the bottom of the solenoid, measures the position of the levitated object. 
	\item In the basic system, the sensor output is connected directly to the input of the MIC502 fan-management chip. 
	\item The fan-management chip produces a pulse-width modulated (PWM) drive signal to the LMD18201 H-bridge chip. The PWM scheme adjusts the average current in the solenoid (i.e. $i_m$ in Eq. \ref{eqn:diffeq}).
\end{itemize}

The schematic of the basic system is shown in Figure \ref{fig:schematic}. We have found surprisingly good performance under visual inspection, even with this bare-bones system. (The mass of the levitated object was cruicial, however.)
\begin{figure}[ht]
	\begin{center}
		\includegraphics[scale=0.4]{basic_schematic.PNG}
	\end{center}
	\caption{\label{fig:schematic}Schematic of the bare-bones maglev system.}
\end{figure}

In order to quantitatively characterize the performance, we added a control input port, which was added to the sensor reading before it was fed back to the fan-management chip. The step-response is shown in Fig. \ref{fig:basic_step}. We have filtered the sensor output with a passive $RC$ filter with $\tau = RC = 0.1$ ms.
\begin{figure}[ht]
	\begin{center}
		\includegraphics[scale=0.7]{basic_step.PNG}
	\end{center}
	\caption{\label{fig:basic_step}The blue $50$mV step is the input step to the system. The top, orange trace shows the corresponding sensor response. Note the persistent ripple in the step response.}
\end{figure}

In particular, note the $1$kHz, persistent ripple. We will design a compensator circuit with the intent of removing this oscillation.

\section{Compensation}

Our compensation strategy is based on root-locus diagrams of the basic two-pole system. Figure \ref{fig:rlocus}a shows the root-locus of the basic two-pole system. For any gain, the closed-loop poles are located on the $j\omega$-axis, which indicates perpetual oscillations. This is consistent with the observation of long-lived oscillations in the basic-system step response.
\begin{figure}[ht]
	\begin{center}
		\includegraphics[scale=0.3]{rlocusplots.png}
	\end{center}
	\caption{\label{fig:rlocus}(a) Root locus diagram of the basic two-pole system. (b) Root locus diagram of the compensated system. The system poles can be pulled into the left-half plane. This root locus diagram is only qualitative, since the trajectory is heavily dependent on the actual location of the open-loop poles and zeroes.}
\end{figure}

Therefore, our compensation strategy is to include a zero and a pole, far to the left of the system poles. (The pole is added because I didn't know of a convenient circuit to add only a zero.) As seen in the root locus diagram of Fig. \ref{fig:rlocus}b, the system poles can be ``pulled'' into the left-half plane (LHP), which corresponds to damping of the oscillations.

Note that the system poles can be pulled further into the LHP by placing the compensator pole further to the left. This was our main design consideration.

We have utilized the compensation circuit as in Figure \ref{fig:compensator}.
\begin{figure}[ht]
	\begin{center}
		\includegraphics[scale=0.6]{compensator.PNG}
	\end{center}
	\caption{\label{fig:compensator}The compensator circuit (a lead network). The opamp (non-inverting amplifer) stage ``undoes'' the attenuation due to the initial passive circuit stage. We used $R_1 = 100k\Omega$, $R_2 = 1k\Omega$ and $C = 0.1\mu F$.}
\end{figure}
This circuit fragment, which incidentally is a standard lead-network, has the transfer function:
\begin{equation}
	\frac{V_{out}}{V_{in}} = \frac{sR_1C+1}{s(R_1||R_2)C+1} \approx \frac{sR_1C+1}{sR_2C+1}
	\label{eqn:compensator_tf}
\end{equation}
where the last equality is valid under the approximation $R_2 << R_1$. By choosing $R_1 = 100k\Omega$ and $R_2 = 1k\Omega$, we place the pole a hundred times further out along the negative axis in the $s$-plane. 

In the actual implementation, we have also included a variable gain stage (non-inverting opamp amplifier) in order to scan the system root locus (as in Fig. \ref{fig:rlocus}b).

The compensated system was characterized by a step response, shown in Figure \ref{fig:compensated_step}.
\begin{figure}[ht]
	\begin{center}
		\includegraphics[scale=0.7]{compensated_step.PNG}
	\end{center}
	\caption{\label{fig:compensated_step}The step response of the compensated system. The blue trace represents the step input, and the orange trace is the sensor output.}
\end{figure}
Note that the undesirable ripple has been completely eliminated. The downside of this compensation scheme, however, is that the speed of the circuit has been greatly reduced. The new time-constant is roughly $40$ times larger than the original system.

\section{Conclusion}

We have assembled and compensated a magnetic levitation system. The compensation was designed in order to remove the long-lived high frequency ripples in the basic system, and was derived from a theoretical root-locus analysis.

Most importantly, the system was manufactured with an attractive appearance in mind; namely, a sleek, industrial design.

\begin{thebibliography}{9}
	\bibitem{ss495_ds}
		Honeywell.
		\emph{SS490 Series Datasheet}. (Hall-effect sensor)
		
	\bibitem{mcp601_ds}
		Microchip Technology Inc.
		\emph{MCP601/1R/2/3/4 Datasheet}, 2007. (Single-supply op amp.)
				
	\bibitem{mic502_ds}
		Micrel, Inc..
		\emph{MIC502 Datasheet}, March 2003. (Fan Management IC)
			
	\bibitem{lmd18201_ds}
		National Semiconductor Corporation.
		\emph{LMD18201 3A, 55V H-Bridge}, 2004. (H-Bridge IC)
		
	\bibitem{lundberg2009}
		Lundberg, Kent.
		\emph{Feedback Systems for Analog Circuit Design}, 6.302 Spring 2009 Notes. 
\end{thebibliography}


\end{document}