Software apps and online services
This project is about controlling the temperature of a pool and a sauna.
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.
You can control your pool temperate with this project.
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.
This project can control the temperature of your sauna as well.
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.
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").
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.
They are connected to D2 and D3 on the second socket the ControlEverything relay board comes with:
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 :)
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:
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.
If you require professional help with your projects, don't hesitate to write me a line about your needs at firstname.lastname@example.org. Thank you!