Thing-O-Matic: Z-Minimum Probe G-Code

The G-Code in start.gcode homes all three axes, but now I have two limit switches on the Z axis: the MBI Z-Maximum at the top and a new Z-Minimum on the platform. The Z axis platform can’t miss the switch at the top, but I must position the nozzle directly over the Z-Minimum switch on the platform before probing for it. Homing the stage at the top of the Z axis makes sure the nozzle starts more-or-less at the right height over the switch, which then provides an exact adjustment.

For the home switches on my Sherline CNC milling machine, the EMC2 homing routines proceed in two stages: a fast slew to find the switch, then a slow approach to ensure the axis doesn’t overrun the switch. That seemed like a good way to ensure that the X and Y stages would home repeatably enough to hit a 2 mm button with a 1 mm nozzle every time.

I recycled the default home sequence for coarse homing, albeit with the speeds cranked up a bit:

(- coarse home axes -)
G162 Z F1000	(home Z to get nozzle out of danger zone)
G161 Y F4000	(retract Y to get X out of front opening)
G161 X F4000	(now safe to home X)
G92 X-53.0 Y-59.0 Z117.0	(set XYZ coordinate zeros)

Then the fine homing sequence backs off a few millimeters and bumps the switches very slowly:

(- fine home axes)
G0 X-51 Y-57 Z115 F400	(back off switches)
G161 Y F200
G161 X F200
G162 Z F200
G92 X-53.0 Y-59.0 Z117.0	(re-set XYZ coordinate zeros)

You could set relative motion mode with G91; that might be cleaner all around.

I discovered experimentally that you must set all three axes in the G92 command, because any missing axes get set to 0.0: probably not what you want. It’s not what I expected, either, but this isn’t the EMC2 G-Code dialect I’m more familiar with.

In normal use, the extruder has been heating for quite a while and there’s no pressure inside. There’s most likely a long strand of filament hanging off the end that will interfere with the switch, so a preliminary wipe is in order. I first pause the nozzle over the middle of the platform as a visual indication that everything started up OK, then make a dogleg around the wiper blade to the front of the wipe station:

(- manual nozzle wipe)
G0 X0 Y0 Z10	    (pause at center to build confidence)
G4 P500
G0 X40 Y-57.0 Z10	(move to front, avoid wiper blade)
G0 X56            (to wipe station)
G0 Z6.0           (down to wipe level)
M6 T0			        (wait for temperature settling)
G1 Y-40	F1000		  (slowly wipe nozzle)

With the dry wipe done, move to the Z-Min switch and poke it very very slowly:

(- home Z downward to platform switch)
G0 X55.9 Y8 Z3	      (get over build platform switch)
G161 Z0 F50	          (home downward very slowly)
G92 X55.7 Y8 Z1.45	  (set Z for actual switch trip height)
G0 Z6.0			          (back off switch to wipe level)

I had to determine the actual height of the trip point experimentally, by doing some test extrusions and adjusting that Z1.45 to make the answer come out right. I’m sure that will change as things settle into their final places.

Ditto for the exact XY location of the Z-Min switch, which I found by using a very slow G1 move to Z2.0 in place of the G161 probe.

Note that you increase the Z value in G92 to lower the initial nozzle position and vice versa. It helps to draw some diagrams and work through the whole thing to be sure you understand it; that’s what I had to do, anyway.

Then return the nozzle to the wipe station by running over the blade again to dislodge any gunk on the front side, crank up the extruder to build up pressure, and wipe again to get rid of the snot ball:

(- start extruder and re-wipe)
G0 X56 Y-40     (set up for wipe from rear)
G1 Y-57.0 F1000 (wipe to front)
M108 R2.0	      (set stepper extruder speed)
M101		        (Extruder on, forward)
G4 P4000  	    (take up slack, get pressure)
M103		        (Extruder off)
G4 P4000  	    (Wait for filament to stop oozing)
G1 Y-40	F1000		(slowly wipe nozzle again)
G0 X0           (get away from wiper blade)

Running the extruder here ensures that, no matter what, the molten ABS in the hot end begins the print in a consistent state every time. The extruded length varies from a few millimeters to a real string, so there’s obviously plenty of variation.

Then I put a manual splodge turd at the middle of the front edge of the platform. This is unnecessary now that SF40 shuts off the extruder before zipping off to the first Skirt, so I’ll probably junk it in the near future:

(- manual splodge)
G0 X0 Y-58		  (to front center)
G0 Z0.5 		    (just over surface)
M108 R2.0	      (set stepper extruder speed)
M101            (start extruder)
G4 P2000        (build up a turd)

Putting all that together with some odds & ends gives the complete current version of start.gcode:

(---- start.gcode begins ----)
(MakerBot Thing-O-Matic with aluminum HBP and Z-min platform switch)
(Tweaked for TOM 286 - Ruttmeister MK5 stepper extruder mod)
(Ed Nisley - KE4ZNU - May 2011)
(- set initial conditions -)
G21		(set units to mm)
G90		(set positioning to absolute)
(- begin heating -)
M104 S210 T0	(extruder head)
M109 S120 T0	(HBP)
(- coarse home axes -)
G162 Z F1000	(home Z to get nozzle out of danger zone)
G161 Y F4000	(retract Y to get X out of front opening)
G161 X F4000	(now safe to home X)
G92 X-53.0 Y-59.0 Z117.0	(set XYZ coordinate zeros)
(- fine home axes)
G0 X-51 Y-57 Z115 F400	(back off switches)
G161 Y F200
G161 X F200
G162 Z F200
G92 X-53.0 Y-59.0 Z117.0	(re-set XYZ coordinate zeros)
(- manual nozzle wipe)
G0 X0 Y0 Z10	    (pause at center to build confidence)
G4 P500
G0 X40 Y-57.0 Z10	(move to front, avoid wiper blade)
G0 X56            (to wipe station)
G0 Z6.0           (down to wipe level)
M6 T0			        (wait for temperature settling)
G1 Y-40	F1000		  (slowly wipe nozzle)
(- home Z downward to platform switch)
G0 X55.9 Y8 Z3	      (get over build platform switch)
G161 Z0 F50	          (home downward very slowly)
G92 X55.7 Y8 Z1.45	  (set Z for actual switch trip height)
G0 Z6.0			          (back off switch to wipe level)
(- start extruder and re-wipe)
G0 X56 Y-40     (set up for wipe from rear)
G1 Y-57.0 F1000 (wipe to front)
M108 R2.0	      (set stepper extruder speed)
M101		        (Extruder on, forward)
G4 P4000  	    (take up slack, get pressure)
M103		        (Extruder off)
G4 P4000  	    (Wait for filament to stop oozing)
G1 Y-40	F1000		(slowly wipe nozzle again)
G0 X0           (get away from wiper blade)
(- manual splodge)
G0 X0 Y-58		  (to front center)
G0 Z0.5 		    (just over surface)
M108 R2.0	      (set stepper extruder speed)
M101            (start extruder)
G4 P2000        (build up a turd)
(---- start.gcode ends ----)

Then I did a bunch of measurements to see how it worked…