Stepper motor controller


Closed Thread
Results 1 to 23 of 23

Hybrid View

  1. #1
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Hi Al,
    1. Thanks for the nice code example / project, I will try it out !
    2. Question: It appears you have set this up as a control for a home brew CNC project, just judging from the use of limit switch inputs, is that correct, and any issues using it for that?
    Thank You
    JS
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  2. #2
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    Hi Joe, the original idea was to have a handy and simple device to solve linear positioning requirement, and when you do positioning, you also need a zero point to start and limits security.

    But since you can serialy network the controllers, you can also control two or three axis and have a small open loop cnc system. The only limitation is that you will have only point to point positioning or linear interpolation but not the circular. But for simple drilling tasks, for instance, this will be ok.

    Nice to hear from you.

    Al.
    Last edited by aratti; - 3rd February 2009 at 07:34.
    All progress began with an idea

  3. #3
    Join Date
    Sep 2007
    Location
    USA, CA
    Posts
    271


    Did you find this post helpful? Yes | No

    Default

    I believe there is a typo in this sub...

    WAddress: ' write controller address
    Write 4,RData[1]
    goto ReadEeprom

    should read...
    WAddress: ' write controller address
    Write 5,RData[1] 'matches the reads...
    goto ReadEeprom

  4. #4
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    Tenaja you are correct. Correction is necessary otherwise controller address cannot be canged. Any attempt to change the address will modify the configuration.

    So please correct the write controller address code as per Tenaja suggestion.

    Code:
    WAddress: ' write controller address
    Write 5,RData[1] 
    goto ReadEeprom
    Al.
    All progress began with an idea

  5. #5
    Join Date
    Sep 2007
    Location
    USA, CA
    Posts
    271


    Did you find this post helpful? Yes | No

    Default

    Al, I'd like to add one more bit of "correction" just to your description of this project. It is certainly totally usable as is, however, it is not a "true" trapezoidal accel/decel curve. To get trapezoidal curves you need fancy math that involves integrals, or some approximation of the integral that cuts it down to division.

    Simply adding or subtracting a fixed time between each step does provide acceleration, but the curve comes out logarithmic. The shorter the time between steps (i.e. faster motor rpm), the faster the acceleration (steeper accel curve). This may not make a difference for many applications, but if you are trying to synchronize or optimize any motion, it is important to note.

  6. #6
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    however, it is not a "true" trapezoidal accel/decel curve. To get trapezoidal curves you need fancy math that involves integrals, or some approximation of the integral that cuts it down to division.
    Accelleration; Velocity and travel are three quanties totaly indipendent that can be changed to suit a specific application but still totaly indipendent.

    When a command travel is given, the controller start the move with accelleration as per the slope given. When full speed is reached than it will travel at full speed for a while and than it will decellerate to position. This is TRUE TRAPEZIODAL PROFILE, to understand it better, please refer to the attached picture (snap137). Surelly you have forgotten that we are using a stepper motor in a open loop and that this device is totaly time dipendent (one pulse = one step).

    The quantity "ACCELERATION" is given in steps (default = 600) and this quantity will fix the slope. The algoritm will test the travel quantity you have sent (in steps) and if found greater than twice the accelleration then it will subtract twice the accelleration from the total travel to obtain the profile shown in the picture.
    If the travel quantity is less than twice the accelleration then the travel profile will be "TRIANGULAR" for the simple reason that maximum speed will never be reached and decelleration will commence when accelleration is still in progress.

    Simply adding or subtracting a fixed time between each step does provide acceleration, but the curve comes out logarithmic.
    I don't know how much you know about log functions, but I assure you that you will never get a log function with addition or subtraction.

    Al.
    Attached Images Attached Images  
    All progress began with an idea

  7. #7
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    I am posting two more drawings to better illustrate the profile geometry produced by the controller.

    Al.

    P.S. I wish the EDIT function could be restored soon.
    Attached Images Attached Images   
    All progress began with an idea

Similar Threads

  1. 18f4431; driving a stepper IN HARDWARE mode
    By DDDvvv in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 21st January 2010, 16:49
  2. Replies: 11
    Last Post: - 6th November 2008, 10:27
  3. Controlling stepper motor with PIC
    By The Master in forum Off Topic
    Replies: 3
    Last Post: - 1st July 2008, 10:21
  4. Driving Stepper Motor with PBL3717
    By crhomberg in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 8th November 2007, 20:59
  5. problem with stepper!!
    By ibra in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 7th August 2007, 16:41

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts