Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    Help Configuring PWM Fan in Thermostatic Mode for Duet Drivers

    Scheduled Pinned Locked Moved
    Tuning and tweaking
    6
    27
    4.6k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • SnowCrashundefined
      SnowCrash @wilriker
      last edited by SnowCrash

      @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 be T0:100 because I have a similar configuration with T25 (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.

      wilrikerundefined 1 Reply Last reply Reply Quote 0
      • wilrikerundefined
        wilriker @SnowCrash
        last edited by wilriker

        @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.

        Manuel
        Duet 3 6HC (v0.6) with RPi 4B on a custom Cartesian
        with probably always latest firmware/DWC (incl. betas or self-compiled)
        My Tool Collection

        SnowCrashundefined 1 Reply Last reply Reply Quote 0
        • SnowCrashundefined
          SnowCrash @wilriker
          last edited by SnowCrash

          @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 🙂

          SnowCrashundefined 1 Reply Last reply Reply Quote 0
          • SnowCrashundefined
            SnowCrash @SnowCrash
            last edited by SnowCrash

            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:

            0_1531556661228_misc.png

            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?

            config.g
            config-override.g

            wilrikerundefined 1 Reply Last reply Reply Quote 0
            • wilrikerundefined
              wilriker @SnowCrash
              last edited by

              @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. 😉

              Manuel
              Duet 3 6HC (v0.6) with RPi 4B on a custom Cartesian
              with probably always latest firmware/DWC (incl. betas or self-compiled)
              My Tool Collection

              Phaedruxundefined 1 Reply Last reply Reply Quote 0
              • dc42undefined
                dc42 administrators
                last edited by dc42

                The name (like many other string parameters in RRF) probably needs to be enclosed in double quotes.

                Duet WiFi hardware designer and firmware engineer
                Please do not ask me for Duet support via PM or email, use the forum
                http://www.escher3d.com, https://miscsolutions.wordpress.com

                1 Reply Last reply Reply Quote 0
                • Phaedruxundefined
                  Phaedrux Moderator @wilriker
                  last edited by Phaedrux

                  @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.

                  Z-Bot CoreXY Build | Thingiverse Profile

                  wilrikerundefined 2 Replies Last reply Reply Quote 2
                  • wilrikerundefined
                    wilriker @Phaedrux
                    last edited by wilriker

                    @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.

                    Manuel
                    Duet 3 6HC (v0.6) with RPi 4B on a custom Cartesian
                    with probably always latest firmware/DWC (incl. betas or self-compiled)
                    My Tool Collection

                    Phaedruxundefined 1 Reply Last reply Reply Quote 2
                    • wilrikerundefined
                      wilriker @Phaedrux
                      last edited by

                      @phaedrux We are going to upvote each other into the hall of fame of reputation. 😂

                      Manuel
                      Duet 3 6HC (v0.6) with RPi 4B on a custom Cartesian
                      with probably always latest firmware/DWC (incl. betas or self-compiled)
                      My Tool Collection

                      1 Reply Last reply Reply Quote 0
                      • Phaedruxundefined
                        Phaedrux Moderator @wilriker
                        last edited by

                        @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.

                        Z-Bot CoreXY Build | Thingiverse Profile

                        1 Reply Last reply Reply Quote 2
                        • SnowCrashundefined
                          SnowCrash
                          last edited by SnowCrash

                          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?

                          Phaedruxundefined 1 Reply Last reply Reply Quote 0
                          • Phaedruxundefined
                            Phaedrux Moderator @SnowCrash
                            last edited by

                            @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.

                            Z-Bot CoreXY Build | Thingiverse Profile

                            1 Reply Last reply Reply Quote 1
                            • SnowCrashundefined
                              SnowCrash
                              last edited by SnowCrash

                              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-2

                              So my firmware is 1.21, but perhaps my specific version of that release isn't up-to-date enough?

                              Phaedruxundefined 1 Reply Last reply Reply Quote 0
                              • Phaedruxundefined
                                Phaedrux Moderator @SnowCrash
                                last edited by Phaedrux

                                @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.

                                Z-Bot CoreXY Build | Thingiverse Profile

                                1 Reply Last reply Reply Quote 0
                                • JoergS5undefined
                                  JoergS5
                                  last edited by

                                  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?

                                  dc42undefined 1 Reply Last reply Reply Quote 0
                                  • dc42undefined
                                    dc42 administrators @JoergS5
                                    last edited by

                                    @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.

                                    Duet WiFi hardware designer and firmware engineer
                                    Please do not ask me for Duet support via PM or email, use the forum
                                    http://www.escher3d.com, https://miscsolutions.wordpress.com

                                    deckingmanundefined 1 Reply Last reply Reply Quote 1
                                    • SnowCrashundefined
                                      SnowCrash
                                      last edited by SnowCrash

                                      @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?

                                      1 Reply Last reply Reply Quote 0
                                      • deckingmanundefined
                                        deckingman @dc42
                                        last edited by

                                        @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.

                                        For info, using a thermistor stuck to a driver chip controlling a fan to blow air onto the back of the boards, after an hour or more of printing, I typically see the driver temperature reporting about 15 degrees higher than the CPU temperature. More specifically, with the fan running in thermostatic mode between 40 and 50 deg C, I might see 47 degrees on the driver but only 32 being reported for the CPU. I did calibrate the cpu temperature by using M912 so they both read the same at an ambient of about 22 deg C.

                                        Ian
                                        https://somei3deas.wordpress.com/
                                        https://www.youtube.com/@deckingman

                                        SnowCrashundefined 1 Reply Last reply Reply Quote 1
                                        • SnowCrashundefined
                                          SnowCrash @deckingman
                                          last edited by SnowCrash

                                          @deckingman said in Help Configuring PWM Fan in Thermostatic Mode for Duet Drivers:

                                          @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.

                                          For info, using a thermistor stuck to a driver chip controlling a fan to blow air onto the back of the boards, after an hour or more of printing, I typically see the driver temperature reporting about 15 degrees higher than the CPU temperature. More specifically, with the fan running in thermostatic mode between 40 and 50 deg C, I might see 47 degrees on the driver but only 32 being reported for the CPU. I did calibrate the cpu temperature by using M912 so they both read the same at an ambient of about 22 deg C.

                                          Awesome, @deckingman, thanks!

                                          In that case, I might switch to monitoring the cpu temp instead of the drivers as it would give me the gradual fan speed ramp up I'm looking for.

                                          How do you monitor that particular temp? (virtual heater number?)

                                          And could you please tell me how you calibrated the cpu temp?

                                          deckingmanundefined 1 Reply Last reply Reply Quote 1
                                          • Phaedruxundefined
                                            Phaedrux Moderator
                                            last edited by Phaedrux

                                            https://duet3d.dozuki.com/Wiki/Calibrating_the_CPU_temperature

                                            M106 P2 F100 L0.2 B0.5 T35:40 H100:101:102	; Set fan 2 Duet case fan. Turns on when the MCU temperature (virtual heater 100)
                                            ; reaches 45C and reaches full speed when the MCU temperature reaches 65C or if any TMC2660 
                                            ; drivers (virtual heaters 101 and 102) report that they are over-temperature
                                            

                                            This is what I use to control the dual case fans for my enclosure. Works quite well. You can modify the set point to keep the cpu relatively cool and be confident the drivers are fairly close.

                                            Z-Bot CoreXY Build | Thingiverse Profile

                                            1 Reply Last reply Reply Quote 1
                                            • First post
                                              Last post
                                            Unless otherwise noted, all forum content is licensed under CC-BY-SA