Playing G-code files

The Player module allows you to play files from the SD card.

Files are read one line at a time, and each line is executed as if it had been received from a controlling host.

Mac users beware: it appears that the play function does not accept files that have a space in their name.

Files on sdcard MUST be line terminated by \n ONLY, not \r (Note for MAC users). On the very latest version of smoothieware it will tolerate \r\n terminated lines.


Here are all the available options for the Player module

Option Value Description
on_boot_gcode /sd/on_boot.gcode G-code file to play when the board boots. This file will automatically be played when the board is done booting up. Useful for example if you want to home your printer when it boots, or do similar tasks. For more information see on_boot.gcode
on_boot_gcode_enable true If set to true, play the on_boot_gcode file when the board boots up
after_suspend_gcode G91 G0 E-5 G0 Z10 G90 G0 X-50 Y-50 G-code to execute automatically right after the suspend command is received, this is useful if you want to retract, or turn off heaters etc. The _ character gets converted into space
before_resume_gcode G91 G1 E1 G90 G-code to execute automatically right after the resume command is received, but before resuming execution. However, NOTE this is generally not needed as the resume will restore the state it was in before the suspend. The _ character gets converted into space
leave_heaters_on_suspend false If set to true, heaters are left ON when suspend is received. If set to false, heaters are turned OFF when suspend is received, and then turned back ON when resume is received.



You can use the play command to execute files stored on the SD card.

You must specify a file name and its path, for example :

play /sd/gcodefile.gcode

By default, the command will be quiet. If you want the command to output every G-code in the file to the serial port ( the command was called from ), add the -v ( verbose ) parameter :

play /sd/gcodefile.gcode -v

[!WARNING] Pronterface will ignore commands it does not understand, unless you prefix them with @.

Therefore, send your command as @play /sd/gcodefile.gcode and it will work.

[!DANGER] Repetier will act kind of mean, and ignore any command it doesn’t understand.

Unlike Pronterface it won’t give you a method to pass commands anyway.

You can possibly use the M24 G-code instead.


When a file is playing, you can use the progress command to get a report of the current position in the file, and elapsed time.


You can also use the abort command to stop the execution of the file.


Can be used for either sd card playing or when streaming from Pronterface or Octoprint.

Will suspend a print in progress it does the following…

  1. Send pause to upstream host, or pause if printing from sd
  2. Wait for empty queue
  3. Save the current position, extruder position, temperatures - any state that would need to be restored
  4. –retract by specified amount either on command line or in config– - not implemented yet
  5. Turn off heaters. (unless the config has leave_heaters_on_suspend true)
  6. Optionally run after_suspend gcode (set in config defines gcode to run eg. after_suspend G91G0E20G90)

User may jog or remove and insert filament at this point, extruding or retracting as needed.

This could be triggered by a Switch module to setup a simple out of filament detector.

NOTE Issuing a home after a suspend will cancel the suspend and you will not be able to resume.

NOTE the queue must drain before it will suspend, if you need to have the system suspend quicker the only way to do it is to set the config variable mm_per_line_segment 1 this will mean it will stop within 32mm, but there is a performance penalty for segmenting when you do not need to.

[!INFO] Stopping Smoothie

These are the different ways of stopping Smoothie:

Command G-code Movement Heaters File playing Recoverable Documentation Explanation
abort M26 Stops an SDCARD print immediately Not affected Aborts Position maintained, but file must be restarted Player Stops the execution of a file being played from SDCARD, it will complete the current gcode, but stop immediately after that, the rest of the queued commands are discarded. It attempts to maintain the correct position after the abort.
suspend M600 Stops once queue is empty Turned off if option enabled (default) Paused, can be resumed Yes, with resume or M601, position maintained Player Suspends the execution of a file being played from SDCARD or being streamed from a host (upstream support required currently pronterface and octoprint support it, otherwise host needs to be manually paused), all state is saved and jogging and extruding is allowed. Mainly used for mid print filament change, or filament out detection. M601 resumes the print or the resume command
No command, but there is a configurable «kill» button M112 Stops instantly if kill button pressed, if issued from host has to wait for the receive buffer to have room. Turned off aborted No, position is lost, home will be required supported-g-codes Instantly stops all operations, printer fully halts until M999 is sent. Position is lost.
Sending Control-X to smoothie over the serial port or USB serial port   should work at any time even when streaming, does the same as the kill button Turned off aborted No, position is lost, home will be required   Instantly stops all operations, printer fully halts until M999 is sent (or $X). Position is lost.

If the kill button is pressed (or there is a temperature fault, M112 is issued, a limit switch is hit or other error) the system enters the Halt state, in this state the play led flashes, and the state can be cleared by issuing M999 or holding the flashing kill button for 2 seconds (it can also be cleared from the LCD panel). While in the Halt state any command issued from the host will get a !! response (with a few exceptions). The PSU may be turned off when Halt is entered if there is a psu Switch defined.

All commands can be triggered by a button or a sensor if a Switch module is configured to do so.

You can read more about the kill button at Smoothie kill button


Will resume a suspended print it does the following…

  1. Restore the temperatures and wait for them to get up to temp
  2. Optionally run before_resume gcode if specified
  3. Restore the position it was at and E and any other saved state
  4. Resume sd print or send resume upstream


The following G-codes are supported by the Player module :