Makergear M2: Slic3r Start and End G-Code Routines

Being that type of guy, my Start and End G-Code routines are somewhat more elaborate than usual…

The Start routine handles homing, which is more dangerous than you might think, and wiping the drool off the nozzle:

;-- Slic3r Start G-Code for M2 starts --
;  Ed Nisley KE4NZU - March 2013
M140 S[first_layer_bed_temperature]	; start bed heating
G90				; absolute coordinates
G21				; millimeters
M83				; relative extrusion distance
M84				; disable stepper current
G4 S3			; allow Z stage to freefall to the floor
G28 X0			; home X
G92 X-95		; set origin to 0 = center of plate
G1 X0 F30000    ; origin = clear clamps on Y
G28 Y0			; home Y
G92 Y-125		; set origin to 0 = center of plate
G1 Y-122 F30000    ; set up for prime near front edge
G28 Z0			; home Z
G92 Z1.0		; set origin to measured z offset
M190 S[first_layer_bed_temperature]	; wait for bed to finish heating
M109 S[first_layer_temperature]		; set extruder temperature and wait
G1 Z0.0 F2500	; plug extruder on plate
G1 E10 F300		; prime to get pressure
G1 Z5 F2500		; rise above blob
G1 Y-115 F30000	; move away
G1 Z0.0 F2500	; dab nozzle to remove outer snot
G4 P1			; pause to clear
G1 Z0.1			; clear bed for travel
;-- Slic3r Start G-Code ends --

The fundamental problem with homing is that you don’t know where the nozzle stands in relation to the build platform and the bulldog clips clamping the glass plate to the aluminum heater. If you simply home X and Y with Z unchanged, you will eventually plow the nozzle directly across a clip. Trust me on this, you do not want to do that.

So Line 7 disables the stepper motors. In an ideal world, the Z axis stage would then free-fall to the bottom of the chassis during the 4 second pause produced by the G4 S3 instruction. In the real world, that works most of the time, but the platform sometimes sticks where it is. You don’t want to home the Z axis to the top of its travel, because that will eventually crunch the nozzle into those clips, so I plan to add a bottom limit switch so I can drive the platform to a known location away from everything else.

The default M2 Start G-Code puts the XY origin at the front left side of the platform, following the RepRap convention. Maybe it’s just me, but having the origin in the middle of the platform makes more sense for my objects; most of my OpenSCAD models are more-or-less symmetric, so putting the XY origin at their center works well. Ultimately, it doesn’t matter as long as you’re consistent, but my Start G-Code doesn’t produce the same results as the Makergear setup.

Line 9 homes the X axis and Line 10 sets the coordinate to -95. The X axis home position is about 5 mm from the left edge of the glass plate, so the nozzle has about 195 mm of travel to the right edge of the 200 mm plate. The X=0 origin will be in the middle of the printable range, with -95 mm to the left limit (the home position) and +95 to the right edge; the nozzle can travel another 30 mm beyond the right edge to about +125. Line 11 puts the nozzle in the middle of its travel at X=0.

Line 12 homes the Y axis and Line 13 sets the coordinate to -125. The Y axis home position is almost exactly on the front edge of the 250 mm glass plate, so the Y=0 origin is centered on the plate. The nozzle can travel an additional 10 mm off the rear edge of the plate. Note that you must position the nozzle somewhere on the X axis that avoids the bulldog clips; any of X=±95 or X=0 will work. Line 14 puts the nozzle in the middle of the plate at Y=0; it’s already at X=0, so the plate is now centered.

Line 15 homes the Z axis. I’ve set the limit switch so that the home position leaves exactly 1.0 mm between the nozzle and the glass plate, which I find easier to measure than the Makergear suggestion of 0.1 mm. Of course, that’s because I have a Starret taper gauge in my tool cabinet. Use what you have, but use it consistently.

Line 16 sets the Z axis coordinate position to +1.0 mm, matching the measured height, so that Z=0 corresponds to the nozzle exactly kissing the glass plate. The Makergear defaults put Z=0 about 0.1 mm above the platform; I’d rather apply model- and material-dependent offsets to “natural” machine positions.

All of that ignores Z axis backlash. Some preliminary guesstimates put that around 0.1 mm, far better than my Sherline, but still large with respect to the layer thickness. I need more measurements of that, plus some measurements of the actual glass flatness. I think the glass bows upward by about 0.1 mm in the middle, but that requires better probing that will be easier under LinuxCNC control where I can do automated platform mapping.

With the nozzle parked 1.0 mm over the platform, the next two lines wait for everything to reach the proper temperature. I preheat the platform and crank up the extruder temperature before starting the program , so these steps don’t take too long.

However, the nozzle cools off as the drool contacts the much colder platform (it’s heated to 70 °C, but that’s cooler than 150-ish °C by a considerable margin) and the PID loop struggles to reheat it. I think that’s due to the default I term being only 0.1, which reduces integral windup during preheating, but also slows recovery from a sudden thermal load. It helps to preheat the nozzle about 10 °C over the desired temperature, then let it cool during this step.

M2 - Wipe blobs on glass platform
M2 – Wipe blobs on glass platform

Line 19 uses Nophead’s trick (which I cannot find now) of planting the nozzle on the plate at Z=0.0 to reduce drool, although I do that after the nozzle reaches extruding temperature. The drool forms a blob on the platform as the nozzle heats, but the nozzle punches directly through it on the way to Z=0.0.

Line 20 runs 10 mm of filament into the hot end to pressurize the extruder. Some of the molten goo oozes out around the nozzle, enlarging the blob on the glass plate. The object of the game is to leave all that behind: having a generous contact patch on the glass helps.

The larger blob on the left of the picture (at Y=-125) comes from that process.

Line 21 starts the wiping dance:

  • Raise the nozzle above the blob to Z=5 mm
  • Move away from the blob by 5 mm. I’ll probably change this to move in the +X direction.
  • Tap the nozzle on the platform, so (almost all of) the molten PLA slides away from the orifice
  • Get 0.1 mm of clearance from the platform, directly over the new blob
  • Scoot off to print a Skirt extrusion around the object

The smaller, rather flat, blob on the right comes from the nozzle tap. A thin hair may stretch from the blob to the start of the skirt, but it doesn’t amount to much.

Sometimes, of course, the blobs don’t adhere to the glass plate and accompany the nozzle to the start of the skirt. By the conservation of perversity, that’s also when the skirt starts on the far side of the origin, so the blob smears all over the object’s first layers. The Makergear wipe process extrudes the waste filament over the side of the plate, then shears it off as the nozzle returns to the surface; I’ll try blending that in with my startup sequence at some point.

My slic3r configuration extrudes at least 15 mm of filament into the skirt, giving the extruder plenty of time to reach a steady state before starting the actual object. Generally that’s far more than enough filament, but sometimes … well, it’s a good idea to watch what’s going on.

On the other end of the printing process, the End G-Code routine handles shutdown with the object on the platform:

;-- Slic3r End G-Code for M2 starts --
;  Ed Nisley KE4NZU - March 2013
M104 S0		; drop extruder temperature
M140 S0		; drop bed temperature
M106 S0		; bed fan off
G1 Z195	F2500	; lower bed
G1 X0 Y0 F30000	; center nozzle
M84     	; disable motors
;-- Slic3r End G-Code ends --

Line 3 begins turning the heaters and bed fan off. I’ve unplugged the fan for now, so Line 5 is just for completeness.

Line 6 lowers the bed to the bottom under power, because that’s faster that a free fall and it’s guaranteed to work.

With the object safely out of the way, Line 7 centers the nozzle over the platform.

Finally, Line 8 turns off the steppers off; the platform drops another few millimeters

Then everything cools down. Because I run the platform at well above PLA’s glass transition temperature, it must cool for quite a while until the object stiffens up.