Machsupport Forum

Mach Discussion => VB and the development of wizards => Topic started by: Damir on April 15, 2015, 11:52:05 AM

Title: Tangential spindle
Post by: Damir on April 15, 2015, 11:52:05 AM
Hello

If someone can help me with the script, I currently use 4-axis in the tangential mode.
4-axis rotates servo motor (step / dir), which serves as a spindle motor.
My question is, spindle motor should run only until the 4-axis is not moving, and stop when moving 4-axis.
4-axis movement detected by capacitive sensor (input1)
thanks
Title: Re: Tangential spindle
Post by: TPS on April 16, 2015, 03:07:39 AM
Hi,

macropump can help:

If IsActive(Input1) Then
  DoSpinStop()
End If

Thomas
Title: Re: Tangential spindle
Post by: Damir on April 16, 2015, 05:15:07 AM
I tried with this script:

If Not IsActive(Input1) Then
DoSpinCW()
End if 
If IsActive(Input1) Then
DoSpinStop()
End if 
End

and works but it is immediately activated and working all the time and to jog, G0 and G1.
I need a script that would be activated only in G1.
Thanks
Title: Re: Tangential spindle
Post by: TPS on April 16, 2015, 06:37:36 AM
Hi,

something like this might work:

act_feedrate=GetDro(18)

If (act_feedrate<1500) and (GetLed(4)=1) Then
  If Not IsActive(Input1) Then
    DoSpinCW()
  End if 
  If IsActive(Input1) Then
    DoSpinStop()
  End if 
End If

Thomas

Title: Re: Tangential spindle
Post by: Damir on April 16, 2015, 12:06:56 PM
Thank you for helping me.
Unfortunately does not work, script the Start spindle motor but not turn off spindle when the input is active.
thanks
Title: Re: Tangential spindle
Post by: TPS on April 16, 2015, 02:41:03 PM
Ok seems not to be so easy,

act_feedrate=GetDro(18)

If (act_feedrate<1500) and (GetLed(4)=1) Then
  If Not IsActive(Input1) Then
    DoSpinCW()
  End if 
End If

  If IsActive(Input1) Then
    DoSpinStop()
  End if 


Thomas
Title: Re: Tangential spindle
Post by: Damir on April 17, 2015, 04:44:09 AM
does not work
when first detected active (input1) turns off spindle motor and then do not turn on spindle.
question:
Could we use M code in the G-code to activate the script, for example M3 activate script, M5 deactivate script (or we can create some other M code),
because we are in the script from before had a problem because she started immediately as soon as start Mach3?
thanks
Damir
Title: Re: Tangential spindle
Post by: TPS on April 17, 2015, 05:05:09 AM
Hello,

--Could we use M code in the G-code to activate the script, for example M3 activate script, M5 deactivate script (or we can create some other M code),
--because we are in the script from before had a problem because she started immediately as soon as start Mach3?
--thanks
--Damir

please try to explane what is the real clue behind this fuctionality,
because for the moment i am not that i understand 100% the thing.

maybe a snipped of your g-code wold help.



Thomas  




Title: Re: Tangential spindle
Post by: Damir on April 17, 2015, 05:36:03 AM
I make a machine for making rugs and use tufting head (driven by servo motor) tufting head rotates 360 degrees.Such a script I need to stop the servo motor while the tufting head rotates, otherwise makes mistakes and hitting too many yarns in one place.

this is an example of my G-coda:
G21 (metric ftw)
G90 (absolute mode)
G91.1 X0.00 Y0.00 Z0.00 F2500.00 (axis position)
G91.1 Z0.00 F2500.00

M01 (Tufting yarn colors 'Layer 1')
(Tufting consisting of 1 segments.)
G0 X98.20 Y120.82
Z70.00 (z-axis in the position)
M3 G4 P3 (needle start wait 3ms)
G1 X-96.94 Y120.82
G1 X-96.94 Y114.33
G1 X98.20 Y114.33
G1 X98.20 Y107.84
G1 X-96.94 Y107.84
G1 X-96.94 Y101.35
G1 X98.20 Y101.35
G1 X98.20 Y94.86
G1 X-96.94 Y94.86
G1 X-96.94 Y88.36
G1 X98.20 Y88.36
G1 X98.20 Y81.87
G1 X-96.94 Y81.87
G1 X-96.94 Y75.38
G1 X98.20 Y75.38
G1 X98.20 Y68.89
G1 X-96.94 Y68.89
G1 X-96.94 Y62.40
G1 X98.20 Y62.40
G1 X98.20 Y55.91
G1 X-96.94 Y55.91
G1 X-96.94 Y49.42
G1 X98.20 Y49.42
G1 X98.20 Y42.93
G1 X-96.94 Y42.93
G1 X-96.94 Y36.44
G1 X98.20 Y36.44
G1 X98.20 Y29.94
G1 X-96.94 Y29.94
G1 X-96.94 Y23.45
G1 X98.20 Y23.45
G1 X98.20 Y16.96
G1 X-96.94 Y16.96
G1 X-96.94 Y10.47
G1 X98.20 Y10.47
G1 X98.20 Y3.98
G1 X-96.94 Y3.98
M5 Z0.00 (needle stop z-axis in the position)
G4 P0 (wait 0ms)

(end of tuft job)
M5 Z0 (needle stop z-axis in the position)
G4 P0 (wait 0ms)
G0 X0 Y0 Z0 A0 F2500.00 (go back to zero)
Title: Re: Tangential spindle
Post by: TPS on April 17, 2015, 05:58:25 AM
Hi Damir,

makes it a little bit clearer
put this in macropump:


act_feedrate=GetDro(13)

If (act_feedrate<3500) and (GetLed(4)=True) Then
  If Not IsActive(Input1) Then
    DoSpinCW()
  End if  
End If

  If IsActive(Input1) Then
    DoSpinStop()
  End if  


what i try to do with this:

act_feedrate=GetDro(13)
If (act_feedrate<3500) and (GetLed(4)=True) Then

is to the check the atual feedrate the 3500 must be lower than your G0 feedrate and
higher than your max G1.
try to use this to seperate between G0 and G1.

the GetLed(4)=True is to check that a g-code programm ist started.



Thomas
Title: Re: Tangential spindle
Post by: TPS on April 17, 2015, 06:04:57 AM
changed getdro(18) to getdro(13)

sorry wrong dro
Title: Re: Tangential spindle
Post by: TPS on April 17, 2015, 06:38:29 AM
Hello Damir,

the feedrate thing is not working to seperate between
G0 and G1. if i look to your g-code maybe we can use the
z-axis as second trigger like this:

act_Z=GetDro(2)

If (act_Z>69) and (GetLed(4)=True) Then
  If Not IsActive(Input1) Then
    DoSpinCW()
  End if  
End If

  If IsActive(Input1) Then
    DoSpinStop()
  End if  


Thomas


Title: Re: Tangential spindle
Post by: BR549 on April 17, 2015, 10:27:07 AM
What exactly is it that you are trying to do ?? I would love to help BUT I have no idea as to what you need. Do you have a picture of the machine ??

(;-) TP
Title: Re: Tangential spindle
Post by: Damir on April 17, 2015, 11:17:20 AM
Hello Damir,

the feedrate thing is not working to seperate between
G0 and G1. if i look to your g-code maybe we can use the
z-axis as second trigger like this:

act_Z=GetDro(2)

If (act_Z>69) and (GetLed(4)=True) Then
  If Not IsActive(Input1) Then
    DoSpinCW()
  End if 
End If

  If IsActive(Input1) Then
    DoSpinStop()
  End if 


Thomas



My Z-axis is never constant so that every time I need to change the script.
Title: Re: Tangential spindle
Post by: Damir on April 17, 2015, 11:35:17 AM
Thanks BR549
Title: Re: Tangential spindle
Post by: TPS on April 18, 2015, 02:27:15 AM
Hello Damir,

if the function should only be enabled between M3 and M5 call in
g-code we can use them to enable like this:

add this conde in M3
Code: [Select]
setUserLed(2100,1)
add this conde in M5
Code: [Select]
setUserLed(2100,0)

and this in macropump
Code: [Select]
If (GetUserLed(2100)=True) and (GetLed(4)=True) Then
  If Not IsActive(Input1) Then
    DoSpinCW()
  End if 
End If

  If IsActive(Input1) Then
    DoSpinStop()
  End if 

the only thing i see, that nothing resets the UserLed if
you cancle a program.
but give it a try.

Thomas




Title: Re: Tangential spindle
Post by: Damir on April 18, 2015, 04:18:27 AM
Unfortunately again nothing
Start spindle motor and turn it off when it detects input, after that it does not start spindle motor.

Damir
Title: Re: Tangential spindle
Post by: TPS on April 18, 2015, 06:47:52 AM
Hello Damir,

tested here:

M3
setUserLed(2100,1)

M5
setUserLed(2100,0)

macropump
If GetOEMLed(2100) and GetLed(4) Then
  If IsActive(Input1) Then
    DoSpinStop()
  else
    DoSpinCW()
  End if  
End If


don't ask me why GetUserLed does not work, GetOEMLed is working.

Thomas


Title: Re: Tangential spindle
Post by: TPS on April 18, 2015, 07:09:30 AM
ok i am pretty sure the next problem will be the dwell of the spindle,
because it is locking axis movement and so Input1 will go off again.

so i think the only practicable way well be to drive a axis not tangential and
control it miz g-code, something like this:

G0 Z0 A0
G0 X100 Y100
G0 Z70
M3
G1 X0
M5
G1 A90
M3
G1 Y80
M5
G1 A180
M3
G1 X100
M5
G1 A90
 

and so on.
what means you can only do straight line an no circles
(witch would not work anyway with this code for turn on/off spindle)


Thomas
Title: Re: Tangential spindle
Post by: BR549 on April 18, 2015, 10:15:21 AM
OK there are 2 servos one drives the tufting head ( C axis )  and the other(Z axis) does what ?  Why don't you simply program the stops and starts in the Gcode program ??

(;-) TP

Title: Re: Tangential spindle
Post by: Damir on April 20, 2015, 05:01:51 AM
Hello Damir,

tested here:

M3
setUserLed(2100,1)

M5
setUserLed(2100,0)

macropump
If GetOEMLed(2100) and GetLed(4) Then
  If IsActive(Input1) Then
    DoSpinStop()
  else
    DoSpinCW()
  End if 
End If


don't ask me why GetUserLed does not work, GetOEMLed is working.

Thomas




Thanks TPS
I just tried this script and works perfectly.
thank you very much