Reading this post by Boriz .....
http://www.picaxeforum.co.uk/showthread.php?21219-Stepper-stuff&highlight=stepper
............ prompted me to buy the unit and try to understand stepper motors. There is also a good tutorial by Westy in one of the forum sections.
The following code, based on Boriz's has produced a working stepper unit, albeit a little inaccurate.
From the attached data sheet, I understand that 64 steps will give me one revolution of the motor and 64 motor revs are needed for one shaft rev.
I make that 4096 steps. but from the code above I only need 512 loops of variable w2 for a complete rev
I also cannot understand the switching sequence table. It shows 8 changes per step, where I am using 4. Is this to do with mixing "drive" types?
Should my pinsb sequence be %0001, %0011, %0010, %0110 and so on.
Finally, the ULN2003 circuit I am using shows the four coils commoned and taken to +ve. The stepper motor data sheet shows no such connection.
http://www.picaxeforum.co.uk/showthread.php?21219-Stepper-stuff&highlight=stepper
............ prompted me to buy the unit and try to understand stepper motors. There is also a good tutorial by Westy in one of the forum sections.
The following code, based on Boriz's has produced a working stepper unit, albeit a little inaccurate.
Code:
#Picaxe 18m2
'Stepper motor driver test
'Boris Burke May 2012
setfreq m8
dirsb=%00001111 'set port direction
main:
for w2=0 to 512 ' do it 512 times for one complete rev
for b1=0 to 3
lookup b1,(%0011,%0110,%1100,%1001),pinsb 'step the driver outputs
pause 5
next b1
'pause 1
next w2
pause 5000
goto main
I make that 4096 steps. but from the code above I only need 512 loops of variable w2 for a complete rev
I also cannot understand the switching sequence table. It shows 8 changes per step, where I am using 4. Is this to do with mixing "drive" types?
Should my pinsb sequence be %0001, %0011, %0010, %0110 and so on.
Finally, the ULN2003 circuit I am using shows the four coils commoned and taken to +ve. The stepper motor data sheet shows no such connection.
Attachments
-
164.1 KB Views: 55
-
69.9 KB Views: 91