Tool X - Y setting.


One of the later additions to Tweakie is a laser cross hair pointer which is used to set the initial X - Y tool position on the work. These little devices are made in China and are as cheap as chips, they are easy to use and a well worth addition to any router. It makes position setting so quick and easy.


It should be noted that the accuracy I am able to achieve with this device is better than 0.5 mm and whilst this is just fine for a router (where alignment is often to a pencil line on the surface of the work or the edge of an engraving blank) it would not really be a suitable addition for a mill which may require precise alignment to an edge where the conventional edge finder can achieve a much greater degree of accuracy.








(1) This is the laser cross hair pointer. The cruciform pattern is produced by a series of prisms at 90 degrees to each other incorporated into the adjustable focusing ring on the front of the device. They are designed to operate at 3.5 Volts but work at 2.4 Volts just as well.


(2) The cross pattern produced by the laser device is quite precise. In use the X and Y Axis are jogged until this cross is centred on the work starting position then with the click of a screen button the X and Y Axis move until the cutting tool takes up this exact position.


(3) The pointer has been clamped in a block of alloy which has in turn been bolted to the side of the Z Axis. Both the body and the focus ring of the pointer must be clamped as any subsequent movement of either part will cause the position of the cross to move. Although the actual location of the pointer on the Z Axis is not critical it should be mounted so that by jogging the X and Y Axis it is able to project the cross onto the bottom left of the work table (or the machine home position). For testing purposes it is operated here by a Ni-Cad battery but this will be replaced with a -3 Volt supply.


(4) Setting the device up is a little tricky as the focus has to be adjusted to optimal at the centre of the Z Axis travel, the cross pattern has to be aligned with the X - Y Axis and the angle at which it points has to be adjusted so that the cross does not move it’s position on the table when the Z Axis is traversed end to end. Two or three millings, just taking dust off the mounting block produced the perfect alignment. Not as difficult to do as I first thought it would be.


(5) Because the reflectivity of various materials and surfaces varies it is desirable to be able to adjust the apparent brightness of the cross pattern. As the light from these lasers is plane polarised I have fitted a rotatable disc incorporating a piece of polarising film and when this disc is rotated between 0 degrees and 90 degrees the apparent brightness varies from full on to completely off thus enabling an optimum brightness to be selected. It is a factor of our eyesight that makes coherent laser light appear to ‘sparkle’ therefore the narrower the perceived beam width the better.


(6) Mach software is designed to be easily customisable by the user (thanks Artsoft) and to this end I have added two ‘buttons’ to the Mach screen labelled ‘Laser on/off’ and ‘Home to Laser’ then using the inbuilt Visual Basic script editor added instructions to the Laser on/off button to toggle the laser on or off and (after carefully measuring the X - Y laser / tool offset using the Mach DRO’s) added instructions to the Home to Laser button to home the cutting tool onto the laser position, turn the laser off and reset the DRO’s ready for the work to begin. Nothing could be simpler.

Here are some more photo’s of the polarised filter and it’s adjusting ring. The film is held in place by a circlip and I have replaced the two alloy spacers with a turned part. Machining dust was getting in and sitting on top of the filter - this setup should prevent that, also it looks a lot more professional.

Common to most of these laser pointers, the body of the device is electrically connected to the + supply. However, had my clamping device been made of Delrin (or similar) the body of the laser pointer would have been electrically isolated from the machine ground and as it only draws some 12 mA it could have been powered directly from the breakout board with no other components (transformer, relay etc) being necessary. Something to think about for anyone else who is planning to fit one of these devices to their machine.


There are some dangers associated with using lasers and although the (Class IIIa) laser pointer I have used here is rated at < 5mW radiated power at a wavelength of 650nm it should, however, be stressed that staring into the beam (or the reflected beam for prolonged periods) could possibly cause irreversible eye damage.

For tool position setting the reflected beam is only viewed for a few seconds at a time and the worst that could happen here is perhaps a bit of after vision - a lot less damaging to your eyes than glancing into the sun for example.

Protective glasses and goggles are made for use with lasers of this wavelength and not only do they provide a factor of eye protection they also enhance the projected image by removing a lot of the fuzziness and making the image appear sharper. The don’t look quite as cool as shades but remember that your eyes are precious so take care of them.


Tool height Z setting.


Mach already has a screen button dedicated to setting the Z axis or tool height relative to the surface of the work but to implement this function some extra software and hardware has to be produced.


Again the Visual Basic script editor is used to compile a macro which, on the click of the screen button, lowers the Z axis slowly until the tool touches the surface of a conductive plate, it then deducts the plate thickness from a safe Z move and sets the Z axis DRO to tool height above the work. (If you wish to use my VB script, this can be attached to the Auto Tool Zero button from within Mach by clicking the Operator / Edit Button Script then clicking on the Auto Tool Zero button, deleting anything that may already be in the box and then copying the script into the box and finally Saving it).


The conductive plate (insulated on one side for conductive work table use) is electrically connected to an LPT input pin and defined as Probe Input in Mach (Config / Ports & Pins / Input Pins).


VB scripts that I have used for tool position setting.


To add buttons to the Mach screens the ’Screen 4’ editor has been used. This can be downloaded, free of charge, from the Artsoft website - a help file and some examples can also be found there. Once buttons have been added, using the editor, the scripts can be attached from within Mach then the macro’s are automatically run when the screen buttons are clicked.

Mach is, I think, unique in the way in which it actively supports the user customisation of it’s operation and provides for the resolution of any problems that may be encountered (through it’s extremely helpful members forum).


Please note :- The following scripts may not reliably ‘copy & paste’ into Mach (due to the Unicode characters used on this website) - If an error is encountered then the relevant script should be typed, manually, into the VB button script box within Mach (the usual culprit for the compiler error is the ‘ character).





To toggle the laser pointer on and off with the same button the following macro was used. The output pin 8 from the LPT port is used here for connection to the solid state relay that turns the laser on and off. Pin 8 is then configured as Output 5 within Mach.



If IsOutputActive(OUTPUT5) Then 'Check to see if its on

DeActivateSignal(OUTPUT5) 'Its on so turn it off


ActivateSignal(OUTPUT5) 'Its off so turn it on

End If




To home the tool to the laser position the following macro was used. The X and Y offset between the tool and the laser is entered in Xmove and Ymove.


Probably the easiest way to measure the offset is to use an engraving point to make a small indentation in the surface of a piece of scrap material fixed to the work table then Zero the X and Y DRO’s. Next, jog each axis until the laser cross is centred on the indentation previously created then read the offsets from the X and Y DRO’s. These are the values which are then used in the macro (changing the sign as necessary).



Xs = GetOemDRO(59) 'X-Scale DRO

Ys = GetOemDRO(60) 'Y-Scale DRO

Xmove = -73.3844 * 1/Xs 'Move distance adjusted for X-Scale factor

Ymove = 10.7438 * 1/Ys 'Move distance adjusted for Y-Scale factor

DeActivateSignal(OUTPUT5) 'Turn off laser

Code "G91 G0 X" &Xmove & "Y" &Ymove ' Makes an incremental move the distances that you set

While IsMoving () ' Waits while that happens


Code "G90" 'Goes back to absolute moves

DoOEMButton (1008) 'Zero X-Axis DRO

DoOEMButton (1009) 'Zero Y-Axis DRO





To set the tool height above the work the following macro was used. The input pin 15 from the LPT port is used here for connection to the plate. The plate thickness , probe feed rate, maximum probing distance and Z retract height should be changed to suit the machine. Within Mach the Probe Input is configured to pin 15 and set active low.


Following reported problems, quite a few changes have been made to this macro since the first version and it has grown in size with each revision.

With the help of others, we have now tested Rev.4 extensively so hopefully this will be the final revision.


Rev.2 ( Feb.2010 ) modified to resolve issues with G90/G91 and Z Scale DRO settings also redundant G4 dwell commands removed.

Rev.3 ( Mar.2010 ) if probe reaches maximum distance without touching then message added to status bar.

Rev.4 ( Mar.2010 ) error trapping routines and message box improved.

Rev.5 ( May.2012 ) stop added to clear a possible feed-hold condition.


CurrentAbsInc = GetOemLED (48) 'Copy current G90/G91 state

CurrentGMode = GetOemDRO (819) 'Copy current G0/G1 state

CurrentFeed = GetOemDRO (818) 'Copy current feedrate

Contact = 0 'Clear the contact flag

PlateThickness = 2.8 'Touch Plate thickness is set here

ProbeFeed = 100 'Probing feedrate is set here

SetVar (1, -20) 'Maximum probing distance is set here

SetVar (2, 5) 'Retract height is set here

Code "M5" 'Ensures spindle is not running

Code “G21” 'Ensure metric units are used

Zs = GetOemDRO (61) 'Copy current Z-Scale DRO

Call SetOemDRO (61,1) 'Set Z-Scale DRO to 1

Label1: 'Entry point for Retry

DoOemButton (1010) 'Zero Z-Axis DRO

Code "(Setting Tool Zero)" 'Message for status bar

While IsMoving () 'Wait until task has been completed


If GetOemLED (825) = 0 Then 'Check to see if touch plate is already grounded

Code "G90 G31 Z #1 F" & ProbeFeed 'Probing move

While IsMoving () 'Wait until task has been completed


If GetOemLED (825) = True Then 'Check to see if probe has touched plate

Contact = 1 'Set the contact flag

End If

DoOemButton (1003) 'Clear a possible feed-hold condition

ProbePos = GetVar (2002) 'Exact point probe touched

Code "G0 Z" & ProbePos 'Go back to exact point of touch if there was any overrun

While IsMoving () 'Wait until task has been completed


Call SetDRO (2,PlateThickness) 'Set Z-Axis DRO to Touch Plate thickness

Code "G0 Z #2" 'Retract off Touch Plate the set distance

While IsMoving () 'Wait until task has been completed


Code "(Z-Axis is now Zeroed.)" 'Message for status bar

Code "F" & CurrentFeed 'Restore feedrate to original setting

If Contact = 0 Then 'Probe reached max travel without touching

Code "(ERROR - Probe did not touch.)" 'Message for status bar

Response = MsgBox ("ERROR - Probe did not touch.",37,"Auto Tool Zero")

If (Response = 4) Then 'User chose Retry

GoTo Label1 'Retry Probing routine

End If

End If


Code "(ERROR - Touch Plate is grounded.)" 'Message for status bar

Response = MsgBox ("ERROR - Touch Plate is grounded - Check connection.",16,"Auto Tool Zero")

End If

Call SetOemDRO (61,Zs) 'Restore Z-Scale DRO to original setting

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

Safety must always take priority. Use your head don’t loose it. Safety first, safety second, safety third.



As mentioned earlier the laser pointer is operated under software control by Mach. It is powered by a -3 Volt DC supply, the AC side of which is switched on and off by an opto isolated, solid state relay. The input side of this relay requires less than 10 mA at 5 Volts so this is driven directly from the LPT breakout board.

Relays such as this are also ideal for computer controlled switching of heavier loads such as spindle motors, dust extraction systems etc. A Google search will provide data sheets and specifications of the various types including those that take a 0 to 10K resistive input to provide an output speed control of ac motors. The output is typically rated 480 Volts at 25 Amps but a considerable sized heatsink would be necessary for operation at this current.

My touch plate is just a piece of copper clad PCB bonded to a piece of brass (to give it some weight), one end of the electrical connection is soldered to the PCB whilst the other end is connected to pin 15 of the LPT port. PCB material is ideal for this purpose as the conductive surface, being soft, is kind to the cutting edge of the tool and when the surface eventually becomes peppered with tiny indentations it is cheap and easy to replace with another piece.


This is an extremely effective and accurate way of setting the tool height and again nothing could be simpler, both to implement and to use.


In some instances (where insulated spindles are used) the cutting tool will not be at ground potential therefore it will be necessary to temporally connect the cutting tool to ground using a short lead and crocodile clips whilst the tool height is set.

CNC is only limited by our imagination.


copyright (c), all rights reserved.

Rounded Rectangle: CNC Home.
Rounded Rectangle: Construction 1.
Rounded Rectangle: Construction 2.
Rounded Rectangle: Construction 3.
Rounded Rectangle: Construction 4.
Rounded Rectangle: Construction 5.
Rounded Rectangle: Routing & Cutting.
Rounded Rectangle: Vinyl Cutting.
Rounded Rectangle: Lithophanes.
Rounded Rectangle: Engraving.
Rounded Rectangle: Making a Vinyl Cutter.
Rounded Rectangle: Soft & Hard Issues.
Rounded Rectangle: Micro Stepping.
Rounded Rectangle: Bob the Mill.
Rounded Rectangle: Making Printed Circuits.
Rounded Rectangle: Making a 4th Axis.
Rounded Rectangle: Tool Position Setting (1).
Rounded Rectangle: Low Power Lasers.
Rounded Rectangle: Gallery.
Rounded Rectangle: Related Links.
Rounded Rectangle: Site Map.
Rounded Rectangle: Sam.
Rounded Rectangle: Optic.
Rounded Rectangle: The X Files.
Rounded Rectangle: Bertie.
Rounded Rectangle: The Rover Jet Engine.
Rounded Rectangle: The New Laser Project.
Rounded Rectangle: The RF Laser.
Rounded Rectangle: Various Projects.
Rounded Rectangle: Rounded Rectangle: 2