Hello Guest it is December 07, 2024, 01:37:10 PM

Author Topic: What is The Problem in this Code?  (Read 5195 times)

0 Members and 1 Guest are viewing this topic.

Offline khalid

*
  •  213 213
    • My Wood carving
What is The Problem in this Code?
« on: April 10, 2010, 12:34:56 PM »
Hi,
I am working on CNC embroidery machine.. Following is the Machine specifications in Mach3

1- X-axis step/ unit = 244.34   Velocity=200 and acceleration= 50
2- Y-axis same as above
3- Z-axis step/unit 40 velocity=1000 and acceleration=400

Now the Z-stepper is connected with sewing machine wheel with 1:1 ratio pully. The z-axis motor is 200 steps/revolution and controller is set to 1/2 step. Total steps/unit 400... Now i kept for Z-axis 40 steps/unit so that for each 10mm linear move one revolution completes.

My embroidery software generate following Gcode.

G90
G21
G64
F 2000
(NEEDLE UP RAPID MOVE- Light bulb Off if On)
M09
G00 X-0.1 Y0 Z2
G00 X9 Y2.6 Z2
(START STITCHING- Light Bulb Off if On)
M09
G00 X17.2 Y1.1 Z2
G00 Z8
M786
G00 X25.3 Y-0.2 Z2
G00 Z8
M786
G00 X26.1 Y-0.3 Z2
G00 Z8
M786


Where M786 is Macro and the purpose of this to setOEMDRO (802,0) i.e. After each Z-move Z-axis DRO becomes zero.

THE PROBLEM:
My X/Y moves running very well but my Z-stepper moves very little about 10 degrees only.. I don't know why this happening?... When i do not load Gcode in Mach3 and run the Z-motor through MDI typing G00 Z10 then stepper completes one Full revolution.. but when i load above Gcode the Z-axis DRO contineously changing and zeroing and the motor runs very slow upto 10 degrees after each X/Y moves..

Please help me:(
Regards


PS:
the M786.m1s macro only include following line
SETOEMDRO(802,0)
and this macro is kept in Mach3 macro folder and running like a charm.

Following is some embroidery carried out by my friend RENE using my software
www.my-woodcarving.blogspot.com
Re: What is The Problem in this Code?
« Reply #1 on: April 10, 2010, 01:29:22 PM »
I tried it and it works fine in my machine as it is.
Has to be something related to configuration

Offline khalid

*
  •  213 213
    • My Wood carving
Re: What is The Problem in this Code?
« Reply #2 on: April 10, 2010, 01:44:40 PM »
I tried it and it works fine in my machine as it is.
Has to be something related to configuration

Hi elpablito:)
Did you change the steps/unit ?.. Any help by posting screenshot of configuration?
Re: What is The Problem in this Code?
« Reply #3 on: April 10, 2010, 02:40:11 PM »
You have Z with 1:1 pulley.
When you move 10units your wheel turns 1 rev. You have an accel of 400units/s^2

Since for v0=0 you have z(t) = 1/2 a*t^2 , solving for t

t= Sqrt (z(t) * 2 / a) = Sqrt (10units * 2 / 400units/s^2) = 0.223 seconds

So if im not wrong you are trying to complete a full revolution from steady state in 0.22 seconds.

Are you sure your motor is not loosing steps?

Offline khalid

*
  •  213 213
    • My Wood carving
Re: What is The Problem in this Code?
« Reply #4 on: April 10, 2010, 03:34:21 PM »
You have Z with 1:1 pulley.
When you move 10units your wheel turns 1 rev. You have an accel of 400units/s^2

Since for v0=0 you have z(t) = 1/2 a*t^2 , solving for t

t= Sqrt (z(t) * 2 / a) = Sqrt (10units * 2 / 400units/s^2) = 0.223 seconds

So if im not wrong you are trying to complete a full revolution from steady state in 0.22 seconds.

Are you sure your motor is not loosing steps?
Sorry .. I have to minimise the acceleration..Say 100 and velocity to 600.. and will try it.. Actually the Stepper has almost no load.. the sewing machine wheel is removed and have no inertia at all.. I attached the Stepper and Machine shaft with 1:1 teeth belt pully..
Regards
Re: What is The Problem in this Code?
« Reply #5 on: April 10, 2010, 03:42:45 PM »
Try what happens with alow accel and then increase it gradually
Re: What is The Problem in this Code?
« Reply #6 on: April 10, 2010, 03:43:59 PM »
velocity can be set according to your mottor max rpm, but for accel you will have to try