Pool And Sauna Controller

About the project

Control your pool and sauna from anywhere!

Items used in this project

Hardware components

Temperature Sensor Waterproof (DS18B20) Temperature Sensor Waterproof (DS18B20) x 2
Particle Photon Particle Photon x 1
Grove - 2-Channel SPDT Relay Grove - 2-Channel SPDT Relay We used one of these boards with 4 channels instead. x 1

Software apps and online services

Particle 2.0 iOS App Particle 2.0 iOS App
porter app porter app

Story

This project is about controlling the temperature of a pool and a sauna.

Story

Sergio contacted me some time ago to develop a control system for his pool and sauna. He did all the hardware connections and I developed the software. This write-up is the result of our team effort.

Pool

You can control your pool temperate with this project.

yes, control its temperature from your phone/device

Here's how it works: the heater of the pool turns on automatically when it detects water flowing. So the control here is as simple as turning the water pump on when the temperature of the water is lower than the desired temperature.

When the temperature reaches the target set by the user, the pump stops, hence the heater stops.

Sauna

This project can control the temperature of your sauna as well.

how hot do you like it? (hint: use your phone to answer that)

The same philosophy used for the pool is used in the control of the sauna. In fact, the code is duplicated almost line by line - my apologies to the gods of good coding practices.

Software

The behavior of the system was modeled using a Finite State Machine, which are wonderful at keeping the code clean and implementing the sequential steps required for making the system work.

Here's how it works:

When the system powers on, the finite state machine (FSM from now on) starts in the initState. After 10 seconds, it automatically transitions to the offState (if the previous system state was off) or the idleState (if the previous system state was idle or on).

In the offState, the system is completely off, nothing happens until the user turns it on.

In the idleState, the temperature of the pool/sauna is monitored all the time. There is no heating in this state. When the temperature goes under the target temperature configured by the user, the FSM transitions to the onState.

In the onState, the temperature of the pool/sauna is also monitored all the time. The heating in turned on in this state. When the temperature goes over the target temperature configured by the user, the FSM transitions to the idleState and the cycle repeats.

The user can set the system on or off by calling the cloud function setOnOff("on") or setOnOff("off").

State diagram of the system

Sensors

Two DS18B20 digital temperature sensors are used in this project. Each one has a pull-up resistor of 4k7 as recommended in the datasheet. The pool sensor is connected to D2 and the sauna sensor is connected to D3.

We use two waterproof ds18b20 digital temperature sensors

My prototype shows only one waterproof ds18b20, the second one is a 3 pin package

They are connected to D2 and D3 on the second socket the ControlEverything relay board comes with:

;

;

1 / 2The board comes with a second socket that we used for the sensor connections (click the arrow for more pics)

Connections

On the relay board, relay 1 is connected to the pool pump and relay 2 is connected to the sauna heater.

Here's a connection diagram for dummies :)

Connection diagram for dummies - I took 5V and GND from the photon's socket

User interface

You can use Porter (iOS or Android) or the Particle 2.0 app (iOS only for now - until Android gets version 2.0). The system comes with some defaults for the target temperatures but the user can modify them to their liking.

There is also a switch in the firmware for selecting Celsius (default) or Fahrenheit. The settings are stored in EEPROM (non-volatile memory) every time they are changed so the board keeps the users settings intact even if power is lost.

Here are some screenshots of the Porter app when the system is on and when it's off:

;

;

1 / 2System is heating (click the arrow for more pics)

Conclusion

We hope you find value in this article. Feel free to respect it and/or check Gustavo's other projects here. Something is not clear enough? Leave a comment below and we'll try to figure it out together.

Sergio and Gustavo.

Help

If you require professional help with your projects, don't hesitate to write me a line about your needs at gusgonnet@gmail.com. Thank you!

Code

Plant UML code for the state machine of the firmware

To draw the FSM image, copy paste this code in http://www.plantuml.com/plantuml/uml

github repo

flash this code in your photon

Credits

Photo of gusgonnet

gusgonnet

If you need professional help with a project, contact me at gusgonnet@gmail.com

   

Leave your feedback...