Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: renenpaz on June 30, 2010, 10:45:47 PM

Title: How start to run an Embroidery Mach profile
Post by: renenpaz on June 30, 2010, 10:45:47 PM
Hi,

I need initializate my embroidery profile using Single Blk mode

I will use and X,Y,Z axis, and swap Z with spindle.

I will make a Macro (M910.m1s) and place in Initialization String.

M910.m1s
DoOemButton(1004)  'Pressing button Single Blk


I need start spindle using Cycle Start buttom,
but I need change default function of this button
and use a VBscript .
I saw in Mach2 Customization than I can change default
Funtion for Cycle Start Button and use a VB Macro. Macro could be M900.m1s

M900.m1s
SwapAxis(3,6)  'Swap pins of Z axis for Spindle pins
SetSpinSpeed(S100)  'sET spindle Speed in 100RPM
DoSpinCW( )     'Start Spindle at 100RPM Speed

Then spindle start,

Cycle Start button will be pressed in each spindle revolution
using a optoswitch connected to one Input Pin, configured like
OEM trigger1, and assig OEM code to OemTrigger in System Hotkeys.

Each spindle revolution will press Cycle Start once, and run
one Gcode Line for X and Y movements. Like I will be in
Single BLK mode, I don't need to use Cycle Star Buttom.

Also I need to create another VB screen button for
stop spindle and pause system.

May work in this way?

New problem will be, how many revolutions will be possible to get
considering Mach response 1/10 second and Optoswich start and Stop
I think more and less 6-7 times/second for a 400 RPM. IT depends
also of lenght of X and Y movements.


Thanks for your help.

Regards

Rene

Title: Re: How start to run an Embroidery Mach profile
Post by: BR549 on July 01, 2010, 10:12:18 AM
less than 1/sec
Title: Re: How start to run an Embroidery Mach profile
Post by: renenpaz on July 01, 2010, 10:40:14 AM
Hi BR549... I don't understand your answer,, please explain..

I have another doubt.

 What is best place to connect stepper motor for spindle work?
In controller are free Z and A axis,

I was thinking that really I don't need swapaxis (Z, spindle)

If my set up is using only spindle, and I need homing spindle
is possible change properties of Home Z button, and
use a VB script for homing at low speed until optoswitch for home limit
will be triggered.

It's possible??
 

Thanks in advance

Rene
Title: Re: How start to run an Embroidery Mach profile
Post by: BR549 on July 01, 2010, 11:59:39 AM
You will not have enough time to complete all that you want to do inside of each VB I/O read SO mach will stretch the I/O read cycle and that could end up as SECs per read OR mach will skip over VB calls.

ALSO it is a Bad idea to control MOTION code from the Macropump.  NOT always safe.

VB code in mach is NOT realiable enought to do what you want to do. You need to do it as a plugin in. THEN maybe you can make it work.
Title: Re: How start to run an Embroidery Mach profile
Post by: renenpaz on July 03, 2010, 12:59:10 PM
Hi, BRP 549, Thanks for your answers.

I think that Mach can't skip over VB calls, because I will work in single blk mode, then in each motor revolution will be only one VB call
for Cycle Start and run only one Gcode Line for X and Y axis movement.PLS correct me if I am wrong.

Yo're right about that VB I/O operation  could be very slow. (I should verify how slow)
but I have the option of reduce speed of motor until I can  put inside one motor
revolution all procces (external input +oem code and + x,y axis movement)
(I will use 48 deg/rev stepper motor and my set up will be 7.64step/mm)
 
Initially I need to test system and know what time I need for optical switch activation
what time it needs for send OEM TRIGGER code 1000  to controller for
and what time takes to controller send pulses for  axis move 1mm one axis.
In this way I will kow how many stitches I can do.

If finally all proccess take 1 sec for stitch , the final SPM will we 60.

Do you know if are another way to run code line by line using an external input?


Thanks for your answer, I hope you can continuing help me.

Rene
Title: Re: How start to run an Embroidery Mach profile
Post by: BR549 on July 03, 2010, 04:52:52 PM
RENE it may run as slow as several secs per stitch.

I have said all along that it probably will not work.

There is no way to do what you want from Mach as it is .

Maybe from a plug in where you have direct access to the engine and fast I/O

You best bet is going to be to set up the spindle with a large FAST servo and let Gcode run the show. There IS a reason why embroidery machines run proprietary hardware/software.
Title: Re: How start to run an Embroidery Mach profile
Post by: renenpaz on July 03, 2010, 10:09:59 PM
OK, then is preferable stay using first G code generated by Khalid software..

May you remember it

G00 Z 0.8---------------Needle motor turn 80% of rev (needle come inside fabric stitich and going out)
M786--------------------Macro (GetOemDro(802.0) Zeroing Z AXIS
G00  X 1.5 Y 2.5  Z 0.4-----Hoop movement and Z axis complete revolution and turn 20 % of next (needle is 3mm above fabric before stitching)
G00 Z0.4---------------Needle motor turn 40% of rev (needle stitch fabric and going  out and stop 3mm above fabric)
M786
G00 X 2.5 Y3.5 Z0.4

In this way is not synchronism, but is possible to do 150-200 Stitches per minute,, (tested).
there  arn't VB I/O only pure and simple GCODE

Thanks for all your help and patience

Regards

Rene

Title: Re: How start to run an Embroidery Mach profile
Post by: BR549 on July 03, 2010, 11:00:29 PM
OK what is the Mcode(M786) for that will slow down the code. I don't remember the Mcode in  Khalid's gcode file.

Title: Re: How start to run an Embroidery Mach profile
Post by: khalid on July 04, 2010, 03:25:02 AM
M786 just Zeroing the Z-axis DRO (Further explanation will be done by RENE)... You can play with Free software at the following download links at CNCzone....Just download free DST files from internet ..Open in my software and it will generate the Gcode...You can then help Rene...

We can improve this software with all of your help...RENE has tested the Gcode with 200stitchs per minute and the results are promising..Unfortunately i am busy in some other projects so didn't working on my embroidery machine and this software...

http://www.cnczone.com/forums/showthread.php?t=57404&page=33
Title: Re: How start to run an Embroidery Mach profile
Post by: BR549 on July 04, 2010, 11:18:54 AM
OK lets go over the GCODE :

from THE NEEDLE UP POSITION  A0.000 you can move the XYA untill you get to just above the fabric(say A90.000) then you must stop A while the needle cycles thru the fabric and back to a needle clear point (say A270.000). Then you can do XYA moves until the A reaches A90.000 again.

Is that correct so far ?
Title: Re: How start to run an Embroidery Mach profile
Post by: BR549 on July 04, 2010, 12:07:54 PM
IF SO then gcode


G0 X0.000 Y0.000 A0.000           move to start point
X1.000 Y1.000 A90                move to the stitch start position
A270                                    stitch
A0                                        Return to A zero fastest way axis rotation stays the same for sewing head(;-)
X2.000 Y2.000 A90                Move to next stitch position
A270                                    stitch
A0
X3.000 Y3.000 A90
A270                                    Stitch
A0
M1                                        Hold to change  thread color, Install manual or auto spindle LOCK for safety




Seems simple enough to me. You just need FAST powerfull servos/steppers to make the whole process run fast and smoothly.

Add in a thread sensor for thread breakages to stop machine. Runs in macropump the function turned on when sewing off when not.

ALSO seeing how this is a simple 2d process you can restart from any line by just using "start from here" and off you will go NO NEED for run from here as they are not any modal values that change from startup

Title: Re: How start to run an Embroidery Mach profile
Post by: BR549 on July 04, 2010, 12:35:03 PM
OK add in a bobin sensor to know when the bobin runs LOW of thread.

You could also use tool changes M6 T4 to designate what color thread to load and use the M6 macro to move the machine into thread loading position and it could return to the exact start spot to restart.
T1 = white
T2= blue
T3= yellow

ect,ect

This would work very well for quilters as well as you can control every aspect of the stitch. HECK you could even add embroidery to your quilt ON THE FLY if you wanted.

HUM I can sew learned as a child watching MOM do pattern layouts. Might need to build the kids a new Quilter/embroider machine.
Title: Re: How start to run an Embroidery Mach profile
Post by: BR549 on July 04, 2010, 01:09:46 PM
OK NOW if we can get "Khalid software" to do all the CAM/Gcode work for embriodery AND quilting we can do it .

Title: Re: How start to run an Embroidery Mach profile
Post by: khalid on July 04, 2010, 01:45:22 PM
Hi BR549, all the above are included in my Gcode embroidery software... You can run your machine with indexing mode "A*********" or simple XYZ moves.. Machine stop for every thread change..A thread tension sensor can be installed for any thread breakage...

Moreever you can do any commercial embroidery design
Title: Re: How start to run an Embroidery Mach profile
Post by: renenpaz on July 05, 2010, 01:14:02 AM
Hi

This is a piece of embroidery G code

G01 X-0.6 Y-19.9 Z-0.4
G01 Z-1.0
M786-------------Set Z counter in cero,
G01 X0.5 Y-19.4 Z-0.4
G01 Z-1.0
M786
G01 X1.2 Y-19 Z-0.4
G01 Z-1.0

M786 macro =SetOemDro(802,0) 'Set Z axis to cero value.

I need to know if I cant put a similar Macro
in MacroPump for run it in background for zeroing
Z values when z=1.0,for reduce gcode lines
and try to get if gcode can run faster, when i reduce
a big quantity of lines.

Macro in Macropump  will be like this

GetOemDro(802) 'Get Z axis DRO
If OemDro(802)=1
then 
SetOemDro(802,0)

Thanks in advance for your help

Rene



 
Title: Re: How start to run an Embroidery Mach profile
Post by: BR549 on July 05, 2010, 10:29:18 AM
Rene any time you add a piece of macro code to the mix you will slow the overall process down.

Please explain in detail what the M786 macro actually does and WHY it is needed.  

In the Gcode example above the macro is NOT needed.

Title: Re: How start to run an Embroidery Mach profile
Post by: renenpaz on July 05, 2010, 02:11:47 PM
Hi,

Ufffffff,, here in my country usually is said in my situation "No pone Una"
when  each thing that some one said  is refuted......
and  literally  is relative to a baseball pitcher that never makes a strike and always bad  balls.
Sorry
Things that happens when one is trying to do something without adequate knowledges.....

I will explain as better I can how this Gcode works

Needle bar motor is set in Z axis and one revolution=360 degree= 1stith = 1.0  =100% rotation
Motor Tuning /Z axis /Steps x mm = 200.
Velocity = 600
Accel 600.

INITIAL STATE X0,Y0 AND Z0 ---Hoop centered and needle in upper position

N05 G01 X-0.6 Y-19.9 Z-0.2------------X,Y axis moves to first stitch location, Z axis rotate 20%(needle is stopped 3mm before get inside fabric

N10 G01 Z-0.8--------------------Z axis move 80% or revolution (Needle get inside fabric, stitch, get outside and stop when is 3 mm above fabric.

N15  M786-----------------------This macro, set Z counter in cero value
 
N20 G01 X0.5 Y-19.4 Z-0.4--Hoop moves to next stitch location, Z axis rotate 40% of revolution and needle is stopped 3mm before get inside  fabric

N25 G01 Z1.0-----------------Z axis rotate 60%,  complete a revolution, and needle is stopped 3mm above fabric after is get outside fabric

N30  M786.........

N35 ... similar to N20.

As you can see, hoop movement  in 40% of one revolution, when needle is above fabric, and in 60% of revolution, needle moves alone.

Macro 786 sets the counter of Z axis to cero value in each revolution, when Z=0.8 or Z= 1.0
A axis has option of "rot 360 rollover" for, but in some tests done, A axis seems to be very slow for this purpose

I think that if this macro is placed out of Gcode, and taking effect every time that Z=0.8 and 1.0
total process may be faster because will be a lot less of lines in Gcode.
Object is make one revolution using percent values 1.0 is one motor revolution and one needle operation
Is question of Try,,,if not we can come back as now is.

If not,, how can I set cero Z axis for each revolution.?

Thanks in advance

Rene
Title: Re: How start to run an Embroidery Mach profile
Post by: BR549 on July 05, 2010, 02:35:48 PM
Rene the total lines of gcode have little to do with it. Mach can be "extremely" fast in Gcode output. Usually MUCH faster than the machine can actually move.

The problem is when you mix VB(extremely slow) with gcode in areas of MOTION control.

SO IF you want speed then you need to consider a GCODE ONLY approach to the machine

When using the A axis  there are things to consider to get fast responce. ONE is that the axis is setup as Degrees per min. SO you need to setup the axis to be as fast as possible with a large enough motor to avoid lost steps. Next you have to run the accel values very high and the Top velocity only as fast as the accell values will allow.  Accel is more important than top speed as you will rarely be at top speed. But you will always be accelerating/decelerating.

The A should be able to run JUST as fast as the other axis but remember it is not moving far 1 rev at best so to get better accel values it may be necessary to gear the stepper down to have more available torque to get the mass moving.

Next you have to tell mach what the diameter of the A axis control point is so it can SYNC the feedrate to both the XY and A and still get fast movement. Otherwise Mach will only move as fast as the slowest axis normally A


AS to resetting A to zero? it is not needed.

Look at the Gcode I posted above your stop start points are just deg points in the A axis.  From the needle up position A0.000 the code can do XYA moves to get to the stitch position. Then from that point you do a stitch move to the next A position (needle clear of fabric) then from that point you can do another ZXA move to take A back to the zero point(shortest route) that keeps the stepper moter moving in the same direction of rotation for the sewing head. THen from the needleup point A0.000 the cycle starts again.

Never does the A need to be reset to zero.

Mach can do these moves very very quickly IF you have the proper equipment
Title: Re: How start to run an Embroidery Mach profile
Post by: renenpaz on July 05, 2010, 05:37:34 PM
BRP549,Thanks for your clear explanation

I must consider two things.

1-Khalid Embroidery G code Generator software set the A axis work in different way,,,A axis  run in one line from 0 degree to 359 degree and after X,Y axis moves. I must ask Khalid if he can change A axis mode  in similar way of Z axis, like your gcode example.
Then I should mark --360 rollover--in General config.

2-I don't have a clear idea of about set up motor tuning for high speed  A axis,,, could yo help me? My cnc router don't use a A axis, and newer in building process will use A axis as linear axis for slave it  with Y axis. My actual Axis set up take a long time to arrive 359 degree from cero.

Thanks

Rene
Title: Re: How start to run an Embroidery Mach profile
Post by: BR549 on July 05, 2010, 06:38:40 PM
Rene, you can use any ABC axis as the slave. BUT you can only use A as interpolated moves with XY.

SO I would stick with A as your needle control. That way you can control the stitch length with extreme precision AND be able to make coordinated XYZ moves to the next stitch point and that saves time in the cycle. when the XY arrives at the next stitch point the Needle will already be in position to stitch without delay.

You may have to set the MACH kernal freq as fast as your computer will allow. Then set the A stepper motor to 200 steps per 1 rev of the motor. Next go to the axis tunning and set the accel up to as fast as the stepper can move without loosing steps. Next set the vel to the same number to start with.

Now go to the mdi screen and type in an A move say G0 A180  to see how fast it can move 1/2 turn.  Next go to the setting screens Top LH side and set the Aaxis value for A axis radius correction to .001 that should make the axis move in feedrate sync with the XY OR is that 999 heck just try both to see which is faster.



Title: Re: How start to run an Embroidery Mach profile
Post by: renenpaz on July 05, 2010, 11:22:20 PM
Hi, BRP,

Your advice was very useful. I configured A axis in this way
Steps/min = Steps/deg = 200/360 = 0.55555
Velocity = 360deg x 600RPM = 216000---Similar 600RPM
Accel= 253000

X,Y axis---As my router
Step/min= 409.52
Vel = 1000 mm/min
Accel = 5000

Gcode in this way.

F216000-------- If is less A axis run slowly, in this case X,Y runs at max speed select in Motor Tuning
G01 X0Y-9.7---Hoop moves to first stitch location 
G01 A290  -----Needle motor gives first stitch, needle is out of fabric, and above 3mm
G92 A0----------A DRO is set in cero value----(ONLY IS USED IN THIS LINE FOR SET CERO IN THIS PLACE) 
G01 X0.1 Y-19.4 A140---- Hoop and needle moving together , needle stops when is 3mm above fabric before get inside.
G01 A359  ------------------Needle motor gives second stitch, needle is out of fabric and above 3mm
G01 X0.1  Y-19.0 A140

As you can see, Hoop movement is during 140 degree of rotation (40%), is when needle is above fabric.

Also I select "Rot 360 Rollover" in General Config.

I ran same code in same X,Y config using Z axis, anf time was 11 min. NOw was 5.00 minutes.

Attaching  xml file and Gcode

I suppose than if Feed is 216000 deg/min for A axis, is not important for  X and Y axis because it will run at max speed established  in Motor Tuning
when  Vel= 1000 mm/min  ..its is true? If not how can I drive A axis at 600RPM and X,Y at 1000 mm/min

Thanks again,

Rene

PD---My embroidery set up will be using 7.5 degree Stepper motors, using belts, Speed will be 3000-3500 mm/min.
Title: Re: How start to run an Embroidery Mach profile
Post by: renenpaz on July 05, 2010, 11:44:49 PM

Now go to the mdi screen and type in an A move say G0 A180  to see how fast it can move 1/2 turn.  Next go to the setting screens Top LH side and set the Aaxis value for A axis radius correction to .001 that should make the axis move in feedrate sync with the XY OR is that 999 heck just try both to see which is faster.

Sorry, I can't find in Setting Page where make A axis radius correction,,,how button says?
Iam using Mach R3 0.42 0.20

Thanks

Rene
Title: Re: How start to run an Embroidery Mach profile
Post by: BR549 on July 06, 2010, 07:38:12 PM
Rene on the standard screenset it is on the settings page (the green one) top right hand corner it says Rotation Radius

Title: Re: How start to run an Embroidery Mach profile
Post by: renenpaz on July 06, 2010, 10:20:36 PM
Thanks BRP549.

I set previously 0.001 , and after 999 in Radius correction, I din't see visible effects in screen
I must look well, when I test embroidery machine
Radius correct lid for A axis is ON now.

What effect causes exaclty Radius correction for A axis?
 Will ralent A axis movement accord X, Y axis mov lenght?

I have another  doubth,
 
IN  MOTOR TUNING are

X,Y axis  VEL= 1000 mm/mm
A axis = 216000mm/min=216000deg/min= 600rpm

Feed in Gcode = 216000.

When  GCODE is running, I suposse that A axis will run in 216000 deg/min
and X,Y axis, will run at max speed in Tuning motors= 1000 mm/min
Is correct?

Thanks

Rene