![]() |
Forum Index : Microcontroller and PC projects : Temperature differential logic
Author | Message | ||||
Phil23 Guru ![]() Joined: 27/03/2016 Location: AustraliaPosts: 1667 |
Just not quite getting my rusty brain around temperature differential logic. This simple code works, but doesn't allow for any differential. Like say 0.3° If TmpCur<TmpTar Then 'Compare Current & Target temperature. PumpStat="Running" 'Turn the Pump on. pin(PinLed1)=1 else PumpStat="Standby" 'Turn the Pump off. pin(PinLed1)=0 endif Main reason I want differential, is not for Solar control, but for when I'm using the Heat Pump. I want to reduce the amount of times it cycles on & off. Cheers. |
||||
atmega8![]() Guru ![]() Joined: 19/11/2013 Location: GermanyPosts: 724 |
.....??? HYSTERESIS ? |
||||
Phil23 Guru ![]() Joined: 27/03/2016 Location: AustraliaPosts: 1667 |
That's the term I should have used. Ie, When temperature gets to 34°C, stop heating, but don't start again before it falls below say 33.6°. Guessing it will need some sort of cycle flag. Cheers |
||||
atmega8![]() Guru ![]() Joined: 19/11/2013 Location: GermanyPosts: 724 |
This Is very simple. HYSTERESIS is done by a Schmitt-Trigger. You need a software Schmitt-Trigger like this: if( Input > top) LED = 1 else if( Input < min) LED = 0 |
||||
robert.rozee Guru ![]() Joined: 31/12/2012 Location: New ZealandPosts: 2428 |
try the following: hyst = 1 If TmpCur<(TmpTar-hyst) Then 'Compare Current & Target temperature. PumpStat="Running" 'Turn the Pump on. pin(PinLed1)=1 endif If TmpCur>(TmpTar+hyst) Then 'Compare Current & Target temperature. PumpStat="Standby" 'Turn the Pump off. pin(PinLed1)=0 endif when the current temperature falls 1 degree below the target temperature, the pump is turned on. when the current temperature rises 1 degree above the target temperature, the pump turns off. cheers, rob :-) |
||||
Phil23 Guru ![]() Joined: 27/03/2016 Location: AustraliaPosts: 1667 |
Thanks Rob, That's basically what I came up with once I rested my brain & could thing logically again. If TmpCur<(TmpTar - TmpDif) Then PumpStat="Running" 'Turn the Pump on. pin(PinLed1)=1 else if TmpCur>(TmpTar) then PumpStat="Standby" 'Turn the Pump off. pin(PinLed1)=0 endif Just not swinging on the high side of the set temp. Will just have to add a minimum wait timer on it for when it's in heat pump mode now so the compressor unit can depressurise. Have found a good example some else has done of Ardurino over here. Phil. |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |