Great Start Script Gcode Snippets
Scott Smith

Last updated on June 11th, 2017 at 02:34 pm

Many slicers today have the option to add specialized GCODE to the beginning and end of your print jobs. These scripts contain command code values that conduct special functions like, move the print head up, pre heat the nozzle and hot bed as well as many other functions.
I’ll post a few that I like to include in my start up and ending scripts with my MK2.

Note: at this time 12/16/2016 the EEPROM on the Rambo board is not unlocked so without great effort you can not save these commands to eeprom and need to be implemented via start or end scripts.
Update: Recent revisions to firmware now allow updating the eeprom so these values can be saved to your printer as well as running them via gcode.

Start Up Script

 

M300 S1567 P240; Play that Beep Beep Yo
M301 P22.18 I1.27 D96.74 ; PID Tuning delete this line if you do not want to use it
G28 W ; home all without mesh bed level
G1 E-1 F100; retract 1mm at speed of 100mms to prevent oozing when mesh bed leveling
G80 ; mesh bed leveling
G1 Y-3.0 F1000.0 ; go outside printing area
G1 X60.0 E9.0 F1000.0 ; intro line
G1 X150.0 E12.5 F1000.0 ; intro line
G1 Y-1.0 F1000.0 ; Reversal Intro line grabs melted filament off the nozzle
G1 X10.0 E12.5 F1000.0 ; Prepare to print from home
M205 X15 Z0.4 E5 ; set max jerk you can delete this line if you do not want it being used

 

Ending Script

G91 ; Relative positioning so the printer knows where to do it's math from from here forward
G1 E-1 F900 ; Retract 1mm at 15mm/sec to reduce filament ooze
G1 F600 Z+10 ; Raise off print 10 mm at 2mm/sec before we make larger moves
G90 ; Absolute positioning
G1 F2000 Z205 X5 Y205 ; Move print head all the way to the top out of the way
G1 F4000 X10 Y207 ;go to rear corner bringing the bed forward
M104 S0 ; Turn off hot end heater
M107 ; Turn off print cooler
M140 S0 ; Disable heated bed
G92 E0 ; Reset extruder position
M84 ; Turn steppers off
M117 Prusa i3 ready ; Display a message on the screen of your liking
M300 S1567 P240 ; Play some beeps so we can hear the print has finished

 

Other helpful gcode snippets you may like to try.

PID Autuning your nozzle temps.

This will be a very important feature to get more consistent temps on your extruder delivering more uniform extrusions.

Performing an Autotune requires you to issue a command that repeats itself several times and once complete presents you with the best average values you can then add to your start gcode.

I use Pronterface to connect via USB to my printer to run the autotune. I find it easier to manually enter these commands where I can see the feedback on my computer and then copy the values that are output to mg start up script.

If you don’t already have a copy of Pronterface you can download a copy here. Printrun appears to be what the package is named these days but Pronterface is still part of the application package.

Once you have installed Pronterface, launch the click connect up top app and enter

the M303 E0 s200 c8   gcode as shown in the illustration below.

pronter1

Click Photos to Enlarge

Once you’ve entered the command click send and the process will begin. It will run thru a series of cycles of heating your nozzle and gathering the temperature values and once completed it will instruct you which values you should copy and use as your PID Autotune values as shown below.

pronter2

Click Photos to Enlarge

So with the above values derived from the tuning process we would write a line of gcode to place in our staring script like this

M301 P23.99 I1.44 D100.24  ; PID Autotun Values for my printer

 

Now once completed you can insert the line above with your PID values into your starting script and experience much more stabilized nozzle temperatures.

You can find more in depth information at the RepRap site relating to PID Autotune here.

Join in Comment below...

What is the utility of “M115 U3.0.7 ; tell the printer latest firmware version available”. If a new firware version has been installed… it’s not enought?

I know these are just examples, but you should probably have your “M115 U3.0.7” changed to “M115 U3.0.9” instead for people that cut and paste the commands.