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.1k
    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.
    • Gixxerfastundefined
      Gixxerfast
      last edited by Gixxerfast

      Hi!
      EDIT3:
      There is a bug in 3.3 that messes up the temp interval scaling. it IS fixed in 3.4 beta. The other strange behaviour with these fans (Sanyo) can be fixed with a 10K pullup resistor between the fan control and 5V.
      If added the fan control scales very well.
      END EDIT3

      EDIT2: One problem seems to have been fixed in 3.4 and that is the thermostatic control that doesn't scale pwm wrongly any more. However there's still a problem with no fan under 55 % PWM duty and the difference between 99% and 100% PWM duty is 2700 rpm.
      END EDIT2

      EDIT: The main problem seems to be that the PWM control doesn't scale according to this:
      56639549-4974-4305-8ee6-4c514bad7648-image.png

      If it did (assuming I understand this correctly) I would let my fan be controlled by a temp of say 45 - 60C Where it would have a L value of 0.4 and an X value of 0.9 (to cap the fan speed due to noisy fan) and it would scale linearly inbetween. I can't se that it does. It's like nothing until it reaches max temp and then the X value needs to be real close to 1 to getthe fan going more or less at all.

      End EDIT

      I have two Sanyo SanAce 60 controller bay fans. They have tacho signal and pwm control

      43fd933d-7197-4a4c-9a50-029b9c8c35f6-image.png

      From the diagram above it seems like I should be able to control th ePWM duty cycle. However I get only full blast or nothing.

      Here's my config:

      ; Controller fan 1
      M950 F2 C"!0.out3+out3.tach" Q25000                     ; create fan 2 on pin out3 and set its frequency
      M106 P2 S1.0 H3:4 L0.1 X0.5 T30:50 C"Controller fan 1"  ; controlled by Sensor 3 - MCU
      
      ; Controller fan 2
      M950 F3 C"!0.out4+out4.tach" Q25000                     ; create fan 3 on pin out4 and set its frequency
      M106 P3 H0 T45:115 L0.1 X0.5 C"Controller fan 2"
      

      I we take controller fan 2 above, only when I set max X1.0 and it reaches max temp will it start. When the temp goes under top value then it will stop.

      Any ideas?

      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

        Btw
        If the bed is 65C then I will get 1600 rpm with this:

        M106 P3 H0 T20:40 L0.7 X254 C"Controller fan 2"
        

        I will get 6900 rpm (full rpm) with this:

        M106 P3 H0 T20:40 L0.7 X255 C"Controller fan 2"
        

        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

          As a manual fan I can control it

          e41f9ee5-12c1-462f-a418-5e6daf9302d3-image.png

          Also if I set one temp and set S0.95 I get half of full speed. But I can't seem to define a temp interval.

          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 which firmware version are you running? A bug in this area was fixed recently.

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

              @dc42 V3.3 release I don't dare stepping into beta territory 🙂

              m122
              === Diagnostics ===
              RepRapFirmware for Duet 3 Mini 5+ version 3.3 (2021-06-15 21:46:11) running on Duet 3 Mini5plus WiFi (standalone mode)
              Board ID: H1668-Y296U-D65J0-40KMA-KR03Z-RK6ZH
              

              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 @dc42
                last edited by

                @dc42
                Are you thinking of this. It's a bit vague isn't it:

                In RepRapFirmware 3.4.0beta3

                Bug fixes:
                
                M106 proportional thermostatic control (i.e. using two T values) didn't work
                

                It doesn't say when this bug was introduced and how it didn't work.

                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

                  Something is wrong here. I adjust the fan in steps from the dashboard in DWC

                  ; Controller fan 2
                  M950 F3 C"!0.out3+out3.tach" Q25000                     ; create fan 3 on pin out4 and set its frequency
                  ;M106 P3 H0 L0.92 X0.98 T45:65 C"Controller fan 2"
                  M106 P3 S-1 C"Controller fan 2"
                  

                  ae423547-6d0d-4924-9803-1628ae1cd8ca-image.png

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

                  ; Controller fan 2
                  M950 F3 C"!0.out3+out3.tach" Q25000                     ; create fan 3 on pin out4 and set its frequency
                  M106 P3 H0 L0.55 X1.0 T60:90 C"Controller fan 2"
                  

                  c20a936a-6b27-4dc7-af25-303de7aeb43b-image.png

                  I get a clear feeling that if I multiply the values I put in fan control and multiply it by 1/255 then I'll get a value that corresponds approximately with the data sheet for the fan

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

                    Hi hope someone is reading these posts and can help

                    When looking in the object model I find this:
                    e967a0ae-495b-44db-9710-0bc1acf12cac-image.png

                    AFAIK, it should be 25000 Hz, what's going on 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

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

                      OK, I'm documenting here as I (sort of) understand what's going on.

                      In RRF 3.4 most aof the fan control that I seem to have issues with has been rewritten. The factor 0.5 that I sort get a hint of above seem to be have been totally removed.

                      So, the question is, do I dare to switch to RRF 3.4 beta or will I be in a heap of other troubles then?

                      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 @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
                                            • First post
                                              Last post
                                            Unless otherwise noted, all forum content is licensed under CC-BY-SA