Setting up Closed Loop Stepper Mode


Page 1 of 2 12 LastLast
Results 1 to 12 of 18

Thread: Setting up Closed Loop Stepper Mode

  1. #1
    Registered
    Join Date
    Jun 2005
    Location
    USA
    Posts
    1253
    Downloads
    0
    Uploads
    0

    Cool Setting up Closed Loop Stepper Mode

    Tom,
    I have a question, I have watch several videos and read numerous posts on setting up closed loop stepper mode with the KFLOP. I can see you select CLSTEP, and encoder for Input.

    My question is where do you put in the number of steps per unit with the encoder?

    I have the Renishaw LM10 which is 1um, so 25,400 pulses per inch. When I look under KmotionCNC all I see is the actual steps per unit but nothing on the encoder side. I looked in the init.c files and do see it there either.

    Thanks

    Russ

    Similar Threads:


  2. #2
    Gold Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    2324
    Downloads
    0
    Uploads
    0

    Default Re: Setting up Closed Loop Stepper Mode

    Hi Russ,

    Use KFLOP's InputGain0 parameter to match the encoder resolution to the motor resolution.

    Similar to this example with a rotary encoder.
    Closed Loop Stepper

    Regards

    TK
    http://dynomotion.com


  3. #3
    Registered
    Join Date
    Jun 2005
    Location
    USA
    Posts
    1253
    Downloads
    0
    Uploads
    0

    Default Re: Setting up Closed Loop Stepper Mode

    Tom,

    Thanks. Now I see where that aspect goes. I could not find anyone who used linear magnetic scales like the Renishaw. Right now I have my servo motors closed loop with their amps and have been driving the amps with Step and Direction. This work perfect on my small machine and I could hold tolerance with .001 with no issue. On my larger 5x5 machine I had to add some harmonic drives which introduced some backlash, probably .010", which is driving me crazy. I decided to get some high quality magnetic scales to see if I can address the issue. The resolution is 1um which is 3.937 X 10-5 inches. This comes down to 24,500 pulses per inch if my math is right. The scales output quadrature differential signals, so do I take 24,500 * 4 = 101,600 for my InputGain0. I see on the example they are diving the actual pulses/rev of the stepper motor, but don't think I would do that in my case. Again, I have not found any example, but know of several people using these magnetic scales with commercial type machines running other controllers. I have seen several people mention they are closing the loop of their servo and linear scale, but again not real example. I have read your comments on the potential problems when you introduce part of the mechanical machine in the loop. My machine is really tight except for the backlash, and I can move the gantry without the gearing reduction smooth enough not even with a 750W servo due to the mass, so that left me with a gearing reduction which on the surface is smooth as glass, but lots of gears have issues as well.

    Thanks for you help.

    Russ



  4. #4
    Gold Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    2324
    Downloads
    0
    Uploads
    0

    Default Re: Setting up Closed Loop Stepper Mode

    Hi Russ,

    Many users have run Closed Loop Glass scales with Step/Dir Drives. It normally works well.

    The closed loop will correct for the backlash, however only after some time. Imagine you are holding a 1ft chain connected to a cart that you are trying to position to within 1inch. Looking at the cart's position you can decide to move your end of the chain right or left to move the cart into position. Note that you must move the cart slowly into position because you have no way of stopping the cart until you fully remove the slack in the other direction. Friction may work well in your favor. You might find it works well until something is pushing and pulling on the cart (ie cutting forces). The result is likely to be much better than if you couldn't see what the cart was doing at all, but not likely to be perfect in all cases.

    Your math looks right except maybe the factor of 4. When they say the resolution is 1um that might refer to the quadrature counts. Its simple to figure it out. Move the axis an inch and see if the encoder changes by 24,500 or 101,600 counts.

    No you would not put 101,600 as the InputGain0. The idea is to put whatever factor necessary to match the encoder to your steps/inch. I don't think you have told us your resolution in motor steps/inch. For example assume your motor steps/inch is 10000steps/inch and your linear encoder is 24500steps/inch. Then use:

    InputGain0 = 10000/24500 = 0.408163

    If you then make a large move on the Step Response Screen you should see that the red and blue plots match closely within any mechanical errors and servo errors..

    HTH
    Regards

    TK
    http://dynomotion.com


  5. #5
    Gold Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    2324
    Downloads
    0
    Uploads
    0

    Default Re: Setting up Closed Loop Stepper Mode

    Opps I think it should actually be 1000 counts/mm x 25.4mm/inch = 25400 counts/inch not 24500

    TK
    http://dynomotion.com


  6. #6
    Registered
    Join Date
    Jun 2005
    Location
    USA
    Posts
    1253
    Downloads
    0
    Uploads
    0

    Default Re: Setting up Closed Loop Stepper Mode

    Tom,
    you are correct, my typo'd the count is 25,400

    My servo motors have encoders with 2000 P/R, which attach to a Harmonic Reducer which is 11:1, that attaches directly to a 40mm pitch ballscrew.

    2000 * 11 = 22,000 P/R Now add in the ballscrew: 40mm / 22000 = 25.4mm / X so X = 13,970 Pulses/Inch

    So if I following your guidance I take: 13,970 / 25,400 = .55 so my inputgain0 would be set to .55 correct?

    I am currently figuring out how to attach the read heads to the machine as well as the tape but can lay the tape on the table and connect a temp cable to the read head to see if Kflop is seeing them move. Thanks again for all your help

    Russ



  7. #7
    Gold Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    2324
    Downloads
    0
    Uploads
    0

    Default Re: Setting up Closed Loop Stepper Mode

    Hi Russ,

    That looks correct except for any possible factors of 4 due to pulses vs counts. So verify your numbers by moving 1 inch.

    Regards

    TK
    http://dynomotion.com


  8. #8
    Registered
    Join Date
    Jun 2005
    Location
    USA
    Posts
    1253
    Downloads
    0
    Uploads
    0

    Default Re: Setting up Closed Loop Stepper Mode

    Tom,
    I have not physically attached the Linear Scale read head to an axis but laid the scale tape on my table, and connected the encoder head as follows:

    KANALOG Connections
    JP1-Pin 5 Phase A
    JP1-Pin 6 Phase A/
    JP1-Pin 7 Phase B
    JP1-Pin 8 Phase B/
    5V to encoder +5V
    Gnd to encoder 0V

    I tested the power and got my 5V as expected. I can run the encoder head along the tape and the LED turns Green which indicates it is reading the tape. If I check the KFLOP screen for digital IO I can see the second encoder flash on an off when I move the head.

    Right now I have my MPG connected to Encoder 0 position, probably will need to move that when I hook up this stuff for real, so I can keep Encoder 0 for the X axis and Encoder 1 for the Y axis, and Encoder 3 for the Z axis, so I guess I can modify the code and make my MPG encoder 4.

    I wanted to see if the encoder was actually counting up and down when I moved it manually with my hand but can't see any place you can see this on any screen in Kmotion.

    I then when to the configuration page and configured just the Y axis with Encoder Input and CL Step. I also showed the inputgain0 as .55 and saved it and downloaded it into KFLOP. I then went to the step response screen and figured maybe I would see the counts, but nothing. Perhaps this will not work unless it is physically connected to the axis. It will take me a few days to figure out how to make some brackets to mount the heads and tape, but wanted to see if things appear to be working before I went to all that effort.

    Appreciate any guidance, I read the manual over and over and must be missing something again. LOL

    Russ



  9. #9
    Registered
    Join Date
    Jun 2005
    Location
    USA
    Posts
    1253
    Downloads
    0
    Uploads
    0

    Default Re: Setting up Closed Loop Stepper Mode

    Tom,

    I went out this morning and setup the encoder head and tape in a temp fashion so I could do some more testing with the linear scale.

    Setting up Closed Loop Stepper Mode-kflop-encoder-step-jpg

    I have PID with I set to .01, I set the 0gain to .55 as calculated then I told it to do a step of 25,400, which should have been the number of counts on the encoder for one inch.

    I don't really understand the plot.

    The red position plot I can see the steps 25,400 at the top, the command plot I don't understand, the numbering on the left looks wrong. This almost seems like I have the A and B phase of the encoder reversed. A little guidance please.

    Russ



  10. #10
    Gold Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    2324
    Downloads
    0
    Uploads
    0

    Default Re: Setting up Closed Loop Stepper Mode

    Hi Russ,

    That looks good to me. The only issue is about a 1 inch difference between the commanded destinations(blue) and the measured positions(red). If you push the "Zero" button they should both start at zero.

    We normally initialize the Axis Destination to the current encoder position with:

    EnableAxisDest(0,ch0->Position);

    The Axis Screen can be used to display the Destinations and Positions for all the Axes.

    You aren't showing the configuration but I'm guessing you are testing open loop as there is no output (green - uses right side scale).

    Regards

    TK
    http://dynomotion.com


  11. #11
    Registered
    Join Date
    Jun 2005
    Location
    USA
    Posts
    1253
    Downloads
    0
    Uploads
    0

    Default Re: Setting up Closed Loop Stepper Mode

    Tom,

    I restarted and did everything in Kmotion and did not touch KmotionCNC this time. I enabled the Y axis and then corrected the configuration and then did the following step response.

    Setting up Closed Loop Stepper Mode-encoder-correction-applied-jpg

    This time the plot looks more like what I expected. Both curves are almost directly on top of each other which seems correct. It also has the Green plot showing correction but I am not exactly sure how to read that aspect. I did notice you can watch the axis page and see the encoder count. I forgot to run the test of moving the axis one inch and see if I got 25,400 counts. I think I am starting to get closer. I have not done the rest of the filter aspect, that will come next as soon as I mount the encoders and scales permanently on the machine.

    Russ



  12. #12
    Gold Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    2324
    Downloads
    0
    Uploads
    0

    Default Re: Setting up Closed Loop Stepper Mode

    Hi Russ,

    Looks like you have a few issues. You should make open loop moves first as it is simpler to analyze.

    Feedback appears unstable. Maybe reduce I Gain to 0.001

    Feedback is requiring more than the allowed 200 counts so the Output is saturating and limited

    Position doesn't return to zero after the move. That seems strange. It is even correcting 200 steps but is still off 150 which means a total error of 350 steps. Either you have significant mechanical errors or steps or counts are being lost.

    Regards

    TK
    http://dynomotion.com


Page 1 of 2 12 LastLast

Tags for this Thread

Posting Permissions

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


About CNCzone.com

    We are the largest and most active discussion forum for manufacturing industry. The site is 100% free to join and use, so join today!

Follow us on


Our Brands

Setting up Closed Loop Stepper Mode
Setting up Closed Loop Stepper Mode