Spartan117 wrote: βMon Jul 04, 2022 3:44 pm
If you are not careful, the lathe will tip over from all the attachments
I wish i could give you some tips for your PLC-problems... But hey, even the centroid-pros here seem to be stumped for that kind of problems, so how should i be able to help you It's a pity, that PLC-thing could be such a powerful tool with a little bit of support for certain questions.
Even with C-Axis, it will not have more weight than with the original AC-motor
The PLC is very powerfull, it is possible to hire professional support, but well I better learn how to go fishing, than to buy a fish
Uwe
Re: C-Axis for lathe
Posted: Mon Jul 04, 2022 4:12 pm
by Spartan117
suntravel wrote: βMon Jul 04, 2022 4:01 pm
...but well I better learn how to go fishing, than to buy a fish
Me too! But my fishing-teacher is speaking swahili, not german...
Re: C-Axis for lathe
Posted: Tue Jul 05, 2022 7:13 am
by Scary
That looks an awesome setup. I have been looking at similar but I was stuck on the plc side of things. I feel like I might have to borrow some of your code . I also like the electric clutch idea, beats the air clutch I made because I donβt need to turn the compressor on
Re: C-Axis for lathe
Posted: Tue Jul 05, 2022 7:22 am
by suntravel
Scary wrote: βTue Jul 05, 2022 7:13 am
That looks an awesome setup. I have been looking at similar but I was stuck on the plc side of things. I feel like I might have to borrow some of your code . I also like the electric clutch idea, beats the air clutch I made because I donβt need to turn the compressor on
Pls, wait till I have this running, then the PLC code and macros will be debugged, and I post the final version.
Uwe
Re: C-Axis for lathe
Posted: Tue Jul 05, 2022 9:27 am
by cnckeith
suntravel wrote: βSun Jul 03, 2022 7:55 am
Now I figured out how to set C home to the zero index pulse from spindle encoder.
G91 is not part of CNC12 lathe, so I used the current position for incremental moves.
Would be better to have the C axis continuous moving to the zero index, but could not figure out how to do this.
Maybe I must find a way to trigger an input with the encoder zero index?
Than I could use M105 /C P#
Any ideas how to do this?
But for now it works to home C allways to the same position.
;------------------------------------------------------------------------------
; Filename: mfunc57.mac
; M57 macro
; Description: Set C-Axis Home to Zero Index from Spindle Encoder
; Notes: C-Axis must be turned on
; M200 only for testing, remove later
; #5043 current position C
; #23405 index pulse from spindle encoder
;------------------------------------------------------------------------------
IF #50010 ;Prevent lookahead from parsing past here
IF #4201 || #4202 THEN GOTO 1000 ;Skip macro if graphing or searching
G98
N100
#104=#5043+0.1
G0 C[#104]
N200
IF #23405==1 THEN GOTO 300 ELSE GOTO 100
N300
#105=#23405
M200"Spindle Pos=%f"#105
#102=#5043
M26 /C
#101=#5043
M200"C set from%f to 0 CPos=%f"#102#101
suntravel wrote: βTue Jun 28, 2022 1:56 pm
I started to build a C-axis for my lathe.
Since my lathe is with gearbox and some lash in the gears, I decided to go with an extra drive belted directly on the spindle an be engaged with a clutch.
Setting up C axis in the Wizard is the easy part, but then you can jog the C-Axis while the spindle is running, or turn on the spindle while the clutch is engaged. Would make some funny smoke
So till now the way I build some safety for this is quite simple ( I am not the best PLC programmer )
If P#93=1 C Axis will be displayed on the DRO as rotary axis
If P#93=512 C Axis will not be displayed on the DRO
If P#218 is set to 3 you can only jog X and Z with the WMPG
If P#218 is set to 7 you can jog C, X and Z with the WMPG (C as 4th axis)
;------------------------------------------------------------------------------
; Filename: mfunc52.mac - Turn C-Axis on
; M52 macro
; Description: User Customizable Macro
; Notes: C-axis must be configured in the Wizard
; Requires: custom PLC StandardSpindleStage
; ;Inhibit Spindle when P#93=1 C-axis On - UWE
; IF !SpindleEnableOut_M || SV_MACHINE_PARAMETER_93 == 1 THEN (DoSpindleStop)
;------------------------------------------------------------------------------
IF #50010 ;Prevent lookahead from parsing past here
IF #4201 || #4202 THEN GOTO 1000 ;Skip macro if graphing or searching
M5
G4 P1
#103=1
#104=7
G10 P1093 R[#103]
G10 P1218 R[#104]
; Output8 for Clutch ON
M68
N100
;------------------------------------------------------------------------------
; Filename: mfunc52.mac - Turn C-Axis off
; M53 macro
; Description: User Customizable Macro
; Notes: C-axis must be configured in the Wizard
; Requires:
;------------------------------------------------------------------------------
IF #50010 ;Prevent lookahead from parsing past here
IF #4201 || #4202 THEN GOTO 1000 ;Skip macro if graphing or searching
#101=512
#102=2
G10 P1093 R[#101]
G10 P1218 R[#102]
; Output8 for Clutch OFF
M88
N100
;------------------------------------------------------------------------------
; Filename: mfunc55.mac - To run from VCP AUX 10 key, set p197 = 5511
; M55 macro
; Description: Turns C-Axis ON/OFF
; Notes:
; Requires: Machine home must be set prior to use.
;------------------------------------------------------------------------------
IF #50010 ;Prevent lookahead from parsing past here
IF #4201 || #4202 THEN GOTO 1000 ;Skip macro if graphing or searching
N100 ;Insert your code between N100 and N1000
#105=#9093
IF #105==512 THEN M52 ELSE M53
N1000
And some edit in the PLC to inhibit spindle ON if C-axis is on
;==============================================================================
StandardSpindleStage
;==============================================================================
IF (SpindleEnableOut_M || SpinStart_M ) && !SpinStop_M && ChuckOpenCloseComplete_M
THEN SET SpindleEnableOut_M
; inhibit spindle with C-axis ON - UWE
IF !((SpindleEnableOut_M || SpinStart_M ) && !SpinStop_M) THEN RST SpindleEnableOut_M
IF SpindleEnableOut_M && !M37 && SV_MACHINE_PARAMETER_93 == 512 && !(OUTPUT8) THEN (VFDEnable_O)
IF SpindleEnableOut_M && !M37 && !SpindleDirectionOut_M && SpindleBrakeTimer THEN (SpinFWD)
IF SpindleEnableOut_M && !M37 && SpindleDirectionOut_M && SpindleBrakeTimer THEN (SpinREV), (VFDDirection_O)
IF !SpindleEnableOut_M || SV_MACHINE_PARAMETER_93 == 1 THEN (DoSpindleStop)
Not the most elegant solution, but it works
Now I must find a clutch that will do the job and figure out if I can use the spindle encoder for setting C Home....
Uwe
Parameter 93 has a special Option for C-Axis (Add a 16, This will automatically hide and show the C-Axis on the DRO with M50/M51). Attached is how i would setup the C-Axis Macros for M50/M51. Because there is a conflict with M50, i moved the existing Part 0 All Axes to M45, i also have this attached. Will have to change VCP button to reflect change in M-Code though.
As for PLC, the acorn does require some additional code in PLC to prevent spindle from turning on. Here is what i did,
M51_SV IS SV_M94_M95_51 ;(C-Axis Enable)
; JOGBOARD SPINDLE CONTROL (Add M51_SV to SpinStop_M)
IF (SpinStopKey || KbSpinStop_M || SkinSpinStop_M || MpgSpinOff_M) ||
(SpinAutoModeLED && !(M3 || M4)) ||
(SV_PC_RIGID_TAP_SPINDLE_OFF && SpinAutoModeLED) ||
ProbeSpindleInhibit_M || SV_STOP || ErrorFlag_M || LimitTripped_M ||
M51_SV
THEN (SpinStop_M)
;Under MainStage, Add Logic to turn on Output for Clutch
;CAxisEnable
IF M51_SV THEN (CAxisEnable) ;Will need to Assign "CAxisEnable" to an Output for this to compile.
;--M-Codes (Add M51_SV to be reset when exiting Job or MDI)
; Reset these M-codes if not in CNC Program Running mode
IF !(SV_PROGRAM_RUNNING || SV_MDI_MODE) || SV_STOP
THEN RST M3,
RST M4,
RST M6,
RST M8,
RST M7,
RST M10M,
RST M10L,
RST M11L,
RST M18,
RST M3P,
RST M35,
RST M51_SV
Parameter 93 has a special Option for C-Axis (Add a 16, This will automatically hide and show the C-Axis on the DRO with M50/M51). Attached is how i would setup the C-Axis Macros for M50/M51. Because there is a conflict with M50, i moved the existing Part 0 All Axes to M45, i also have this attached. Will have to change VCP button to reflect change in M-Code though.
As for PLC, the acorn does require some additional code in PLC to prevent spindle from turning on. Here is what i did,
M51_SV IS SV_M94_M95_51 ;(C-Axis Enable)
; JOGBOARD SPINDLE CONTROL (Add M51_SV to SpinStop_M)
IF (SpinStopKey || KbSpinStop_M || SkinSpinStop_M || MpgSpinOff_M) ||
(SpinAutoModeLED && !(M3 || M4)) ||
(SV_PC_RIGID_TAP_SPINDLE_OFF && SpinAutoModeLED) ||
ProbeSpindleInhibit_M || SV_STOP || ErrorFlag_M || LimitTripped_M ||
M51_SV
THEN (SpinStop_M)
;Under MainStage, Add Logic to turn on Output for Clutch
;CAxisEnable
IF M51_SV THEN (CAxisEnable) ;Will need to Assign "CAxisEnable" to an Output for this to compile.
;--M-Codes (Add M51_SV to be reset when exiting Job or MDI)
; Reset these M-codes if not in CNC Program Running mode
IF !(SV_PROGRAM_RUNNING || SV_MDI_MODE) || SV_STOP
THEN RST M3,
RST M4,
RST M6,
RST M8,
RST M7,
RST M10M,
RST M10L,
RST M11L,
RST M18,
RST M3P,
RST M35,
RST M51_SV
Thank you Chris, this helps me to understand better how this PLC works...
Uwe
Re: C-Axis for lathe (construction in progress)
Posted: Fri Jul 08, 2022 3:46 am
by suntravel
I made some calculations about the setup of the driver and overall gear ratio for the C-Axis.
My Driver supports no Steps per rev like 3600 or 7200, so the overall gear ratio must be 4.5 / 9 / 45 or 90
This makes sure the CNC can calculate full steps for the positions in degree up to 0.1Β° resolution
Keep this in mind if you build your own.
You can use the spreadsheet to find a useful combination.
Uwe
Re: C-Axis for lathe (construction in progress)
Posted: Sun Jul 10, 2022 11:07 am
by suntravel
Had milled the parts to mount the C-Axis drive today, the machine are building themselves, with a bit of human input
Uwe
Re: C-Axis for lathe (construction in progress)
Posted: Sat Jul 16, 2022 11:48 am
by suntravel
Now it works for first testing, but still waiting for the clutch....
Got this running today, but I will make some more complex things with it like shown here