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

    Thermostatic Fan trigger

    Scheduled Pinned Locked Moved Solved
    Tuning and tweaking
    3
    16
    666
    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.
    • mwwhitedundefined
      mwwhited
      last edited by

      On my Duet3 (3.1 RC9) I set up a fan inside of my power supply. Right now the fan toggles from on/off. I tried changing the blimp time to 10 seconds but that didn't work. What I would like is a way to turn the fan on at 35C and not turn back off until it hits 25C.

      Current config....

      M308 S3 P"temp3" Y"thermistor" T100000 B4138 ; configure sensor 3 as thermistor on pin temp3 for Power supply
      M950 F3 C"out9" Q500 ; create fan 3 on pin out9 and set its frequency
      M106 C"Power Supply" P3 H3 S1.0 L1.0 T35 B10.0 ;Power supply fan (3) linked to power supply temp (3). Turn on at 35C stay on for at least 10 seconds

      deckingmanundefined 1 Reply Last reply Reply Quote 0
      • mwwhitedundefined
        mwwhited
        last edited by

        daemon.g solution worked 🙂

        daemon.g

        M98 P"0:/macros/Special Scripts/Check Power Supply"
        
        G4 S10 ; wait 10 seconds
        

        Special Scripts/Check Power Supply

        if fans[3].actualValue > 0.0 && sensors.analog[3].lastReading < 25
            ;echo "fan running and temp less than 25c... stop fan"
            M106 P3 S0.0
        elif fans[3].actualValue < 0.5 && sensors.analog[3].lastReading > 35
            ;echo "fan stopped and temp greater than 35c... start fan"
            M106 P3 S1.0
        
        1 Reply Last reply Reply Quote 0
        • A Former User?
          A Former User
          last edited by A Former User

          did you try T25:35 ?
          never mind, that probably isn't what you're after

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

            @mwwhited I'm fairly sure that you are stuck with 1 degree of hysteresis. Early firmware versions had no hysteresis which made fans constantly switch on and off when the temperature was close to the switching point. If it's any use, you can set a temperature range using something like M106 T25:35 which would run the fan at low speed at 25 and full speed at 35 deg C. Then maybe add an L and/or H parameter but it won't do exactly what you want.

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

            1 Reply Last reply Reply Quote 0
            • mwwhitedundefined
              mwwhited
              last edited by

              Yeah, I tried T25:35 and it just turned on at 35 then back off at 34.something. I also tried T35:25 and it turned on at 25 and turned of just under 25.

              deckingmanundefined 1 Reply Last reply Reply Quote 0
              • mwwhitedundefined
                mwwhited
                last edited by

                This fan really doesn't like PWM. I tried different frequencies and it just started to sing at that a harmonic of that frequency until it was at 100%.

                Guess I could dig into the firmware and see how difficult it would be to add my idea. Even if it was a new parameter or notation. Say something like T35:-10

                A Former User? 1 Reply Last reply Reply Quote 0
                • deckingmanundefined
                  deckingman @mwwhited
                  last edited by deckingman

                  @mwwhited said in Thermostatic Fan trigger:

                  Yeah, I tried T25:35 and it just turned on at 35 then back off at 34.something. I also tried T35:25 and it turned on at 25 and turned of just under 25.

                  That sounds like the fan itself doesn't play nicely with PWM. You could try adjusting the PWM frequency. I've used really low values like 10 Hz to tame some stubborn fans. Others have used much higher frequencies.

                  EDIT. Sorry I was typing while you were posting so didn't see you comment about PWM.

                  EDIT2 - but it might worth trying a really low value like 10 HZ before you give up??

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

                  1 Reply Last reply Reply Quote 0
                  • A Former User?
                    A Former User @mwwhited
                    last edited by

                    @mwwhited said in Thermostatic Fan trigger:

                    Guess I could dig into the firmware and see how difficult it would be to add my idea

                    would be easier to use conditional g-code probaly.

                    deckingmanundefined mwwhitedundefined 2 Replies Last reply Reply Quote 1
                    • deckingmanundefined
                      deckingman @A Former User
                      last edited by

                      @bearer said in Thermostatic Fan trigger:

                      @mwwhited said in Thermostatic Fan trigger:

                      Guess I could dig into the firmware and see how difficult it would be to add my idea

                      would be easier to use conditional g-code probaly.

                      There's a thought............👍

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

                      1 Reply Last reply Reply Quote 0
                      • mwwhitedundefined
                        mwwhited
                        last edited by

                        @deckingman said in Thermostatic Fan trigger:

                        @mwwhited said in Thermostatic Fan trigger:

                        Yeah, I tried T25:35 and it just turned on at 35 then back off at 34.something. I also tried T35:25 and it turned on at 25 and turned of just under 25.

                        That sounds like the fan itself doesn't play nicely with PWM. You could try adjusting the PWM frequency. I've used really low values like 10 Hz to tame some stubborn fans. Others have used much higher frequencies.

                        EDIT. Sorry I was typing while you were posting so didn't see you comment about PWM.

                        No worries.. I tried changing the base frequency higher and lower and it still did the same thing. Maybe I just need to add an cap like this Suppressing Acoustic Noise in
                        PWM Fan Speed Control Systems
                        suggests... yeah it's for AVRs but its the same idea. this fan may not have a built in capacitor. (At least not a big enough one.)

                        It would still be nice to have a high on/low off toggle but running it at lower speeds would mostly help.

                        1 Reply Last reply Reply Quote 0
                        • mwwhitedundefined
                          mwwhited @A Former User
                          last edited by

                          @bearer said in Thermostatic Fan trigger:

                          @mwwhited said in Thermostatic Fan trigger:

                          Guess I could dig into the firmware and see how difficult it would be to add my idea

                          would be easier to use conditional g-code probaly.

                          I was wondering about that. Maybe a trigger to toggle... it would be a nice work around. I'll give it a go later.

                          1 Reply Last reply Reply Quote 0
                          • mwwhitedundefined
                            mwwhited
                            last edited by

                            I can write a loop but I don't have threading so I can't make a background monitor. Is their polling, timers or a way to trigger on a temperature value? the only trigger options I see are for endstops/simple edge triggers (M581)

                            1 Reply Last reply Reply Quote 0
                            • A Former User?
                              A Former User
                              last edited by

                              didn't the latest DSF support conditional code and thus the daemon.g file?

                              https://forum.duet3d.com/topic/14701/daemon-g-usage-cases

                              or if you're not using DSF it ought work?

                              IDK, i had a hard time just rememering what to search for to find it

                              mwwhitedundefined 1 Reply Last reply Reply Quote 0
                              • mwwhitedundefined
                                mwwhited @A Former User
                                last edited by

                                @bearer said in Thermostatic Fan trigger:

                                didn't the latest DSF support conditional code and thus the daemon.g file?

                                https://forum.duet3d.com/topic/14701/daemon-g-usage-cases

                                or if you're not using DSF it ought work?

                                IDK, i had a hard time just rememering what to search for to find it

                                That's awesome... I missed that post before. Thanks 🙂

                                1 Reply Last reply Reply Quote 0
                                • A Former User?
                                  A Former User
                                  last edited by

                                  (It should probaly be mentioned in more obvious places in the documentation, I had a hard time finding it; and try it if works before celebrating!)

                                  1 Reply Last reply Reply Quote 0
                                  • mwwhitedundefined
                                    mwwhited
                                    last edited by

                                    daemon.g solution worked 🙂

                                    daemon.g

                                    M98 P"0:/macros/Special Scripts/Check Power Supply"
                                    
                                    G4 S10 ; wait 10 seconds
                                    

                                    Special Scripts/Check Power Supply

                                    if fans[3].actualValue > 0.0 && sensors.analog[3].lastReading < 25
                                        ;echo "fan running and temp less than 25c... stop fan"
                                        M106 P3 S0.0
                                    elif fans[3].actualValue < 0.5 && sensors.analog[3].lastReading > 35
                                        ;echo "fan stopped and temp greater than 35c... start fan"
                                        M106 P3 S1.0
                                    
                                    1 Reply Last reply Reply Quote 0
                                    • A Former User?
                                      A Former User
                                      last edited by

                                      I might be cursing in church here; maybe cross post to the use case thread, or link it here or something to increase odds of others finding it?

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