Hello Guest it is February 28, 2021, 11:55:45 PM

Author Topic: Totally Lost with Offsets.  (Read 313 times)

0 Members and 1 Guest are viewing this topic.

Totally Lost with Offsets.
« on: July 11, 2020, 04:05:41 PM »
I apologise if I am just missing the point. I have watched as many youtubes as i can and it seems simple to me but MACH3 wont obey.

Let me explain. I have used MACH3 to drill PCB's for years by having four phantom holes as part of the etch that then drops onto pegs, worked great machine died of old age. But it releid on me acurately center punching and drilling the first hole which went on a peg.

So enter my new machine two weeks ago to which I have attached a usb Microscope that comes up nicely in Mach3 on windows XP. The Machine a 3 axis router CNC 6040 uses the Bitsensor.com USB controller.

My thinking went like this. Replace the drilled holes with etched crosshairs on the PCB. Clamp the pcb to the bed and the move the head until the crosshairs are over the etched crosshair. Zero the x and y in G54.

Now here comes the rub.

The DRL file in the Gerber list does not use the crosshairs as a zero coordinate it seems to use the edge of the board. So when I then employ my parser written in Vis Basic, I get a series of ready to go G&M code that I then load into mach3.

The difference between the crosshairs and actual workpiece zero and the camera crosshairs and the spindle adds up to an offset of -88mm in x and -63mm in y.

So if I simply move the spindle -88 and -63 then rezero in G54 the program performs fine and all the holes drill in place.

But it is a nuisance doing this every time.

I thought if I put the offsets into G55 manually I would be able to bring this offset in after setting x and y to zero in G54, but when I zero the machine coordinates the G54 offsets alter to numbers that make no sence. There seems to be a legacy value from the machines move before zeroing.

If I the switch to G55 the offset is way out and it misses the board completely.

How can moving the head work and changing to G55 not.

How can I either in zeroing the machine coordinates also make the G54 zero so that when I switch to the G55 the new zeros is at the -88 and -63 position.

It seems like whackamole as soon as I alter one offset it moves all the others and the -88 and -66 become corrupted.

Am I just missing the point .

All I want to do is zero in the crosshair. then tell it that really zeros is -88 and -63 from where the spindle is sitting.

Thanks in advance if any of you can help.

I feel like I am in limbo.

Nothing seems to add up.

Best regards

Forbin One


« Last Edit: July 11, 2020, 04:12:33 PM by forbinone »

Offline ZASto

*
  •  351 351
    • View Profile
Re: Totally Lost with Offsets.
« Reply #1 on: July 11, 2020, 04:57:23 PM »
Instead crosshairs, you can use small vias for your board extremes in Y direction, find the screenset that has "laser zero" functionality, use some Tweakie's code for Local System Rotate (so you can fix your PCB in almost any rotated position), and a small endoscope camera like this one: https://www.aliexpress.com/item/32255881055.html?spm=a2g0o.productlist.0.0.355e6e5eOM1Cfb&algo_pvid=39d12563-0f6f-413f-8833-c5ebe7c18563&algo_expid=39d12563-0f6f-413f-8833-c5ebe7c18563-0&btsid=0ab6f83915945003200298906e170d&ws_ab_test=searchweb0_0,searchweb201602_,searchweb201603_

Code for Local System rotate according to buttona A, B and C (on another computer I made it a single button):
Code: [Select]
'Button A script;

Zmove = GetOEMDRO(1202)
Code "G0 G53 Z" &Zmove
While IsMoving()
Wend
Call SetOEMDRO(118,0) 'reset system rotate DRO
Code "(Locate Datum then click Button B)" 'message for status bar
Call SetOEMDRO(3,1) 'set slow jog rate to 1%
Call SetUserLed(1102,1) 'open Klaus's video window


'Button B script;
 
DoOEMButton (1008) 'zero X axis DRO
DoOEMButton (1009) 'zero Y axis DRO
Code "(Locate Reference then click Button C)" 'message for status bar


' Button C script
 
Sub Main()
  X1pos = GetOemDRO(800) 'read x axis DRO
  Y1pos = GetOemDRO(801) 'read y axis DRO
  If (Y1pos=0) Then GoTo Label1 'avoid divide by zero error
  b = Atn(X1pos/Y1pos)*(180/(4*Atn(1))) 'calculate angle
  b = b - (b*2) 'change sign (+/-)
  Code "G0 X0 Y0" 'move to datum
  While IsMoving () 'wait for task to be completed
  Wend
 ' Xmove = 70.850 'enter your camera offset here
  Xmove = GetOemDRO(1103)
'  Ymove = 1.070 'enter your camera offset here
Ymove = GetOemDRO(1104)
  Code "G91 G0 X" &Xmove & "Y" &Ymove 'make incremental move
  While IsMoving () 'wait while that happens
  Wend
  Code "G90" 'go back to absolute moves
  Call SetOemDRO(118,b) 'set system rotate DRO
Label1:
  DoOEMButton (1008) 'zero X axis DRO
  DoOEMButton (1009) 'zero Y axis DRO
  Call SetOemDRO(3,80) 'reset jog rate to 80%
  Code "(Process complete)" 'message for status bar
  Call SetUserLed(1103,1) 'close Klaus's video window
End Sub

Of course this assumes that you use KD's camera plugin

Camera ON script, and Camera Zero script according to second image:
Code: [Select]
'Camera button script;

Zmove = GetOEMDRO(1202) 'get Z tool change location (machine coordinates)
Call SetUserlED(1104,1) 'light up LED near camera button
Call SetOemDRO(118,0) ' reset system rotate DRO
Call SetOEMDRO(3,5) 'set slow jog rate to 5%
Call SetUserLed(1102,1) 'open Klaus's video window
Code "G0 G53 Z" &Zmove 'goto Z tool change height
While IsMoving()
Wend
Code "(Locate Datum then click CAMERA ZERO)" 'message for status bar

'Home button script;
 
Call SetOemDRO(3,80) 'reset jog rate to 80%
Xs=GetOemDRO(59) 'read Xscale DRO
Ys=GetOemDRO(60) 'read Yscale DRO
Xmove =GetUserDRO(1103) * 1/Xs 'enter your camera offset here
Ymove = GetUserDRO(1104) * 1/Ys 'enter your camera offset here
Code "G91 G0 X" &Xmove & "Y" &Ymove 'make incremental move
While IsMoving () 'wait while that happens
Wend
Code "G90" 'go back to absolute moves
DoOEMButton (1008) 'zero X axis DRO
DoOEMButton (1009) 'zero Y axis DRO
SetUserLED(1103,1) 'close Klause’s video window
SetUserLED(1104,0) 'Switch off LED near camera button
Code "(Homing to Datum Complete)" 'message for status bar

Hope this will help you

If needed, I can attach you screenshots of board made in KiCAD with vias and where I place auxiliary origin.
Make no mistake between my personality and my attitude.
My personality is who I am.
My attitude depends on who you are.
Re: Totally Lost with Offsets.
« Reply #2 on: July 11, 2020, 05:33:58 PM »
Thanks Zasto, I think i am a long way from understanding what your post says.

Although i have been around mach3 for many years it's like a car to me. I just get in and drive. I still have no knowledge of how to tinker inter the bonnet.

If nothing else is forthcoming I will put the effort into using your information.

But be assured I am very grateful for you efforts.

Many Thanks

ForbinOne.

Re: Totally Lost with Offsets.
« Reply #3 on: July 11, 2020, 05:53:08 PM »
Is it not possible to do this with simple offsets. ??
Re: Totally Lost with Offsets.
« Reply #4 on: July 13, 2020, 05:27:39 PM »
I will add my own reply and thank Zastro but I have worked out an even simplet soluition.

I simply park the crosshairs of the usb microscope over the Crosshairs on the pcb etch and on the main screen, touch the x dro and overide the value with the offset and the same with Y. It just accepts its where i want it to be and cracks on. 

Offline Graham Waterworth

*
  • *
  •  2,274 2,274
  • Yorkshire Dales, England
    • View Profile
Re: Totally Lost with Offsets.
« Reply #5 on: July 13, 2020, 07:56:55 PM »
One line at the start of your g-code will do it and one at the end.

O0001
G21 G40 G00 G99
G54
G52 X-88. Y-63.
G00 ETC...

(MORE LINES)

G52 X0 Y0
M30
Without engineers the world stops