book collections email follower instructable user
Picture of Smart Data Logging Water Geyser (Heating) Controller for the Home
Web Pages.jpg

Ever since I started building projects with Arduino and the ESP8266 I have been obsessed with Home Automation and its ability to potentially make life easier and save energy and consequently money. This has been represented in my past published Instructables (See References) and so a challenge was born when I discovered that the geyser (water heater) in my new home roof space was connected to the mains power 24/7 with no local on/off control and was controlled by a relatively inaccurate internal thermostat not to mention the difficulty to adjust the water temperature setting. The task - how to bring the water temperature control easily to me with an ability to display/record the temperature/power consumption trends over the last 24 hours to allow me to maximise my water temperature when I needed it at the lowest possible power consumption.

Main features of the controller include:

  • Water temperature measurement and display
  • Up to 4 extra optional sensors that can be attached to the external skin of the geyser to monitor the geyser external temperatures - used to assess the need for any external geyser insulation. After this exercise is done, you may if you prefer remove the sensors or simply leave them in place to monitor and log the geyser wall temperatures with the water temperature for reference. The firmware auto adapts to the number of sensors connected to it.
  • Two timed controller periods, each with its own start/stop times and separate ON/OFF setpoint values.
  • Automatic logging every hour of the average water temperature over the last hour, each external skin sensor plus the number of minutes that the geyser has been ON during the last hour.
  • All of the above can be viewed on the optional local OLED display.
  • A "display sleep" timer that switches the display off and on at a specified time over the 24 hour period to prevent possible light noise in the room.
  • A control button to step through the various screen displays or "wake" up the display for a short duration if it is in sleep mode
  • Additionally all of the above real time and logged data plus all configuration is available online via your computer or mobile phone using a series of web pages on your browser connected directly to your home WiFi network and/or in the absence of a local connection you can start the Controllers own WiFi Access point and connect to that and then use it identically as per the home network connection.
  • A high water temperature check that switches the geyser OFF if the water temperature exceeds 75'C
  • Error messages in the event of sensor fail or open circuit.
  • The controller clock runs either directly from an optional real time clock that itself is maintained automatically from an online NTP time server. If the RTC is not fitted, the internal software clock is maintained using the NTP time server.

A block diagram of the complete Geyser Control System (GCS) can be seen in the above figure.

It physically comprises the following parts, each described further in the project

  1. The Geyser temperature measurement probe constructed from a modified geyser thermostat compatible with the geyser (Either modify the one currently in place or purchase a new one from the plumbing supplies shop).
  2. Up to four optional geyser "skin" or wall temperature sensors that can be attached to the wall of the geyser to measure the outside temperature of the geyser.
  3. A junction box to connect up to 5 temperature sensors into one 3 wire bus connection to the controller.
  4. A solid state relay (SSR) switching module to be used for the remote switching of the geyser heater from the main control unit. For safety, this is housed in its own housing complete with a heat sink. (Note. My photo shows an earlier prototype using a normal relay, actual installed unit uses the SSR)
  5. The main control unit with a single control button and optional small OLED display for the local display of all main measurements, logged data and settings. An integrated web server & browser screens are available to read and set up the controller (The display is optional simply because the whole interface of the controller can be handled via its WiFi connection)

Step 1: Main Controller Enclosure Including Electronics and Housing

Picture of Main Controller Enclosure Including Electronics and Housing
Controller Components.jpg
Enclosure parts.jpg

The Main Controller can be broken down into 6 main elements

  1. Enclosure and front panel
  2. OLED display and bezel (Optional)
  3. Real Time Clock Module (RTC) and mounting bracket (Optional)
  4. Control Button - Manual
  5. Control Button - Reset
  6. Printed Circuit Board

Circuit board
These components are specific to the board layout and size supplied with this project. If you produce your own circuit board or build on strip board then the component sizing and pin spacing can vary to suit your own requirements.

  1. Mains IN - Screw terminal block 2 pins, Pin spacing 0.2in (5.08mm) (See figure)
  2. TB1,2 - Screw terminal block 3 pins, Pin spacing 0.2in (5.08mm) (45 degree angle recommended)(See figure)
  3. Q1 - PNP-Transistor, package TO92, (EBC); 2N3906 or similar
  4. R1 - 1.5kΩ Resistor, tolerance ±5%; pin spacing 400 mil
  5. R7, R20 - 4.7kΩ Resistor, tolerance ±5%; pin spacing 400 mil ****Note 4
  6. R17 - 3.3kΩ Resistor, tolerance ±5%; pin spacing 400 mi
  7. R19 - 680Ω Resistor, tolerance ±5%; pin spacing 400 mil **** Note 4
  8. Flash-Config Pushbutton 6 x 6 x 6 mm miniature Reset Pushbutton 6 x 6 x 6 mm miniature
  9. ESP1, ESP2 - IO connector 8 way, pin spacing 100 mil, Single Row
  10. RTC - IO connector 4 way, pin spacing 100 mil, Single Row
  11. C2 - Ceramic Capacitor, spacing 200 mil, voltage 6.3V; capacitance 100 nF
  12. C3 Capacitor, polarized, capacitance 470 or 1000uFC2 Capacitor, pin spacing 5mm
  13. Power supply 3.3v 600mA 240 V AC-DC Power module (See figure & Note 1**)
  14. PCB Circuit board - See the last section for artwork Gerber files for the 110 x 66 mm circuit board that I produced. These files can be uploaded to an online manufacturer, in the past, have used OSH Park and SeedStudio. Including shipping , it was surprisingly a lot cheaper for 12 boards than my local supplier in South Africa! and I was very happy with their quality, service and pricing. There are also a lot of other Chinese, US and European manufacturers offering an online service.
    The schematic is in fact very simple and if you prefer, you can create your own smaller artwork and it is easily possible to build this circuit on strip board (if using strip board, I suggest that you replace the specified ESP-12 module with a DIL variant such as NodeMcu or WEMOS D1). (See Notes 2,3 & 4)

Note 1. I recommend that you test the purchased power supply module BEFORE you mount it on the main PCB as there are several versions of this module with different output voltages available, all similar in appearance (I accidentally fitted a 5V version to one of my boards and then wondered why the ESP12 got VERY hot!!). Apart from this mishap, I have built over 10 builds successfully albeit with testing the supply beforehand.

Note 2. The board used here is a multi-project board that I recently updated. A fully populated version can hold mains power supply, RTC clock, 3 relays, a hardware watchdog, supports ESP8266 sleep mode, mains protection components, all IO is brought out to pin headers for external expansion including I2C & SPI devices. This project does not require all of this so a sub-equipped version is presented as (for me) producing a smaller footprint was not economically justified.

Note 3. You cannot fail to notice that the included board layout has two rather "excessive" 14 mm holes in it! These are there solely to allow the board to be fitted into a standard South African plastic wall mounting light switch enclosure. If you are 3D printing an enclosure or using a proprietary housing, you could use these to facilitate mounting otherwise I recommend simply using quality thick double sided tape to secure the board in any other housing arrangement.

Note 4. **** Resistors R19 and R20 plus wire links 1 & 2 are not marked on the supplied PCB silkscreen - they are fitted in place of the omitted relays 1 & 2 that are marked on the PCB layout.

Push Buttons

The controller has a push buttons mount on the enclosure and is wired in parallel with the flash/prog button switch that is mounted on the circuit board - it is used as a manual control button that also doubles up as the flash button during development / programming. It can be used to step through the display screens, start the Controller Access Point Web server (press for 4-6 seconds) and provide a soft reset to the controller (hold for > 10 seconds).
The choice of button is not critical and can be from any supplier of your choice. The two that I used are listed on Amazon as "Twshiny PBS-33B 12mm Push Button Waterproof Lockless Momentary ON/OFF Switch" in a variety of colours although I actually purchased mine from AliExpress.

OLED display and Bezel (Optional)

I chose the ubiquitous 0.96" I2C IIC Serial 128X64 OLED LCD Display as a low cost simple local display module. This is actually not strictly required as you do all of the configuration via the onboard web server on your computer and/or mobile phone. The display just gives you a nice local display for viewing the main controller data. The firmware autodetects whether the display is fitted so you can just omit or fit as preferred. Fitting these displays neatly into a proprietary housing can be a bit of a challenge so I created a small bezel on my 3D printer. The resulting STL file is included in the list of downloadable files in the last section. Take care to use the I2C version of the display rather than the SPI version. Also worthy of note, you can get two versions of the display - one totally monochrome and one with the first two lines being yellow on black and the rest blue on black. You can use either but the display format is chosen to take advantage of the nice aesthetics of the dual colour!

Real Time Clock (RTC) (Optional)

I used the higher accuracy DS3231 RTC module available from Amazon and AliExpress in a variety of shapes and sizes (and prices!). Since the controller automatically updates the RTC at power up and every few hours via an online NTP server you do not need to do any initial set up of the RTC time. In fact given the regular NTP time correction, it is perfectly OK to use the cheaper lower accuracy DS1307 RTC module as they are both electrically interchangeable and both have an integral battery to preserve the time in the event of a power cut. It is also possible to use the controller without the RTC if you want to save assembly time and cost but the controller will take a few minutes to boot up as it MUST have the wifi connected at the start to set the internal clock from the online NTP server at power up. The RTC gives the advantage that once configured (via its own Web server), it will then run without any wifi connected and immediately on power up (Without wifi connected, the device can still be configured and viewed off line using its additional Offline web server running on the controllers own Access Point) that can be started by pressing and holding the control button for 6 seconds.

To mount the RTC on the front panel or anywhere convenient on the side of the enclosure you can simply use thick double sided tape bearing in mind that at some time you will need to change the RTC battery. If you prefer a more "elegant" mounting arrangement, I have included STL files for a dedicated mounting bracket that you can glue to the enclosure front panel/side wall that allows you to easily remove the RTC module for battery swap.

Enclosure & front panel

The choice of enclosure largely depends on what is available to you in your country/region and of course your personal preferences. The board used here is designed specifically to fit in the standard wall box used for lighting in South Africa ... 110 x 66 mm with two large holes to cater for the front panel mounting supports. This gives me a very affordable housing and range of front panel options.

SESupply3 months ago
Awesome instructable - well done!
chrisgimson (author)  SESupply3 months ago
Thanks for the compliment - much appreciated.
Jetsom3 months ago
Great project!
PS. For those that don't live in South Africa, replace
the term 'Geyser' with 'Water Heater' if you don't know what the author
is talking about....
chrisgimson (author)  Jetsom3 months ago
Thanks for the compliment. I did not realise that the term "geyser" was not a common one - I will edit the title and intro to clarify.