Thermostatic Fan trigger



  • 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



  • 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
    


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



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



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



  • 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



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



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



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



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



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



  • 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)



  • 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



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



  • (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!)



  • 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
    


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


Log in to reply