Page 1 of 3

Using mechanical and ZRI/Proximity switches for homing a lathe

Posted: Sun May 26, 2019 10:22 pm
by martyscncgarage
To get very repeatable homing on a lathe using either DMM ZRI or a proximity or hall effect sensor on the leadscrew pulley, and mechanical switches on the homing end of the axis, here is the setup and the cnct.hom file I used:

Z mechanical limit is on input 1
X mechanical limit is on input 2
Z Prox/ZRI is on input 3 (DO NOT ASSIGN IN THE WIZARD)
X Prox/ZRI is on input 4 (DO NOT ASSIGN IN THE WIZARD)

M92 /X L1 ;Move to X+ home switch, back off until it clears.
M105 /X P-4 F3 ;Move X plus at 3ipm until input 4 closes
M26 /X ;Set X home here

M92 /Z L1 ;Move to Z+ home switch, back off until it clears.
M105 /Z P-3 F3 ;Move Z minus at 3ipm until input 3 closes
M26 /Z ;Set Z home here


Once the CNCT.hom file is created, make sure you set the Wizard to Custom Home file so it doesn't overwrite it.

Also, keep a copy your modified .hom file in its own directory so you can copy it into the CNCT directory should you need to, and always have a backup copy of it.

Re: Using mechanical and ZRI/Proximity switches for homing a lathe

Posted: Wed Dec 09, 2020 2:32 pm
by Allin1Chris
In V4.60 Centroid has implemented a ZriHomingAll Input in the wizard that is assignable. This Input still requires the user to edit their home file however. Marty's example above is still a valid method. Multiple Inputs can still be used and is up to the user. Here is an example using ZriHomingAll (all 3 axes wired into single input) for a Mill.

I suggest first setup your settings and I/O in the wizard, and even select "Wizard Generate Home file" and Write settings. Before editing your cncm.hom file your self, you should then change this option to "I will create my own home program" option under Homing and Travel to prevent the wizard from overwriting your edits. This will give you a home sequence setup with you current I/O and will only need to add the Zri Input.

In this setup i used HomeAll on Input 1 and ZriHomeAll on Input 2. You will need to change the #50002 and M105/106 P values to the input you choose in the wizard for your Zri Inputs.

If you are interested in learning to do your own macros please check out Centroid's Introduction to Macros and Mill/Lathe Manuals for description of M and G Codes available to you.

Code: Select all

;Homing Example Using Home Switches and Zri Input.
;ZriHomeAll is Input 2

N100 ;Check for open home switch
IF !#[50000 + #9822] THEN M225 #100 "HomeAll switch tripped!!!\nPlease clear before Homing.\n\nPress Cycle Cancel to end Homing"
IF !#[50000 + #9822] THEN GOTO 100

N200 ;Check for Closed Zri (Zri is Input 2)
IF #50002 THEN M225 #100 "Axis Sitting on Index Pulse!!!\nJog Axis off Index Pulse.\n\nPress Cycle Cancel to End Homing"
IF #50002 THEN GOTO 200

;Disable all limits
M94 /101 /102 /103 /104

;Perform Homing commands
M92/Z L1			;Move Plus to Home Switch
M105/Z P-2 F5		;Move Minus Until Zri Input Closes at 5 in/min
M26/Z			;Set Z Home Position at Index Pulse
M106/Z P2 F5		;Move Plus to Clear Zri Input at 5 in/min

M92/Y L1			;Move Plus to Home Switch
M105/Y P-2 F5  		;Move Minus Until Zri Input Closes at 5 in/min
M26/Y				;Set Y Home Position at Index Pulse
M106/Y P2 F5		;Move Plus to Clear Zri Input at 5 in/min

M91/X L1			;Move Minus to Home Switch
M106/X P-2 F5		;Move Plus Until Zri Input Closes at 5 in/min
M26/X			;Set X Home Position at Index Pulse
M106/X P2 F5		;Move Minus to Clear Zri Input at 5 in/min

G53 X0Y0Z0		;Move Axes to Home Position

;Enable all limits
M95 /101 /102 /103 /104

Re: Using mechanical and ZRI/Proximity switches for homing a lathe

Posted: Wed Dec 09, 2020 3:08 pm
by martyscncgarage
When looking at Chris' example, these M code definitions are useful. You have edit his file based on how your machine homes.

M26 Set Axis Home
M91 Move to Minus Home
M92 Move to Plus Home
M94,M95 Output On/Off
M105 Move Minus to Switch
M106 Move Plus to Switch

Re: Using mechanical and ZRI/Proximity switches for homing a lathe

Posted: Tue May 24, 2022 10:58 am
by lavrgs
Glad I found this, I have held off setting up ZRi because I only have two inputs open. If I can do everything with just one input I'm a happy camper

Re: Using mechanical and ZRI/Proximity switches for homing a lathe

Posted: Sat Nov 05, 2022 1:04 am
by TCandee
Are the zri outputs from the dyn4 run in series like the limit switches on a homeall setup or run in parallel? Asking because I’m having no luck in series.

Re: Using mechanical and ZRI/Proximity switches for homing a lathe

Posted: Sat Nov 05, 2022 7:09 am
by martyscncgarage
TCandee wrote: Sat Nov 05, 2022 1:04 am Are the zri outputs from the dyn4 run in series like the limit switches on a homeall setup or run in parallel? Asking because I’m having no luck in series.
No.
You can run the mechanical limits in series, but ZRI needs its own in put. The control needs to see the individual Index marker pulses for accurate homing.

I would not chance putting the ZRI's in series.

Marty

Re: Using mechanical and ZRI/Proximity switches for homing a lathe

Posted: Sat Nov 05, 2022 10:47 am
by ShawnM
You wire all ZRI signals in parallel to the same input. Using Chris's example code, after the first axis trips the home switch it then moves away from the home switch in search of the marker pulse. When it hits the marker pulse and the ZRI input set in the wizard closes it sets home. Then that same axis moves off the marker pulse to open or clear the ZRI input. Then it moves on to the next axis to do the same thing. When all axis have homed to the ZRI marker pulse the code then uses G53 to move all axis back to the home position.

This code allows you to use ONE input with all the ZRI marker pulses in parallel.

Re: Using mechanical and ZRI/Proximity switches for homing a lathe

Posted: Sat Nov 05, 2022 11:21 am
by martyscncgarage
ShawnM wrote: Sat Nov 05, 2022 10:47 am You wire all ZRI signals in parallel to the same input. Using Chris's example code, after the first axis trips the home switch it then moves away from the home switch in search of the marker pulse. When it hits the marker pulse and the ZRI input set in the wizard closes it sets home. Then that same axis moves off the marker pulse to open or clear the ZRI input. Then it moves on to the next axis to do the same thing. When all axis have homed to the ZRI marker pulse the code then uses G53 to move all axis back to the home position.

This code allows you to use ONE input with all the ZRI marker pulses in parallel.
Nice!

Re: Using mechanical and ZRI/Proximity switches for homing a lathe

Posted: Sat Nov 05, 2022 12:53 pm
by TCandee
Ok that’s what I figured. I did set it up in parallel and the z axis works great but I can’t get the x axis to even home with the mechanical limit using the code in this thread. Tried putting the x axis code first and that did not help. I am set up with home all on input 1 and zrihomeall on 2.

I am basically just a bit past a bench test at this point so I am manually triggering the limit. This is a 2 axis lathe. It goes through the z axis perfectly and moves on to x and triggering the limit doesn’t nothing. I am seeing that the input is triggering. I just get a message that it could not find home after about 5 seconds. I’ll send a report later. Not in the shop at the moment. I copied the code from here but deleted the y axis section.

Re: Using mechanical and ZRI/Proximity switches for homing a lathe

Posted: Sat Nov 05, 2022 3:00 pm
by TCandee
here is the report