Change filament mid-print

What is the problem?

I want to change my fillament mid-print when the first spool runs empty.

What did you already try to solve it?

Installed a plugin but for this plugin I need to connect a fillament sensor directly to the Pi printserver.

Additional information about your setup

I use a Anycubic Vyper 3D printer. The Vyper already has a filament sensor pre installed and connected to the printers mainboard. How can I achieve this filament swap without canceling mid-print?

For us to help you we need more details. When you opened this topic, there was a template and that template asked for a systeminfo bundle (note that the blue text is a link). Please provide one and we can start there.

In general, OctoPrint and a 3D printer need two-way communications for advanced features like filament runout sensors.

From the Terminal tab in OctoPrint, send an M115 to the printer and examine the output for:

If the printer firmware doesn't support this feature, then OctoPrint can't interact with the printer when the filament runs out. If the printer firmware does support this feature, then we may be able to proceed.

1 Like

Thanks for your reply. I edited my post and included the systeminfo bundle. When I run M115 in terminal I get this response:

Send: M115
Recv: FIRMWARE_NAME:Marlin bugfix-2.0.x (Sep  2 2021 20:16:33) PROTOCOL_VERSION:1.0 MACHINE_TYPE:Anycubic Viper EXTRUDER_COUNT:1 UUID:cede2a2f-41a2-4748-9b12-c55c62f367ff
Recv: Cap:EEPROM:1
Recv: Cap:PROGRESS:0
Recv: Cap:PRINT_JOB:1
Recv: Cap:RUNOUT:1
Recv: Cap:Z_PROBE:1
Recv: Cap:SDCARD:1
Recv: Cap:REPEAT:0
Recv: Cap:ARCS:1
Recv: ok
Send: M155 S2
Recv: ok
Recv:  T:21.11 /0.00 B:21.05 /0.00 @:0 B@:0
Recv:  T:21.05 /0.00 B:20.90 /0.00 @:0 B@:0
Recv:  T:21.00 /0.00 B:20.86 /0.00 @:0 B@:0
Recv:  T:21.03 /0.00 B:20.98 /0.00 @:0 B@:0

It appears that the printer firmware does NOT support HOST_ACTION_COMMANDS so interaction with the printer's filament runout sensor by OctoPrint is probably not possible. Your printer does report Cap:RUNOUT:1 but so does my LulzBot TAZ 6 which doesn't have a runout sensor so I don't know exactly what that means.

Please go to Settings, Serial Connections and enable serial logging (at the bottom). Start a print (of something simple) and "break" the filament just before the printer's sensor. Allow whatever happens to complete and then "clean up" and upload another bundle.

You could also try this experiment after uploading the same simple print to the printer's SD card and see how the printer behaves (a bundle will not be needed).

You could contact the printer manufacturer and ask that they enable support for HOST_ACTION_COMMANDS or you can ask them for the firmware sources so you can build your own.

Hey @b-morgan, so I just followed your advice.

First I cut the filament and printed a small object over OctoPrint. When the sensor recognize the missing filament the Vyper Display says: "The Filament is insufficent or the filament sensor is malfunctioning." However the printer keeps going. I upload the new systeminfo bundle in this comment.

When I print over the printers SD-Card without OctoPrint, the same message appears on the Display but this time the printer stops printing. (1.2 MB)

How can I proceed now?

Unfortunately, that is exactly what I expected to happen. Without the input from HOST_ACTION_COMMANDS, OctoPrint is totally oblivious.

Internally, the firmware communicates with itself and the runout sensor causes the print to stop. I assume you can now add more filament and interact with the firmware somehow to continue the printing.

I see two (maybe three) ways to proceed...

First I would attempt to obtain or build a custom version of the firmware with HOST_ACTION_COMMANDS enabled. Ask Anycubic support to do that for you (and the rest of their user community) and when that fails, ask for a copy or the location of the source files. To be compliant with the license for Marlin, they have to provide this to you.

Second would be to purchase another filament runout sensor (or move the wires on the one you have) and connect it to the GPIO pins of the RPi. There are plugins available that will allow OctoPrint to detect the sensor and do something useful.

Third, don't start printing unless you know there is enough filament to finish it. While this doesn't eliminate unexpected failures, it will allow a very large percentage of your prints to be successful. If you are having a large number of filament failures, then examine the filament feed path and determine how to eliminate the issue.

I'm sorry there's no "magic bullet" available. Anycubic will probably tell you that it doesn't "support" OctoPrint (and that the only reason for having a USB port is for firmware updates).


To add to what b-morgan said, Marlin has many configuration.h options that enable safe homing filament change with automatic filament retraction/insertion, audible notifications and front panel interaction at filament change, that all work very well with Octoprint.

These options are off by default and must be enabled by the user.

A look through that file will be helpful to you.