G-code for chamber fan

is there a gcode to enable the chamber fan on print start? id like to enable it when it passes 35c in the chamber and then turn off or reduce chamber fan speed as needed?

i have never messed with gcode yet so i would have no idea how to do this

my chamber can hit 42c on long prints due to the soundproofing box i built around it and if i remove the top/door it adds to the sound which will keep me from sleeping

Hi @irish-leprecon,

The X1C chamber temperature live control is not (easily) achieved by coding due to many limitations.
Some relevant to your case:

  1. The g-code is interpreted line by line, so a conditional loop is interpreted once and not run continuously - suggestion: use the layer change g-code, i.e. at every layer change, it will verify the chamber temperature and adjust the fan speed;

  2. There are many unavailable variables. The truth is that they just aren’t documented. I usually find them by trial and error with educated guesses based on the other variables’ names and types.
    I cannot find the chamber temperature, and I am printing, so I am unable to verify - suggestion: my guess is an array, so test chamber_temperature[0] ;

  3. The chamber temperature is regulated in the printer g-code and firmware; the latter takes precedence and is not editable. I think 35C will not be a problem, but you must test.

The marling command to set the BL chamber fan is

M106 P3 SXXX;

The XXX varies between 0 and 255, i.e. 0% - S0 and 100% - S255.
Instead of using the maximum, you can use a lower frequency and reduce noise.

At your own risk, go to the printer settings(1), machine g-code tab (2), and in the layer box (3):


add the following script:

{if chamber_temperature[0] > 35}
M106 P3 S255; turn on the chamber cooling fan at maximum
{else}
M106 P3 S0; turn off the chamber cooling fan
{endif}

Please let me know if it works or if something is unclear. TY.

1 Like

does it matter where i put the lines in? i’m guessing the line gives priority so is there a specific area it should be before/after somewhere else?

It would matter if there is a command to change the fan settings afterwards. My g-code(default) mainly focuses on the timelapse, update info, etc… no fan.
Anywhere should work…

Edit: for testing, I would print something simple (e.g. a cube) and set the temperature to a value slightly superior to the measured value. The fan will start (or not) quickly, and you save material and time to get the result.

1 Like

Was anyone able to get this working? Have tried the script at layer change but it does not activate the chamber fan.

I am sorry to read it, and thank you for sharing.
I was almost sure it could work. I still don’t see how it can fail. I will try to replicate your test and look for a solution if it exists.

Please correct me if I am wrong: you added the code into the “Machine G-code” - “Layer Change G-code” and tested it and found that when the printer chamber temperature exceeds the 35ºC setpoint, the auxiliary fan doesn’t start as expected.

2 Likes

Correct, yes. Tried the setpoint lower at 19 for my testing so I could see the result quickly but the fan never triggers.

Have tried completely clearing filament gcode too - no difference unfortunately.