Introduction: Automated Solar Heating for Pools
This is a cheap pool heating automation which uses solar power to heat the water.
It is based on an esp8266 module (connected to a router or used as an AP(accesz point)) which allows the system to be controlled through WiFi using a web browser or it's app (still in development).
It uses a water pump/filter to recirculate the water in the pool through a black hose (pipe)/solar panel to heat it.
The system continuously measures the water temperature from the hose/pipe and starts the water pump/filter when a certain temperature is reached.
It can also be turned on/off by the user.
The web app offers full control of the system, including a schedule to turn on the pump/filter between 2 hours and also keeps the temperature log of the past 3 days.
The software can be updated through WiFi (OTA) allowing bug fixes/new features to be done remotely.
Also the WiFi data is encrypted using WPA2 encryption.
Step 1: Parts & Materials, Tools & Software
Parts & Materials
- WeMos D1 Mini (Amazon)
- WeMos D1 Mini Relay Shield (Amazon)
- Breadboard (Amazon)
- DS18B20 Waterproof (temperature sensor) (Amazon)
- DS3231 rtc (Real Time Clock) (Amazon)
- Male-male jumper cables (around 15-20 pcs needed) (Amazon)
- AC plug (splitted)
- AC cable (splitted at both ends)
- AC socket
- Phone charger
- USB type b micro cable (normal phone cable)
- A jar (optional)
- Some string (optional)
- A black hose/pipe (15-25m long, about 70 feet) or a solar panel for heating water
- Water pump / filter
!!Make sure the black hose/pipe or solar panel fits the pump/filter
- Small screwdriver
- Soldering iron
- Some soldering tin
- Some duct tape
- Arduino Ide (reference here, download page here)
- Esp boards added to arduino (great short tutorial here)
- You may also need the CH340 dirver (download page here)
- Also add those libraries to arduino (tutorial here)
Step 2: Soldering and Wiring
- Solder female-male pins on the esp, female up (if not already soldered)
- Solder some jumper wires on the temperature sensor, and isolate them
- Cut the D1 pin on the relay shield (or bend it) and solder a wire from D1 to D3 (Ithe relay is connected to pin D1, 2C pins are D1 and D2, used for the rtc, so the relay must be connscted to another pin)
Esp, relay and power connections
- Place the Esp on the breadboard
- Place the relay shield on the esp
- Connect +3V/3v3 (if it doesn't work, connect 5V) on the esp with the positive power line on the breadboard
- Connect gnd on the esp with the negative power line on the breadboard
- Connect Vin/Vcc/+ on the rtc to positive power on the breadboard
- Connect Gnd/- on the rtc to gnd on the breadboard
- Connect SCL/C on the rtc with D1
- Connect SDA/D on the rtc with D2
Temperature sensor wiring
- Connect the yellow (could be orange too) wire on the temperature sensor (data) to D4
- Connect the black wire on the temperature sensor (gnd) to gnd on the breadboard
- Connect the red wire on the temperature sensor (Vcc) to positive power on the breadboard
Step 3: AC Connections
- Solder one wire of the AC plug to one of the wires of the AC cable, then insulate them
- Open the relay contacts (middle and right)
- Attach the two wires on the other end of the cable to the relay, in the middle and the right (the order doesn't matter)
- Close the 2 relay contacts
- Detach the plastic cover from the socket
- Connect the other wire of the plug to the socket
- Connect the other wire of the cable to the socket (the one not soldered)
- Reattach the plastic cover, and fit it on the jar
- Fix the socket to the jar with the string (or a rubber band)
Step 4: Water Pump/filter and Hose/solar Panel
- Place the black hose/pipe in a spiral on a flat area that usually is full of sun, and run one end to the pool, or if you have a solar panel, follow the installation instructions
- Follow the pump/filter installation instructions (for the pump place both hoses in the pool), but replace the hose pumping back in the pool with the black hose/pipe
Step 5: Code
Here is the link to GitHub with the sketch.
It is explained alongside with the functions (//comment) in the code, but if you have any questions, feel free to hit the comments.
- Now, copy or download the sketch.
- Open Arduino ide
- Open or paste the sketch
- Change the ssid and password variables on line 42 and 43 with your WiFi ssid and password at home
- Go to Tools>Board, scroll down and select WeMos D1 R2 & mini
- Then go to Tools>Port and select the available USB port
- Hit upload and wait for the sketch to upload
- Open Serial Monitor and wait for the Esp to connect and get an IP, you will use that IP to connect to it (try to remember it or write it down)
In the final version, the WiFi SSID and password and the ap name and password will be configurable with the website, so you won't need to change the code.
Step 6: Put It All Together
- Run a double AC line to where you will place the system.
- Find a dry place to put the breadboard with the esp on
- Power it up with the phone charger
- Connect the AC plug to the AC line
- Connect the pump/filter in the socket controlled by the esp
- Fix the temperature sensor on the black hose (preferably somewhere in the spiral) with some tape
And it's done!
Step 7: The Web App
!!You need to be connected to the same network as the esp
The Web App is made for mobile phones only so on the PC it might take a lot more time to load and it will not look as well as on the phone.
Open any browser and write the IP address of the Esp (you need to be connected to the same network as the Esp).
The big button will toggle the relay.
Under it there is a form to set the temperature of the water
The OTA button is for OTA programming (if you tap it and don't want to reprogram it, reset the system (unplug it))
The log button will take you to the log page with the log of the temperatures of the past 3 days
The time button will take you to the time settings page (to set the current time/date)
The settings button will take you to the settings page, where you can set the time the relay will be on/off and schedule the esp to keep the relay on between 2 hours
Step 8: Debugging
The code might have bugs, If you find any, just report them in the comments and i'll try to fix them.
This code also includes OTA programming (tutorial here), so if you want to change the code you won't have to tear it apart, just press the OTA button on the home page.
Participated in the
First Time Author Contest
Participated in the
Solar Contest 2017
Participated in the
Automation Contest 2017