User Manual

Using Stepper Motors
Stepper motors are great for (semi-)precise control, perfect for many robot and CNC projects. This HAT supports up to
2 stepper motors. The python library works identically for bi-polar and uni-polar motors.
Running a stepper is a little more intricate than running a DC motor but its still very easy.
Connecting Stepper Motors
For unipolar motors: to connect up the stepper, first figure out which pins connected to which coil, and which pins are
the center taps. If its a 5-wire motor then there will be 1 that is the center tap for both coils. Theres plenty of tutorials
online on how to reverse engineer the coils pinout. (https://adafru.it/aOO) The center taps should both be connected
together to the center GND terminal on the Motor HAT output block. then coil 1 should connect to one motor port (say
M1 or M3) and coil 2 should connect to the other motor port (M2 or M4).
For bipolar motors: its just like unipolar motors except there's no 5th wire to connect to ground. The code is exactly
the same.
For this demo, please connect it to M1 and M2
Run python3 to get to the Python REPL.
Controlling Stepper Motors
To demonstrate the usage, we'll initialise the library and use Python code to control a DC motor from the Python REPL.
First you'll need to import and initialize the MotorKit class.
© Adafruit Industries
https://learn.adafruit.com/adafruit-dc-and-stepper-motor-hat-for-raspberry-
pi
Page 20 of 31