Time-delay a 12v fan output based on heater output?
-
Hi peeps, just a quick one - is there any way I can configure a fan output to turn off after a time delay from a related heater output turning off?
I've got a 12v fan that will be on a 240v PTC enclosure heater. The fan needs to always be running when the PTC has power to it, which is easy enough as I could drive the 12v fan from the heater output. But what would be cool (no pun intended) would be if, when the heater output turns off (as the enclosure is up to temperature) I could "run on" the 12v fan for 30 seconds or so, just to provide a little passive cooling of the PTC element afterwards.
No big deal if not, just wondered before I started wiring it up.... (nb: I don't have a temperature probe on the PTC itself, the enclosure heating will be controlled by a PTC sensor half-way up the enclosure measuring ambient temperature)
-
-
@brumster does the PTC element have its own temperature sensors? if so then you can configure a thermostatic fan, that way you are not using time, but temperature to control the fan.
-
@T3P3Tony hiya, thanks for the reply. The PTC doesn't have a sensor on it no, it is ultimately controlled by the enclosure temperature sensor which is mid-way in the enclosure - it will control the power to the PTC heater to maintain the enclosure temperature, cycling it on and off as necessary.
I think I'll just rely on the fan being wired into the 12v signal that activates the solid-state relay for the PTC. That way, PTC is on means fan is on. Accepted that there will be a short period of switching the PTC off where it's hot with no fan, but I suspect it will be OK.
-
@brumster
If you must have a timed delay then you can use daemon.g
You will need to create in your /sys directory.
By default it will run every 10 seconds.
If that maximum latency between turning on the heater and the fan activation is acceptable, then use the first section of the code below.
If you need it to check more frequently, then delete the first section and un-comment the second section.
If you need to manually control the fan at some point you must set the global variable autoChamberFan to false.set global autoChamberFan = false
in the console.
You will need to adjust the fan and heater numbers you wish to use in the appropriate variables.; 0:/sys daemon.g - by default will run once every 10 seconds ; ****************************************************************************** if !exists(global.autoChamberFan) global autoChamberFan = true ; create a global so we can opt out and manually control fan if needed var heaterNumber = 1 ; set to whichever heater you're monitoring or hard code it belo var fanNumber = 0 ; set to whatever fan you'recontrolling or hard code it below var fanOffDelay = 60 ; delay to turn off the fan in seconds if !exists(global.fanTimeOut) global fanTimeOut = (state.time - 1) ; create our variable and set the initial value so the fan is off if heat.heaters[var.heaterNumber].state != "off" ; heater is on, standby or tunin M106 P{var.fanNumber} S255 ; turn the fan on set global.fanTimeOut = state.time + var.fanOffDelay ; reset our timeout value else if global.fanTimeOut < state.time ; the fan is off, so we check if we've reashed teh timeout M106 P{var.fanNumber} S0 ; turn off the fan ; ********************************************************************************** ; ************************************************************************************ ; use this code to run code every X seconds ; 0:/sys daemon.g - using a loop to run at less than 10 second intervals ;if !exists(global.autoChamberFan) ; global autoChamberFan = true ; create a global so we can opt out and manually control fan if needed ;var loopTime = 2 ; set to number of seconds between checks ;var heaterNumber = 1 ; set to whichever heater you're monitoring or hard code it below ;var fanNumber = 0 ; set to whatever fan you'recontrolling or hard code it below ;var fanOffDelay = 60; delay to turn off the fan in seconds ; ; ;if !exists(global.fanTimeOut) ; global fanTimeOut = state.time - 1 ; create our variable and set the initial value so the fan is off. Using a global so you can see it in object model ; echo "initial timeout = " , global.fanTimeOut ;while true ; if (heat.heaters[var.heaterNumber].state != "off") && (global.autoChamberFan = true) ; heater is on, standby or tuning ; set global.fanTimeOut = state.time + var.fanOffDelay ; reset our timeout value ; echo "time = " ^ state.time ^ " : New timeout = " ^ global.fanTimeOut ; M106 P{var.fanNumber} S255 ; turn the fan on ; else ; if (global.fanTimeOut < state.time) && (global.autoChamberFan = true) ; the fan is off, so we check if we've reashed the timeout ; M106 P{var.fanNumber} S0 ; turn off the fan ; G4 S{var.loopTime} ; *****************************************************************************************
-
@OwenD that is awesome, thankyou! I will wire it up in order to try this and see how it goes... cheers...