Shop OBEX P1 Docs P2 Docs Learn Events
StepperDriveErz — Parallax Forums

StepperDriveErz

idbruceidbruce Posts: 6,197
edited 2014-04-24 01:46 in Propeller 1
Hello Everyone

Considering that a few people have recently shown an interest in one of my stepper drivers, I finally decided to alter some of them, provide much better documentation for all of them, and add them all to one file. I believe with a little studying, these drivers should be easy to understand, and will give the reader a nice overview of single ended NCO/PWM counters.

This is the most complete, concise, and comprehensive release of my work pertaining to stepper drivers. If you find any errors with these drivers, please let me know.

I hope they find a good home :)

Bruce

EDIT: Please refer to post #20

Comments

  • idbruceidbruce Posts: 6,197
    edited 2012-02-29 06:29
    To Whom It May Concern

    I have decided to attempt to make this file pretty consistent with the Gold Standard Specification. I cannot say that I personally agree with the entire specification, so it will not meet the exact requirements, but it will be pretty darn close, and therefore I intend to submit it when it is finished.


    So needless to say that there will be a new release, and the new release will contain:
    • An MIT license
    • A StepperDriveErz object
    • A demonstration program utilizing the StepperDriveErz object
    • More versatility
    • Methods that utilize default settings
    • Methods that can be sent customized parameters
    • And better documentation
    Bruce
  • SarielSariel Posts: 182
    edited 2012-02-29 09:43
    I have been doing a bit of studying on PWM Fan control, Tach readings, and steppers lately. And am about to DL the link above. I look forward to the "Mostly Golden" release when it is available. Thanks for the effort on this one.
  • idbruceidbruce Posts: 6,197
    edited 2012-02-29 17:14
    @Sariel
    I look forward to the "Mostly Golden" release

    LOL I have a wierd sense of humor, but to me that is funny. Old habits die hard and I have never been a person that conforms well to something that I do not fully accept.

    I must say this file is now transforming into something completely different. With the exception of breaking a few rules of the specification, I am doing my very best to make these drivers easy to use and understand. In the past, it was not necessarilly beneficial for me to create an object file for my drivers, but now that I am creating an object file, I can foresee it becoming useful to myself and many others. Without getting into details, I can say that after setting certain default values, the object should be very easy to use without understanding a whole lot of detail.

    I look forward to getting it done, because it is eating up a lot more time than I anticipated, however it should be a good thing to share with other Prop heads that use stepper motors.

    Bruce
  • photomankcphotomankc Posts: 943
    edited 2012-03-01 07:26
    Really appreciate the efforts Bruce! This is something that has been missing for a while for the Prop. I had an object long ago that built a table to handle accel and it worked nicely but it ate up the memory in no time with a couple of steppers. I need to get a couple more BigEasy drivers so I can test out your code. Looking at it breifly I get the sense that it is designed to make each move from a full stop to full stop. It will not accelerate/decelerate from a currently moving speed to a newly defined speed correct? That gets a bit complicated but it's the biggest drawback to the current system I am using for my robot. Any substantial changes to speed require me to stop and restart or risk a stall if you just try to jam-it.
  • idbruceidbruce Posts: 6,197
    edited 2012-03-01 07:50
    photomankc
    Looking at it breifly I get the sense that it is designed to make each move from a full stop to full stop. It will not accelerate/decelerate from a currently moving speed to a newly defined speed correct? That gets a bit complicated but it's the biggest drawback to the current system I am using for my robot. Any substantial changes to speed require me to stop and restart or risk a stall if you just try to jam-it.

    In it's current state, yes it is from stop to stop, however, perhaps it is possible to achieve, just as long as you never exceed max speed. In the file that I am preparing for the OBEX, there are now six stepper drivers instead of three. Three of the methods (functions) will use several default parameters, whereas the other three drivers will have the ability to send custom parameters.

    Of course these drivers will have new names for the OBEX, but for the sake of discussion and to provide understanding, please refer to the RunDaStepperMotor function in the file above. Within this function, there are three REPEAT loops. By varying the CycleOffset parameter within the middle loop, you could effectively change speed. So let's say that when supplying the CycleOffset parameter to the method, you copy it into a global varible which can be altered, but this copied variable should be used in all three loops. Additionally, by altering the CycleOffset in the middle loop, you must also alter the RampingSteps for the final loop.

    Bruce
  • idbruceidbruce Posts: 6,197
    edited 2012-03-01 08:03
    photomankc

    After thinking about it a while longer, there are probably several solutions to this problem.

    You could also use WAITCNT(Counter += CycleOffset -= RampIncDec) to increase speed and WAITCNT(Counter += CycleOffset += RampIncDec) to decrease speed.

    Bruce
  • idbruceidbruce Posts: 6,197
    edited 2012-03-01 08:15
    photomankc

    I would use the latter suggestion, because it would allow ramping to the desired speed

    Bruce

    EDIT: I am sure it could be done quite easily with the information provided.
  • idbruceidbruce Posts: 6,197
    edited 2012-03-01 08:21
    photomankc

    Give me a little while and I might throw something together for you.
  • PublisonPublison Posts: 12,366
    edited 2012-03-01 08:38
    Bruce,

    The attention to detail on the comments are much appreciated!

    Great work!

    Jim
  • idbruceidbruce Posts: 6,197
    edited 2012-03-01 09:03
    The attention to detail on the comments are much appreciated!

    Thanks Jim

    You should see the file I am working on now. Definitely quite a bit more information. Each method contains a description of the parameters for the method, and I additionally went the extra mile to explain the purpose of each local variable.

    Bruce
  • idbruceidbruce Posts: 6,197
    edited 2012-03-01 16:04
    @photomankc

    I have been bouncing the idea of a variable speed stepper driver around in my head for several hours now, and I believe I have a pretty clear vision of how to accomplish the task. Since I have a clear vision of the task and since I think it may be useful to a few people, I have decided to write one and include it with the other methods in the future StepperDriveErz object. It won't be long and I should have a solution for you. Instead of making it complicated for myself, I have decided to make speed changes according to pulses (steps) per second, as compared to something like RPM or RPS.

    Bruce
  • idbruceidbruce Posts: 6,197
    edited 2012-03-10 08:22
    Thanks Jim

    You should see the file I am working on now. Definitely quite a bit more information. Each method contains a description of the parameters for the method, and I additionally went the extra mile to explain the purpose of each local variable.

    Bruce

    I just discovered that I cannot find my future object file anywhere on my PC. It appears that I must have altered the original to make the variable stepper driver.

    OOOOOPPPSS What a bummer.
  • sielbearsielbear Posts: 3
    edited 2012-03-16 23:06
    Bruce,

    Thanks so much for all of this work! I'm going to play with this tomorrow to see how it improves my current motor control. It looks like some nice enhancements have been made! Sorry for the late response - I thought I had notifications enabled in the previous thread, but clearly I did not!
  • idbruceidbruce Posts: 6,197
    edited 2012-03-17 15:24
    @sielbear

    You're welcome. It has always been my hope that this code would be useful to someone else besides myself. As for the enhancements, it is truly a shame that I altered my original file without saving it to another name, because THAT file was really looking good. Perhaps someday in the near future, I might reach deep within myself to redo all the work that I lost.

    Bruce
  • turbosupraturbosupra Posts: 1,088
    edited 2012-03-18 18:03
    Hi Bruce,

    How well do you think this would work with an automotive stepper motor solenoid?
  • idbruceidbruce Posts: 6,197
    edited 2012-03-18 19:08
    turbosupra

    I never heard of a stepper motor solenoid. However to give you a brief overview, this software driver should drive any normal stepper electronic driver that requires a pulse going to the "step" pin. This software driver is incapable of controlling the individual coils of a stepper motor.

    Providing you have an electronic driver that requires a pulse to a step pin, you might be able to use it with some alterations and tailoring.

    Bruce
  • tonyp12tonyp12 Posts: 1,951
    edited 2012-03-18 19:56
    >incapable of controlling the individual coils of a stepper motor.

    But should not be to hard to add direct drive of dual h-bridges?
    doing half-stepping is simple, and quarter or even micro stepping should be pretty easy to add too.
    Look at my spin demo code.
    http://forums.parallax.com/showthread.php?138695-Now-Available-QuadStepper-board-for-QuickStart&p=1083078&viewfull=1#post1083078
  • idbruceidbruce Posts: 6,197
    edited 2012-05-02 03:51
    Referring to Post #13

    I just found my original file. YIPPEE.

    I have attached it below for safe keeping, however I am unsure where I stopped on this file and I don't have time to review it now. This file contains quite a bit more information, because I was attempting to make it "Mostly Golden".

    Considering it is not finished, it may take some exploration to determine what is going on and where I stopped.

    Bruce

    EDIT: Please refer to post #20
  • idbruceidbruce Posts: 6,197
    edited 2014-04-24 01:46
    All I can is WOW.

    I will need to go back over this file with a fine tooth comb to resolve all the uncertainty and errors.

    Anyhow, I just found out how bad of shape this file was in, after copying some code for another driver. I cannot say how fast this file will be repaired, but I will repair and finish this. This file is no where near the state I last left it and it was definitely in much better shape the last time I worked on it.

    My sincerest apologies to anyone who downloaded this file and wasted time on it.
Sign In or Register to comment.