How to Change Filament Manually During Printing with Octoprint

If you are using Octoprint with your 3D printer you can get benefit of pause and resume printing feature. Actually when you click on Pause button on Octoprint web interface your 3D printer will stop immediately. And then you can continue when click on Resume button. 

Thats fine but you may want to use this feature to change or add a new filament. However hotend remains on the last position when you click on Pause. If you want to change a filament you need to move the hotend on a better position. When you change the position of the hotend, you don’t have a chance to resume the print successfully. The print head doesn’t return to the last position automatically.

To be able to resume printing successfully,  you need to enter some commands which will printer execute immediately after a click on Pause button and before the printer continues printing after a click on Resume button.

Warning: This will only work if you are running Marlin (others not tested) and  not printing from SD and not using multiple extruders since OctoPrint will only then be able to track the necessary position data and print parameters due to firmware limitations.

Ok. Lets start. Open Octoprint Settings and select GCODE Scripts.

Find After print job is paused section and write following code inside.

{% if pause_position.x is not none %}
; relative XYZE
G91
M83

; retract filament (3mm), move Z slightly upwards
G1 Z+5 E-3 F4500

; absolute XYZE
M82
G90

; move to a safe rest position, adjust as necessary
G1 X0 Y0
{% endif %}

Find Before print job is resumed section and write following code inside.

{% if pause_position.x is not none %}
; relative extruder
M83

; prime nozzle
G1 E-3 F4500
G1 E3 F4500
G1 E3 F4500

; absolute E
M82

; absolute XYZ
G90

; reset E
G92 E{{ pause_position.e }}

; move back to pause position XYZ
G1 X{{ pause_position.x }} Y{{ pause_position.y }} Z{{ pause_position.z }} F4500

; reset to feed rate before pause if available
{% if pause_position.f is not none %}G1 F{{ pause_position.f }}{% endif %}
{% endif %}

Save and close the settings page.

Now you can stop the printer wherever you want during print and change the filament. If you want to change filament in certain layers you can use Multi Colors plug-in.

You can check howto install plug-ins in Octoprint https://docs.octoprint.org/en/master/features/plugins.html#installing-plugins

In Layer number or height box you can write layer number or numbers with comma separated which you want your 3d printer to stop to change filament.


Be aware that there is Rainbow Filaments available in the market for fancy looking prints.

 

 

 

 


Lastly, if you want to upgrade Octoprint / RPi pip version open a shell terminal to your RPi. (In Windows you can use Putty tool)

ssh pi@octopi.local -l pi

or 

ssh pi@RASPBERRY_IP_ADDRESS -l pi

and write following commands

source ~/oprint/bin/activate
pip install --upgrade pip

Source: