A method to improve the performance of open-loop, stepper-motor-driven systems is presented. The method is titled "On-Hardware Optimization" because a step state command sequence is optimized for best system performance through a computer-controlled interaction between the optimization software and the stepper-motor-driven system hardware. "Best system performance" is defined in terms of an objective function. A real-time interface passes step commands to the motor and acquires system position and velocity data. The Matlab Optimization Toolbox performs a constrained optimization of the objective function where each "'function call" runs the physical stepper motor system. The user has flexibility to establish constraints, set termination criteria, get feedback about the optimization, and observe live plots of the optimization progress. The benefits of the direct approach are that the command sequence is optimized for a specific system, and that a model is not required. The results of two experiments are presented: the first illustrates a substantial reduction in residual vibration when a trapezoidal velocity trajectory is executed, and the second finds a set of input parameters defining a velocity profile in a system with backlash and compliance. The method can be used on systems other than stepper motors. (c) 2004 Elsevier Ltd. All rights reserved.