Hello Guest it is March 28, 2024, 11:59:29 AM

Author Topic: Pokeys57CNC and homing to middle ?  (Read 2924 times)

0 Members and 1 Guest are viewing this topic.

Pokeys57CNC and homing to middle ?
« on: August 16, 2019, 08:06:53 PM »
I'm converting a mill to use a Pokeys57CNC controller with Mach4, and looking at setting up the homing switches.  Currently the homing switches on the X and Y axes use inductive probes for homing switches, and they're located in the middle of the travel.

The Pokeys user manual describes how homing switches can be configured for various options ("On home" and "Out home"events etc) but I can't see one which allows for homing to a switch in the middle of travel, ie when the machine powers up, it may be either to the left or the right of the home switch, and will need to travel in the appropriate direction until the home switch changes state.

Is this possible with the Pokeys575cnc or will I need to change to home switches at the ends of the travel instead ?
Re: Pokeys57CNC and homing to middle ?
« Reply #1 on: August 16, 2019, 08:54:04 PM »
Hi,
home switches can be anywhere on an axis. When the home switch is activated it will reset the machine coordinates,
but you can choose to reset them to zero OR some offset. Thus if you had a home switch in the middle of an axis you
could set a 'home offset' equal to half the axis travel. This would result in the machine coordinate zero being at  the
end of the axis despite the home switch being in the middle.

You have identified one problem however. If for instance you set the initial homing direction to the right, and when at power up
the machine was already to the right of the home switch, the machine will travel yet further to the right hitting the end of
the axis before any home switch activation.

I solved this problem by having my home switches near (within a few millimeters) of the end of travel. Further I used
roller plunger microswitches which because of their defined and repeatable hysteresis make good home switches.
I used to have limit switches beyond the home switches but they were cheap switches and I didn't design the mounting
well and I wiped a couple out.  I removed them all and rely on 'soft limits'. Because I get very reliable and accurate homing
this has proved adequate. If I were to fit limit switches I would use inductive proximity switches. They can easily be arranged
such that an over travel event does not destroy them.

The 57CNC gives you plenty of inputs. I would take advantage of that an use one input per switch and would further recommend
separate home and limit switches. For a three axis machine that would mean six limit switches and three home switches for a total
of nine inputs. Many people combine limit and home functions but with such a capable controller you don't have to.
It means also that if a switch event occurs than Mach knows exactly what event it represents, not having to deduce whether
its a limit or a home event or even if its a X++ or an X-- event.....with one switch/one input no deduction or interpretation
is required or potential mistake be made.

Craig

https://nz.element14.com/honeywell/bzc-2rq18-a2/switch-basic-top-roller-plunger/dp/1525198
Note this is the New Zealand site and is in NZD. If you search for Element14, or equivalently for Newark in the US or
Premier Farnell in the UK you will get the same product but in your local currency.
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: Pokeys57CNC and homing to middle ?
« Reply #2 on: August 17, 2019, 12:15:08 AM »
You have identified one problem however. If for instance you set the initial homing direction to the right, and when at power up the machine was already to the right of the home switch, the machine will travel yet further to the right hitting the end of the axis before any home switch activation.

Yep, this is exactly what my question was.  So currently there is no option to directly address this.  Putting the home switches at one end of the travel is what I'd like to avoid if possible.

I haven't really looked into this at all, but would it be possible to use a script in Mach4 (LUA ?) that runs as part of the homing routine - to initially drive all axes out of home, then resume the regular "move towards home" routine ?
« Last Edit: August 17, 2019, 12:27:51 AM by Geoff_S »
Re: Pokeys57CNC and homing to middle ?
« Reply #3 on: August 17, 2019, 01:33:13 AM »
Hi,

Quote
So currently there is no option to directly address this.

There are in fact provisions that you could use:

Quote
LUA Syntax:
dir, rc = mc.mcAxisGetHomeDir(
                              number mInst,
                              number axisId)

Description:
Get the hominig direction for the specified axis.

And this API:

Quote
LUA Syntax:
rc = mc.mcAxisSetHomeDir(
      number mInst,
      number axisId,
      number dir)

Description:
Set the specified axis' homing direction.

You can use these APIs to read and set the homing direction, all that is required is some skillful coding.
What they can't do is tell Mach on which side of the home switch it is UNTIL it has homed OR if you tell it so.
Machs great, it has a great deal of programming power to make it very flexible but its not magic.

If you do not wish to be required to tell Mach where its newly powered up state is EITHER shift your home switches
OR buy some 'you beaut' non volatile multi-turn encoder equipped servos......at considerable expense.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: Pokeys57CNC and homing to middle ?
« Reply #4 on: August 17, 2019, 01:51:28 AM »
Thanks.  Is Mach4 able to read the curent state of a homing switch, or can it only detect changes in home switch states ?  Looks like I'll spend some time reading up on the API.  I'm quite comfortable with programming generally, just no experience yet with Mach4's API.
Re: Pokeys57CNC and homing to middle ?
« Reply #5 on: August 17, 2019, 02:29:17 AM »
Hi,
Machs program structure and it API is a major part of 'coding in Lua'. In fact Lua is pretty simple, even if it has
a syntax 'only a mother could love' but the structure and API really make Mach4 so versatile.

I do have a solution for you....its a bit long winded but it works. Remember this workaround is because you cant be bothered
to shift your home switches.......so no complaining that its difficult!

Firstly you cannot set the machine coordinates in Mach at will. You can't do this in Mach3 OR Mach4.
I have a cheat that allows you to do so in Mach4.....it was an interesting excerise but in truth I never use it.

The only way you can 'set' the machine coordinates is by homing, also called referencing, your machine. Thereafter the
machine coordinates are 0,0,0 or some other set of numbers that you programmatically define as 'home offsets'

Lets assume that you are in  Mach4 session and you have by whatever means referenced your machine so your machine
coordinates are valid relative to the nominal home positions determined by your home switches. When you shut Mach4 down
you could save the current machine e coordinates is the .ini file. Once the machine is shut down it seems highly likely that
your machine wont move until you start a new session.

When you start a new session initially Mach has no idea where it is, it has lost all reference to the previous session. What Mach
may reasonably guess is the the machine is in the same position as when it was shut down last. You can read the
stored machine coordinates and using those coorinates guess whether the home switches are to the right or the left
of the machines current position. You can use the API I posted to set the homing direction based on Machs guess.

With Mach having set the homing direction then <Ref All> should cause the machine to move, in homing order,
towards your home switches irrespective of where the machine position is.

Should it transpire that your machine axes can or have been moved between sessions this method would fail.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'