Stepper motor
Posted: Tue Dec 04, 2012 5:28 am
I am having difficulty controlling motor direction with the Easydriver
board from SparkFun/Brian Schmalz. My drives turn one direction (or
the other if I reverse the pins) but ignore my attempts to reverse.
I am using an Armite (rev 2, Kernel 7.21) to control an EasyDriver
(v3). I am attempting to drive one of several small bipolar stepper
motors. I am running the Armite off USB power, and the motor drive
power is from a small 0-15v/3A DC bench supply. The grounds are tied
together. The motors are 4 and 6 pin NEMA 17 motors with either 152
ohms/phase or 12.5 ohms/phase.
Stepping works well for me on all motors tried, with a good range of
control over speed and no especially excessive heat.
Unfortunately, I seem to be unable to control the direction pin using
simple code. I am wondering if I need a pullup/down (the Armite uses
3.3v logic), whether there are timing issues when changing direction,
or if there is something else wrong.
The complete code I'm using is:
#include <PULSE.bas>
#define INPUT 0
#define OUTPUT 1
#define PULSE 500
#define STEP_PIN 2
#define DIR_PIN 3
#define STEP PULSOUT(STEP_PIN, PULSE)
'#define DIR_CCW LOW(DIR_PIN)
'#define DIR_CW HIGH(DIR_PIN)
#define DIR_CCW OUT(DIR_PIN) = 0
#define DIR_CW OUT(DIR_PIN) = 1
DIR(DIR_PIN) = OUTPUT
DIR_CCW
for j = 0 to 100
for i = 0 to 3200
'print " ", j
STEP
'wait(100)
next
wait(1000)
if (j MOD 2) = 1 then
print "DIR_CW"
DIR_CCW
else
print "DIR_CCW"
DIR_CW
endif
next
Thanks,
Dave Witten
board from SparkFun/Brian Schmalz. My drives turn one direction (or
the other if I reverse the pins) but ignore my attempts to reverse.
I am using an Armite (rev 2, Kernel 7.21) to control an EasyDriver
(v3). I am attempting to drive one of several small bipolar stepper
motors. I am running the Armite off USB power, and the motor drive
power is from a small 0-15v/3A DC bench supply. The grounds are tied
together. The motors are 4 and 6 pin NEMA 17 motors with either 152
ohms/phase or 12.5 ohms/phase.
Stepping works well for me on all motors tried, with a good range of
control over speed and no especially excessive heat.
Unfortunately, I seem to be unable to control the direction pin using
simple code. I am wondering if I need a pullup/down (the Armite uses
3.3v logic), whether there are timing issues when changing direction,
or if there is something else wrong.
The complete code I'm using is:
#include <PULSE.bas>
#define INPUT 0
#define OUTPUT 1
#define PULSE 500
#define STEP_PIN 2
#define DIR_PIN 3
#define STEP PULSOUT(STEP_PIN, PULSE)
'#define DIR_CCW LOW(DIR_PIN)
'#define DIR_CW HIGH(DIR_PIN)
#define DIR_CCW OUT(DIR_PIN) = 0
#define DIR_CW OUT(DIR_PIN) = 1
DIR(DIR_PIN) = OUTPUT
DIR_CCW
for j = 0 to 100
for i = 0 to 3200
'print " ", j
STEP
'wait(100)
next
wait(1000)
if (j MOD 2) = 1 then
print "DIR_CW"
DIR_CCW
else
print "DIR_CCW"
DIR_CW
endif
next
Thanks,
Dave Witten