Plugins idea - 'Blip' the part cooling fan

Problem: some two wire part cooling fans require a spin up to 100% before they can effectively spin down to a lower percentage. This fellow calls it 'blipping'

From Reddit : "(...) In addition to "the fan is usually off for the first layers" that others have posted, these fans tend to not spin at lower percentages (30 and less) unless your slicer supports "blipping" the fan to full power when it starts. This gets the fan started by going full power, then dropping to your set percentage." -- xXsaberstrikeXx

Ideally this should be an option in the slicer software, but so far, I've seen nothing in Cura/Prusa so I was wondering if some clever individual would write a plugin that can intercept M106 gcodes and 'blip' the fan to full speed (momentarily) where appropriate. example: if M106 S80 found in gcode then M106 S255 sent immediately before hand. I imagine the value of 'S' would be user configured in the plugin because different fans may require it -- my fan can start spinning at values over 100 so the plugin would not need to blip the fan.

Thanks for taking the trouble to read.

I think this is actually a firmware option that can be enabled to handle this in Marlin.


really, what's the option?

Configuration_adv.h, FAN_KICKSTART_TIME:


that's great... so the part cooling fans on consumer 3d printers are Pulse Width Modulation fans?

Yep, that's how they adjust the speed. Not all fans accept PWM, but many that come with 3D printers do.

well, none of the Creality Ender models have PWM hotend/part fans... and i'm looking very closely at other manufacturers. In the mean time, it seems to be quite an undertaking to post process a gcode file on octoprint... but it's nice to know that if I had a new controller board and new PWM fans marlin 'seems' compatible.

Where have you found this? My Ender 5 Pro seems to have a PWM part fan and runs just fine. Can't see anything in the Marlin config that suggests it is not using PWM, and the speed varies just fine. How else do they vary the speed in this case?

My E3 pro had a DC controlled fan
same on the skr 1.4 turbo

I haven't tested this but it should get you close in case you would like to write a plugin instead of playing with the firmware.

# coding=utf-8

import octoprint.plugin
import re

class FanBlip(octoprint.plugin.OctoPrintPlugin):
    def rewrite_m106(self, comm_instance, phase, cmd, cmd_type, gcode, *args, **kwargs):
        if gcode and gcode == "M106":
            CmdDict = dict ((x,float(y)) for d,x,y in (re.split('([A-Z])', i) for i in cmd.upper().split()))
            if "S" in CmdDict:
                s = int(CmdDict["S"])
                if s < 100:
                    cmd = [("M106 S255"), #Full Speed
                            ("G4 S1"), # Wait a second
                            ("M106 S" + str(s))] #Back to the set value
          "Bliping the fan")
                    return cmd
                    return None

__plugin_name__ = "FanBlip"
__plugin_pythoncompat__ = ">=2.7,<4"
def __plugin_load__():
    global __plugin_implementation__
    __plugin_implementation__ = FanBlip()

    global __plugin_hooks__
    __plugin_hooks__ = {
        "octoprint.comm.protocol.gcode.queuing": __plugin_implementation__.rewrite_m106

put it in a file called and place it in your OP plugin folder.

you can actually upload single file plugins in the latest version of OctoPrint for easier install.

1 Like

Sweet. I wasn't aware of that.