[Tip] Faster and more readable Mini 1 and TAZ 6 G-code

Get answers & advice for all of your 3D printing & Free Software needs here!
Post Reply
User avatar
pehjota
Posts: 12
Joined: Fri Aug 18, 2017 2:09 pm
Location: New Jersey, USA
Contact:

[Tip] Faster and more readable Mini 1 and TAZ 6 G-code

Post by pehjota » Wed Oct 30, 2019 2:10 am

A little over two years ago I started rewriting the LulzBot start/end G-code procedures to speed up Libiquity's prints, and ever since I've been improving the G-code and adding more configurations. I planned to rework my changes into patches for LulzBot, but I found Phabricator's Diffusion patch submission workflow awkward (plus my tuits are always square...). And now that Aleph Objects activity on Phabricator has ceased, I decided now I better just post what I have here.

I use Slic3r, so this G-code contains Slic3r's temperature variables in square brackets; adjust accordingly for Cura or other slicers. The TAZ 6 procedures also have some filament temperature variables in angle brackets that you should set (unfortunately Slic3r doesn't have retraction, wiping, probing, or removal temperatures that can be used in G-code).

Disclaimers: Although these procedures have been tested on Libiquity's LulzBot printers, I make no guarantees that these procedures will work on your printer and tool head. Beware that any faulty G-code (including when generated by a slicer) has the potential to damage equipment, and you should always monitor a printer especially closely when running any G-code program (including a sliced part design) for the first time. All that said, if you're comfortable with customizing G-code and you want somewhat faster prints, read on...

I made the G-code more readable by adding more comments, more blank lines, and vertically aligned command arguments. I also made some command sequencing changes to increase speed. First, I heat up the hotend to retraction temperature while homing all three axes (LulzBot G-code doesn't start heating up until after homing the axes) and then move the nozzle to the wiper pad while heating to wiping temperature (LulzBot G-code waits until wiping temperature, then spends extra time moving to the wiper pad). Here is Mini 1 start G-code that does this (beware: retraction, wiping, and probing temperatures in this G-code are hard coded for HIPS):

Code: Select all


; Input file name: [input_filename]
; Printer preset: [printer_preset]
; Filament preset: [filament_preset]
; Print preset: [print_preset]

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Begin LulzBot Mini HIPS start G-code ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; Set units, positioning modes, and extruder origin
G21                                  ; Set units to millimeters
G90                                  ; Set absolute positioning mode
M82                                  ; Set E absolute mode (override G91)
G92 E0                               ; Set extruder position to 0 (origin)

; Begin heating hotend to HIPS retraction temperature
M107                                 ; Turn off the print cooling fan
M104 S150                            ; Set hotend temperature without waiting
M140 S[first_layer_bed_temperature]  ; Set bed temperature without waiting

; While waiting for the hotend to heat, auto-home the axes
G28                                  ; Auto-home all axes
M109                                 ; Wait for hotend temperature

; Retract filament before wiping
G1 Z150 E-30 F75                     ; Slowly lower Z and retract filament

; Begin heating hotend to HIPS wiping temperature
M104 S170                            ; Set hotend temperature without waiting

; While waiting for the hotend to heat, position the nozzle over the wiping pad
G1 X45 Y174 Z10 F11520               ; Move nozzle to just over wiping pad
M109                                 ; Wait for hotend temperature

; Wipe the nozzle
G1           Z-0.5 F4000             ; Plunge nozzle into wiping pad
G1 X55  Y172       F4000             ; Wipe
G1 X45  Y174 Z0    F4000             ; Wipe
G1 X55  Y172       F4000             ; Wipe
G1 X45  Y174       F4000             ; Wipe
G1 X55  Y172       F4000             ; Wipe
G1 X45  Y174       F4000             ; Wipe
G1 X55  Y172       F4000             ; Wipe
G1 X60  Y174       F4000             ; Wipe
G1 X80  Y172       F4000             ; Wipe
G1 X60  Y174       F4000             ; Wipe
G1 X80  Y172       F4000             ; Wipe
G1 X60  Y174       F4000             ; Wipe
G1 X90  Y172       F4000             ; Wipe
G1 X80  Y174       F4000             ; Wipe
G1 X100 Y172       F4000             ; Wipe
G1 X80  Y174       F4000             ; Wipe
G1 X100 Y172       F4000             ; Wipe
G1 X80  Y174       F4000             ; Wipe
G1 X100 Y172       F4000             ; Wipe
G1 X110 Y174       F4000             ; Wipe
G1 X100 Y172       F4000             ; Wipe
G1 X110 Y174       F4000             ; Wipe
G1 X100 Y172       F4000             ; Wipe
G1 X110 Y174       F4000             ; Wipe
G1 X115 Y172 Z-0.5 F1000             ; Wipe slower, bury nozzle in cleanish area
G1 Z10                               ; Lift out of wiping pad

; Begin heating hotend to HIPS probing temperature
M104 S170                            ; Set hotend temperature without waiting

; While waiting for the hotend to heat, auto-home X and Y
G28 X0 Y0                            ; Auto-home X and Y
M109                                 ; Wait for hotend temperature

; Probe the bed and enable bed leveling compensation
M204 S300                            ; Set acceleration for probing moves
G29                                  ; Probe the bed
M204 S2000                           ; Set acceleration back to normal
G1 X5 F5000                          ; Move away from X endstop
G1 Z10 F5000                         ; Lift off the bed-leveling washer

; Begin heating hotend to first layer temperature
M104 S[first_layer_temperature]      ; Set hotend temperature without waiting

; While waiting for the hotend to heat, position the nozzle and pause
G1 X5 Y15 F5000                      ; Move near front left corner
G4 S1                                ; Dwell/pause command queue for 1 second
M400                                 ; Pause processing until moves complete

; Ensure the hotend and bed are at the first layer temperatures
M109                                 ; Wait for hotend temperature
M190                                 ; Wait for bed temperature

; Extrude filament back into the nozzle
G1 Z2 E0 F75                         ; Slowly raise nozzle and extrude filamant

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; End LulzBot Mini HIPS start G-code ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Here's the Mini 1 end G-code, which pushes out the bed for part removal 15 mm farther than LulzBot G-code does (removal temperature hard coded for HIPS):

Code: Select all


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Begin LulzBot Mini HIPS end G-code ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; Ensure moves are complete
M400                                 ; Pause processing until moves complete

; Begin cooling
M104 S0                              ; Set hotend temperature without waiting
M140 S0                              ; Set bed temperature without waiting
M107                                 ; Turn off the print cooling fan

; Move to cooling position and retract filament
G92 E5                               ; Set extruder position for retraction
G1 X5 Y5 Z160 E0 F10000              ; Move bed and nozzle and retract filament
M190 R60                             ; Wait for bed to cool

; Move to print removal position
M140 S0                              ; Set bed temperature without waiting
G1 X145 Y190 Z160 F10000             ; Move bed forward and toolhead right

; Idle
M84                                  ; Turn off stepper motors
G90                                  ; Set absolute positioning mode

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; End LulzBot Mini HIPS end G-code ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

For the TAZ 6 I made further speed improvements that I've not yet ported back to the Mini 1 G-code, such as moving the nozzle to the first probe point (the front-left bed-leveling washer) while (instead of after) heating up to probing temperature. Single Extruder v2.1 start G-code:

Code: Select all


; Input file name: [input_filename]
; Printer preset: [printer_preset]
; Filament preset: [filament_preset]
; Print preset: [print_preset]

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Begin LulzBot TAZ 6 Single Extruder v2.1 start G-code ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;
; Initialization, homing, and retraction
;

; Set units, positioning modes, and extruder origin
M73 P0                               ; Set LCD print progress to 0%
M75                                  ; Start print job timer
G26                                  ; Clear any "PROBE FAIL" (needed? see T372)
G90                                  ; Set absolute positioning mode
M204 S500                            ; Set acceleration
M82                                  ; Set E absolute mode (override G91)
G92 E0                               ; Set extruder position to 0 (origin)
M420 S0                              ; Disable bed leveling with previous matrix

; Begin heating hotend to retraction temperature
M107                                 ; Turn off the print cooling fan
M104 S<retraction_temperature>       ; Set hotend temperature without waiting
M140 S[first_layer_bed_temperature]  ; Set bed temperature without waiting

; While waiting for the hotend to heat, auto-home the axes
M117 Homing all axes...
G28                                  ; Auto-home all axes
M109 R<retraction_temperature>       ; Wait for hotend temperature

; Retract filament and move Y toward wiping pad (Z_SAFE_HOMING_Y_POINT - 30 mm)
M117 Retracting...
G1 Y228 E-30 F100                    ; Retract and move toward wiping pad

;
; Wiping
;

; Begin heating hotend to wiping temperature
M104 S<wiping_temperature>           ; Set hotend temperature without waiting
M400                                 ; Don't show status until retracted

; While waiting for the hotend to heat, position the nozzle over the wiping pad
M117 Moving to wipe...
G1 X-15 Y100 F3000                   ; Move nozzle over wiping pad
M109 R<wiping_temperature>           ; Wait for hotend temperature

; Wipe the nozzle
M117 Wiping nozzle...
G1           Z1   F3000              ; Push nozzle into wiping pad
G1 X-17 Y95       F1000
G1 X-17 Y90       F1000
G1 X-17 Y85       F1000
G1 X-15 Y90       F1000
G1 X-17 Y80       F1000
G1 X-15 Y95       F1000
G1 X-17 Y75       F2000
G1 X-15 Y65       F2000
G1 X-17 Y70       F2000
G1 X-15 Y60       F2000
G1 X-17 Y55       F2000
G1 X-15 Y50       F2000
G1 X-17 Y40       F2000
G1 X-15 Y45       F2000
G1 X-17 Y35       F2000
G1 X-15 Y40       F2000
G1 X-17 Y70       F2000
G1 X-15 Y30  Z2   F2000
G1 X-17 Y35       F2000
G1 X-15 Y25       F2000
G1 X-17 Y30       F2000
G1 X-15 Y25  Z1.5 F1000
G1 X-17 Y23       F1000
G1          Z10   F1000              ; Lift out of wiping pad
M400                                 ; Don't heat or show status until wiped

;
; Probing
;

; Begin heating hotend to probing temperature
M104 S<probing_temperature>          ; Set hotend temperature without waiting

; While waiting, move to (LEFT_PROBE_BED_POSITION, FRONT_PROBE_BED_POSITION)
M117 Moving to probe...
G1 X-9 Y-9                           ; Move over front left bed-leveling washer
M400                                 ; Don't show status until moved
M109 R<probing_temperature>          ; Wait for hotend temperature

; Probe the bed and enable bed-leveling compensation
M117 Probing bed...
M204 S100                            ; Set acceleration for probing moves
G29                                  ; Probe the bed
M204 S500                            ; Set acceleration back to normal
M420 S1                              ; Enable bed leveling with new matrix
G1 Z10 F5000                         ; Lift off the bed-leveling washer

;
; Printing
;

; Begin heating hotend to first layer temperature
M104 S[first_layer_temperature]      ; Set hotend temperature without waiting
M400                                 ; Don't show status until done probing

; While waiting for the hotend to heat, position the nozzle and pause
M117 Moving off probe...
G1 X0 Y0 Z15 F5000                   ; Move above and away from last washer
M400                                 ; Don't show status until moved

; Ensure the hotend and bed are at the first layer temperatures
M109 R[first_layer_temperature]      ; Wait for hotend temperature
M190 S[first_layer_bed_temperature]  ; Wait for bed temperature

; Extrude filament back into the nozzle
M117 Priming nozzle...
G1 Z2 E0 F75                         ; Slowly extrude filament back into nozzle
M400                                 ; Don't show status until primed
M117 Printing...

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; End LulzBot TAZ 6 Single Extruder v2.1 start G-code ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

And the end G-code beeps to let you know when the print is done (remove the M300 command if this annoys you) and asks if you want to keep the hotend and bed warm to save time starting up the next print (though for safety, in case you walk away from the printer, it starts cooling down until you push the knob):

Code: Select all


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Begin LulzBot TAZ 6 Single Extruder v2.1 end G-code ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; Ensure moves are complete
M400                                 ; Pause processing until moves complete

; Begin cooling
M104 S<retraction_temperature>       ; Cool hotend to retraction without waiting
M140 S<removal_bed_temperature>      ; Cool bed to removal temp without waiting
M107                                 ; Turn off the print cooling fan

; Retract and re-prime filament
G91                                  ; Make below Z and E movements relative
G1     E-3 F1000                     ; Retract some filament from the nozzle
G1 Z20 E-3 F3000                     ; Lift nozzle and retract more filament
G1      E6 F3000                     ; Re-prime nozzle (T584)
G90                                  ; Restore absolute positioning mode

; Cool bed
M117 Moving to cool...
G1 Y0 F3000                          ; Move bed to cooling position
M400                                 ; Don't show status until moved
M190 R<removal_bed_temperature>      ; Wait for bed to cool

; Move to print removal position
M117 Printing complete
G1 X-19 Y280 F3000                   ; Move bed forward and toolhead left
M84                                  ; Turn off stepper motors (implicit M400)
M77                                  ; Stop print job timer
M300 P200                            ; Beep

; Optionally keep hotend and bed warm
M104 S0                              ; Cool hotend without waiting
M140 S0                              ; Cool bed without waiting
M0 Done, keep warm?
M104 S<retraction_temperature>       ; Set hotend to retraction without waiting
M140 S<removal_bed_temperature>      ; Set bed to removal temp without waiting

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; End LulzBot TAZ 6 Single Extruder v2.1 end G-code ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Finally here are (less thoroughly tested) G-code procedures for the TAZ 6 with the Dual Extruder v3. Start:

Code: Select all


; Input file name: [input_filename]
; Printer preset: [printer_preset]
; Filament preset: [filament_preset]
; Print preset: [print_preset]

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Begin LulzBot TAZ 6 Dual Extruder v3 start G-code ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;
; Initialization, homing, and retraction
;

; Set units, positioning modes, and extruder origin
M73 P0                               ; Set LCD print progress to 0%
M75                                  ; Start print job timer
G26                                  ; Clear any "PROBE FAIL" (needed? see T372)
G90                                  ; Set absolute positioning mode
M204 S500                            ; Set acceleration
M82                                  ; Set E absolute mode (override G91)
M420 S0                              ; Disable bed leveling with previous matrix

; Begin heating hotend to retraction temperature
M107                                 ; Turn off the print cooling fan
M104 S<retraction_temperature> T0    ; Set hotend temperature without waiting
M104 S<retraction_temperature> T1    ; Set hotend temperature without waiting
M140 S[first_layer_bed_temperature]  ; Set bed temperature without waiting

; While waiting for the hotend to heat, auto-home the axes
M117 Homing all axes...
G28                                  ; Auto-home all axes
M109 R<retraction_temperature> T0    ; Wait for hotend temperature
M109 R<retraction_temperature> T1    ; Wait for hotend temperature

; Retract filament and move Y toward wiping pad (Z_SAFE_HOMING_Y_POINT - 30 mm)
M117 Retracting...
T0                                   ; Target extruder 0
G92 E0                               ; Set extruder position to 0 (origin)
G1 Y243 E-15 F100                    ; Retract and move toward wiping pad
T1                                   ; Target extruder 1
G92 E0                               ; Set extruder position to 0 (origin)
G1 Y228 E-15 F100                    ; Retract and move toward wiping pad

;
; Wiping
;

; Begin heating hotend to wiping temperature
M104 S<wiping_temperature> T0        ; Set hotend temperature without waiting
M104 S<wiping_temperature> T1        ; Set hotend temperature without waiting
M400                                 ; Don't show status until retracted

; While waiting for the hotend to heat, position the nozzle over the wiping pad
M117 Moving to wipe...
G1 X-19 Y100 F3000                   ; Move nozzle over wiping pad
M109 R<wiping_temperature>           ; Wait for hotend temperature

; Wipe the nozzle
M117 Wiping nozzle...
G1           Z1   F3000              ; Push nozzle into wiping pad
G1 X-19 Y95       F1000
G1 X-19 Y90       F1000
G1 X-19 Y85       F1000
G1 X-17 Y90       F1000
G1 X-19 Y80       F1000
G1 X-17 Y95       F1000
G1 X-19 Y75       F2000
G1 X-17 Y65       F2000
G1 X-19 Y70       F2000
G1 X-17 Y60       F2000
G1 X-19 Y55       F2000
G1 X-17 Y50       F2000
G1 X-19 Y40       F2000
G1 X-17 Y45       F2000
G1 X-19 Y35       F2000
G1 X-17 Y40       F2000
G1 X-19 Y70       F2000
G1 X-17 Y30  Z2   F2000
G1 X-19 Y35       F2000
G1 X-17 Y25       F2000
G1 X-19 Y30       F2000
G1 X-17 Y25  Z1.5 F1000
G1 X-19 Y23       F1000
G1 X-17     Z15   F1000              ; Lift out of wiping pad
M400                                 ; Don't heat or show status until wiped

;
; Probing
;

; Begin heating hotend to probing temperature
M104 S<probing_temperature> T0       ; Set hotend temperature without waiting
M104 S<probing_temperature> T1       ; Set hotend temperature without waiting

; While waiting, move to (LEFT_PROBE_BED_POSITION, FRONT_PROBE_BED_POSITION)
M117 Moving to probe...
G1 X-3 Y-9                           ; Move over front left bed-leveling washer
M400                                 ; Don't show status until moved
M109 R<probing_temperature> T0       ; Wait for hotend temperature
M109 R<probing_temperature> T1       ; Wait for hotend temperature

; Probe the bed and enable bed-leveling compensation
M117 Probing bed...
M204 S100                            ; Set acceleration for probing moves
G29                                  ; Probe the bed
M204 S500                            ; Set acceleration back to normal
M420 S1                              ; Enable bed leveling with new matrix
G1 Z10 F5000                         ; Lift off the bed-leveling washer

;
; Printing
;

; Begin heating hotend to first layer temperature
M104 S[first_layer_temperature] T0   ; Set hotend temperature without waiting
M104 S[first_layer_temperature] T1   ; Set hotend temperature without waiting
M400                                 ; Don't show status until done probing

; While waiting for the hotend to heat, position the nozzle and pause
M117 Moving off probe...
G1 X0 Y0 Z15 F5000                   ; Move above and away from last washer
M400                                 ; Don't show status until moved

; Ensure the hotend and bed are at the first layer temperatures
M109 R[first_layer_temperature] T0   ; Wait for hotend temperature
M109 R[first_layer_temperature] T1   ; Wait for hotend temperature
M190 S[first_layer_bed_temperature]  ; Wait for bed temperature

; Extrude filament back into the nozzle
M117 Priming nozzle...
T0                                   ; Target extruder 0
G92 E-15                             ; (No-op) Keep retration extruder position
G1 Z8.5 E0 F100                      ; Slowly extrude filament back into nozzle
T1                                   ; Target extruder 1
G92 E-15                             ; Restore retration extruder position
G1 Z2   E0 F100                      ; Slowly extrude filament back into nozzle
M400                                 ; Don't show status until primed
M117 Printing...

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; End LulzBot TAZ 6 Dual Extruder v3 start G-code ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

End:

Code: Select all


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Begin LulzBot TAZ 6 Dual Extruder v3 end G-code ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; Ensure moves are complete
M400                                 ; Pause processing until moves complete

; Begin cooling
M104 S<retraction_temperature> T0    ; Cool hotend to retraction without waiting
M104 S<retraction_temperature> T1    ; Cool hotend to retraction without waiting
M140 S<removal_bed_temperature>      ; Cool bed to removal temp without waiting
M107                                 ; Turn off the print cooling fan

; Retract and re-prime filament
G91                                  ; Make below Z and E movements relative
T0                                   ; Target extruder 0
G1     E-1  F300                     ; Retract some filament from the nozzle
G1 Z10 E-5 F3000                     ; Lift nozzle and retract more filament
G1      E6 F3000                     ; Re-prime nozzle (T584, T1724)
T1                                   ; Target extruder 1
G1     E-1  F300                     ; Retract some filament from the nozzle
G1 Z10 E-5 F3000                     ; Lift nozzle and retract more filament
G1      E6 F3000                     ; Re-prime nozzle (T584, T1724)
G90                                  ; Restore absolute positioning mode

; Cool bed
M117 Moving to cool...
G1 Y0 F3000                          ; Move bed to cooling position
M400                                 ; Don't show status until moved
M190 R<removal_bed_temperature>      ; Wait for bed to cool

; Move to print removal position
M117 Printing complete
G1 X-19 Y280 F3000                   ; Move bed forward and toolhead left
M84                                  ; Turn off stepper motors (implicit M400)
M77                                  ; Stop print job timer
M300 P200                            ; Beep

; Optionally keep hotend and bed warm
M104 S0 T0                           ; Cool hotend without waiting
M104 S0 T1                           ; Cool hotend without waiting
M140 S0                              ; Cool bed without waiting
M0 Done, keep warm?
M104 S<retraction_temperature> T0    ; Set hotend to retraction without waiting
M104 S<retraction_temperature> T1    ; Set hotend to retraction without waiting
M140 S<removal_bed_temperature>      ; Set bed to removal temp without waiting

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; End LulzBot TAZ 6 Dual Extruder v3 end G-code ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

I maintain these procedures as *.gcode files in a Slic3r configuration repository, so updates will go there whenever I make them. If the forums remain up, I may also update this thread in the future. Comments and improvements welcome!
CEO, Libiquity, a freedom-respecting electronics vendor and upcoming LulzBot compatible parts vendor

Printer fleet: three TAZ 6.02 "Olive Oil" (with SE v2.1 "Tilapia" and DE v3 "Yellowfin") and one Mini 1.03 "Foxglove"

Post Reply