Help Configuring PWM Fan in Thermostatic Mode for Duet Drivers
-
@snowcrash You are right that TMC drivers will only have a fake-temperature reported. it is 100°C if the driver goes into warning and 150°C if the driver goes into thermal-shutdown. In any other case the reported temperature of virtual heater 101 will be at 0°C - unless @dc42 accepts my pull request at GitHub. In that case there will be another fake-temperatur of 50°C if any driver is activated. 0°C would then mean all drivers are shut off.
So unless you add your own thermistor to the stepper drivers there is no way of getting their temperature.
The following virtual heaters are defined:
100: MCU
101: All TMCs on Duet board
102: All TMCs on DueX(2|5) boardP.S.: This means your
H
parameter checks for temperature of MCU, all TMCs on the Duet, all TMCs on DueX and temperatures on heaters that probably are not defined (103, 104). I think it will take the highest value of any of these to apply to what speed the fan should spin. So if any of these heaters will report 65°C (probably only 100 is able to ever do that anyway) it will spin the fan at full speed even if all other channels report a (much) lower temperature.P.P.S.: This is probably only a typo in your post but
F25000
means 25 KHz not MHz. The value ofF
is given in Hz. -
@dc42 said in Help Configuring PWM Fan in Thermostatic Mode for Duet Drivers:
The diode should be connected the other way round (anode to the fan PWM input). An ordinary small signal silicon diode such as 1N4148 should work.
Thanks, @dc42! Diagram fixed:
@wilriker said in Help Configuring PWM Fan in Thermostatic Mode for Duet Drivers:
Thanks @wilriker!
@snowcrash You are right that TMC drivers will only have a fake-temperature reported. it is 100°C if the driver goes into warning and 150°C if the driver goes into thermal-shutdown. In any other case the reported temperature of virtual heater 101 will be at 0°C - unless @dc42 accepts my pull request at GitHub. In that case there will be another fake-temperatur of 50°C if any driver is activated. 0°C would then mean all drivers are shut off.
OK, I think I got it
So, given these limitations, and assuming I want the fan to be normally on at 50% (i.e. all the time), and only have it go to up to 100% if any of the 5 drivers on the Duet goes above the 'warning' limit (100°C), I've revised M106 command to this:
M106 P1 S0.5 I1 F25000 L0.5 B4 H101 T100 CDuet_Fan
Is this the correct formulation to achieve the above?
So unless you add your own thermistor to the stepper drivers there is no way of getting their temperature.
The following virtual heaters are defined:
100: MCU
101: All TMCs on Duet board
102: All TMCs on DueX(2|5) boardP.S.: This means your
H
parameter checks for temperature of MCU, all TMCs on the Duet, all TMCs on DueX and temperatures on heaters that probably are not defined (103, 104). I think it will take the highest value of any of these to apply to what speed the fan should spin. So if any of these heaters will report 65°C (probably only 100 is able to ever do that anyway) it will spin the fan at full speed even if all other channels report a (much) lower temperature.Thanks for the clarification.
In this case, I think documentation on this parameter is very unhelpful to the point of being misleading (I'm mainly referring to the fourth example and the subsequent text that's supposed to explain it).
P.P.S.: This is probably only a typo in your post but
F25000
means 25 KHz not MHz. The value ofF
is given in Hz.Yep, typo, good catch. I indeed meant 25KHz (though might be interesting to see a fan running at 25MHz...
-
@snowcrash said in Help Configuring PWM Fan in Thermostatic Mode for Duet Drivers:
So, given these limitations, and assuming I want the fan to be normally on at 50% (i.e. all the time), and only have it go to up to 100% if any of the 5 drivers on the Duet goes above the 'warning' limit (100°C), I've revised M106 command to this:
M106 P1 S0.5 I1 F25000 L0.5 B4 H101 T100 CDuet_Fan
Is this the correct formulation to achieve the above?
I think your
T
parameter should rather beT0:100
because I have a similar configuration withT25
(on the heated bed for the PSU fan) that will stop the fan below this temperature.Also I think you do not need
L0.5
here. I won't hurt but don't see a reason to use this on a thermostatically controlled fan.Thanks for the clarification.
In this case, I think documentation on this parameter is very unhelpful to the point of being misleading (I'm mainly referring to the fourth example and the subsequent text that's supposed to explain it).
OK, I have to say I find this very example in the documentation to be very clear - but it may be my software engineer background that immediately translates this into code in my head.
Can you say, how you would have explained this fourth example? Maybe we can improve documentation this way.
-
@wilriker said in Help Configuring PWM Fan in Thermostatic Mode for Duet Drivers:
@snowcrash said in Help Configuring PWM Fan in Thermostatic Mode for Duet Drivers:
So, given these limitations, and assuming I want the fan to be normally on at 50% (i.e. all the time), and only have it go to up to 100% if any of the 5 drivers on the Duet goes above the 'warning' limit (100°C), I've revised M106 command to this:
M106 P1 S0.5 I1 F25000 L0.5 B4 H101 T100 CDuet_Fan
Is this the correct formulation to achieve the above?
I think your
T
parameter should rather beT0:100
because I have a similar configuration withT25
(on the heated bed for the PSU fan) that will stop the fan below this temperature.I think you're right, thanks!
So the formulation updates to:
> > M106 P1 S0.5 I1 F25000 L0.5 B4 H101 T0:100 CDuet_Fan
Which means the fan will normally be running at 50% (i.e. when all drivers are under 100°C).
But this leaves the question of how to ramp the fan up to 100% if the temp of any of the drivers goes above 100°C?
Also I think you do not need
L0.5
here. I won't hurt but don't see a reason to use this on a thermostatically controlled fan.I take your point, so now we have:
> > M106 P1 S0.5 I1 F25000 B4 H101 T0:100 CDuet_Fan
Thanks for the clarification.
In this case, I think documentation on this parameter is very unhelpful to the point of being misleading (I'm mainly referring to the fourth example and the subsequent text that's supposed to explain it).
OK, I have to say I find this very example in the documentation to be very clear - but it may be my software engineer background that immediately translates this into code in my head.
Can you say, how you would have explained this fourth example? Maybe we can improve documentation this way.
Here's one example I've just encountered that illustrates the difficulty I have with following the text.
Take this line from the documentation about the T parameter:
"In this mode the fan will be on with the PWM set by the S parameter (subject to a minimum of 0.5) when the temperature of any of the heaters listed in the H parameter is at or above the trigger temperature set by the T parameter, and off otherwise. Thermostatic mode can be disabled using parameter H-1."
...it's very long and phrased in a highly complicated way. I'd break it down into much shorter and concise sentences, while trying to bear in mind that some of the people reading the text are totally clueless about these things (like me )
Regarding the examples themselves, I'd start by adding many more of them and have at least one example dedicated for each of the parameters (atm there are some parameters that aren't covered in the examples). In other words, I'd cover all the parameters, and use each example to tackle one parameter at a time (thus keeping things as simple as possible).
I'd also rearange the text so that each example is followed by its explication so it's easier to read (rather than constantly scrolling up and down and getting confused).
Moreover, I'd definitely add all the things you explained about the virtual heaters destination codes (100, 101, 102), as it isn't mentioned at all in the text, and to my mind at least, when the text says:
"if any TMC2660 drivers (virtual heaters 101 and 102)..."
and later on,
"... to virtual heaters (which have heater numbers 100 upwards)..."
This would logically (but apparently wrongly) imply that 'driver 0' is referred to by virtual heater '100'; 'driver 1' is referred to by virtual heater '101', etc.
Lastly, notice that although virtual heaters 101 and 102 are explicitly mentioned in the text and the fourth example, there is no mention of how they are actually assigned and/or any mention of the DueX2/5.
-
@snowcrash said in Help Configuring PWM Fan in Thermostatic Mode for Duet Drivers:
> > M106 P1 S0.5 I1 F25000 L0.5 B4 H101 T0:100 CDuet_Fan
Which means the fan will normally be running at 50% (i.e. when all drivers are under 100°C).
But this leaves the question of how to ramp the fan up to 100% if the temp of any of the drivers goes above 100°C?
Usually this ramp-up would be progressing as the temperature progresses. Here we have special case as this is a virtual heater with only 3 fixed temperatures and jumps between them. This also means that as soon as one of the TMC drivers will go into warning state, the temperature will jump from 0°C to 100°C - so will the fan jump from its initial 50% speed to 100% speed without ramp-up.
About the documenation part:
More detailed explanation on virtual heaters can be found at M305 which also explains how to add your own. So this part is already there.Regarding the other parts you mentioned about
M106
: it is a wiki after all. How about you propose in this thread a new text with all the changes you think should go in there and we do a peer-review here? Afterwards one of us can update the wiki. I think that would be a great idea with input from a lot of people.
Maybe even start a new thread about it so that everyone can spot the purpose of it right away. -
@wilriker said in Help Configuring PWM Fan in Thermostatic Mode for Duet Drivers:
@snowcrash said in Help Configuring PWM Fan in Thermostatic Mode for Duet Drivers:
> > M106 P1 S0.5 I1 F25000 L0.5 B4 H101 T0:100 CDuet_Fan
Which means the fan will normally be running at 50% (i.e. when all drivers are under 100°C).
But this leaves the question of how to ramp the fan up to 100% if the temp of any of the drivers goes above 100°C?
Usually this ramp-up would be progressing as the temperature progresses. Here we have special case as this is a virtual heater with only 3 fixed temperatures and jumps between them. This also means that as soon as one of the TMC drivers will go into warning state, the temperature will jump from 0°C to 100°C - so will the fan jump from its initial 50% speed to 100% speed without ramp-up.
Cool, will try it out.
About the documenation part:
More detailed explanation on virtual heaters can be found at M305 which also explains how to add your own. So this part is already there.Fair enough, but then I'd have a note in M106 like the one in M143 saying:
"(refer to M305 for further details on how to set this up)"
Regarding the other parts you mentioned about
M106
: it is a wiki after all. How about you propose in this thread a new text with all the changes you think should go in there and we do a peer-review here? Afterwards one of us can update the wiki. I think that would be a great idea with input from a lot of people.
Maybe even start a new thread about it so that everyone can spot the purpose of it right away.I just walked straight into this one, ha? Man, I've got to learn when to keep my big mouth shut...
Although I don't feel even marginally qualified to write/edit wiki's on the Duet, I can also see a certain advantage to the 'newbie writes the guide' approach. It will definitely keep things at the very basic level Plus, I'm a big believer that one of the best ways to learn something is to try explaining it to someone else.
The biggest question in this context is time. If I go about doing it, I'll try to do the best I can and that means investing time into it. Having multiple projects in the air atm, it won't be easy, but I promise to put this on my TODO list and hopefully get it in done as soon as time allows.
Edit:
@wilriker, I just had a quick look at the M305 section of the Wiki and it says there that:
"Channel 1001 represents the temperature warning and overheat flags on the TMC2660 drivers on the Duet Wif/Ethernet."
This means my M106 with H101 is not right, no?
How sure are you about your description above of the virtual heaters' code designations?
Edit of the Edit:
Ok, it was a very quick look... from the text that follows that quoted above, it looks like you have it right.
Sorry to have doubted you
-
Update:
Hooked-up the fan as per the (corrected) schematic above and edited config.g to have the latest formulation of the M106 command, namely:
M106 P2 S0.5 I1 F25000 L0.5 B4 H101 T0:100 CDuet_Fan
(Note that I've changed the fan header to FAN2 both in the above command and in the hardware connection).
... but the fan isn't running.
I believe the problem lies somewhere within the thermostatic-mode and/or triggering-range parameters, because when I tried running the fan in regular PWM mode with:
M106 P2 S0.5 I1 F25000 L0.5 B4 H-1 CDuetFan
I can manually control the fan's speed with the slider and it runs exactly as is it should.
Another issue - which I don't know if related to the above - is that FAN2's name as defined in the M106 command (i.e. 'Duet_Fan'), doesn't show in the 'misc' section of DWG:
I deleted all the browsing history, cookies, etc., and reloaded DWG, but the name still doesn't appear.
I've attached the complete config.g and config-overdrive.g files below.
Help please?
-
@snowcrash Let's start at the end: naming fans is currently only possible in @chrishamm's fork of RRF. In the regular version this will only be available from version 2.02 (note that 2.01 is next to come).
About the fans not spinning: I just tested the same command (except the
I1
part) on my machine and can confirm that it is not working this way - but if you lower the start value of the temperature to -1°C, i.e.T-1:100
it will work.
I thought I had a theory why that is but in the middle of writing it here I realized it doesn't make sense. So: no clue why it has to be like that but it works.And the last part: never be sorry to doubt me! I mean it. I'd rather have you doubt me all the time than expecting I know everything. When I got the email notification of your post I was also thinking about the possibility that in this case out of some reason the heater channel would have been required instead of the virtual heater, so I also doubted myself here.
-
The name (like many other string parameters in RRF) probably needs to be enclosed in double quotes.
-
@SnowCrash
@wilriker said in Help Configuring PWM Fan in Thermostatic Mode for Duet Drivers:@snowcrash Let's start at the end: naming fans is currently only possible in @chrishamm's fork of RRF. In the regular version this will only be available from version 2.02 (note that 2.01 is next to come).
This is true, however, @chrishamm released a version of the firmware with the fan name change included. You can find it here. And I can confirm as @dc42 says that you will need to enclose the name in double quotes. Ex: C"Duet_Fan". Once that's done it works as advertised.
-
@phaedrux said in Help Configuring PWM Fan in Thermostatic Mode for Duet Drivers:
@SnowCrash
And I can confirm as @dc42 says that you will need to enclose the name in double quotes. Ex: C"Duet_Fan". Once that's done it works as advertised.I just updated the wiki accordingly to reflect this as well.
P.S.: I have not tried it but when enclosed in double-quotes I at least guess this can then also contain whitespace.
-
@phaedrux We are going to upvote each other into the hall of fame of reputation.
-
@wilriker said in Help Configuring PWM Fan in Thermostatic Mode for Duet Drivers:
@phaedrux said in Help Configuring PWM Fan in Thermostatic Mode for Duet Drivers:
@SnowCrash
And I can confirm as @dc42 says that you will need to enclose the name in double quotes. Ex: C"Duet_Fan". Once that's done it works as advertised.I just updated the wiki accordingly to reflect this as well.
P.S.: I have not tried it but when enclosed in double-quotes I at least guess this can then also contain whitespace.
Just tested and I can confirm that white space is allowed when enclosed with quotes.
-
Very cool, guys! thank you very much! great job and upvotes all around
I'll test both the modified M106 formulation and fan naming tonight on my machine so as to (hopefully) add a nice 'solved' to the title of this tread.
p.s. this has been nagging at me for a while now so have to ask: what do the little pin buttons next to each fan name in DWC actually do?
-
@snowcrash The pins let you lock the fan speed. Useful for gcode controlled fans if you set the speed too high or too low in the slicer.
-
Thanks, @Phaedrux
I can also happily confirm @wilriker's solution (T-1:100) works great (Thanks @wilriker!)
(though obviously I can only affirm this for the initial 50% speed and not the jump to 100% if temps go above 100°C - unless someone knows of a way to do this?)
However, a final snag remains as the fan's naming still eludes me.
I added double-quotes to the fan's name in the C parameter as instructed:
M106 P2 S0.5 I1 F25000 L0.5 B4 H101 T-1:100 C"DuetFan"
Reset the Duet and re-loaded DWC, But the name remains 'FAN2' like before.
That's my M115 data:
M115
FIRMWARE_NAME: RepRapFirmware for Duet 2 WiFi/Ethernet FIRMWARE_VERSION: 1.21 ELECTRONICS: Duet WiFi 1.02 or later FIRMWARE_DATE: 2018-03-2So my firmware is 1.21, but perhaps my specific version of that release isn't up-to-date enough?
-
@snowcrash to get the renaming to work you would need to use the DWC version 1.22.1 v2 and the special firmware version 2.01 (b1.5?) from here https://forum.duet3d.com/topic/5485/duet-web-control-wishlist-notes-and-priorities/25
But at this point it might just be worth waiting for the next official release of 2.01 and associated DWC version.
-
If the TMC chip does not report temperatures correctly, isn't it better to measure the temperatures with a sensor yourself (e.g. at the heat sink of the controller which is under max load, so X or Y controller) and take this temperature to decide how to handle fan speed?
-
@joergs5 said in Help Configuring PWM Fan in Thermostatic Mode for Duet Drivers:
If the TMC chip does not report temperatures correctly, isn't it better to measure the temperatures with a sensor yourself (e.g. at the heat sink of the controller which is under max load, so X or Y controller) and take this temperature to decide how to handle fan speed?
If the drivers get hot, they will heat the CPU through the PCB. So you could use a combination of the CPU temperature and the driver warning to handle fan speed.
-
@phaedrux said in Help Configuring PWM Fan in Thermostatic Mode for Duet Drivers:
@snowcrash to get the renaming to work you would need to use the DWC version 1.22.1 v2 and the special firmware version 2.01 (b1.5?) from here https://forum.duet3d.com/topic/5485/duet-web-control-wishlist-notes-and-priorities/25
But at this point it might just be worth waiting for the next official release of 2.01 and associated DWC version.
Yeah, I think you're absolutely right. It's just a convenience anyway, so I'll wait with this.
@joergs5 said in Help Configuring PWM Fan in Thermostatic Mode for Duet Drivers:
If the TMC chip does not report temperatures correctly, isn't it better to measure the temperatures with a sensor yourself (e.g. at the heat sink of the controller which is under max load, so X or Y controller) and take this temperature to decide how to handle fan speed?
Excellent suggestion, @JoergS5, thanks.
Whenever possible I prefer to use the internal circuitry, but in this case external sensor/s do seem like the best solution. The downside would be the need to devise suitable hardware to interface with the Duet (either ready-made or custom) and the additional wiring & clutter.
I'll look into this more closely when I get some free time
@dc42 said in Help Configuring PWM Fan in Thermostatic Mode for Duet Drivers:
@joergs5 said in Help Configuring PWM Fan in Thermostatic Mode for Duet Drivers:
If the TMC chip does not report temperatures correctly, isn't it better to measure the temperatures with a sensor yourself (e.g. at the heat sink of the controller which is under max load, so X or Y controller) and take this temperature to decide how to handle fan speed?
If the drivers get hot, they will heat the CPU through the PCB. So you could use a combination of the CPU temperature and the driver warning to handle fan speed.
Thanks, @dc42! Sounds great. Could you please give an example of how to accomplish this?