User Manual
Table Of Contents
- Guide Contents
- Overview
- Assembly
- Solder on Headers and Terminal Block
- Powering Motors
- Voltage requirements:
- Current requirements:
- Power it up
- Installing Software
- Enable I2C
- Python Installation of MotorKit Library
- Using DC Motors
- Connecting DC Motors
- Controlling DC Motors
- Full Example Code
- Using Stepper Motors
- Connecting Stepper Motors
- Controlling Stepper Motors
- Stepping
- Full Example Code
- Python Docs
- Stacking HATs
- Addressing the HATs
- Stacking in Code
- Downloads
- Files
- Schematic
- Fabrication Print

motor in place, as seen in the animated GIF above
2. Double Steps - this is also fairly simple, except instead of a single coil, it has two coils on at once. For example,
instead of just coil #1 on, you would have coil #1 and #2 on at once. This uses more power (approx 2x) but is
stronger than single stepping (by maybe 25%)
3. Interleaved Steps - this is a mix of Single and Double stepping, where we use single steps interleaved with
double. It has a little more strength than single stepping, and about 50% more power. What's nice about this style
is that it makes your motor appear to have 2x as many steps, for a smoother transition between steps
4. Microstepping - this is where we use a mix of single stepping with PWM to slowly transition between steps. It's
slower than single stepping but has much higher precision. We recommend 8 microstepping which multiplies the
# of steps your stepper motor has by 8.
You can call the onestep function with two optional keyword arguments. To use these, you'll need to import stepper
as well.
Then you have access to the following options:
direction , which should be one of the following constant values:
stepper.FORWARD (default)
stepper.BACKWARD
style , which should be one of the values:
stepper.SINGLE (default) for a full step rotation to a position where one single coil is powered
stepper.DOUBLE for a full step rotation to position where two coils are powered providing more torque
stepper.INTERLEAVED for a half step rotation interleaving single and double coil positions and torque
stepper.MICROSTEP for a microstep rotation to a position where two coils are partially active
release() which releases all the coils so the motor can free spin, and also won't use any power
The function returns the current step 'position' in microsteps which can be handy to understand how far the stepper
has moved, or you can ignore the result.
To take a double-coil step backward call:
You can even use a loop to continuously call onestep and move the stepper, for example a loop of 200 microsteps
forward for smooth movement:
That's all there is to controlling a stepper motor from CircuitPython! Steppers are handy motors for when you need
smooth or precise control of something--for example 3D printers and CNC machines use steppers to precisely move
tools around surfaces.
Full Example Code
from adafruit_motor import stepper
kit.stepper1.onestep(direction=stepper.BACKWARD, style=stepper.DOUBLE)
for i in range(200):
kit.stepper1.onestep(style=stepper.MICROSTEP)
© Adafruit Industries
https://learn.adafruit.com/adafruit-dc-and-stepper-motor-hat-for-raspberry-
pi
Page 22 of 31










