Open-Loop Position Control of a Stepper Motor
In open-loop control, the controller performs a control action without any feedback from the response of the system to the control action. The control effort is adjusted by another system or manually by a human operator.
In this example, a joystick is used to specify the number of steps and the direction of rotation of a 28BYJ48 stepper motor. An Adafruit Trinket microcontroller will apply the required sequence of pulses based on the joystick measurement. The pin mapping of the microcontroller and the pulse sequence of the stepper motor are described in an external library. The code in the external library as well as generated code will be used to achieve the open-loop control of the stepper motor.
The wiring diagram of the connections.
The complete revolution of 512 steps can be divided into smaller increments.
Choose 8 steps per increment.
Let the forward motion of the joystick above 3V result in one increment of the motor.
Let a value below 1V result in one increment in the opposite direction.
Assemble the open-loop controller.
The joystick input.
The output is handled by the external library and uses pins 0–3 of the Trinket.
The complete microcontroller specification.
The trinket uses the USBtiny programmer.
The location of the library.
Upload the code. You may have to disconnect the joystick input before uploading.