[Machinekit] Stepper motor configuration

2016-09-21 Thread euerka
Dear all,
Recently i am trying to use CRAMPS.ini(without cape just BBB) to drive step 
motor.
My Motor model is:
Moon's stepping motor
Type 17HA6403-09N

Driver is A4988

 P8-13 and P8-14 are used as stepdir and step.

First of all, I adjust the limit current to 0.43A according to motor data 
sheet.
Then i set scale to -1600 in the configure file

[AXIS_0]
>
> #
> # Step timing is 40 us steplen + 40 us stepspace
> # That gives 80 us step period = 12.5 KHz step freq
> #
> # Bah, even software stepping can handle that, hm2 doesnt buy you much 
> with
> # such slow steppers.
> #
> # Scale is 200 steps/rev * 5 revs/inch = 1000 steps/inch
> #
> # This gives a maxvel of 12.5/1 = 12.5 ips
> #
>
>
> TYPE =  LINEAR
> MAX_VELOCITY =   200.0
> MAX_ACCELERATION =   3000.0
> # Set Stepgen max 20% higher than the axis
> STEPGEN_MAX_VEL =240.0
> STEPGEN_MAX_ACC =3600.0
>
> BACKLASH =   0.000
>
 

> SCALE =  -1600
>
 

>
> MIN_LIMIT = -1.0
> MAX_LIMIT = 220.0
>
> FERROR = 1.0
> MIN_FERROR = 0.25
>
> HOME =  0.000
> HOME_OFFSET =   0.00
> HOME_IGNORE_LIMITS =YES
> HOME_USE_INDEX =NO
> HOME_SEQUENCE = 0
>
> # Set to zero if you don't have physical home/limit switches
> # Set to the desired homing and latch velocity if you have switches
> # See: https://github.com/machinekit/machinekit-docs
> HOME_SEARCH_VEL =   0.0
> HOME_LATCH_VEL =0.0
>
> # these are in nanoseconds
> DIRSETUP   =  200
> DIRHOLD=  200
> STEPLEN=  1000
> STEPSPACE  =  1000
>


As motor specification shows 0.9 deg per step, 400 step/rev * 4 rev/mm=1600 
step/mm
 my target is 1600 steps per mm.
Then I tested G01X1.f40., it looks rotate 4 round. 
If i tested G00X1.F40., Motor freezed and make noise. Speed too fast???
Or when i run a G program, sometimes it just freeze and make noise.

Then I tested NC program from nc_files such as butterfly.ngc, it will 
accelerate then decelerate, when speed nearly goes to zero, motor start to 
shaking, and make noise. 

I have almost zero experience about tuning stepper motor, so may i know how 
to configure stepper motor and make it work smooth with machinekit?

Thanks very much!

-chengxi 

-- 
website: http://www.machinekit.io blog: http://blog.machinekit.io github: 
https://github.com/machinekit
--- 
You received this message because you are subscribed to the Google Groups 
"Machinekit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to machinekit+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/machinekit.
For more options, visit https://groups.google.com/d/optout.


Re: [Machinekit] Stepper motor configuration

2016-09-21 Thread Charles Steinkuehler
On 9/21/2016 9:45 AM, euerka wrote:

>  MAX_VELOCITY =   200.0
>  MAX_ACCELERATION =   3000.0
>  # Set Stepgen max 20% higher than the axis
>  STEPGEN_MAX_VEL =240.0
>  STEPGEN_MAX_ACC =3600.0

>  # these are in nanoseconds
>  DIRSETUP   =  200
>  DIRHOLD=  200
>  STEPLEN=  1000
>  STEPSPACE  =  1000
> 
> 
> As motor specification shows 0.9 deg per step, 400 step/rev * 4 rev/mm=1600 
> step/mm
>   my target is 1600 steps per mm.
> Then I tested G01X1.f40., it looks rotate 4 round.
> If i tested G00X1.F40., Motor freezed and make noise. Speed too fast???

Almost certainly.  With a scale of 1600, and a maximum velocity of
200, your maximum step pulse rate would be 320,000 KHz, and with your
acceleration of 3000 mm/s/s, you'll get there pretty quick.  The
default PRU settings result in a maximum pulse speed of about 50 KHz,
so you need to either reduce the maximum allowed velocity or decrease
the PRU cycle time (or both).

What sort of drive system are you using to get 4 rev/mm?  That's
pretty low even for a ball screw with a belt reduction.

> Or when i run a G program, sometimes it just freeze and make noise.
> 
> Then I tested NC program from nc_files such as butterfly.ngc, it will 
> accelerate 
> then decelerate, when speed nearly goes to zero, motor start to shaking, and 
> make noise.

I'm not sure why this is happening, it shouldn't be caused by the fast
step pulse rate issue above.  Sometimes this happens if you have
problems with your stepper motor wiring (the pairs are hooked up wrong
or one of the pairs has faulty wiring).

-- 
Charles Steinkuehler
char...@steinkuehler.net

-- 
website: http://www.machinekit.io blog: http://blog.machinekit.io github: 
https://github.com/machinekit
--- 
You received this message because you are subscribed to the Google Groups 
"Machinekit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to machinekit+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/machinekit.
For more options, visit https://groups.google.com/d/optout.


Re: [Machinekit] Stepper motor configuration

2016-09-21 Thread schoone...@btinternet.com

  
  

On 21/09/16 15:45, euerka wrote:


  Dear all,
Recently i am trying to use CRAMPS.ini(without cape just BBB) to
drive step motor.
My Motor model is:
    Moon's stepping motor
    Type 17HA6403-09N

    Driver is A4988
  


The stepper timings you are using are the theoretical ones for the
chip from the spec sheet, but take no account of any other
source of delays such as opto isolators etc

Try increasing dirhold / dirlen to 1us and steplen / stepspace to
5us
If that cures it, try reducing the figures towards the chip specs
until you hit problems


   

      TYPE =  LINEAR
      MAX_VELOCITY =   200.0
      MAX_ACCELERATION =   3000.0
      # Set Stepgen max 20% higher than the axis
      STEPGEN_MAX_VEL =    240.0
      STEPGEN_MAX_ACC =    3600.0

  


The second issue and potential hiccup are your speeds,
if an axis ever moved far enough to build towards the maximums, I
would expect it to stall.

Are you really expecting your Nema 17 (?) stepper to be able to
accelerate at 3.6 metres per second per second?
Or to move an axis 14.4 metres per minute?

Try calculating how many step pulses that would take and whether you
can generate them

I would move the decimal point one place left for all velocity and
acceleration figures and scale up only if 
you can show spare capacity in step generation


  
  
  -- 
  website: http://www.machinekit.io
  blog: http://blog.machinekit.io
  github: https://github.com/machinekit
  --- 
  You received this message because you are subscribed to the Google
  Groups "Machinekit" group.
  To unsubscribe from this group and stop receiving emails from it,
  send an email to machinekit+unsubscr...@googlegroups.com.
  Visit this group at https://groups.google.com/group/machinekit.
  For more options, visit https://groups.google.com/d/optout.


  




-- 
website: http://www.machinekit.io blog: http://blog.machinekit.io github: https://github.com/machinekit
--- 
You received this message because you are subscribed to the Google Groups "Machinekit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to machinekit+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/machinekit.
For more options, visit https://groups.google.com/d/optout.


Re: [Machinekit] Stepper motor configuration

2016-09-21 Thread Bas de Bruijn



On 9/21/2016 5:03 PM, Charles Steinkuehler wrote:

As motor specification shows 0.9 deg per step, 400 step/rev * 4 rev/mm=1600 
step/mm
>   my target is 1600 steps per mm.
>Then I tested G01X1.f40., it looks rotate 4 round.
>If i tested G00X1.F40., Motor freezed and make noise. Speed too fast???

Almost certainly.  With a scale of 1600, and a maximum velocity of
200, your maximum step pulse rate would be 320,000 KHz, and with your
acceleration of 3000 mm/s/s, you'll get there pretty quick.  The
default PRU settings result in a maximum pulse speed of about 50 KHz,
so you need to either reduce the maximum allowed velocity or decrease
the PRU cycle time (or both).

What sort of drive system are you using to get 4 rev/mm?  That's
pretty low even for a ball screw with a belt reduction.



could it be that instead of 4 rev/mm you have a reduction of 4 mm/rev ?
that would mean 100 full steps/mm and might make more sense.

--
website: http://www.machinekit.io blog: http://blog.machinekit.io github: 
https://github.com/machinekit
--- 
You received this message because you are subscribed to the Google Groups "Machinekit" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to machinekit+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/machinekit.
For more options, visit https://groups.google.com/d/optout.


Re: [Machinekit] Stepper motor configuration

2016-09-22 Thread euerka

Dear Charles,Schooner, Bas de Bruijin,

Due to time lag and working, sorry for late reply.

could it be that instead of 4 rev/mm you have a reduction of 4 mm/rev ?
> that would mean 100 full steps/mm and might make more sense.
>


First of all, I make mistake that is should be 4 rev/mm. So I change scale 
to 100.

As Charles comment:
"Almost certainly.  With a scale of 1600, and a maximum velocity of 
200, your maximum step pulse rate would be 320,000 KHz, and with your 
acceleration of 3000 mm/s/s, you'll get there pretty quick.  The 
default PRU settings result in a maximum pulse speed of about 50 KHz, 
so you need to either reduce the maximum allowed velocity or decrease 
the PRU cycle time (or both). "

May I guess in this comment 320,000 KHz should be 320KHZ, is it? 
If PRU maximum pulse speed is 50KHZ, the max speed is 500? Because scale 
100* 500=50KHZ. 

I am not very sure about Schooner said "Try increasing dirhold / dirlen to 
1us and steplen / stepspace to 5us
If that cures it, try reducing the figures towards the chip specs until you 
hit problems"

Anyhow I tried to change ini file, i am not sure. But it seems no affect.
# these are in nanoseconds
DIRSETUP   =  1000
DIRHOLD=  1000
STEPLEN=  5000
STEPSPACE  =  5000


About speed, yes, i shift one decimal left as follow:

TYPE =  LINEAR
MAX_VELOCITY =   20.0
MAX_ACCELERATION =   300.0
# Set Stepgen max 20% higher than the axis
STEPGEN_MAX_VEL =24.0
STEPGEN_MAX_ACC =360.0

> SCALE =  -100
>
 
It works much better than before, but motor still stall when execute G00. 
Speed still too high? where to set G00 speed? 20.0 is only stand for feed 
speed?
Then when motor change rotate direction, speed decrease to zero, around 
Zero motor start move step by step, make vibration and noise. It seems it 
doesn't work well at low speed. 

It will be much clear if i can post video here.

Thanks for anymore tuning methods!

-chengxi

 


-- 
website: http://www.machinekit.io blog: http://blog.machinekit.io github: 
https://github.com/machinekit
--- 
You received this message because you are subscribed to the Google Groups 
"Machinekit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to machinekit+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/machinekit.
For more options, visit https://groups.google.com/d/optout.


Re: [Machinekit] Stepper motor configuration

2016-09-22 Thread Charles Steinkuehler
On 9/22/2016 9:46 AM, euerka wrote:
> 
> May I guess in this comment 320,000 KHz should be 320KHZ, is it?

Yes, sorry.  The speed required by your configuration was 320 KHz or
320,000 Hz.  My goof on the extra zeros.

> If PRU maximum pulse speed is 50KHZ, the max speed is 500? Because scale 100* 
> 500=50KHZ.

Yes, but that's the STEPGEN_MAX_VEL, you should back off that a bit
for MAX_VEL.

> I am not very sure about Schooner said "Try increasing dirhold / dirlen to 
> 1us 
> and steplen / stepspace to 5us
> If that cures it, try reducing the figures towards the chip specs until you 
> hit 
> problems"
> 
> Anyhow I tried to change ini file, i am not sure. But it seems no affect.
> # these are in nanoseconds
>  DIRSETUP   =  1000
>  DIRHOLD=  1000
>  STEPLEN=  5000
>  STEPSPACE  =  5000

Those values mostly matter for FPGA based stepgen logic, or if your
PRU cycle time is very fast.  The minimum time for any of these values
is one PRU task cycle, which is typically 10 uS, or 10,000 nS, so you
probably won't see any difference by making small changes to these values.

> About speed, yes, i shift one decimal left as follow:
> 
>  TYPE =  LINEAR
>  MAX_VELOCITY =   20.0
>  MAX_ACCELERATION =   300.0
>  # Set Stepgen max 20% higher than the axis
>  STEPGEN_MAX_VEL =24.0
>  STEPGEN_MAX_ACC =360.0
> 
>  SCALE =  -100
> 
> It works much better than before, but motor still stall when execute G00. 
> Speed 
> still too high? where to set G00 speed? 20.0 is only stand for feed speed?
> Then when motor change rotate direction, speed decrease to zero, around Zero 
> motor start move step by step, make vibration and noise. It seems it doesn't 
> work well at low speed.

MAX_VELOCITY sets the G0 speed.  20.0 should be a very reasonable
value, I run with MAX_VEL=200.0 on a system with SCALE=110.0

If your stepper is not moving well at low speed, double-check all your
wiring, the driver, and the motor itself.  Normally, stepper motors
work best at low speed and start having problems (loosing torque and
missing steps) at higher speeds.  A stepper motor _will_, however,
move with only one coil energized, but it will have problems with low
and high speeds.

-- 
Charles Steinkuehler
char...@steinkuehler.net

-- 
website: http://www.machinekit.io blog: http://blog.machinekit.io github: 
https://github.com/machinekit
--- 
You received this message because you are subscribed to the Google Groups 
"Machinekit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to machinekit+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/machinekit.
For more options, visit https://groups.google.com/d/optout.


Re: [Machinekit] Stepper motor configuration

2016-10-08 Thread euerka
Dear all,

Thanks to Charles. My stepper motors have been worked stably with A4988 
driver. 
I try to summarize as follow:

Firstly driver output current have to be adjusted according to stepper 
motor specification.
Secondly  Scale have to be set properly, for example, for 400 pulse /rev, 
screw lead is 4mm/rev, scale is 100.
Thirdly, speed and acceleration have to set reasonable. 
Finally, due to vibration, i use micro stepping function, now i set 1/16, 
which means scale have to change to 1600.

That is what I can understanding now, maybe there are other issues will 
occur in future test.

Best regards!
-chengxi

On Thursday, 22 September 2016 23:56:01 UTC+8, Charles Steinkuehler wrote:
>
> On 9/22/2016 9:46 AM, euerka wrote: 
> > 
> > May I guess in this comment 320,000 KHz should be 320KHZ, is it? 
>
> Yes, sorry.  The speed required by your configuration was 320 KHz or 
> 320,000 Hz.  My goof on the extra zeros. 
>
> > If PRU maximum pulse speed is 50KHZ, the max speed is 500? Because scale 
> 100* 
> > 500=50KHZ. 
>
> Yes, but that's the STEPGEN_MAX_VEL, you should back off that a bit 
> for MAX_VEL. 
>
> > I am not very sure about Schooner said "Try increasing dirhold / dirlen 
> to 1us 
> > and steplen / stepspace to 5us 
> > If that cures it, try reducing the figures towards the chip specs until 
> you hit 
> > problems" 
> > 
> > Anyhow I tried to change ini file, i am not sure. But it seems no 
> affect. 
> > # these are in nanoseconds 
> >  DIRSETUP   =  1000 
> >  DIRHOLD=  1000 
> >  STEPLEN=  5000 
> >  STEPSPACE  =  5000 
>
> Those values mostly matter for FPGA based stepgen logic, or if your 
> PRU cycle time is very fast.  The minimum time for any of these values 
> is one PRU task cycle, which is typically 10 uS, or 10,000 nS, so you 
> probably won't see any difference by making small changes to these values. 
>
> > About speed, yes, i shift one decimal left as follow: 
> > 
> >  TYPE =  LINEAR 
> >  MAX_VELOCITY =   20.0 
> >  MAX_ACCELERATION =   300.0 
> >  # Set Stepgen max 20% higher than the axis 
> >  STEPGEN_MAX_VEL =24.0 
> >  STEPGEN_MAX_ACC =360.0 
> > 
> >  SCALE =  -100 
> > 
> > It works much better than before, but motor still stall when execute 
> G00. Speed 
> > still too high? where to set G00 speed? 20.0 is only stand for feed 
> speed? 
> > Then when motor change rotate direction, speed decrease to zero, around 
> Zero 
> > motor start move step by step, make vibration and noise. It seems it 
> doesn't 
> > work well at low speed. 
>
> MAX_VELOCITY sets the G0 speed.  20.0 should be a very reasonable 
> value, I run with MAX_VEL=200.0 on a system with SCALE=110.0 
>
> If your stepper is not moving well at low speed, double-check all your 
> wiring, the driver, and the motor itself.  Normally, stepper motors 
> work best at low speed and start having problems (loosing torque and 
> missing steps) at higher speeds.  A stepper motor _will_, however, 
> move with only one coil energized, but it will have problems with low 
> and high speeds. 
>
> -- 
> Charles Steinkuehler 
> cha...@steinkuehler.net  
>

-- 
website: http://www.machinekit.io blog: http://blog.machinekit.io github: 
https://github.com/machinekit
--- 
You received this message because you are subscribed to the Google Groups 
"Machinekit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to machinekit+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/machinekit.
For more options, visit https://groups.google.com/d/optout.