# step_scale, max_vel and step/dir timings

19 Apr 2022 11:03 #240645 by RDA
Hello,

As a sanity check can someone say if I have misunderstood something. I have teknic sdsk motors set to 8000p/rev, 10:1 gearbox and 1.5M 40Z pinion. Running these through a mesa 7i96.
For the scale my math is (8000x10)/(1.5xpix40)=~424.413
So this would put my scale to a rough 424
Motors can do around 4000rpm so this would set my max speed to (4000/10)x(1.5xpix40)=~75 398mm/min. This then needs to be in mm/sec so lets say around 1200mm/sec

The teknics "worst" case pulse width for 10ft cable is 900ns low and high, DIR change is 25ns and DIR hold 1us. So my settings would be something like:
```[AXIS_Y]
# MAX_VEL & MAX_ACC need to be twice the corresponding joint value
MAX_VELOCITY = 1200.00
MAX_ACCELERATION = 1500.0
OFFSET_AV_RATIO = 0.5
MIN_LIMIT = -0.01
MAX_LIMIT = 3000.01

[JOINT_1]
TYPE = LINEAR
HOME = 0.0
FERROR = 10.0
MIN_FERROR = 1.0
MAX_VELOCITY = 600.00
MAX_ACCELERATION = 750.0
# The values below should be 25% larger than MAX_VELOCITY and MAX_ACCELERATION
# If using BACKLASH compensation STEPGEN_MAXACCEL should be 100% larger.
STEPGEN_MAXVEL = 800
STEPGEN_MAXACCEL = 937.50
P = 600.00
I = 0.0
D = 0.0
FF0 = 0.0
FF1 = 1.0
FF2 = 0.0
BIAS = 0.0
MAX_OUTPUT = 0.0
# these are in nanoseconds
DIRSETUP   = 500
DIRHOLD    = 500
STEPLEN    = 900
STEPSPACE  = 900
STEP_SCALE = 424.413
MIN_LIMIT = -0.01
MAX_LIMIT = 3000.01
HOME_OFFSET = 0.0```

If I am going terribly wrong could someone please correct me?

19 Apr 2022 19:28 #240676
First, set the P to 1000 and do not change that for step/dir open loop.
Then 1us in not 900ns, it is 1000, but it is wise to set both dir timings to 20000 and both step timings to 5000 until you have everything working properly, then if you find that the velocity is limited you can shorten the timing for step stuff.
From experience i do not like to trust manufacturers specs and run at limits, to short timings can cause lost steps that are hard to figure out when set to marginal values.
As for velocity, are you sure the machine can handle 36 meters/minute as set in the ini file, and just to be sure can it do 75m/m ?
Acceleration of 750mm/s/s is ok for lite machines, but for heavy stuff 500 or 350 or 200 might be needed, depending on the moving mass. Although motors might do such accelerations, the load on everything can be so big as to cause premature failures.
A bit of testing is always good to see and hear how the machine behaves and when you hit the limits, back off some 25% to 50% just to be on the safe side.
For scale i can not help as i have no clue how much does a module 1.5 40 teeth move for one rotation of the pinion, should be in the spec sheet.

20 Apr 2022 18:56 #240750 by RDA

I wasn't sure about the PID and it looked like pnconf puts the same value as maxvel so I went ahead with that. So 1000 is a generic good value for open loop?

Not sure what you mean by the 1us not being 900ns? I agree its best to be as "sloppy" as possible. My main goal was to get an idea that I understood correctly about what to put where.

Same for speed, I am sure it can do 36m/min and probably also the 75m/min. Typically speed is not the issue, you get more trouble from too high accelerations. I wasn't too sure about the difference between maxvel on axis and joint I assume joint is when you do a coordinated move and move more than one axis at a time.

1.5M 40Z pinion is the size of (module*teeth*pi) 1.5*40*pi so ~188.5mm

I'm stilling missing bits and pieces from an actual moving machine but I just wanted to playround with the motors on a bench.

21 Apr 2022 00:35 #240771

I wasn't sure about the PID and it looked like pnconf puts the same value as maxvel so I went ahead with that. So 1000 is a generic good value for open loop?

Not a generic value, exact value it should be set at when the servo period is 1000000 ( 1 million).

Not sure what you mean by the 1us not being 900ns?

1us = 1000ns, so not 900, it was just a remark, does not matter much in this case.

Same for speed, I am sure it can do 36m/min and probably also the 75m/min. Typically speed is not the issue, you get more trouble from too high accelerations. I wasn't too sure about the difference between maxvel on axis and joint I assume joint is when you do a coordinated move and move more than one axis at a time.

Oh, good.
I did try to push a plasma machine i built to 68m/m, it ripped the belts! It did happily work at 55m/m all day though, but in normal use i have it set at 24m/m.
maxvel should be same for the joint and corresponding axis, it should be at least 25% more than velocity for that axis/joint, and it should be 100% more if backlash compensation is used.

1.5M 40Z pinion is the size of (module*teeth*pi) 1.5*40*pi so ~188.5mm

OK, although i would still measure to be sure. Be aware that tape measures also differ a lot, so using 2 or more of them from different manufacturers is always a good idea.
Last time i used 3 of them, they had a delta of 2mm on 3 meter length!
The following user(s) said Thank You: RDA

21 Apr 2022 22:25 #240828 by andypugh

1.5M 40Z pinion is the size of (module*teeth*pi) 1.5*40*pi so ~188.5mm

OK, although i would still measure to be sure.

If it is a 1.5M gear then the pitch should be very nearly exact. But use 4 or 5 decimal places in the INI, there is a π in there so it will never be a round number.

The following user(s) said Thank You: RDA