Setting up a basic Z height touch off probe with a MESA 7i96

More
02 Oct 2023 01:01 - 02 Oct 2023 08:39 #282038 by Waldemar
Evening all,

So the time has come to get a Z height touch off probe set up on my router.  I want to integrate the surface that gets touched off on to a fixture which would speed things up no end for a repetitive job I've got in the pipeline (many tool changes using sub 1mm end-mills...)

I found an excellent tutorial here and I just want to double check that I've understood the wiring up bit correctly.

I already have 24VDC going to my IN COMMON (pin 12) as my limit switches are NPN and my spindle chassis is connected to mains earth.  Basically I'm asking - do I connect up the probe like so:

 

Or have I woefully misunderstood the assignment?

Obviously there're other things to be done with the software and working out probe height relative to workpiece etc., but he's done a really good job of describing the necessary steps required to get this up and running.

Thanks in advance for any advice, notes of caution etc.

Wal.
Attachments:
Last edit: 02 Oct 2023 08:39 by Waldemar.

Please Log in or Create an account to join the conversation.

More
02 Oct 2023 19:39 - 02 Oct 2023 21:35 #282090 by Waldemar
Spent some time on this earlier and have now sorted it.  The answer to my original post above was yes, that'll work just fine.

The info in the link that I included was of limited use - perhaps a little outdated - but it did the job of illustrating (to me anyway) the process involved to get this set up.

I did find a better link with info that worked perfectly - here you go:  www.diycncdesign.com/linuxcnc-2.8-touch-plate-probe.html

Everything appears to be working exactly as it should, there's just one observation I have:

If I double tap the crocodile clip on the spindle it triggers the limit switches - if I tap the crocodile clip slowly, or just clip it to the tool then there's no problem, but if I tap it rapidly (or fumble it clipping it on) then I trigger the limit switches.  Is this an electrical noise issue?  It's not too much of a problem for me, but if anyone can offer any pointers on what's causing it, what I can do to mitigate it etc. I'd appreciate it.

--

Anyway.  This is what I did to get a Z Touch Off probe working with my Mesa 7i96:

In the same folder that contains the .hal and .ini files I created a file called ztouch.xml and pasted the following into it:

    <pyvcp>
    <button>
    <relief>RAISED</relief>
    <bd>1</bd>
    <halpin>"ztouch"</halpin>
    <text>"Z TOUCH OFF"</text>
    <font>crying"Arial", 8)</font>
    </button>
    </pyvcp>

In the folder called subroutines I created a file called z_touch.ngc and copy/pasted the following into it:

O<z_touch> sub
; Cancel all Z offsets
    G92.1
    G49
    G10 L20 P0 Z[#<_hal[axis.z.pos-cmd]>]
    ; Set incremental mode
    G91
    ; Force LinuxCNC to refresh hal pin states prior to reading HAL pin
    M66 E0 L0
    ; Check if probe is already tripped
    O10 if [#<_hal[motion.probe-input]> EQ 1]
        O10 return [-1]
    O10 endif
    G38.2 Z-10 F25    (probe down using a fast feedrate)
    G0 Z0.5        (move up by 0.5mm)
    ; Allow a half second for the probe input to clear
    G4 P0.5
    ; Force LinuxCNC to refresh hal pin states prior to reading HAL pin
    M66 E0 L0
    ; Check if probe is already tripped
    O21 if [#<_hal[motion.probe-input]> EQ 1]
        O21 return [-1]
    O21 endif
    G38.2 Z-1 F5    (probe down using a slow feedrate to get better accuracy)
    G10 L20 P0 Z5    (set current WCS Z value = plate thickness)
    G0 Z10        (move up 10mm above work piece)
O<z_touch> endsub

In my custom_postgui.hal file I copy/pasted:

# Button for automated Z Touch Off with plate
    net ztouch halui.mdi-command-00 <= pyvcp.ztouch

In my .hal file:

In the # external inputs section I added:

# --- PROBE-IN ---
    net probe-in     <=  hm2_7i96.0.gpio.005.in

(I used pin 5 on the Mesa cards TB3 I/O)

and lower down towards the end of the file I added:

# ---probe signal---
    net probe-in => motion.probe-input

In my .ini file:

In the [DISPLAY] section I added:

    PYVCP = ztouch.xml

In the [RS274NGC] section I added

    SUBROUTINE_PATH = /home/wal/linuxcnc/subroutines

In the [HALUI] section I added:

    MDI_COMMAND = O <z_touch> CALL

And that's pretty much it.  I'll be modifying the ngc file a bit so that the spindle travels to a particular location on the fixture to touch off the tool, but otherwise I'll be using it as is.  Works nicely!
Last edit: 02 Oct 2023 21:35 by Waldemar.
The following user(s) said Thank You: tommylight

Please Log in or Create an account to join the conversation.

More
02 Oct 2023 21:39 #282096 by PCW
As far as noise goes, is the 24V common connected to frame ground?
 

Please Log in or Create an account to join the conversation.

More
02 Oct 2023 22:01 #282098 by Waldemar

As far as noise goes, is the 24V common connected to frame ground?

Not inside the control box, no.  It'll be connected to the mains earth by virtue of being in contact with the spindle / frame of the router.

Wal.

Please Log in or Create an account to join the conversation.

More
02 Oct 2023 22:27 #282100 by PCW
So its actually connected to the router frame (not just the spindle proper)?
You don't want any situation where the rotating part of the spindle can be at a
different potential than the spindle motor/frame

I would ground the 24V common to Earth ground in the control cabinet

Please Log in or Create an account to join the conversation.

More
02 Oct 2023 23:05 #282103 by Waldemar

So its actually connected to the router frame (not just the spindle proper)?

The croc clip connects to the end-mill at the moment, but if I was setting up a high repetition job then I might end up screwing down the end of the wire to, say, the spindle bracket.

You don't want any situation where the rotating part of the spindle can be at a
different potential than the spindle motor/frame

What could cause such an eventuality?

I would ground the 24V common to Earth ground in the control cabinet

Like so?  ie. attached to the same place that the MESA card is grounded to which, if I recall, shares mains earth with the higher voltage stuff inside the case...  I appreciate that's not ideal and that in an industrial setting you'd typically want to isolate the two into their own separate earth pits, but I don't have that luxury.  Perhaps doing it this way would increase the noise, rather than calm it..?

 

Wal.
Attachments:

Please Log in or Create an account to join the conversation.

More
03 Oct 2023 00:17 - 03 Oct 2023 00:18 #282106 by PCW
The issue I seen is that the spindle has only a weak ground path through its bearings
and you may cause current to flow through the bearing (which causes bearing damage)
 Spindles can also build up static which can cause noise and ESD damage

I still think the noise situation will be better if the 24V common is returned to
earth ground. (the 7I96 frame GND should be returned to earth ground separately)
 
Last edit: 03 Oct 2023 00:18 by PCW.
The following user(s) said Thank You: Waldemar

Please Log in or Create an account to join the conversation.

More
03 Oct 2023 08:41 #282139 by Waldemar
Thanks for your advice.

I wonder whether it would be worth me making some new mounting brackets for my limit switches in hard plastic?  I use the ubiquitous proximity sensors (pictured) and at the moment they're mounted to a metal bracket that's connected to the router frame.  Perhaps if I isolate them from the frame of the router..?  Just thinking out loud...

 

Wal.
Attachments:

Please Log in or Create an account to join the conversation.

More
04 Oct 2023 01:07 - 04 Oct 2023 01:09 #282229 by Waldemar
Was having an extended play with the router earlier and have run into a bit of an issue.

My intention is to be able to face off the touch surface to provide me with a reference height, so I thought fine - I'll detach the crocodile clip whilst facing off and then re-attach once that's done.

In theory it should work, BUT it turns out that I appear to have a very noisy earth that's leaking into my spindle  (I'm in an old Victorian mill in the UK).  Basically:  with the crocodile clip disconnected, as soon as the end-mill touches the touch off plate to face it off I get the "Probe tripped during non-probe move" error and the fun stops.  I noticed that touching any metal part of the router with the touch off plate half illuminates the LED on the input pin on the 7i96.

So, I've had a search around and found this topic along with rodw's tip:

forum.linuxcnc.org/38-general-linuxcnc-q...move?start=10#235121

    a no wiring solution is to and.2 the probe input with a digital input and in your gcode probing routine issue a M67 or M68 command to turn the input on and off. simple and effective.

Which sounds exactly like what I need to do - trouble is I don't know enough.  I've had a look at the and.2 info here:

linuxcnc.org/docs/html/man/man9/and2.9.html

but would someone be kind enough to explain how I'd use this in the context of my .hal file?

Am I right in thinking that I'm theoretically turning on the probe-in by synchronising the state of the actual probe-in and a digital input which I can then change using an M code in my subroutine that switches the probe off..?

Just a bit clueless on how to implement this...

Wal.

 
Last edit: 04 Oct 2023 01:09 by Waldemar.

Please Log in or Create an account to join the conversation.

More
30 Oct 2023 14:08 #284130 by masawee
how touch plate files add to linuxcnc if not have mesa card. only have paraller card and pin 15 working well true/fail at hall meter.
what files and codes need add and were can working, add button and subroutine code make this. i not totally understand what file and were need add, some example i try make but my machines not have same name files or file folders. linuxcnc 2.8.4-1-gb

Please Log in or Create an account to join the conversation.

Time to create page: 0.191 seconds
Powered by Kunena Forum