Why I use RepRap Firmware (Duet Wi-Fi) for my CNC

Probe XYZ workpiece Origin
How about this little gem. I was able to create and use and XYZ probe touchplate and enable the machine to use it with a few lines of gcode in a macro.

The macro sort of cheats the system. It uses a gcode command that normally instructs the system how far away a Tool is from an endstop. Meaning it usually just measures that offset distance. But I am highjacking that function to move the bit into position then I manually set my own offset distances. But I have to reset the tool offset with every use. Not a bad deal.

This macro will set the G55 origin to the corner of the work material. The G54 and G53 coordinate systems will not be affected.



	;This Macro will use a Corner Touchplate to probe the Origin of a Material block.  Meaning it will find the top corner of your block of wood to CNC.
;This macro "Tricks" the machine into doing this by using the M585 "Probe Tool" offset function.  This function is not intended for this purpose but I made it work.
;This function usually is used to do a one time machine calibration to find the offset of a tool.  So the code below may look funky because I have to keep resetting the tool offset.



	;This section should be added to your config.g or something but you can also define it here.
;M558 P5 C"!e0stop" K1 		;Define Probe
;G31 P950 X0 Y0 Z0 K1		;Define Probe offsets. I choose to have this probe use a 0 offset so I can override it in each probe macro.


G90						;Use Absolute Positioning
T0						;Select Default Tool

	;Display a message to add the touchplate and jog bit above it.
M291 R"Jog to above the touchplate" P"Click OK to proceed." S2 T0 X1 Y1 Z1

M585 Z30 F120 P0 S1		;Probe For Z
G10 P0 L1 X0 Y0 Z0		;Reset the tool Offset
G92 Z10					;Set home position for this axes in the G53/G54 Coord system	<--This is where you can add the Probe offset
G10 L20 P2 Z10			;Set home position for this axes in the G55 Coord system		<--This is where you can add the Probe offset


G91						;Use relative Positioning


M585 Y100 F420 P0 S1	;Probe For Y	S1= Move in Minus direction (S0=Plus)
G10 P0 L1 X0 Y0 Z0		;Reset the tool Offset
G10 L20 P2 Y1.58			;Set home position for this axes in the G55 Coord system	<--This is where you can add the Probe offset


G0 Y10 F6000			;Reposition to +10 mm

M585 X100 F420 P0 S1	;Probe For X	S1= Move in Minus direction (S0=Plus)
G10 P0 L1 X0 Y0 Z0		;Reset the tool Offset
G10 L20 P2 X1.58			;Set home position for this axes in the G55 Coord system	<--This is where you can add the Probe offset


G0 X10 F6000			;Reposition to +10 mm
G0 Z30 Y30				;Lift tool out of the way


G90						;Use Absolute Positioning
M291 R"Remove the Touchplate" P"Probing is complete." S1 T4		;T3 = Timeout	S1= Close button only
G55						;Switch to the G55 Coords
G0 X0 Y0 Z0				;Move to the new origin
G54						;Switch back to the machine Coords


; You can use this to check the probe status.  Is it currently triggered?
;G31: Set or Report Current Probe status

As you can see in the demo video it works nicely. And I did all of this without a single line of code in firmware!

1 Like