\subsection{stepper}
\label{sec:pyafm:stepper}
+Because of thermal drift and mechanical instability, the distance
+between the tip and the surface changes significantly over time. When
+the distance change exceeds the range of the piezo scanner, the
+stepper motor must be engaged to reposition the AFM tip relative to
+the sample. The earlier LabVIEW software (\cref{sec:labview}) lacked
+the ability to control the motor on its own, so it would pause roughly
+every half hour and prompt the operator to make the necessary manual
+adjustments. Automatic motor control allows the system to run longer
+without interrupts, facilitating the collection of large data sets.
+
The \stepper\ package provides Python control of stepper
motors\cite{jones95}. The package is mostly concerned with the
maintenance of internal motor state:
Actualizing the motor control signal is left up to the caller, in this
case \pyafm.
-TODO: backlash and step-size graphics.
+We verified the stability and reproducibility of the microscopic
+movement of the motor by making several approach-retreat cycles from
+the surface of $\sim$70 steps which resulted in the data displayed in
+\cref{fig.stepper:backlash}. We also measured the distance the
+surface moved with every step by determining the change in deflection
+voltage as a function of peizo position as we stepped the AFM tip
+closer the the surface. Our stepsize data is displayed in
+\cref{fig:stepper:step-size}.
+
+The motor is very consistent when approaching the surface, which
+indicates that our control software is operating correctly. However,
+the motor exhibits some hysteretic behavior on a scale of $\sim$46
+steps, which is almost certainly due to \emph{backlash}, or slack in
+the motor--surface coupling machinery. The first 46 steps in a new
+direction take the slack out of the coupling, and further steps move
+the tip relative to the surface. The problem can be avoided entirely
+by simply replacing ``backwards motion by one step'' with ``backwards
+motion by 60 steps and forward motion by 59 steps''.
+
+One issue raised by backlash is that it might be the source of some of
+our surface drift, as the drive-chain relaxes towards some central
+value and pulls the surface with it. By oscillating into our eventual
+position, we could perhaps settle the system at the beginning,
+reducing the need for adjustments later on. While this is not a
+problem for the current unfolding experiments, it could be an issue
+for longer unfolding-refolding experiments.
+
+\begin{figure}
+ \begin{center}
+ \subfloat[][]{\label{fig:stepper:backlash}
+ \asyinclude{figures/stepper/backlash}}
+ \hspace{\stretch{1}}
+ \subfloat[][]{\label{fig:stepper:step-size}
+ \asyinclude{figures/stepper/step-size}}
+ \caption{\protect\subref{fig:stepper:backlash} Stepper motor
+ reproducibility, stability, and backlash. The data are from a
+ single continuous counterclockwise trace of 14 approach-retreat
+ cycles. The jump from about $(18, -6)$ to $(17, -0.4)$ is the
+ snap-off effect, where short-range attractive interactions
+ between the tip and the sample---due to surface wetting in
+ air---require the tip to be actively pulled off surface. Signal
+ noise is comparable to that expected by drift.
+ \protect\subref{fig:stepper:step-size} Motor step size
+ calibration. The stepper gradually stepped closer to the
+ surface, feeling forward with the piezo after each step.
+ Successive motor positions yield traces $a$, $b$, $c$, $d$, and
+ $e$. As the motor moves the sample closer, less piezo movement
+ is required to approach to same deflection level. The average
+ spacing between the traces is roughly $170\U{nm}$. Traces $c$
+ and $d$ have regions of negative deflection because the tip no
+ longer retracts far enough from the surface to break free of the
+ snap-off effect. There is no backlash because the data were
+ taken during a single approach.\label{fig:stepper}}
+ \end{center}
+\end{figure}
\subsection{pypid}
\label{sec:pyafm:pypid}