PiStep2 Stepper Controllers for Raspberry Pi
PiStep2 is the new (May 2016) release of PiStep which has been a standard stepper motor controller for Raspberry Pi for a couple of years. PiStep2 changes the GPIO header to a 40 pin version, compatible with all Raspberry Pis since B+. This includes A+, B+, 2B, 3B and Zero.
In addition, the ULN2803, which is the Darlington driver chip, has been replaced by a surface mount version. This allows us to fit twice as many stepper motor channels on roughly the same area of PCB
To keep the cost similar to the older, 2-channel only PiStep, we offer a Dual version of the new PiStep as well as the quad version.
Purchase PiStep2 Here
PiStep2 uses a single GPIO pin for each of the stepper drive outputs. There are 4 drivers per stepper motor, so a total of 16 GPIO pins are used.
- MOTOR 1: Physical pins 11, 12, 13, 15 (GPIO 17, 18, 27, 22)
- MOTOR 2: Physical pins 16, 18, 22, 7 (GPIO 23, 24, 25, 04)
- MOTOR 3: Physical pins 33, 32, 31, 29 (GPIO 13,12,6,5)
- MOTOR 4: Physical Pins 38, 37, 36, 35 (GPIO 20,26,16,19)
To drive the stepper motors you must change the pins that are enabled in a specific sequence – using either a 4-step or an 8-step sequence. You can reverse the sequence to make the stepper motors go the opposite way. See Matt from Raspberry Pi Spy’s excellent article here.
PiStep2 Jumper Settings
NB. PiStep2 v2.1 has the jumper settings marked incorrectly; Setting to the left (marked Vcc) is actually Vin, for voltage from 2-pin screw terminal. Setting to the right (marked Vin) is actually for using the 5V
Although you can have all four stepper motors connected to the Pi at the same time, it is unlikely that you can have them all moving simultaneously. This is because the total current required will exceed that available from the Pi. For this reason the Pistep2 (like the older PiStep) provides options to add extra power to the 5V line via the on-board micro-USB connector, or to add a completely separate power supply (up to 9V for standard “5V” stepper motors). The small jumper selects which power supply to use. If the jumper is to the right (nearest the micro-USB connector) then it will use the 5V on the board (which can be supplemented with external 5V into the USB), and if it is to the left then it will use the voltage supplied into the 2-pin screw terminal.
PiStep2 Example Software
There are 2 python examples that we provide. Both of these are based on Matt’s software from the link above.
- stepper.py simply rotates a single stepper motor at a fixed speed. Edit the code to change to using a different motor
- stepctrl.py places the main sequencing code into a separate thread and then uses keyboard input to select which motor, if any, is operating.
Placing the sequencing into a separate thread makes it possible for the stepper motor to carry on turning while the main program looks at sensors or user inputs to decide what to do next. I intend to create a simple library that allows the a separate thread to be easily created for each motor, enabling change of speed and direction very simply from the main program – not available yet however.