I found a used hot tub online, that's a couple of years old and I decided I can make a cool project out of it. The built-in controls were already annoying and time-consuming, so that gave me further reason to tinker with it. In order to save energy, I lower the pool temperature when not used, but if I wanted to use the hot tub, I had to turn the temperature up 4 hours in advance. As an example of what I mean by saying annoying: In order to save energy, I had to lower the pool temperature when not used, but if I wanted to use the hot tub, I had to turn the temperature up 4 hours in advance. Another thing that happened was that somehow the circulation pump decided to turn on randomly during the night - that would probably have gotten under control if I had read the manual, but as a tinker I prefer to tear out the controls and use a Raspberry Pi instead - so here's my article "Open source hot tub controller."
Safety WarningIf you also plan to tinker with your hot tub you should be aware of the risks. While high voltage systems are interesting experimentally, they can be dangerous, and if not treated with care, respect and intelligence, they can result in fatal injuring. There are a bunch of guides online on how to work safely with high voltage. If you are not certain on what you are doing, stop now and go educate yourself.
ComponentsIn this project I'm using an UniPi 1.1, but it doesn't have to be one, you could also use the Raspberry GPIOs with a relay board, the UniPi comes in handy to have a 1-Wire connection as well. The terminals, mounting rails and cable canals I use are not necessary but makes the cabinet look clean, one can simplify that by wiring it directly. The UniPi needs a 5V power supply, I use a DIN rail mounted one with 3A output current. The built in lights are usually powered with 15V, I've used an 12V power supply. As replacement of the old control panel, I used an metal plate with 6 water resistant push buttons instead.
Tidy up the CabinetI am not reusing any of the built-in controller electronics, therefore I am removing them all.
My hot tub has the following wires:
- Circulation Pump
- Jets Pump
- Blower
- Heater
- Ozonator
- Temperature sensor
- Flow sensor
- Supply
- 2x Display cable
The clamps on the PCB are labelled. It's a good idea to mark the cables so you would know the purpose of each cable later on.
To make the wiring easier, I took the whole cabinet out. Then I removed all the components, cleaned the ole thing and started with the installation.
I am not reusing the original control panel. It could probably be integrated somehow, but since it only shows the temperature, it's not worth the effort. I also thought about installing a touch display, but they kinda do not work if your fingers are all wet. So I replaced the control panel with a metal sheet with 6 water resistant push buttons.
The built-in temperature sensor is a temperature-dependent resistor (PT100). Although the UniPi has an analog input with which I could measure the resistance, I thought I'd make my life easier by using an 1-Wire temperature sensor instead.
A second temperature sensor was installed inside the heater for safety reasons - to monitor the heater's temperature and protect it from over-heating. This one is also replaced by an 1-Wire temperature sensor.
Now to the actual wiring. First, I installed the cable ducts, left, right, on the top and in the middle of the cabinet.
Next I installed two DIN rails, one in the middle between the cable ducts, and one 75 mm below the middle cable duct. I use self-tapping screws to mount all of the components.
On the lower DIN rail I mounted the terminals, the relays, and the 5V power supply. As clamps I used rail mounted terminals with tension springs. On the left are the terminals for the supply line - 3x Gray for the 3 phases - 1x Blue for the neutral - 1x Yellow / Green for the ground. Then for every other cable I added a gray, a blue and a yellow/green clamp. Some of the cables in the hot tub are somewhat thick. I am in Europe and there we have different standards on cable thickness than the US. The terminals have to be able to accommodate 6mm^2 for all connections.
To the right of the clamps are the relays. The UniPi internal relays can only switch 5A, so they cannot be used to switch the load directly. I used power relays with 230V AC control voltage and now the installation is able to handle power of up to 4kVA.
On the left end side of the upper DIN rail, I mounted 2 potential distributors, one for GND and one for 12V+. The 12V+ is provided by the UniPi. Next to it, I placed the UniPi 1.1, with a mounting plate for DIN rails.
I got lucky with the size of the cabinet, everything fits just right.
Now the fun starts - let's do the wiring. The wire colors are not standard. I use the colors in the following way:
- Black: 230V Power
- Red: 230V Switched
- Blue: Neutral Conductor
- Dark Blue: 5V or 12V+
- Dark Blue/White: 5/12V GND
- Green/Yellow: Earth/Ground
I use ferrules for every wire end, they are not necessary for this kind of clamp, but it makes it look pretty.
I have 3 phases available, the main fuse is 16A Typ C. The heater has 10A, the pumps will have around 6A each. So I distribute the load to all 3 phases. I use the first one to power the control unit, the ozone and the blower, the second phase for the heater and the third one for the 2 pumps.
The magnetic and flow sensors are digital, so I connected 1 end to the 12V and the other to one of the digital inputs. Same for the push-buttons on the new control panel, connected one solder tail to 12V and the other one to a digital input. In total I used 8 out of 14 digital inputs of the UniPi.
In the original setup the lights are connected to a segregated lights controller. I didn't reuse the light controller, instead I connected the ribbon cables directly to the 12V power supply. The lights have RGB LEDs, I connected the red and blue one to create a purple light. Downside: I don't have any fancy light effects anymore, just the purple light.
To improve the WiFi connection, I do no longer use the original metal lid, but replace it with a acrylic one.
The cover of the hot tub has secure clips attached, so the wind would not accidentally open it. I, of course, forget to close those clips, so I installed a magnetic switch that notifies me when the cover opens.
So far so good, it's time to prepare the brains of the operation.
Operating SystemI used nymea to control the UniPi and BerryLan for the WiFi setup.
Get the latest nymea flavored Raspberry Pi Buster image here: https://downloads.nymea.io/images/raspberrypi/latest
After the download I flashed the SD Card by using https://www.balena.io/etcher/, inserted the SD card in the UniPi and powered the hot tub on. Since the latest image version there is no need to change anything on the OS itself, BerryLan and nymea come preinstalled.
The default modus for BerryLan is "offline", means the BT server starts when the Raspberry Pi is not connected to any network.
BTW.: With BerryLan someone could set the Raspberry also in the access point mode, so the client could connect directly to the hot tub without a router.
Alright, now the OS is good to go, and we can continue with the final steps.
SetupI am using the desktop app for nymea:app. You can also install it for Android & iOS devices, and control your UniPi just the same.
The nymea plug-in for the UniPi comes not pre-installed, so I intalled the plug-in using the nymea:app:
Menu -> Systems settings -> System update -> Install or remove software -> nymea-plugin-unipi2 -> install
AddDevice
In order to tell nymea what kind of UniPi is used, I needed to add an UniPi type: Add Device -> UniPi -> UniPi 1 in my case - the nymea UniPi plug-in suports all Neuron, Neuron extensions and UniPi device models.
Afterwards I was able to add the relay outputs, nymea knows how many IOs are available: Add Device -> UniPi -> Digital output -> Selected DO1 and named it "Heater"
I repeated those steps for all the relays and I set up the controls as follows:
- Relay 2: Jets Pump
- Relay 3: Circulation Pump
- Relay 4: Blower
- Relay 5: Ozonator
- Relay 6: Light
Then I added the inputs: Add Device -> UniPi -> Digital Input -> Selected "DI 1" and named it "Flow Sensor". I repeated those steps for all the inputs I have:
- Input 1: Flow Sensor
- Input 2: Cover Sensor
- Input 3: Button 1
- Input 4: Button 2
- Input 5: ...
The 1-Wire temperature sensor: Add Device -> One wire interface -> Name to "One wire interface"
Inside the one wire interface device there is the toggle button "Auto add one wire device", I enabled this option so one wire temperature sensors will be added automatically.
Last, but not least, I added 2 Toggle Buttons. They are not really devices, but more close to "states". This helps me to use them later on in my "Favorites" list, so that I can quickly toggle everything on or off.
Add Device -> nymea -> Toggle Switch -> Name: Summer Mode The "Summer Mode" is to deactivate the heater completely during the summer months. Add Device -> nymea -> Toggle Switch -> Name: Ready Mode The "Ready Mode" is to switch the target temperature between 37°C (ready) and 29°C (not ready).
Add some Magic
Magic is basically a ruleset which commands nymea to do stuff automatically.
- If "Ready Mode" is on and "Summer Mode" off and temperature is below 37°C the heater and circulation pump will get activated, else they will get deactivated.
- If "Ready Mode" is off and "Summer Mode" is off and temperature is below 29°C the heater and circulation pump will get activated, else they will get deactivated.
- If circulation pump is on and flow sensor is not on then send an alert.
- If water temperature drops below 3°C then send an alert.
- If water temperature reaches 37°C send notification "Hot tub ready"
- If magnetic sensor is off then send notification "Hot tub cover is open".
- Between 10:00 and 10:15 turn on the jets pump.
- If button 1 pressed turn the blower on/off
- If button 2 pressed turn the jets pump on/off
- If button 3 pressed turn the lights on/off
- If button 4 pressed play/pause Denon Heos (external device)
- If button 5 pressed turn Philips Hue on/off (external device)
- If button 6 pressed turn all lights off (external devices)
Setup Remote Connection
I don't use the hot tub every day, so I didn't set a "Heat Up" rule. Sometimes, when I come home from work, I just want to jump in as soon as possible, so I use the remote connection to turn the heater on in advance. My hot tub heats up in the speed of about 2 degrees per hour. I usually keep the temperature at 29° in idle mode, so I have to turn the heater on 4 hours in advance. PS.: Some people think that heating the tub up needs more energy, than keeping the temperature ready at all times, but I've checked, and this is not the case on my side.
The remote connection setup enables push notifications too, so you can get cool notifications like that:
Now I can turn on/off each pump, set the hot tub mode "Ready" or "Summer", check the temperature and switch the blower.
That's it, the hot tub is ready - I love to switch the pool on right from the comfort of my couch, or on my way back from work. For those lazy Sunday mornings, I set specific timers, so I can enjoy a dip before breakfast. Hope you liked my article and I would love to hear your opinion on the project.
30. Sept. 2019
- Updated install commands for Raspbian Buster
- Updated to the new UniPi plug-in - nymea-plugin-unipi2
- Updated the OneWire plug-in
- Added Relay 6 to switch the light
- Added new control panel with push buttons
- Updated Etcher link to Balena
- Added App previews
22. Nov. 2019
- Updated to latest nymea Buster image
- Removed command line commands
Comments