auto zero tool problem

Discussion of Mach3 CNC control software
Post Reply
kiark82
Posts: 16
Joined: Tue Jul 29, 2014 7:26 pm

auto zero tool problem

Post by kiark82 » Fri Apr 03, 2015 12:55 pm

Hi there.

Since working with different tools is fun i had to get a zero probe to get rid of all the inaccuracies when changing tools manually.

I have the hardware and the pins set up and got to the part with the script. Im using this one from instructables:

'VB Code Start
'-------------------
CurrentFeed = GetOemDRO(818)
DoSpinStop()

ZMove = 20.00 'Total lenght of Probe to move before Stop or no Contact Made.
ZOffset = 1.60 ' Plate Hight
ZSal = ZOffset + 2.00 '+ Free Hight, Will possition the Proble 2 MM over the Material.

StopZmove = 0
If GetOemLed (825)=0 Then
DoOEMButton (1010)
Code "G4 P2.5"
Code "G31 Z-"& ZMove & "F25"
While IsMoving()
Sleep(200)
Wend
Probepos = GetVar(2002)
If Probepos = - ZMove Then
responce = MsgBox ("**ERROR** " , 4 , "Probe **ERROR**" )
Code "G0 Z10"
StopZmove = 1
Code "F" &CurrentFeed
End If
If StopZmove = 0 Then
Code "G0 Z" & Probepos
While IsMoving ()
Sleep (200)
Wend
Call SetDro (2, ZOffset)
Code "G4 P1"
Code "G0 Z" & ZSal
Code "(Z zeroed)"
Code "F" &CurrentFeed
End If
Else
Code "(Check Ground Probe)"
End If
Exit Sub
'-------------------
'VB Code Stop

Unfortunately there is some issue with the zaxis movement. It jogs down till it makes contact but instead of going back up it runs deeper for about 2-3 mm. I didnt change anything but the probe height which is 2.5 mm in my case. Am i missing something or are there some general config options that need to be un/checked?

Thanks,

kiark

WillAdams
Posts: 8502
Joined: Mon Apr 09, 2012 6:11 pm
Location: Pennsylvania --- south of the Turnpike, East of US-15
Contact:

Re: auto zero tool problem

Post by WillAdams » Fri Apr 03, 2015 1:55 pm

I wish I could help, but I'm afraid that I'm mystified by what you've written, and totally lack a context to understand it, and it doesn't seem to've been discussed here, or at least not in this fashion.

Would you mind sharing the details of:

- what changes you've made to your machine
- what tool you're using to run this code
- the link for the code (and its license?)

maybe that'll make it easier for someone who actually understands what you're doing to help you.
Shapeoko 3XL #0006 w/Makita RT0701 Router w/0.125″ and ¼″ Elaire precision collets
Nomad 883 Pro #596 (bamboo)

cvoinescu
Posts: 4442
Joined: Thu Jul 19, 2012 6:50 pm
Location: Camberley, UK
Contact:

Re: auto zero tool problem

Post by cvoinescu » Fri Apr 03, 2015 2:41 pm

GRBL now supports probe commands -- why fake it in Visual Basic when GRBL can do it natively?

Also, your code is hard to read without indentation. Use the

Code: Select all

 BBCode element.
Proud owner of ShapeOko #709, eShapeOko #0, and of store.amberspyglass.co.uk

DanMc
Posts: 257
Joined: Fri Apr 13, 2012 3:34 am

Re: auto zero tool problem

Post by DanMc » Sat Apr 04, 2015 2:30 am

OP is using a button script in Mach3, that's why it's in VB.

I don't know why your probe keeps diving after contact but it seems like it has to do with the thickness of the touchplate, like its retracting the right distance but the wrong direction. Is this the actual code you are using (after you modified the touchplate height)?

I use different script that I found on the Mach forum which I found a little easier to understand for me, not having a programming background.

kiark82
Posts: 16
Joined: Tue Jul 29, 2014 7:26 pm

Re: auto zero tool problem

Post by kiark82 » Sat Apr 04, 2015 7:20 pm

sorry for my bad explanation, basically i was doing this:

http://www.instructables.com/id/Mach3-Z ... l/?lang=de

as DanMc stated i'm using mach3 and therefore i have to use that VB script.

i also tried to alter the numbers with + und - to make it retract up, but it didnt work. now im using this script:

Code: Select all

Message( "Auto Zeroing..." ) 
If IsSuchSignal (22) Then
Call SetDRO( 2, 0.00 ) 
code "G31 Z-20.00 F25"
While IsMoving()
Wend
Call SetDRO( 2, 2.50 ) 
code "G1 Z2"
End If
it works most of the time, but after completing one pass i have to restart mach3 or it also retracts into the false direction again :(

@DanMc: could you show me what code you are using currently?

Thanks,

kiark

cvoinescu
Posts: 4442
Joined: Thu Jul 19, 2012 6:50 pm
Location: Camberley, UK
Contact:

Re: auto zero tool problem

Post by cvoinescu » Sat Apr 04, 2015 7:46 pm

My bad, I did not notice the section. And just a week or two ago I scolded someone else for doing exactly the same thing. I am annoyed with myself. :)
Proud owner of ShapeOko #709, eShapeOko #0, and of store.amberspyglass.co.uk

Damin69
Posts: 331
Joined: Fri Oct 31, 2014 3:00 pm
Location: Muscoda, WI

Re: auto zero tool problem

Post by Damin69 » Sat Apr 04, 2015 8:42 pm

I had a similar issue but mine would go down about a 1/4" then retract up. I am useing a c10 Bob I ended up putting a small cap in parallel with the input on the board cleared the issue right up.
Shapeoko 2 #6971
Upgrades
Makita 0701, Nema23s, ACME Z Axis, Nema 23 Belt drive
Expanded to 1000 x 1800
Electronics upgrade C-10 BOB, SainSmart ST-M5045 drivers, Mach3
Damin69's Build Log

DanMc
Posts: 257
Joined: Fri Apr 13, 2012 3:34 am

Re: auto zero tool problem

Post by DanMc » Sat Apr 04, 2015 11:13 pm

This is the code I am using:

Code: Select all

ZDRO = 2
PlateThickness = getOEMDRO(1001)
RetractClearance = 5
Message( "Auto Zeroing..." ) 
If IsSuchSignal (22) Then
code "G31 z-10 F20"
While IsMoving()
Wend
Call SetDRO( ZDRO,6.35)
RetractHeight = RetractClearance + PlateThickness
code "F200"
code "G1 Z"& RetractHeight
End If   
Message( "Z Axis Zeroed" ) 
Note that this is in metric and my touchplate measures 6.35, you would need to change that to whatever yours measures.
Also note that it won't work if your current Z position is more than 10mm above the touchplate.
It's pretty much the same as the second one you posted, just annotated a littler better

Damin69
Posts: 331
Joined: Fri Oct 31, 2014 3:00 pm
Location: Muscoda, WI

Re: auto zero tool problem

Post by Damin69 » Sat Apr 04, 2015 11:20 pm

Here is the code I am using on mine. It is in imperial units.

CurrentFeed = GetOemDRO(818) 'Get the current feedrate to return to later
CurrentAbsInc = GetOemLED(48) 'Get the current G90/G91 state
CurrentGmode = GetOemDRO(819) 'Get the current G0/G1 state

If GetOemLed (825)=0 Then 'Check to see if the probe is already grounded or faulty
DoOEMButton (1010) 'zero the Z axis so the probe move will start from here
Code "G4 P3" ' this delay gives me time to get from computer to hold probe in place
Code "G90 G31Z-4. F4" 'probing move, can set the feed rate here as well as how far to move
While IsMoving() 'wait while it happens
Wend
ZProbePos = GetVar(2002) 'get the exact point the probe was hit
Code "G0 Z" &ZProbePos 'go back to that point, always a very small amount of overrun
While IsMoving ()
Wend
Call SetDro (2, .060) ' change .060 to your plate thickness and then adjust for final accuracy
Sleep 200 'Pause for Dro to update.
Code "G1 Z1. F50" 'put the Z retract height you want here, must be greater than the touch plate thickness
While IsMoving ()
Wend
Code "(Z axis is now zeroed)" 'puts this message in the status bar
Code "F" &CurrentFeed 'Returns to prior feed rate
Else
Code "(Z-Plate is grounded, check connection and try again)" 'this goes in the status bar if applicable
End If
If CurrentAbsInc = 0 Then 'if G91 was in effect before then return to it
Code "G91"
End If
If CurrentGMode = 0 Then 'if G0 was in effect before then return to it
Code "G0"
End If
Shapeoko 2 #6971
Upgrades
Makita 0701, Nema23s, ACME Z Axis, Nema 23 Belt drive
Expanded to 1000 x 1800
Electronics upgrade C-10 BOB, SainSmart ST-M5045 drivers, Mach3
Damin69's Build Log

kiark82
Posts: 16
Joined: Tue Jul 29, 2014 7:26 pm

Re: auto zero tool problem

Post by kiark82 » Mon Apr 06, 2015 6:24 pm

thanks! i will try these codes tomorrow

Post Reply