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

    Solved: Fan control doesn't work correctly in RRF 3.3

    Scheduled Pinned Locked Moved Solved
    Using Duet Controllers
    3
    23
    2.2k
    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.
    • achrnundefined
      achrn @Gixxerfast
      last edited by achrn

      @gixxerfast said in How do I control 4-wire fans:

      With temp control this get even stranger (and not really useful)

      Well, the shape of that graph is mostly correct for the config you've defined.

      M106 P3 H0 L0.55 X1.0 T60:90
      means run at 55% from 60C to 76.5C, then ramp up linearly to 100% at 90C. That's also (most of) what your graph shows teh behavior to be, given that your fan runs at 250rpm for a 55% signal.

      I agree that at 55% signal it should probably be running at faster than 250rpm, and it does't explain why you get a sudden jump in speed when you go from 99.6% to 100%.

      However, all those behaviours would happen, I think, if the duet wasn't pulling the fan PWM line hard enough - if the PWM signal is ramping gradually and the fan is only seeing the very end of that ramp as being the relevant transition. So for short pulses (below about 50%, the fan doesn't see a transition at all, for longer pulses it only sees half the duration it should, but when it's a true 100% PWM, it sees all 100% of that. Seems to fit the symptoms (at least, it does to my naive level of electronics understanding).

      I don't suppose you can lay your hands on an oscilloscope...?

      Edit: if it is this (ie a hardware issue) switching to differnet firmware probably doesn't solve it.

      Gixxerfastundefined 1 Reply Last reply Reply Quote 0
      • Gixxerfastundefined
        Gixxerfast @achrn
        last edited by Gixxerfast

        @achrn No, I wish I had an oscilloscope though.

        Yeah, the inclination of the curve is possibly correct but It's been shifted in x it seems to me.

        In the object model the frequency is set to 250 though the config is correct, It should be 25000 I guess. Also I checked the fan controller code on giyhub and it has been been rewritten a lot in 3.4 so it might be a firmware issue in 3.3. Maybe people don't run four or three wire fans so much.

        Voron V2.4 (#1317) with Duet 3 Mini5+ Wifi and 1LC v1.1 Toolboard
        Voron V0.1 (#637) with Duet 3 Mini 5+ Wifi and 1LC v1.2 Toolboard
        Ender 3 Pro with BTT SKR-2 + RRF

        1 Reply Last reply Reply Quote 0
        • Gixxerfastundefined
          Gixxerfast
          last edited by Gixxerfast

          I had a look in LocalFan.cpp for 3.3 and it was pretty obvious that the old code was not correct and this has been changed in 3.4.

          I therefore installed 3.4 beta 5 and yes, now the thermostatic control of a fan scales correctly to the interval that's configured.

          However it's still strange that you have no fan rpm below 55% duty cycle and the difference between 99% and 100% duty cycle is 2700 rpm which is half of the max speed. It should IMO scale like the speed characteristics diagram above. Something should be corrected or explained here.

          Voron V2.4 (#1317) with Duet 3 Mini5+ Wifi and 1LC v1.1 Toolboard
          Voron V0.1 (#637) with Duet 3 Mini 5+ Wifi and 1LC v1.2 Toolboard
          Ender 3 Pro with BTT SKR-2 + RRF

          1 Reply Last reply Reply Quote 0
          • achrnundefined
            achrn
            last edited by

            @gixxerfast said in Fan control doesn't work correctly in RRF 3.3 and and 3.4:

            However it's still strange that you have no fan rpm below 55% duty cycle and the difference between 99% and 100% duty cycle is 2700 rpm which is half of the max speed. It should IMO scale like the speed characteristics diagram above. Something should be corrected or explained here.

            That still sounds like a hardware fault to me - if something is stopping the signal pulling up fast enough (if pullup is too weak) it would happen like that, I think.

            I think it's unlikely that so few people are using 4-pin fans that no-one else has noticed a catastrophic bug in the firmware..

            As a data point, my delta (runing 3.3 firmware) has two 4-pin fans (Noctua Redux 1800) and they work as expected:
            2b0344b0-04f4-4456-8b5b-e52ae35563bc-image.png

            This is rpm v. duty, stepping from 0.1 duty up to 1.0 and back down to 0.0, in steps of 0.05, sampling the rpm ten times at 2 second intervals at each duty value each direction. There's one erratic data point at 0.25 duty on the way up, one at 0.75 on the way down. There's an interesting step (and some uncertainty) at 0.4 duty.

            The raw data is here, the columns being time, requested duty, actual duty, rpm. fan4.txt

            Gixxerfastundefined 1 Reply Last reply Reply Quote 0
            • Gixxerfastundefined
              Gixxerfast @achrn
              last edited by Gixxerfast

              @achrn OK, thanks. How does you fan config look like? Do you have a pullup on the tacho signal ? Should that matter?

              Voron V2.4 (#1317) with Duet 3 Mini5+ Wifi and 1LC v1.1 Toolboard
              Voron V0.1 (#637) with Duet 3 Mini 5+ Wifi and 1LC v1.2 Toolboard
              Ender 3 Pro with BTT SKR-2 + RRF

              achrnundefined 1 Reply Last reply Reply Quote 0
              • achrnundefined
                achrn @Gixxerfast
                last edited by

                @gixxerfast said in Fan control doesn't work correctly in RRF 3.3 and and 3.4:

                @achrn OK, thanks. How does you fan config look like? Do you have a pullup on the tacho signal ? Should that matter?

                My config looks the same as yours: M950 F4 C"!out5+out5.tach" Q25000 (for purpose of this test, at least)

                I don't have any hardware mods - just four-pin fan connector plugged onto four-pin fan header. That is, take fan out of manufacturers packaging, plug it in to duet. Mine is a MB6HC.

                Adding pullup to the tacho shouldn't be relevant, I think. That won't affect how fast the fan spins. (Unless you think your fan is actually spinning as fast as it should be, and it's just reporting low while spinning at the correct speed, but that wasn't the impression I got).

                Pullup on the PWM might help. I hesitate to suggest a value (because I don't want to be responsible for frying your board or your fan) but maybe someone who is more confident about the circuits will chip in - https://forum.duet3d.com/post/251107 suggests an additional pullup of 10k to 5V. (If the fan is following the usual Intel spec 5V is the correct level - the Intel spec says 5.25V max).

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

                  @gixxerfast there appear to be three issues here:

                  1. The bug with fan temperature control over an interval, which has been fixed in RRF 3,4beta.

                  2. The object model browser in DWC always reports the fan PWM frequency as 250. This is because RRF does not report the PWM frequency. It appears that in the absence of receiving the frequency, DWC is displaying the default value instead of not displaying a value. I will change RRF to report the PWM frequency in the next beta.

                  3. Your fans do not provide a speed that scales linearly with the commanded PWM. This could be just the way your fans behave, or it could be an issue with PWM generation. To investigate the possibility of incorrect PWM generation, I connected a Noctua PWM fan to OUT3 on a Diet 3 Mini, configured it using m950 f5 c"!out3+out3.tach" q25000 and tried various fan settings. I also checked the PWM frequency, which was 24.999kHz according to my oscilloscope. The RPMs I read are:

                  20% 470
                  40% 1600
                  60% 2730
                  80% 3730
                  100% 5020

                  So it appear to me to be working correctly. This was with firmware 3.4.0beta5.

                  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 1
                  • dc42undefined
                    dc42 administrators
                    last edited by

                    PS - it's occurred to me that depending on the input circuit of your fan, you may be able to improve the response by connecting a pullup resistor between the PWM input and +5V. 10K would be a good starting point.

                    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

                    Gixxerfastundefined 2 Replies Last reply Reply Quote 2
                    • Gixxerfastundefined
                      Gixxerfast @dc42
                      last edited by

                      @dc42 OK, but the control pulse voltage is already 5V from the Duet? What would a pullup resistor do in this case?

                      I'm unfortunately a bit lacking in my knowledge of electronics.

                      Voron V2.4 (#1317) with Duet 3 Mini5+ Wifi and 1LC v1.1 Toolboard
                      Voron V0.1 (#637) with Duet 3 Mini 5+ Wifi and 1LC v1.2 Toolboard
                      Ender 3 Pro with BTT SKR-2 + RRF

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

                        @gixxerfast the output is open drain so it relies on there being a pullup resistor in the fan.

                        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 1
                        • Gixxerfastundefined
                          Gixxerfast @dc42
                          last edited by Gixxerfast

                          @dc42
                          Yes, that was (sorry for choice of words) bloody perfect. I added a pullup resistor as you said 10K and now they scale very well 🙂 I have no gap between 99 - 100 % It won't run until 15% but that's sort of expected and not a problem.

                          Btw, I had 4.87V without the pullup between V- and control.

                          It's crimping time. 🙂

                          I hope I can take the 5v from here without any worries.
                          ca4503d9-53dd-49f4-b9f6-be928ba9fbd9-image.png

                          Big thanks to @dc42 and @achrn

                          Voron V2.4 (#1317) with Duet 3 Mini5+ Wifi and 1LC v1.1 Toolboard
                          Voron V0.1 (#637) with Duet 3 Mini 5+ Wifi and 1LC v1.2 Toolboard
                          Ender 3 Pro with BTT SKR-2 + RRF

                          dc42undefined achrnundefined 2 Replies Last reply Reply Quote 1
                          • dc42undefined
                            dc42 administrators @Gixxerfast
                            last edited by dc42

                            @gixxerfast thanks for confirming that.

                            The Intel specification for PWM fans says in section 2.1.4:

                            The following requirements are measured at the PWM (control) pin of the fan cable connector see Figure 7 and Table 1:
                            PWM Frequency: Target frequency 25 kHz, acceptable operational range 21 kHz to 28 kHz
                            Maximum voltage for logic low: VIL = 0.8 V
                            Absolute maximum current sourced: Imax = 5 mA (short circuit current)
                            Absolute maximum voltage level: VMax = 5.25 V (open circuit voltage)
                            This signal must be pulled up to a maximum of 5.25V within the fan.
                            Note:New fan designs are strongly encouraged to implement a 3.3V pull up for compatibility with buffer design limits on Hardware Monitor Devices e.g. Super IO devices.

                            So the specification requires there to be a pullup resistor inside the fan, although it doesn't specify a maximum value for it (the maximum current sourced implies a minimum value of about 1K). My guess is that your fans have a pullup resistor with a very high value, so that in conjunction with the capacitance of the cable, it slows down the rise time of the PWM signal excessively. If the fan cable is long, that would make this more of a problem, due to the increased capacitance.

                            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 1
                            • achrnundefined
                              achrn @Gixxerfast
                              last edited by

                              @gixxerfast said in Solved: Fan control doesn't work correctly in RRF 3.3:

                              @dc42
                              It won't run until 15% but that's sort of expected and not a problem.

                              The Intel spec says behaviour below 20% is undefined. Some fans stop, and some run at a not-very-predictable rate, and some run at the same rpm for all duty values below 20%. Sometimes a manufacturer specifies what a particular fan does in this region, but not always.

                              Gixxerfastundefined 1 Reply Last reply Reply Quote 0
                              • Gixxerfastundefined
                                Gixxerfast @achrn
                                last edited by Gixxerfast

                                @achrn Yes, and the fan speed is so low it doesn't really matter if they are on on or not. It makes no difference. Estoy muy contento 🙂

                                Voron V2.4 (#1317) with Duet 3 Mini5+ Wifi and 1LC v1.1 Toolboard
                                Voron V0.1 (#637) with Duet 3 Mini 5+ Wifi and 1LC v1.2 Toolboard
                                Ender 3 Pro with BTT SKR-2 + RRF

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