The stepper board uses 8 I/O pins to drive up to two stepper motors.
When installing the board be sure to attach the rubber pad to the top of the silver capacitor on the Raspberry Pi board (next to the power plug). This is to prevent the stepper board from shorting to the Raspberry Pi.
The jumper shipped with the board allows the stepper motor to use the +5V from the Raspberry PI. If you use a different stepper you can remove the jumper and supply up to 12 volts to the center pin and connect ground to the pin that had no connection.
Looking at the board with the LED's closest to you the white connector on the left uses the following bits
WiringPi BCM/GPIO Name
0 17 GPIO0
1 18 GPIO1
2 R1:21/R2:27 GPIO2
3 22 GPIO3
The second white connector.
4 23 GPIO4
5 24 GPIO5
6 25 GPIO6
7 4 GPIO7
Gordon's WiringPi automatically adjusts for which version of the Raspberry Pi you have.
To get the highest torque use these bit patterns on the first connector.
Turn 0 and 3 on then wait
Turn 3 off 1 on then wait
Turn 0 off and 2 on then wait
Turn 1 off and 3 on then wait
Turn 2 off (don't wait) goto top of list
#!/usr/bin/python
# -*- coding: utf-8 -*-
import RPi.GPIO as GPIO
import time
import sys
pin1=17
pin2=18
pin3=21
#change next line to 27 if V2 Raspberry Pi
pin4=22
# set pin directions
GPIO.setmode(GPIO.BCM)
GPIO.setup(pin1,GPIO.OUT)
GPIO.setup(pin2,GPIO.OUT)
GPIO.setup(pin3,GPIO.OUT)
GPIO.setup(pin4,GPIO.OUT)
#
Apin1=[0,1,0,0,1]
Apin2=[0,1,1,0,0]
Apin3=[0,0,1,1,0]
Apin4=[0,0,0,1,1]
current=0
target=0
def GO_THERE(target,current):
if current<target:
while current<target:
i=current&2 + 1
GPIO.output(pin1,Apin1[i])
GPIO.output(pin2,Apin2[i])
GPIO.output(pin3,Apin3[i])
GPIO.output(pin4,Apin4[i])
time.sleep(.003)
current= current + 1
else:
while current>target:
i=current&2 + 1
GPIO.output(pin1,Apin1[i])
GPIO.output(pin2,Apin2[i])
GPIO.output(pin3,Apin3[i])
GPIO.output(pin4,Apin4[i])
time.sleep(.003)
current= current - 1
print current,target
return current;
#setup
target=1000
current=GO_THERE(target,current)
time.sleep(2)
target=200
current=GO_THERE(target,current)
target=2000
current=GO_THERE(target,current)
target=200
current=GO_THERE(target,current)