Hello Guest it is June 02, 2025, 12:45:36 PM

Author Topic: Write my own homing procedure?  (Read 318 times)

0 Members and 1 Guest are viewing this topic.

Write my own homing procedure?
« on: May 24, 2025, 03:40:27 AM »
Hello!

I want to write my own homing procedure instead of pushing mach3's buttons 1022 etc. I thought i can do this by overriding limits, passing home/limit signal to the "digitize" input and using g31 instead of such buttons. However mach3 is willing not to let me do so.

- I was unable to get "override limits" to work, neither programmatically, nor manually. Turning "auto limit override" off does not help.

- I was unable to move slave axis alone apart from the master axis.

Is it possible to do these things?

Thanks in advance.

Offline TPS

*
  •  2,585 2,585
Re: Write my own homing procedure?
« Reply #1 on: May 25, 2025, 03:43:12 AM »
to use softlimits it is allways necessary to have a propper homed machine.
any other kind of "homing" will also not allow you to set machine coord's to zero.

homing is normaly handled by the motion controller an every motion controller has IMHO
it's own stategy and paramters for homing, so this allways refers to documentation of the
specific motion controller.

if you search for "preceise" homing you will find a lot of code samples to get it more precise.
a couple of motion controllers can also do a "indexed" homing witch is the best you can get.

homing must no be done by pressing button's, it can be handled by script and also by gcode,
so it can be done more or less "automatic".

i use homing on all my machines and it is done by a simple macro call at the beginning of every
GCode programm.

anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: Write my own homing procedure?
« Reply #2 on: May 28, 2025, 06:26:02 AM »
> to use softlimits it is allways necessary to have a propper homed machine.

But if i am not homed yet and prepare for such homing, i do not need soft limits nor hard limits. But i am unable to turn hard limits off.

> homing is normaly handled by the motion controller an every motion controller

Yes, but my motion controller issues loud kick after it homes the slave axis. It is a controller bug they had "fixed" in the latest firmware, but such fix works only first time after power on. And overall i have some reasons to not trust this homing.

And even if it were not the case, i think g31 has some advantages over the mach3's homing. Namely, after such homing the machine coordinates are reset, so i can never tell how much they were shifted and how precise such procedure is. But with g31 i can easily get the exact difference and then set whatever coordinates i want. And also you can set any feed rate you want and even first move the machine fast to the home switch and then do slow precise measurement, whereas in "home" you have only one speed parameter. And you can gather many points and then set the machine coordinate to some average, which is impossible in case of ordinary homing. And i suspect g31 is also handled by the same motion controller in similar manner (but slightly different).

> if you search for "preceise" homing you will find a lot of code samples to get it more precise.

I had never found them. If i search ""preceise" homing mach3", it yields ony one result that contains no vba scripts and only briefly mentions mach3. And even if i search "precise homing mach3", i found only one link that contains mach3 script, but it involves modbus which i do not have. Can you please provide the links you are talking about?

> homing must no be done by pressing button's, it can be handled by script and also by gcode,
so it can be done more or less "automatic".

I have such script at "ref all home" button (written by myself), but at the core it (and all other scripts i had seen) boils down to pushing good old buttons 1022, 1023, 1024 (or 22, 23, 24 which are the same). The only difference in my script is that i also home the slave axis alone with button 1026 (which i think gives better results with my "eth-mci" controller).

> i use homing on all my machines and it is done by a simple macro call at the beginning of every
GCode programm.

I am not sure i need to home before each job. E. g. i may stop my job and run it again, and the homing procedure may yield slightly different coordinates, so the machine will cut in slightly different place.

Offline TPS

*
  •  2,585 2,585
Re: Write my own homing procedure?
« Reply #3 on: May 28, 2025, 10:18:20 AM »

>> But i am unable to turn hard limits off.
i know no way to turn hard limits off.
only thing i know is DoOemButton(150) -> Override Limits.
maybe you need a hardware suluotion by switching an output to do this,
but normaly HW limit's are HW limit's and they should be are the physical limit.


>> I had never found them. If i search ""preceise" homing mach3", it yields ony one result that contains no vba scripts and only briefly mentions mach3. And even if i search "precise homing mach3", i found only one link that contains mach3 script, but it involves modbus which i do not have. Can you please provide the links you are talking about?

simple example:
Code: [Select]
  SetParam ("XRefPer",40)
  Sleep 200
  DoOEMButton (1022)  'home at 40%
  While IsMoving()
  Wend
  Code "G53 X-2"  'move off switch 2mm
  While IsMoving()
  Wend
  SetParam ("XRefPer",5)
  Sleep 200
  DoOEMButton (1022)  'home at 5%
  While IsMoving()
  Wend
  SetParam ("XRefPer",100)
  Sleep 200
or you have a motion controller witch allows indexed homing

>> I am not sure i need to home before each job. E. g. i may stop my job and run it again,
>> and the homing procedure may yield slightly different coordinates, so the machine will cut in slightly different place.

if you use machine with ATC and do more identical parts in a row, automatic homing and a couple of other preselections
are IMHO elementary, but this depends on your need's

anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: Write my own homing procedure?
« Reply #4 on: May 28, 2025, 10:56:10 AM »
> only thing i know is DoOemButton(150) -> Override Limits.

This is the exact thing i tried and it does not work.

> simple example

Thanks! I had never encountered SetParam ("XRefPer") before.

> or you have a motion controller witch allows indexed homing

Actually my servo steppers likely have index output, but it is not wired to the controller, so it needs some work which i prefer not to do. Moreover, i think if i wire dfferent "enable" outputs to the master and slave axes, i could home them independently, but mach3 is clearly capable of such independent homing without rewiring, it simply does not want to let me do this. And maybe if i make some brain that will force 0 signal to the limit inputs when i home.. Or even force 0 signal into the master y axis step input.. But it could be much, much simpler, which makes me sad panda.

Offline TPS

*
  •  2,585 2,585
Re: Write my own homing procedure?
« Reply #5 on: May 28, 2025, 11:11:01 AM »
have you had a look for

CoupleSlave(bool) 

function?
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: Write my own homing procedure?
« Reply #6 on: May 28, 2025, 11:19:08 AM »
No, i had not! I will try this. However its description is rather obscure, maybe it does the same thing i already achieve with homing B axis alone. Thanks!

Also i forgot one of the main reasons to have my own homing procedure: if i can move slave axis independently, i can make correction for squareness programmatically rather than by moving actual limit switches, which in my setup is not easy.
« Last Edit: May 28, 2025, 11:24:37 AM by wormball »