API Reference
adafruit_stspin
CircuitPython driver for the Adafruit STSPIN220 Stepper Motor Driver Breakout Board
Author(s): Liz Clark
Implementation Notes
Hardware:
Software and Dependencies:
Adafruit CircuitPython firmware for the supported boards: https://circuitpython.org/downloads
- class adafruit_stspin.Modes
Valid microstepping modes for STSPIN220.
Each mode value encodes the state of MODE1-MODE4 pins: - Bits 0-1: MODE1, MODE2 (physical pins if connected) - Bits 2-3: MODE3, MODE4 (multiplexed with STEP/DIR during reset)
- class adafruit_stspin.STSPIN(step_pin, dir_pin, steps_per_revolution: int = 200, mode1_pin=None, mode2_pin=None, en_fault_pin=None, stby_reset_pin=None)
Driver for the STSPIN220 Low Voltage Stepper Motor Driver.
- Parameters:
step_pin (Pin) – The pin connected to STEP (step clock) input
dir_pin (Pin) – The pin connected to DIR (direction) input
steps_per_revolution (int) – Number of steps per full motor revolution
mode1_pin (Pin) – The pin connected to MODE1 input (optional)
mode2_pin (Pin) – The pin connected to MODE2 input (optional)
en_fault_pin (Pin) – The pin connected to EN/FAULT pin (optional)
stby_reset_pin (Pin) – The pin connected to STBY/RESET pin (optional)
- property enabled: bool
Motor power stage enable state.
- Returns:
True if enabled, False if disabled
- Return type:
- property fault: bool
Check if a fault condition exists.
- Returns:
True if fault detected, False if normal operation
- Return type:
- property microsteps_per_step: int
Number of microsteps per full step for current mode.
- Returns:
Microsteps per full step (1, 2, 4, 8, 16, 32, 64, 128, or 256)
- Return type:
- property position: int
Current motor position in steps (0 to steps_per_revolution-1).
- Returns:
Current position in steps
- Return type:
- property speed: float
Motor speed in revolutions per minute (RPM).
- Returns:
Current speed in RPM
- Return type:
- property standby: bool
Device standby state.
- Returns:
True if in standby mode, False if active
- Return type:
- step(steps: int) None
Move the motor a specified number of steps.
- Parameters:
steps (int) – Number of steps to move (positive = forward, negative = reverse)