Ender 3 V3 SE filament sensor in octoprint

Hello from Germany,

I am new and got my Ender 3 V3 SE some days ago.
I attached the original Filament Sensor and so far, its working if I print from the SD-Card.

But I want to print with Octoprint so as far as I know, I have to enable HOST_ACTION_COMMANDS in the Firmware. 2 months ago Creality released the Source Code and a github user released a custom firmware with HOST_ACTION_COMMANDS enabled. Till this point there were only other solutions with Klipper available or only the information that there is no open source code because of GPL violation.

I updated the firmware and I can see 1.0.7 on the display of the printer. Octoprint is not complying any more about missing HOST_ACTION_COMMANDS but Octoprint is printing even if no filament is in the sensor.

I tried these 2 commands (from the host_action_commands video) in the terminal

Send: M119
Recv: Reporting endstop status
Recv: x_min: open
Recv: y_min: open
Recv: z_min: TRIGGERED
Recv: test_axis_known_x_flag = true
Recv: test_axis_known_y_flag = true
Recv: test_axis_known_z_flag = true
Recv: ok

Send: M412
Recv: echo:Unknown command: "M412"
Recv: ok

Dont know why M412 is not working.

Do I have to enable some more functions in Octoprint ?

If I check the Configuration_adv.h from the Repo, HOST_ACTION_COMMANDS is not activated:

But Octoprint is not complying any more and in the terminal is says that HOST_ACTION_COMMANDS is 1 so it must be activated.

PS: Dont know how to compile this by my own

Looks like it's enabled to me.

However, host_prompt_support is not.

There are several guides/YouTube videos on how to compile Marlin firmware.

I found some help on FB how to compile the FW.
So I did it and now the Sensor is present in Octoprint

Send: M115
Recv: FIRMWARE_NAME:Marlin V1.0.6-mod (Sep 12 2024 15:37:33) SOURCE_CODE_URL:github.com/MarlinFirmware/Marlin PROTOCOL_VERSION:1.0 MACHINE_TYPE:Ender-3 V3 SE EXTRUDER_COUNT:1 UUID:cede2a2f-41a2-4748-9b12-c55c62f367ff
Recv: Cap:SERIAL_XON_XOFF:0
Recv: Cap:BINARY_FILE_TRANSFER:0
Recv: Cap:EEPROM:1
Recv: Cap:VOLUMETRIC:1
Recv: Cap:AUTOREPORT_POS:0
Recv: Cap:AUTOREPORT_TEMP:1
Recv: Cap:PROGRESS:0
Recv: Cap:PRINT_JOB:1
Recv: Cap:AUTOLEVEL:1
Recv: Cap:RUNOUT:1
Recv: Cap:Z_PROBE:1
Recv: Cap:LEVELING_DATA:1
Recv: Cap:BUILD_PERCENT:0
Recv: Cap:SOFTWARE_POWER:0
Recv: Cap:TOGGLE_LIGHTS:0
Recv: Cap:CASE_LIGHT_BRIGHTNESS:0
Recv: Cap:EMERGENCY_PARSER:1
Recv: Cap:HOST_ACTION_COMMANDS:1
Recv: Cap:PROMPT_SUPPORT:1
Recv: Cap:SDCARD:1
Recv: Cap:REPEAT:0
Recv: Cap:SD_WRITE:1
Recv: Cap:AUTOREPORT_SD_STATUS:0
Recv: Cap:LONG_FILENAME:1
Recv: Cap:THERMAL_PROTECTION:1
Recv: Cap:MOTION_MODES:0
Recv: Cap:ARCS:1
Recv: Cap:BABYSTEPPING:1
Recv: Cap:CHAMBER_TEMPERATURE:0
Recv: Cap:COOLER_TEMPERATURE:0
Recv: Cap:MEATPACK:0
Send: M412
Recv: echo:Filament runout ON
Recv: ok

But there is no change on the M412 request if I insert / remove the filament.

In Configuration.h I tried

#define FIL_RUNOUT_PULLUP

instead of

#define FIL_RUNOUT_PULLDOWN

and also

#define WATCH_ALL_RUNOUT_SENSORS

But no change.
Any idea ?

OK, maybe its a misunderstanding of M412

I tried this with no filament

Send: M119
Recv: Reporting endstop status
Recv: x_min: open
Recv: y_min: open
Recv: z_min: TRIGGERED
Recv: test_axis_known_x_flag = false
Recv: test_axis_known_y_flag = false
Recv: test_axis_known_z_flag = false
Recv: filament: TRIGGERED
Recv: ok

and with filament inside

Send: M119
Recv: Reporting endstop status
Recv: x_min: open
Recv: y_min: open
Recv: z_min: TRIGGERED
Recv: test_axis_known_x_flag = false
Recv: test_axis_known_y_flag = false
Recv: test_axis_known_z_flag = false
Recv: filament: open
Recv: ok

I assume now its ok ?

But why no change with M412 ?
And why no message in the terminal if I remove the filament ?

This is my current config

#define FILAMENT_RUNOUT_SENSOR
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
  #define FIL_RUNOUT_ENABLED_DEFAULT true // Enable the sensor on startup. Override with M412 followed by M500.
  #define NUM_RUNOUT_SENSORS   1          // Number of sensors, up to one per extruder. Define a FIL_RUNOUT#_PIN for each.

  #define FIL_RUNOUT_STATE     LOW        // Pin state indicating that filament is NOT present.
  //#define FIL_RUNOUT_PULLUP             // Use internal pullup for filament runout pins.
  #define FIL_RUNOUT_PULLDOWN             // Use internal pulldown for filament runout pins.
  #define WATCH_ALL_RUNOUT_SENSORS      // Execute runout script on any triggering sensor, not only for the active extruder.

On aliexpress there was mentioned that we have to add the following code but this was for an general sensor and not printer related.

 FILAMENT_RUNOUT_SCRIPT "M600"

M412 just handles turning on/off filament runout processing. If you turn it off then it won't detect filament runout and nothing will change. if it's on and filament runs out while printing something should happen.

Thx for the answer. :slight_smile:

It looks like I got it working, but there is still a question left. ^^

If I remove the filament, the head is going to a parking position and there are some beeps from the printer.
I get the message: "Nozzle parked"
and if I click on "Continue" I get the message: "purge more | disable runout "

There is no message on the LCD screen.
I put the filament back in the sensor.

If I choose "purge more" --> nothing happened
If I choose "disable runout" --> I get the Message "Resuming" and the printer resumes printing
After this I get the Message "Resuming" and I have to click on "Dismiss"

But if I remove the filament again, nothing happens. I assume this is related to the "Disable Runout" option.
So far I can life with it, but as I am a nerd I want perfect :smiley:

What is the "purge more" option doing ?
Is there a way to get the monitoring working again after the 1st interruption ?
Did I miss something ?

my current settings:
Configuration.h

#define FILAMENT_RUNOUT_SENSOR
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
  #define FIL_RUNOUT_ENABLED_DEFAULT true // Enable the sensor on startup. Override with M412 followed by M500.
  #define NUM_RUNOUT_SENSORS   1          // Number of sensors, up to one per extruder. Define a FIL_RUNOUT#_PIN for each.

  #define FIL_RUNOUT_STATE     HIGH        // Pin state indicating that filament is NOT present.
  //#define FIL_RUNOUT_PULLUP             // Use internal pullup for filament runout pins.
  #define FIL_RUNOUT_PULLDOWN             // Use internal pulldown for filament runout pins.
  //#define WATCH_ALL_RUNOUT_SENSORS      // Execute runout script on any triggering sensor, not only for the active extruder.

Configuration_adv.h

#define HOST_ACTION_COMMANDS
#if ENABLED(HOST_ACTION_COMMANDS)
  #define HOST_PROMPT_SUPPORT
  //#define HOST_START_MENU_ITEM  // Add a menu item that tells the host to start
#endif

Version.h (I changed only the version number so that you can see if the Firmware update was successful)

/**
 * Release version. Leave the Marlin version or apply a custom scheme.
 */
#ifndef SHORT_BUILD_VERSION
  #if ENABLED(HIGH_SPEED_1)
    #define SHORT_BUILD_VERSION "V1.0.6-mod3"
  #else
    #define SHORT_BUILD_VERSION "Ender-3V3 SE_Ten_P1T14T" // GD32F303RET6 + Multilanguage 1.Chinese 2.English 3.German 4.Russian 5.French 6.Turkish 7.Spanish 8.Italian 9.Portuguese
  #endif  
#endif

This is probably the reason why it doesn't work local on the printer. LCD screens act as their own software host and may not be configured to show messages/prompts. Old style reprapdiscount smart controller would show these messages. It's a big disconnect between firmware and screen in the LCD setups most the time.

Hi Nisbo, I was able to get the filament sensor monitor to continue working after fixing it from a runout situation. You need to edit the src/feature/host_actions.cpp file.

In the filament_load_host_prompt function, you can change the text that gets displayed in Octoprint. I changed from "DisableRunout" to "Resume".

  void filament_load_host_prompt() {
    const bool disable_to_continue = TERN0(HAS_FILAMENT_SENSOR, runout.filament_ran_out);
    host_prompt_do(PROMPT_FILAMENT_RUNOUT, PSTR("Paused"), PSTR("PurgeMore"),
      disable_to_continue ? PSTR("Resume") : CONTINUE_STR
    );
  }

Then in the host_response_handler function, remove the line of code that disables the runout sensor.

          case 1: // "Continue" / "Disable Runout" button
            #if BOTH(M600_PURGE_MORE_RESUMABLE, ADVANCED_PAUSE_FEATURE)
              pause_menu_response = PAUSE_RESPONSE_RESUME_PRINT;  // Simulate menu selection
            #endif
            #if HAS_FILAMENT_SENSOR
              if (runout.filament_ran_out) {                      // Disable a triggered sensor
                //runout.enabled = false; // Do not disable the filament runout sensor
                runout.reset();
              }
            #endif
            break;

Compile the firmware and load in on to the printer. I've tested this myself by removing the filament from the sensor multiple times for a single print and it paused every time. Let me know how you go :slight_smile:

Next goal is to make the head park a little higher when paused and get the "PurgeMore" function to work. This way, we can clean the hotend/extruder making sure there are no blobs before continuing the print.