How to make my pool heating system smart
How to make my pool heating system smart
Hello all,
Reverting to the wisdom of this forum hopefully to get some guidance on how to automate my pool heating system, potentially using ESP32. Will try to explain as best as possible.
In summary I have a current water heating system, that uses solar panels. These same solar panels also heat the pool when certain thresholds are met.
This all happens via three main connections to the pool system:
1) The actual hot water circuit that comes from the solar panel and goes through a specific closed circuit that the pool water is in contact with (blue dashed lines / flow B)
2) A 220v line that powers the pool pump when the solar panel closed water circuit flow (Flow B) is being diverted to the pool (fat red line)
3) A PT1000 temp sensor that is connected to the Daikin/Rotex controler (fat purple line) So general rule is, if water heater temp > 65ºc and Pool temp < 35ºc (uses the PT1000 temp sensor for this reading), then close Flow A (from solar panels to water heater) and open Flow B (to pool) and at the same time start and run the pool pump to get water flowing through the system.
As is also visible in the diagram, I already have a Shelly 1PM Pro device to be able to control the Pool Pump remotely, which is already setup and working.
What I now would like to acheive is two things:
1) Hook up the PT1000 temperature sensor (purle line), to not only the Rotex DSR1 controlor but some other SoC such as ESP32 or ESP8266
2) Hook up the 220v line (which could be coverted to 12v) to also a RaspPi or Arduino or ESP32 or ESP8266 so that I can simply know when "Flow B" above is active. By knowing this I can then remotely use the Shelly 1PM to activate the Pool Pump, all of course using Home Assistant (which is already in use for a multitude of things).
So my question is, are the above two scenarios feasible/possible? If so, what would any of you recommend as the architecture? what SoC? how would connections work? can I use a 240v current or should I reduce to 12v/24v? what software could I use to get the readings? would this be easily integratable into home assistant? etc...
I am very new to ESP32 or ESP8266, so would greatly appreciate some hand holding to get me through a potential solution.
Many thanks!
Reverting to the wisdom of this forum hopefully to get some guidance on how to automate my pool heating system, potentially using ESP32. Will try to explain as best as possible.
In summary I have a current water heating system, that uses solar panels. These same solar panels also heat the pool when certain thresholds are met.
This all happens via three main connections to the pool system:
1) The actual hot water circuit that comes from the solar panel and goes through a specific closed circuit that the pool water is in contact with (blue dashed lines / flow B)
2) A 220v line that powers the pool pump when the solar panel closed water circuit flow (Flow B) is being diverted to the pool (fat red line)
3) A PT1000 temp sensor that is connected to the Daikin/Rotex controler (fat purple line) So general rule is, if water heater temp > 65ºc and Pool temp < 35ºc (uses the PT1000 temp sensor for this reading), then close Flow A (from solar panels to water heater) and open Flow B (to pool) and at the same time start and run the pool pump to get water flowing through the system.
As is also visible in the diagram, I already have a Shelly 1PM Pro device to be able to control the Pool Pump remotely, which is already setup and working.
What I now would like to acheive is two things:
1) Hook up the PT1000 temperature sensor (purle line), to not only the Rotex DSR1 controlor but some other SoC such as ESP32 or ESP8266
2) Hook up the 220v line (which could be coverted to 12v) to also a RaspPi or Arduino or ESP32 or ESP8266 so that I can simply know when "Flow B" above is active. By knowing this I can then remotely use the Shelly 1PM to activate the Pool Pump, all of course using Home Assistant (which is already in use for a multitude of things).
So my question is, are the above two scenarios feasible/possible? If so, what would any of you recommend as the architecture? what SoC? how would connections work? can I use a 240v current or should I reduce to 12v/24v? what software could I use to get the readings? would this be easily integratable into home assistant? etc...
I am very new to ESP32 or ESP8266, so would greatly appreciate some hand holding to get me through a potential solution.
Many thanks!
-
- Posts: 9729
- Joined: Thu Nov 26, 2015 4:08 am
Re: How to make my pool heating system smart
Detecting the 220V/12V is trivial; you can simply add a relay that has a coil of the voltage required, and use one of its contacts as a simple switch. Detecting the PT1000 is not so trivial, as you don't know how the Rotex drives that thing. Easiest would be to install a 2nd temperature sensor specifically for the ESP, methinks. You probably want to look at ESPHome if you don't want to dev your own software to interface with HAS.
Re: How to make my pool heating system smart
Hey, thanks for the reply.
Given my lack of knowledge in this area, can you point me to hardware and maybe docs that potentially detail a bit more about what you say about using a "relay that has a coil of the voltage required, and use one of its contacts as a simple switch"?
Also, in regards to the temp sensor, my issue passing a new cable up to the pool, don't think that will be feasible. The original instalares have however mentioned that the 220v cable might have extra unsused lines, which potentially could be used for the temp sensor. What temp sensor would you recommend and how many lines does it require?
Thanks,
Given my lack of knowledge in this area, can you point me to hardware and maybe docs that potentially detail a bit more about what you say about using a "relay that has a coil of the voltage required, and use one of its contacts as a simple switch"?
Also, in regards to the temp sensor, my issue passing a new cable up to the pool, don't think that will be feasible. The original instalares have however mentioned that the 220v cable might have extra unsused lines, which potentially could be used for the temp sensor. What temp sensor would you recommend and how many lines does it require?
Thanks,
Re: How to make my pool heating system smart
Hello everyone,
So I have been advancing on this project with some help, but haven't manged to get any code to run. Am looking for some help.
Basically I bought the following components:
[*] HiLetgo ESP-WROOM-32 ESP32 board (https://www.amazon.es/dp/B0718T232Z)
[*] HiLetgo MAX6675 DC 5V Temperature sensor (https://www.amazon.es/dp/B01F8PVZJ6)
[*] CA ZMPT101B Electricity sensor (https://www.amazon.es/dp/B0C33XV9Y2)
[*] AUKENIEN Breadboard + Jump wires (https://www.amazon.es/dp/B0B2DJPZG4)
[*] Hailege 5 V 2 Channel Relay Module (https://www.amazon.es/dp/B07XYWWDKW)
Wiring diagram is currently as follows: And last revision of the code as follows:
But I am always getting the following error:
I have tried everything to convert, but nothing works, allways get some similar error.
Can any help? Is the code going in the right direction? Is something completely wrong?
Thank you!
So I have been advancing on this project with some help, but haven't manged to get any code to run. Am looking for some help.
Basically I bought the following components:
[*] HiLetgo ESP-WROOM-32 ESP32 board (https://www.amazon.es/dp/B0718T232Z)
[*] HiLetgo MAX6675 DC 5V Temperature sensor (https://www.amazon.es/dp/B01F8PVZJ6)
[*] CA ZMPT101B Electricity sensor (https://www.amazon.es/dp/B0C33XV9Y2)
[*] AUKENIEN Breadboard + Jump wires (https://www.amazon.es/dp/B0B2DJPZG4)
[*] Hailege 5 V 2 Channel Relay Module (https://www.amazon.es/dp/B07XYWWDKW)
Wiring diagram is currently as follows: And last revision of the code as follows:
Code: Select all
esphome:
name: pool-sensors
esp32:
board: nodemcu-32s
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
password: ""
ota:
password: "REMOVED"
wifi:
ssid: "MYSSID"
password: "REMOVED"
# Code
spi:
clk_pin: GPIO25
miso_pin: GPIO27
sensor:
- platform: adc
pin: GPIO36
name: "Voltage Sensor"
update_interval: 60s
- platform: max31865
name: "Pool Temperature Sensor"
cs_pin: GPIO26
#miso_pin: GPIO27
#clk_pin: GPIO25
update_interval: 60s
id: pool_temp_sensor
reference_resistance: 430 Ω
rtd_nominal_resistance: 100 Ω
binary_sensor:
- platform: gpio
pin: GPIO5
id: relay_1
- platform: gpio
pin: GPIO18
id: relay_2
text_sensor:
- platform: template
name: "Pool Temperature Display"
lambda: |-
return id(pool_temp_sensor).state;
icon: "mdi:thermometer"
#uart:
output:
Code: Select all
pool-sensors.yaml: In lambda function:
pool-sensors.yaml:63:32: error: could not convert 'pool_temp_sensor->esphome::max31865::MAX31865Sensor::<anonymous>.esphome::sensor::Sensor::state' from 'float' to 'esphome::optional<std::__cxx11::basic_string<char> >'
* [.pioenvs/pool-sensors/src/main.cpp.o] Error 1
Can any help? Is the code going in the right direction? Is something completely wrong?
Thank you!
-
- Posts: 1706
- Joined: Mon Oct 17, 2022 7:38 pm
- Location: Europe, Germany
Re: How to make my pool heating system smart
Code: Select all
text_sensor:
- platform: template
name: "Pool Temperature Display"
lambda: |-
return id(pool_temp_sensor).state;
icon: "mdi:thermometer"
Code: Select all
could not convert '...state' from 'float' to '...basic_string<char>...'
This answer seems to solve the problem by using the sprintf()-function to format a float into a string.
In your case, something like this could do the trick:
Code: Select all
lambda: |-
char buf[16];
sprintf(buf, "%.2f", id(pool_temp_sensor).state);
return std::string {buf};
Re: How to make my pool heating system smart
Wow, fantastic, thanks so much MicroController. I did try everything before, but never managed to convert. Any code is now running, however, I am not getting any readings from my voltage sensor or temperature sensor.
So temperature is only just "nan" and voltage is always 1v even thou I have it connected to a power outlet and have confirmed voltage.
Can anyone help? might this be wiring or code?
Thanks,
Code: Select all
[13:21:30][E][max31865:101]: SPI bus read all 0 or all 1 (0x0000), check MAX31865 wiring & power.
[13:21:30][D][sensor:094]: 'Pool Temperature Sensor': Sending state nan °C with 2 decimals of accuracy
[13:21:30][D][sensor:094]: 'Voltage Sensor': Sending state 1.05700 V with 2 decimals of accuracy
Can anyone help? might this be wiring or code?
Thanks,
-
- Posts: 1706
- Joined: Mon Oct 17, 2022 7:38 pm
- Location: Europe, Germany
Re: How to make my pool heating system smart
"Not A Number" (NAN) is usually the result of an 'illegal' floating point calculation, like dividing by 0.
Hard to tell where that value comes from. May be some code doing erroneous computations, or a sensor being read as '0', or something else.
Hard to tell where that value comes from. May be some code doing erroneous computations, or a sensor being read as '0', or something else.
Re: How to make my pool heating system smart
Hi once again, and thanks again also, as it was a tip in the right direction.
I managed to solve the issue with a few pin changes:
[*] clk pin = GPIO25 -> GPIO27
[*] Miso pin = GPIO27 -> GPIO19
And code corrections
Basically was using wrong platform for the sensor. Ups.
Temperature sensor is now working great, but my voltage sensor is not.
Even with power hooked up to the ZMPT101B sensor, my voltage is always 1v. I've tried various permutations with "attenuation" but voltage sensor just seemsto be completely all over the place.
Basically, all that I need is to get a "ON / OFF" or "1 / 0" for power ON or power OFF.
Can anyone help?
Thanks,
I managed to solve the issue with a few pin changes:
[*] clk pin = GPIO25 -> GPIO27
[*] Miso pin = GPIO27 -> GPIO19
And code corrections
Code: Select all
#- platform: max31865
- platform: max6675
name: "Pool Temperature Sensor"
cs_pin: GPIO26
update_interval: 60s
id: pool_temp_sensor
#reference_resistance: 4300 Ω
#rtd_nominal_resistance: 1000 Ω
Temperature sensor is now working great, but my voltage sensor is not.
Even with power hooked up to the ZMPT101B sensor, my voltage is always 1v. I've tried various permutations with "attenuation" but voltage sensor just seemsto be completely all over the place.
Basically, all that I need is to get a "ON / OFF" or "1 / 0" for power ON or power OFF.
Can anyone help?
Thanks,
Re: How to make my pool heating system smart
I think, for the temperature sensor part, the DS18B20 underwater version will be a good choice too
https://www.theengineeringprojects.com/ ... 18b20.html
The sensor comes with a long cable. That will help you to connect the sensor with ESP32.
https://www.theengineeringprojects.com/ ... 18b20.html
The sensor comes with a long cable. That will help you to connect the sensor with ESP32.
Re: How to make my pool heating system smart
Hello once again everyone,
So I think I have everything up and running! Firstly thanks very much for everyone's support, it was definately appreciated as it did stear me in the right direction. In the end I do have a few more questions, but let me first start of with changes and end result.
So firstly in terms of components, my final list is:
[*] HiLetgo ESP-WROOM-32 ESP32 board (https://www.amazon.es/dp/B0718T232Z)
[*] HiLetgo MAX6675 DC 5V Temperature sensor (https://www.amazon.es/dp/B01F8PVZJ6)
[*] 220V AC Mains Sensor / Optocoupler Isolation Module Ac 220v (https://www.fruugo.pt/modulo-de-isolame ... anguage=en)
[*] AUKENIEN Breadboard + Jump wires (https://www.amazon.es/dp/B0B2DJPZG4)
So, this means I ditched the ZMPT101B voltage sensor (never managed to calibrate it) and the Relay module, as I realised I didn't need it.
My final wiring diagram is as so: And my final esphome code is as so:
I also have it integrated with home assistant where I am using custom cards to show both temp sensor and voltage sensor.
So I guess my only question here is if anyone spots anything that doesn't make much sense or seems out of place? How can I potentially even simplify this more?
Thanks,
So I think I have everything up and running! Firstly thanks very much for everyone's support, it was definately appreciated as it did stear me in the right direction. In the end I do have a few more questions, but let me first start of with changes and end result.
So firstly in terms of components, my final list is:
[*] HiLetgo ESP-WROOM-32 ESP32 board (https://www.amazon.es/dp/B0718T232Z)
[*] HiLetgo MAX6675 DC 5V Temperature sensor (https://www.amazon.es/dp/B01F8PVZJ6)
[*] 220V AC Mains Sensor / Optocoupler Isolation Module Ac 220v (https://www.fruugo.pt/modulo-de-isolame ... anguage=en)
[*] AUKENIEN Breadboard + Jump wires (https://www.amazon.es/dp/B0B2DJPZG4)
So, this means I ditched the ZMPT101B voltage sensor (never managed to calibrate it) and the Relay module, as I realised I didn't need it.
My final wiring diagram is as so: And my final esphome code is as so:
Code: Select all
esphome:
name: pool-sensors
esp32:
board: nodemcu-32s
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
password: ""
ota:
password: ""
wifi:
ssid: ""
password: ""
# Code
spi:
clk_pin: GPIO27
miso_pin: GPIO19
sensor:
- platform: adc
pin: GPIO33
name: "Pool Voltage Sensor"
update_interval: 5s
accuracy_decimals: 0
raw: true
filters:
- multiply: 0.095238
- offset: 0
- lambda: !lambda |-
if (x < 3) {
return x;
} else {
return (220-round(x))+round(x);
}
- platform: max6675
name: "Pool Temperature Sensor"
cs_pin: GPIO26
update_interval: 15s
id: pool_temp_sensor
text_sensor:
- platform: template
name: "Pool Temperature Display"
lambda: |-
char buf[16];
sprintf(buf, "%.2f", id(pool_temp_sensor).state);
return std::string {buf};
icon: "mdi:thermometer"
output:
So I guess my only question here is if anyone spots anything that doesn't make much sense or seems out of place? How can I potentially even simplify this more?
Thanks,
Who is online
Users browsing this forum: Bing [Bot] and 85 guests