MQTT Swimming Pool Temperature Monitor
Introduction: MQTT Swimming Pool Temperature Monitor
This project is a companion to my other Home Automation projects Smart Data- Logging Geyser Controller and Multi-purpose-Room-Lighting and Appliance Controller .
It is a pool side mounted monitor that measures the pool water temperature, ambient air temperature and barometric pressure. It then displays the pool water temperature on a local LED bargraph and transmits via WiFi/MQTT to a home system - in my case a software upgraded MQTT compatible version of the Lighting Controller. although it is easy to integrate it into any MQTT compatible Home system.
This Instructable focusses on the Pool Monitor design and construction, the upgrade of the Controller (new firmware and addition of an OLED display) will be included in the original controller shortly.
Key features include:
* The absence of poolside mains electricity determines a 18650 battery power supply with an integrated 1W solar polar panel to maintain the battery charge, battery life is further optimised by the use of the ESP8266 "Deep Sleep" mode. In my system, the unit was able to run over our "active swimming pool season" (November through to April) without manual intervention of manual top up charge.
* An optional local built in 8 LED bargraph displaying the pool temperature in 1 degree intervals.
* MQTT data transmission via local WiFi connection to any compatible host system.
* All programming is achieved over WiFi using the Monitor as an Access Point and internal Web Server configuration pages with all programmable parameters being stored in internal EEPROM.
+ Time intervals between wake up and transmissions. 1 to 60 minute intervals.
+ Configurable MQTT topic/message formats
o Individual message topics (E.g PoolTemp, AirTemp, BaroPress)
o Single compact topic (E.g. Pool Temp + Air Temp + Barometric pressure)
o Compatible with OLED display mounted on Multi-purpose-Room-Lighting and Appliance Controller (see title figure for example)
* WiFi network SSID and password
* Access Point SSID and password
* LED bargraph control
* Programable minimum temperature range (15 to 25'C)
* Programmable permanently ON, permanently OFF, Only on during daylight hours
Although I 3D printed my own enclosure / mounting arrangement and used a PCB board from a previous project, you can literally use what suits your personal preferences as nothing is critical or "cast in stone". The last section of this Instructable contains Gerber and STL Files for the PCB boards and ABS housing that I designed specifically for this project
Step 1: Block Diagram and Discussion About the Choice of Components
The block diagram above highlights the main hardware modules of the Pool Monitor.
Processor
The ESP8266 used can be any of the ESP03/07/12 basic modules through to the more perfboard friendly NodeMCU and WEMOS modules.
I used the ESP-12, If your pool is some distance from your WiFi router you may prefer the ESP-07 with an external antenna. 382
The NodeMCU/Wemos modules are very board friendly but will result in a slight increased power consumption due to their extra onboard voltage regulator and LEDS - this will affect the ability of the solar panel to daily keep the battery in charge and you may require a periodic manual charge using the USB port on the charger module.
Temperature sensors - Fig. 2
I have used the easily available and low cost metal tube + cable versions of the DS18B20 temperature sensors that come with around 1 metre of connecting cable as they are already robust and weatherproof. One using the full length of the cable for the pool water measurement and another with a shortened cable for the ambient air temperature.
Air ambient sensor
I have selected the excellent BME280 module to measure the ambient air humidity and barometric pressure. You may be wondering why I did not used the air temperature measurement function of this module.
The reason is simple - if, as I did in the original prototype use this function, you end up measuring the static air temperature INSIDE the housing which tends to read high due to internal self heating of the enclosure air space by the outside sun (it reads perfectly at night!). It was quickly realised that the air temperature sensor needed to be mounted outside of the enclosure but in the shade away from the direct sun light so I switched to a second DS18B20 and provided a small mounting point underneath the enclosure. The BME280 temp sensor although is still used as a diagnostic measurement for the in-enclosure temperature and can be monitored on the configuration server main page.
LED bargraph - Fig. 1
The eight local high intensity LED outputs are driven by a PCF8574 IO expander chip which in turns drives each LED by a PNP 2N3906 transistor. 832