Replace Your Pool and Spa Controller With Raspberry Pi, Arduino, Node Red

In this Instructable I will describe how to build a pool and spa controller that controls a pump motor, multiple electric valve actuators, lights, a cleaner, air blower, and heater. It also measures the water and air temperatures. I built this to replace an old Compool pool controller which broke. The Compool model I had is obsolete and replacing it with a new controller and associated parts would cost around $800. I built this replacement for about $75 (using some parts I already had - buying all new will run about $100).
This pool controller uses Node Red on a Raspberry Pi to provide a web interface for controlling the various devices and displaying the temperatures. The Raspberry Pi has the high level logic to do things like determine whether to turn on the heater based on a temperature setting and the current water temperature and ensure that only valid combinations of devices can be operated at the same time. An Arduino Nano has the low level logic to turn on and off a set of relays which in turn control various motors and valves. The Arduino also reads the temperature sensors. The Raspberry Pi is inside my house and the Arduino is outside by the pool equipment; they communicate over a USB cable.
Rather than provide just a step by step listing of how I built this controller, I will also explain how the various controlled devices work. With that knowledge, you could easily build a controller for a brand new system rather than replace the controller for an existing system like mine.
This project requires some knowledge of electronics because you will assemble and solder various components together to build the controller. It will be helpful to understand the basics of reading a schematic because I provide two, one that describes the whole device and another that describes the power supplies. They are very helpful in understanding the controller as well as fixing any issues that might arise.
Let’s get started!”

Link