Introducing "SyncroStepper" - Syncronization For Multi-Axis Machines
idbruce
Posts: 6,197
Hello Everyone
Here is some code that will allow you to get some good speed out of your stepper motors and keep the start of their movement syncronized. Interpolation is my next project, but for now, this may wet your appetite.
This really isn't what I wanted to do, because there is a lot of redundant code, but it works. I really wanted to create an object for it, but I was having trouble updating and checking my variables. If you want the existing code for the original plan for syncronized steppers, go to this post: http://forums.parallax.com/showthread.php/159900-Does-This-Method-Provide-The-Exact-Same-Return-As-SPINs-Square-Root-Operator?p=1313527&viewfull=1#post1313527
If you want more information pertaining to how the code works and settings for the constants and variables, go to this thread: http://forums.parallax.com/showthread.php/159853-New-Stepper-Driver-Object-A-Variant-Of-PulseTheStepPin
All I can say is.... "Oh yeah baby"
EDIT: The syncronization has not been checked with a scope. If the start of the axes are not truly syncronized, then they are pretty darn close. If more accuracy is needed, then perhaps a "WAITPEQ" would do the trick.
Here is some code that will allow you to get some good speed out of your stepper motors and keep the start of their movement syncronized. Interpolation is my next project, but for now, this may wet your appetite.
This really isn't what I wanted to do, because there is a lot of redundant code, but it works. I really wanted to create an object for it, but I was having trouble updating and checking my variables. If you want the existing code for the original plan for syncronized steppers, go to this post: http://forums.parallax.com/showthread.php/159900-Does-This-Method-Provide-The-Exact-Same-Return-As-SPINs-Square-Root-Operator?p=1313527&viewfull=1#post1313527
If you want more information pertaining to how the code works and settings for the constants and variables, go to this thread: http://forums.parallax.com/showthread.php/159853-New-Stepper-Driver-Object-A-Variant-Of-PulseTheStepPin
All I can say is.... "Oh yeah baby"
EDIT: The syncronization has not been checked with a scope. If the start of the axes are not truly syncronized, then they are pretty darn close. If more accuracy is needed, then perhaps a "WAITPEQ" would do the trick.
Comments
-Phil
No need to apologize for corrections and please feel free to correct me at anytime, because if I am ignorant, I certainly do not want to remain that way
As far as being an interesting project, I would have to ask which part, the project as a whole or just this section of code? However I will say this, there is something very satisfying about seeing two homemade linear actuators operate as smooth as silk and in unison. I am impatiently waiting for the day when I can finally test my extruder, but I am quite a ways from that point.
The test represents X and Y both moving 12 inches in one direction and then 12 inches in the other, under a repeat loop of 10 times, so it represents 20 linear feet of movement for each axis. Additionally, there are several waitcnt(s) in the test code, so these movements would actually be a lot faster.
It needs a cog per steppermotor but it eliminates timedifferences between steppulses. The bresenham algorithm creates this jitter if the "slave"-axle runs at certain speedratios that are not a fraction represented by small even numbers
Best regards
Stefan
The time differences are an absolute necessity to achieve motor ramping. Without ramping, a stepper motor will never be able to achieve it's full potential. So in actuality, time differences are a good thing.
-Phil
Oh, I see... Thanks for clafying.
@Stefan
My apologies for the misinterpretation
Thank you.
-Phil
By the way I posit jitter is neither here-nor-there if you are using a reasonable amount of micro-stepping,
partly because the effect is so small (slight distortions of the sine-waves) and partly because you are generating
steps at a rate where the chopper circuit period is significant, so synchronising with that (not normally possible)
would be needed to avoid jitter.
Or more simply the jitter in microseconds is a much smaller value. You do have to generate steps faster of course.
http://forums.parallax.com/showthread.php/142705-Step-Dir-signal-generator-for-CNC?highlight=manatwork
brs