Expand description
Coil sequencing for four-wire stepper motors.
A stepper turns by energizing its coils in a repeating pattern; stepping through the pattern in one direction or the other advances or reverses the shaft. This module holds the three standard drive patterns and a sequencer that walks them, so a caller toggles the four coil lines (directly, or through a darlington array like the ULN2003) without hand-maintaining the sequence. It also models the step-and-direction interface of driver chips such as the A4988 and DRV8825, which take a step pulse and a direction level and track position as a signed count.
Coil patterns are four bits, the most significant being the first coil (IN1 on a ULN2003 board) down to the least significant (IN4).
Structs§
- Four
Wire - A four-wire stepper driven coil by coil, through a transistor array such as a ULN2003 or an H-bridge.
- Position
- A signed step counter for step-and-direction driver chips.
- Sequencer
- A position in a drive sequence, walked one step at a time.
- StepDir
- A stepper behind a step/direction driver chip such as an A4988 or a DRV8825.
Enums§
Constants§
- DEFAULT_
PULSE_ MICROS - The width of a step pulse a step/direction driver starts with, in microseconds.
- DEFAULT_
STEP_ MICROS - The pause between steps a driver starts with, in microseconds.
Functions§
- steps_
for_ degrees - Converts an angle to a whole number of steps for a given motor.