How to test part cooling fan

Basic Information:

Printer Model: Rolly Your Own
MCU / Printerboard: MKS Robin V3 & Mellow
klippy.log:
klippy.log (72.2 KB)

Describe your issue:

I want to test the part cooling fan on two testers that I’ve designed on my own (working fine, but I want to see the different parts working).

I try manually setting the fan using M106 S255 from the (Mainsail) Console as well as using the fan slider in Mainsail (which sends the same command) with the nozzle cool and at 200C but it doesn’t turn on.

When I’m using the MKS Robin V3 board, I set the fan using the statement:
[fan]
pin: PB1

When I’m using the Mellow FLY-SHT42 toolhead board, I set the fan using the statement:
[fan]
pin: canFly:PB11

Now, the fan seems to work correctly when a print is in operation but I’m curious as to why I can’t control it manually.

What am I doing wrong?

Just use the Gcode in the terminal

https://reprap.org/wiki/G-code#M106:_Fan_On

When you say “terminal” - what do you mean?

As I indicated, I’m using Mainsail and using the “Console” there to send the M106 commands.

Is there a “Klipper terminal” that allows direct operation of G/M codes?

In OctoPrint it’s like this:

There should be something similar in Fluid and Mainsail

I actually meant the console

You can also try set_fan_speed

Should definitively work without running a print job. If you give your fan a name like

[fan_generic fantest]

then you can go like

SET_FAN_SPEED FAN=fantest SPEED=1

No joy. I changed the fan specifier as suggested, ran the SET_FAN_SPEED command and nothing happens.

That’s what I’m using.

Hmm, then no idea. Works for me flawlessly.
Are you sure you have connected the fan to a PWM capable pin?

Yes. In both cases and it works fine when commanded from a GCode print.

Sorry, I should also point out that the LED indicator does not come on except when I’m running a print.

Just tested with just the common command and printer idle:

18:39:51  $ M106 S255
18:39:53  $ M106 S0

Both work without any job running

Maybe there is an issue with the connection to the CAN-Bus board (Mellow FLY-SHT42)

Then the hot end heater, thermistor, heat sink fan, X-Axis endstop and BL Touch wouldn’t be working.

It’s strange.

So it is possible to heat the extruder when you are not printing.

Hmm - this is a really uncommon issue…

No problem at all - and I can load filament (sorry that’s also controlled by the FLY-SHT42 on one printer and by the Robin Nano V3 on the other).

@Sineos Could there be a configuration setting that I’m missing? The klippy.log was attached to the original post.

That’s very odd. Perhaps a subtle wiring issue - like the fan actually getting its power from a stepper or heater. I guess you could try enabling steppers and heaters to see what part of a “print” causes the fan to start turning.

-Kevin

Found the problem (which may point to a bug or two) and I have another question.

When I set up the printer with the FLY-SHT42 board, I used an MKS Robin Nano V3 for the movement steppers. The “printer.cfg” file was taken from another printer which also used the MKS Robin Nano V3 as it was a good base for the heated bed and movement steppers.

I thought I had deleted/commented out all the statements for the functions which are used by the FLY-SHT42 but, I had left in the [fan] statement and I put in another [fan] statement in by “confly.cfg” file which was included in the “printer.cfg”. So I had two [fan] statements, one in each of the .cfg files.

First potential bug - shouldn’t two [fan] statements be flagged as an error during Klipper restart, even if they are in separate .cfg files?

Next, I found the two [fan] statements and removed the one in the printer.cfg file (as the one in confly.cfg should have taken precedence) but there was no difference in operation. Out of desperation, I rebooted the rPi and everything started to work correctly (ie fans working correctly and I can set speeds with the M106 command in the console as well as using the Mainsail slider).

Should I need to reset the rPi for this kind of issue? It seems like the original printer.cfg was buffered in the rPi and was never updated.

Now, in my latest testing, I’m getting an ‘Unknown command: “SET_FAN_SPEED”’ in Mainsail as you can see here:

image

Everything has been updated to the latest level.

The defining statement for the fan is:
[heater_fan heatsink_fan]
pin: canFly:PB11
max_power: 1.0
fan_speed: 1
kick_start_time: 0
heater: extruder
heater_temp: 30.0

Any ideas on this one? I have no idea why the “SET_FAN_SPEED” command is not recognized.

Includes are difficult to handle and some “manufactures”, e.g. RatRig make heavy use of it (for good or worse). Klipper goes through the statements sequentially and the last one to be processed takes precedence.
Note that this is true for exactly the same config sections, e.g. [fan]. If you use a pin twice in different config sections, Klipper will raise an error.

SET_FAN_SPEED is only available for [fan_generic]

Hi @Sineos,

When I look at Klippy.log I only see the latest of the two [fan] statements - this lead me to looking through the two files as the pin wasn’t what I was expecting. What was strange is that the second [fan] statement overwrote the first [fan] statement and doesn’t show up in it’s actual location in the high level .cfg file.

Personally, I consider this to be a bug and not a feature; I’m not sure how often superseding statements are used in .cfg files, but I would think that their appearance creates ambiguity in how the file will be processed that, at very least, should generate a notification to the user. Actually, I consider this worthy of generating an error that requires the user to resolve before they can go further.

Can you answer why I had to restart the rPi to clear this issue?

Thank you for pointing out the mistake in the SET_FAN_SPEED and its need for `[fan_generic]’ my excuse for missing that was that it was late and I was trying one last thing to see if I had resolved all my questions.

Seems unusual. I’m quite sure that a sudo service klipper restart potentially followed by a FIRMWARE_RESTART would have had the same effect.

WRT to the include issue: I’m not a big fan of them as they exactly create such issues if not done carefully. In my opinion not every bug a user creates can or should be caught in the software. This will just cause a maintenance burden for the developer and potentially also limits deliberate choices.

Just take a look at the include hell RatRig has created: Personally I think that leads to a Klipper system a regular user can no longer maintain.

It was RatRig which lead me to ask about standards for the printer.cfg and include files a few weeks ago.

I added a separate .cfg for the FLY-SHT because I felt it would be cleaner to have a separate .cfg for each separate intelligent board with a primary (the Robin Nano) that forms the printer.cfg and the secondary (the FLY-SHT). Next, I listed the features the FLY-SHT would provide and removed/commented them out from the Robin Nano based printer.cfg - with one error. Looking back, I’d still argue that this was the right way to do it.

What is your criteria for deciding which user bugs should be caught in software? The problem here is a classic “It’s impossible to create a fool proof system as fools are too ingenious” (with me being the fool). I’ve been in the situation of supporting users and having to prioritize which user problems are to be caught in software and it’s a hard decision to make.

I’ve found that the problem with saying that you have an opinion that not all user bugs should be caught in software is that you will immediately get asked what is your criteria for deciding which bugs should be caught in software? :wink: