Help with write rules for solar water heater

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
nobody@all
Normal user
Posts: 30
Joined: 09 Apr 2017, 23:27

Help with write rules for solar water heater

#1 Post by nobody@all » 15 Aug 2023, 10:56

Hello. I have write some simple rules to control pump for my diy solar water heater.

Code: Select all

on Solar1#temp do
    if [Solar1#temp] > 30
        gpio,5,1                   //turn on gpio over 30deg
    endif
    if [Solar1#temp] < 27
        gpio,5,0                   //turn off gpio under 27deg
    endif
endon
This works but it is inefficient. My idea is to put one more sensor in boiler and write rules to run gpio every time when temp on solar is higher then temp in water boiler + some histeresis to prevent on/off pump when the temperatures are close together. (sorry for my english but i write with google translate)

TD-er
Core team member
Posts: 8756
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Help with write rules for solar water heater

#2 Post by TD-er » 15 Aug 2023, 11:12

That's a good idea to act on temperature differences.
And maybe let the solar temperature get a bit higher first to allow for a larger temperature difference as the heat transfer is depending on the temperature difference so you can use less energy for your pump.


I guess this can be run on just a timer, no need to act on new measurements for the sensor.

Something like this:

Code: Select all

on System#Boot do
  GPIO,5,0 // Turn off pump
  LoopTimerSet,1,120 // 2 minute loop timer
endon

on Rules#Timer=1 do
  let,1,[Solar1#temp]-[Water#temp] // Store calculations in variable #1
  if [Plugin#GPIO#Pinstate#5] = 1 and [var#1] < 1
    // Temperature difference too low, turn off pump
    gpio,5,0  
  endif
  if [Plugin#GPIO#Pinstate#5] = 0 and [var#1] > 3
    // Temperature difference high enough, turn on pump
    gpio,5,1
  endif
endon

nobody@all
Normal user
Posts: 30
Joined: 09 Apr 2017, 23:27

Re: Help with write rules for solar water heater

#3 Post by nobody@all » 15 Aug 2023, 15:32

Thank you for Your reply. I'am not programmer but learn from materials from youtube and internet and I try to understand your rules.
1. I use only one temperature sensor mounted on solar?
2. where did it came from [Water#temp]- should I create dummy device NAME Water, Values- temp? or add new sensor ds18b20 mounted in water boiler and named water/values temp?

User avatar
Ath
Normal user
Posts: 3519
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Help with write rules for solar water heater

#4 Post by Ath » 15 Aug 2023, 15:41

nobody@all wrote: 15 Aug 2023, 15:32 1. I use only one temperature sensor mounted on solar?
That's fine.
nobody@all wrote: 15 Aug 2023, 15:32 2. where did it came from [Water#temp]- should I create dummy device NAME Water, Values- temp? or add new sensor ds18b20 mounted in water boiler and named water/values temp?
An extra sensor measuring the water temperature should indeed be added, keeping the water temperature manually isn't going to work very efficiently :lol:
There are several ways to add a second ds18b20, but using an extra task called Water is the easiest (though it could use an extra GPIO pin).

NB: Technically it's possible to have multiple (up to 4) of these ds18b20 sensors on the same task/device, but that would be quite confusing in this case, I guess.
/Ton (PayPal.me)

TD-er
Core team member
Posts: 8756
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Help with write rules for solar water heater

#5 Post by TD-er » 15 Aug 2023, 16:05

Just to elaborate a bit on why Ton calls it "confusing" to add an extra 1Wire sensor to the same task...

You now named the task for the solar temp sensor: "Solar1" and the taskvalue "temp"
If you would continue like this, you would get something like this:

Task: Solar1
Value1: temp
Value2: temp2

However, you can also rename the task, so it is more representative to what it is used for:

Task: SolarTank1
Value1: paneltemp
Value2: watertemp

Or just create 2 separate tasks:
Task: Solar1
Value1: temp

Task: water
Value1: temp

It is up to you what might be easier to manage.

One thing to keep in mind is that if you use multiple 1Wire sensors in the same task, they will be read at the same time.
Especially when you are only interested in the temperature difference, this might be useful.

However, if both are located at completely different locations, this might become a bit tricky.

You could have 2 ESPEasy units and share the temperature of one sensor to the other ESPEasy unit via the p2p protocol.

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 30 guests