Smart Data Logging Water Geyser (Heating) Controller for the Home




Introduction: Smart Data Logging Water Geyser (Heating) Controller for the Home

About: British but settled in Cape Town, South Africa. A retired electronics and instrument designer who now continues his 'work' as a hobby and loving every minute of it.

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

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.

Step 2: Circuit Board Build Tips

As I mentioned earlier, board build is pretty straightforward with the possible exception of mounting the ESP12 module. the key is the right tools, a fine soldering iron and a steady hand. I found a magnifying inspection glass also a great help but I also managed without it so it is not essential.
You only have two hands so I strongly recommend the use of a "third hand" accessory as shown in the diagrams, it is excellent for holding the ESP12 module in any required plane whilst adding and soldering wires.

I suggest that the order of assembly be;

  • All low lying components first such as resistors and small capacitors.
  • Push buttons followed by the transistor and then the larger capacitor
  • The header pin connectors The ESP12 module as described below followed by the screw terminal blocks
  • Finally the power supply module

Take care that the transistor and electrolytic capacitor are all orientation sensitive.

ESP12 preparation and mounting.

The key is to solder a 15 mm (approx) length of thin bare copper wire (e.g. telephone cable) to each of the 16 lead outs of the module.

Then take the wired module in the correct orientation and slowly insert one side of 8 wires into the pin holes of the PCB - the antenna end of the module is next to the two push button switches. Be patient and take your time and do not be frightened of using a pair of tweezers and/or small pointed pliers to help guide the wires into each hole.

Once all eight wires of one side are located, take a small piece of double sided tape and place it on the lower side of the module - the intention is to produce an insulating spacer between the module and PCB when you have located the wires on the other side.

Now turn the ESP12 module so that it is raised a distance off the board but is parallel with the board. with a pair of pointed nose pliers and/or tweezers take each wire on the non-inserted side, bend it gently guiding the open end into the correct board pin hole. Repeat for each hole until all 16 extended lead out wires are inserted into the correct board pin hole. gently push the module down towards the board whilst gently pulling each of the wires through the board so that eventually the module is lying above the board with the double sided tape between the module and board.

It sounds far more complicated than it actually is so just take your time. This method also allows you to mount the module on standard strip board should you want to although my personal recommendation is to use a Wemos D1/NodeMCU or similar version of the ESP12 as it is directly compatible with a DIL layout.

When you are happy that everything is located correctly, solder the wires onto the board and cut off the excessive lengths.

Power supply

The power supply is a complete sub-module and on some builds I soldered very short fly leads to the power supply and then to the main board and again used a small piece of double side tape as insulator between the two boards.

In later builds, I had very good success with soldering a header connector with any unused pins pulled out of the connector using pliers - see picture, this made it easier to mount the sub-board onto the main board.

Note/. The observant amongst you will notice that of the photos above show the a purple coloured PCB whereas the component list shows a red PCB, with a different component layout. This is simply because some of the assembly photos were taken with an earlier release board. The board is now updated and the instructions remain valid.

Step 3: Geyser Water Temperature Sensor

The Geyser water temperature sensor assembly whilst not in itself difficult, was probably the most "out of the normal" build element of the total assembly since it must be built to suit YOUR own geyser so you should treat this part of the instructable as "flexible".

Whilst the following instructions and assembly are applicable to my own geyser and thermostat (Satchwell TSE) I am in no doubt that this approach will be usable on a wide range of house geysers and boiler systems however it is your responsibility to make sure that your constructional approach is usable on your own geyser and I recommend you study the requirements before you start any other module.

I had a spare geyser thermostat so it was easy for me to take my time and work on its modification without having any down time of my geyser so you may wish to consider buying a new thermostat to allow you to do the same - they are not expensive and it takes out any risk to your current system.

WARNING - Removing and refitting the thermostat assembly to the geyser involves disconnecting and reconnecting the main 240V AC power feed - this can be lethal if mishandled - ALWAYS check that the power is isolated at the fuse box before attempting any work on it and most certainly do NOT undertake it yourself if you are not competent to do so. If in any doubt whatsoever, consult the assistance of a qualified electrician who can both check your work on the thermostat assembly itself as well as undertake the disconnection and reconnection for you


  1. DS18B20 temperature sensor manufactured by Maxim/Dallas and available from Amazon and AliExpress. The TO92 packaged version is used as this needs to be inserted inside the thermostat temperature sensing stem.
  2. Geyser Thermostat - This will depend entirely on the version/type of your own geyser and should be available from your own local plumbing/hardware store.
  3. 3 way terminal block (optional) - for the 3 wire connection of the temperature sensor. I used 3 ways cut off a 12 way 2A plastic terminal strip sold by all electrical hardware shops. The type is only really important if you plan to use the 3D printed holder (4) as this is dimensioned to use the smaller plastic terminal block.
  4. Terminal block holder (Optional) - This is again a 3D printed mounting bracket I created to facilitate easier gluing of the terminal block to the curved top of the geyser thermostat housing. I notice that the newer Satchwell thermostats have a flat cover which means that the terminal block can be directly glued to the housing cover so check before going to the trouble of printing out a block holder! The 3D printer STL file is in the last section for download.
  5. Mains wire - 4 inch/100mm max of 14 / 16 AWG, 1.3-1.6mm diameter single core for the internal mains connection - note that a domestic geyser can consume upto 4kW power. In my case it was 3 3KW on 220V AC giving a current draw of around 13.5 amps - choose your wire rating to suit your installation. An "easy" approach is to cut 2 inch / 50 mm off the end of the cable currently used to power your geyser and use the two pieces as the internal straps describe next. Again this is based on your geyser being correctly wired now and do I need to mention to isolate the power before cutting the wire?!
  6. Sensor wire - the sensor connection requires 3 wires and a well priced easy available cable is 4 core telephone / alarm wire. The length is from 250 mm when using the "terminal block on top of the thermostat" option to as many metres as you require to the sensor junction box if you are not using the terminal block connector.
  7. Heat shrink tube for insulation of the soldered connections to the DS18B20 temperature sensor.

Note. To use or not to use the terminal block and bracket? It all depends on the type of thermostat that you are working on. It is probably easier as a general instruction to not use them and just running a flying lead from the thermostat directly to the temperature sensor junction box specified later (with the skin sensors).

I do not know the maximum limit of the allowable sensor cable length but my installation is approx 3.5 metres long and I have not had a single failed sensor transmission (the controller monitors lost failed sensor transmissions and rejects any not in a defined valid measurement range)

The conversion steps are very logical.

    Disconnect the power lead at the geyser terminals heeding the previous mains connection warning.

    Remove the thermostat from the geyser taking care not to bend or damage the stem of the temperature sensing element.

    Referring to the figure " Disassembly of standard geyser thermostat" ...

    Figure steps 2-3-4 - After removing the thermostat from the geyser, on the work bench, remove the top cover (it is just a clip fit and whilst a bit fiddly, it is relatively straightforward using a small flat screwdrivers as a lever. After removing the cover, remove the thermostat adjustment knob from the cover.

    Figure step 5 - Remove the internal thermostat parts - this is a 1 way step in that you are effectively destroying the original thermostat build and some of the parts will only be removed with a bit of force using pliers. The only electrical parts that you are interested in is the strips connected to the thermostat mains in and mains out terminals both inside and outside the housing (1 & 2)

    Figure step 6 - Next with a small hacksaw, cut off the tip of the temperature stem. You only need to remove the reduction part of the tip making sure that you smooth off any rough edges of the saw cut. This will allow you to remove the sensing rod that runs down the length of the stem. You should now have an empty temperature sensing stem that runs the full length of the stem into the housing internals (there may well be a small restriction at the housing end due to the crimping of the tube to the plastic housing) that will allow you to insert a replacement temperature sensor.

    Referring to the figure "Assembly of geyser temperature sensor" ...
    Figure step 1 - Solder wire bridges from each incoming mains terminal to its associated mains out terminal on the underside of the thermostat housing. These two straps carry the geyser heater current so it is essential that a) the wire can carry the required current and b) each is soldered well to each internal fitting. The soldered surfaces for each end is relatively large (compared to normal electronic components so use a large soldering tip on your iron with an increased soldering temperature for best results.

    Figure step 2 - The TO92 packaged version of the DS18B20 sensor must be soldered to three wires of the sensor wire (using 4 core telephone/alarm cable). The length of the wire is dependant on whether it is intended to fit the 3 way sensor connection terminal block mounted on the geyser thermostat housing cover or if you intend to do a straight run to the temperature sensor junction box described later.

    Figure steps 2 to 3 - Before you solder the wires to the sensor, slide an approximate 10-15 mm length of thin heat shrink tube over the wire to be soldered

    1. Solder one of the 4 core wires to a sensor leg ensuring a good connection (do not linger too long with the soldering iron to prevent overheating of the sensor.
    2. Repeat 1 for each sensor leg.
    3. Slide the heat shrink tube over each sensor leg pushing each piece as close as possible to the sensor body.
    4. With a hair dryer on full heat apply the heat over the heat shrink tube to shrink the tube to a tight fit over each solder connection - no part of the cable/soldered joints should be uninsulated at the end of the cable. The sensor is rated for up to 125'C but it is possible with a powerful hair dryer to massively overheat the sensor so without being paranoid about it, try to take care not to overheat the sensor for too long so do the heating in stages with cooling periods for the sensor and/or hold the sensor body in a pair of metal pliers or the third hand holding accessory to act as a heatsink.
    5. Make a note of the wire colours used for each sensor connection for future reference as it will not be possible to check this once the sensor is inside the temperature sensing stem! A nice colour code could be black for oV, red for +3.3V and any other colour for the data wire.

    Figure steps 4 to 5 - Feed the wire through the thermostat stem so that it passes straight through the tube (it may well be easier to do this part before soldering the sensor on to it). The idea is to slide the wire up the stem tube so that the temperature sensor can be fit at the end of the tube - either just protruding out of the end or aligned with the end of the tube. The wire is a bit of a tight fit at the restriction of the top of the temperature stem - if you find it too difficult to get the wire past this restriction it is OK to remove the outer protective cable protective cover for the cable that fits along the length of the temperature stem - just make sure the 3 individual wires do not have any nicks in their insulation.

    Figure steps 6 to 7 - Replace the thermostat cover to the housing body threading the temperature sensor cable through the small hole of the cover.

    If you are not fitting a terminal connection block (i.e. using a flying lead connection to the temperature sensor junction box) then you have finished the construction.

    Figure steps 8 to 10 - The terminal block can be glued directly to the thermostat cover if there is a flat enough surface or you may use the 3D printed block holder or of course you can make your own arrangement to fix the block securely. I used a rapid setting two part epoxy resin to secure the assembly - this is a good solution (as opposed to (say) instant glue as it is a viscous consistency that nicely caters for any uneven surfaces.

    Now you have a completed temperature sensor element that separates the temperature measurement from the geyser power terminals. You can test it by connecting the temperature sensor wires to the controller bus connection and you should see the temperature displayed that will respond to you putting your fingers over the element tip - Do NOT test it by immersing in water - it s NOT waterproof (unlike the skin temperature sensors that are water proof)

    Step 4: Geyser Switching Module

    Components Used

    1. Solid State Relay - SSR-40 DA - available from Amazon & AliExpress
    2. Heat sink grease - available from Amazon & AliExpress
    3. Mains wire - 14 / 16 AWG, 1.3-1.6mm diameter single core - use the same type as used for the mains wire used in the Geyser Thermostat modification.
    4. Low voltage wire - not critical. I used the same 4 core telephone/alarm cable that I used for the temperature sensors.
    5. SSR heat sink - available from Amazon & AliExpress as a match to the SSR however you can used any suitable sized heat sink material noting that the SSR will be dissipating typically 30 watts when the geyser is switched on.
    6. 2 x three way terminal block - General purpose 20/30A rated as supplied in local electrical & hardware shops.
    7. Cable glands - General purpose available from the local electrical hardware shops
    8. Enclosure - not critical, any suitable sized plastic housing should do. I suggest that you fit the heatsink on the outside of the enclosure to aid cooling but ensure that the SSR and all wiring is fully enclosed inside the housing.

    The module is not a critical build beyond ensuring that:

    • Any mains wiring is safe from short circuits and accidental touch and all contact screws are thoroughly tightened and all wiring is securely fixed in its terminal blocks.
    • The earth connection from the main power lead is correctly passed through the terminal in and terminal out path.
    • The SSR has an adequate heat sink connected with thermal transfer grease applied at the mating heated surfaces.
    • I found it helpful having separate gland entries for the controller low voltage switching signal, Main power IN and Geyser mains power OUT with the mains wiring at one end of the enclosure and the low voltage wiring at the other end.
    • When connecting the module to the mains, ensure that the mains supply is isolated at the fuse box before any work starts.

    Step 5: Skin/Wall Temperature Sensors (Optional) and Connection Enclosure


    1. Up to 4 DS18B20 temperature sensors - integrated with at least 1 metre length of cable and steel (often sold as "waterproof sensors). Available from Amazon and AliExpress.
    2. Junction box - Not critical and any small plastic enclosure is suitable E.g. Amazon Waterproof Junction box 70 x 50 x 20
    3. 3 way terminal block - not critical E.g 3A terminal strip available from your local electrical shop

    This is a simple "terminal block in an enclosure" junction box arrangement. The critical point is to ensure that the same terminals of the Geyser sensor and each skin sensors are connected in parallel to create a single "Temperature sensor bus". I.e. The VDD of every sensor is connected together + the GND of every sensor is connected together + the DQ line of each sensor is connected together.

    Since the sensors are colour coded and the alarm/telephone wires are colour coded it should be pretty easy to ensure that nothing is cross wired!

    Step 6: Setting Up the Arduino IDE for the ESP8266 and Program Upload

    There are countless instructable projects and online tutorials describing how to set up the Arduino IDE for use with the ESP8266 range of microcontroller boards. Rather than repeat the whole procedure again, I include a link here to one of my own previous instructables and ask you to refer to Step 4 for the instruction.

    Multi-purpose Room Lighting and Appliance Controller With Alexa Voice Control and Automatic Timer Functionality

    You will need a USB to serial convert to connect the Device to your computer. There are several on the market and they are all usable so long as you have the correct USB driver installed on your computer. I normally use the FTDI232 and I have never had a problem installing the necessary drivers for them as Windows has always installed them automatically when I plug in the USB.

    Remember before uploading a program you must ....

    • The console baud rate is set to 115200, and the line ending is set to "No line ending"
    • The board type selection is "Generic ESP8266"
    • Hold the "Flash-Config" button down when you press the "Reset" button and then release the "Flash Config" button AFTER you have released the "Reset" button. - This is critical to ensure that the ESP12 is in flash mode for uploading.
    • Compile and upload the program.

    After compilation you should see the blue LED on the ESP12 flashing during the upload cycle. If it does not flash and you get an "fail to upload" error from the IDE, try again after checking that the Tx, Rx and 0V connections between the USB interface PCB and the board are correct and make sure that the 2 buttons are pressed in the correct sequence.

    After a successful upload, press the reset button once to get past the well known "bug" associated with the ESP8266. The Device should now start up, blue ESP12 LED will start to flash, you will see a boot up message on the serial console and you are now ready to start the initial setup as described later. ..... I am not including any discussion re the details of the software itself as there is a lot of it, the software is very well documented and the reality is that you do not need to change anything in the code unless you want to "jump in" and change things. Nevertheless if you do want any explanation and/or support just message me. (My email address is also in the first lines of the software list - Declarations.h

    Step 7: Putting the Modules Together ...

    The only "complication" I suffered in the final system assembly was the reality that I had to work in in the roof space and tread very carefully not to mention having all necessary tools and bits with me! :).

    Refer to the figure for the system wiring diagram again taking extreme care with all mains wiring isolating the supply before starting.

    1. The mains power cable that used to go to the geyser thermostat now goes to the Geyser Switching Module A.
    2. The switched output mains from the Geyser Switching Module A goes to the mains terminals on the new Geyser heater sensor (if you have enough cable slack it is easier doing this before you replace the heater sensor into the geyser (the exception being the earth wire connection, that can be connected when the sensor is in place).
      Warning …. Make sure that the geyser earth connection is fully restored before restoring the power connection
    3. The temperature sensor connection goes to the Temperature Sensor Junction Module B. Make sure that the incoming and outcoming sensor connections are consistent and correct. I strongly suggest you follow a strict wire colour coding system making a note of what is used where.
    4. The skin temperature sensors if used are also connected to the Temperature Sensor Junction Box B.
      Fixing to the geyser exterior is simple - decide where you want them and then just fix each sensor flat against the geyser wall using duct tape after first wiping the geyser surface free of dust using a dry cloth.
      I initially put four sensors at each end of the geyser at the side to compare the wall temperatures around the geyser. Using the controller display, I established that they were all within a degree of each other so I then moved one to the top of the geyser and again it was within 1 degree of the others. This was reassuring that the geyser was already well insulated and my final installation was just one sensor mounted on the side wall and another just floating in the roof space so that I could get an accurate representation of how warmer the geyser was in relation to the air ambient temperature as this is directly related to any heat losses of the geyser.
      After some days of use, I discovered this to be a consistent 4 to 4'C suggesting that I could further reduce heat losses (and therefore energy consumption) with some external insulation - this will be a future task and I fully expect to reclaim the at least two of the skin sensors for future projects when I am sure I have maximised any insulation.
    5. The geyser controller Module C is on the "house side" of the installation and can be wall mounted or sunk into a wall depending on your enclosure and preferences. Given that the unit can be completely driven by remote connection using your phone and computer it actually does not need to be SO accessible and in my case the preferred location was the top of wall to eliminate the need for any cable runs on the house side i.e. all cabling from the other modules was passed through a small hole in the ceiling immediately above the controller enclosure. I suggest that you seriously consider the proposed location of the controller before you assemble the controller as its location will surely influence the decision as to whether to fit the display or not!

    One last discussion point …. the geyser mains supply and the controller mains supply …. can they be the same?

    For sure there is no reason why you cannot use the same power feed to both devices. Isolating the power will then of course isolate both devices. On the other hand, if you run power to the controller from (say) a fused run from the house socket supply you can work on/test the controller before switching power to the geyser. Is this better or needed? Your choice, there is no safety risk of having separate or combined power so it is purely a matter of convenience or preference. What did I do? ….. I ran them separately.

    Step 8: Using the Controller ... Web Server Pages

    Whilst the OLED screen if fitted allows you to view the controller readings, some settings and logged data, you cannot change anything with it. You can do this via the online web server (using your local wifi connection) or the offline web server using the controllers own access point. The offline and online servers are identical in feature and function except that you can only set the Wifi logon SSID/password values using the offline server.

    So you have installed all the system components, wiring applied power to the controller and hopefully you should see the OLED display if fitted start up or if not fitted, the blue ESP12 LED will be flashing. What next?

    The controller by default after a new build will initialise the EEPROM stored settings to a set of defaults ...

    • Wifi connection DISABLED with blank wifi SSID and login parameter values
    • Default password for the Access Point = password
    • Setpoint SET1 and SET2 On value of 20'C
    • Setpoint SET1 and SET2 Off value of 30'C
    • Geyser Temperature Control Enable = DISABLE
    • Timer 1 control DISABLED
    • Timer 2 control DISABLED
    • Temperature Sensor DS18B20 Index number = 0
    • Skin Sensor 1 DS18B20 Index number = 1
    • Skin Sensor 1 DS18B20 Index number = 2
    • Skin Sensor 1 DS18B20 Index number = 3
    • Skin Sensor 1 DS18B20 Index number = 4
    • Timer 1 & 2 Start Time - 12:00
    • Timer 1 & 2 Stop Time - 15:00
    • Display ON time = 8 AM (0800 hrs)
    • Display OFF time = 11 PM (2300 hrs)

    To manually start the Access Point Web server, press and hold the PROGRAM push button (connected to GPIO0) for a minimum of 4 seconds and no more than 7 seconds (Beware - holding it for 10 seconds or more will force a reset of the controller). - A start message on the OLED display will be indicated.

    To start the Controller offline web server (the Access Point)

    1. Connect your computer / mobile phone wifi to the wifi access point that will start up called NNNNNNNNNNNNNNNNNNNN - Setup. The password is the default value "password" without the quotation marks.
    2. When the network connects, start up your web browser and enter in the browser address field.
    3. The browser will display the web server Main Display start screen - see the above diagrams for examples of the available screens.

    Temperature Sensors

    The first important settings are to ensure that the temperature sensors are being read correctly. The measured temperatures will be displayed on the main screen depending on how many sensors are being used. If only one sensor is connected (I.e No skin sensors) then nothing further needs to be done and the geyser temperature only will be displayed. If you have connected up to four extra sensors to measure the geyser skin temperatures then these will also be displayed as Skin 1 to Skin 2 however at this point, the controller does not know which sensor is which (as they are all connected as one data bus) and the Geyser Temperature may well be indicated as one of the skin sensors. The requirement here is to make sure that the correct temperature reading is assigned to the correct temperature reading.

    Method 1 - if the Geyser and skin sensors are already mounted on the Geyser

    In this case, you would expect the Geyser sensor to be reading a higher temperature than any of the skin sensors (assuming that the geyser water is already heated to something warmer than the remaining skin sensors.

    1. Look at the display and see which of the displayed values is indicating this value
      - (Geyser Temperature, Skin 1, Skin 2, Skin 3 or Skin 4).
    2. Now go to the System settings screen section N and note the current index number (0-4) value of this sensor that you have identified as being the Geyser sensor.
    3. Take that number and change the index value of the "Main Temp Sensor index no" from 0 (the default) to the number that you have noted from step 1.
    4. In the same section change the index number of the skin sensor that you identified in step 2 and change it's to 0.
    5. To lock in the changes you must press the "Upload New Address to EEPROM" button.
    6. You have effectively changed the index numbers of two of the sensors. The displayed Geyser temperature should now be reading the correct Geyser temperature.
      E.g. The default settings are Main Temp - 0, Skin 1 - 1, Skin 2 - 2, Skin 3 - 3, Skin 4 - 4. If you identified in step 2 that skin 3 was in fact reading the Geyser Temperature, you would change the index numbers to show

      - Main Temp - 3, Skin 1 - 1, Skin 2 - 2, Skin 3 - 0, Skin 4 - 4.

    Method 2 - if the Geyser and skin sensors are connected on the bench before installation

    This is the recommended method simply because it allows you to also check that the sensor bus is wired and measuring correctly in the comfort of your lab before committing to the final installation which makes diagnosis and correction more difficult.

    So in this case you have up to 5 sensors in total all wired together to the controller terminals and all will be reading approximately the same ambient air temperature.

    With your warm hands, hold the sensor tip of the Geyser sensor and therefore raise its temperature (Do NOT put it in a cup of warm water as it is not water proof!) Now repeat steps 1 - 5 of Method 1 once you have identified which display value related to the Geyser sensor reading. This time you can hold each skin sensor in turn and identify which one is skin 1, 2, 3 & 4. All you need to do now is label each sensor with a paper tag with its correct skin ident number so that you can readily determine the location on the geyser with each sensor number. E.g. Skin 1 is at the top front, skin sensor 2 is at the front side etc etc. I actually left Skin 4 floating in the roof space so that I could see the ambient temperature of the space and compare it with the geyser outside wall temperatures (the closer the skin temperatures are to the ambient air temperature, the less heat losses you will suffer = the most efficient geyser insulation)

    Display Enable settings - Box P of the System Settings Screen
    This is important if the OLED display is fitted and controls the times when the complete display is turned on and off. There are two settings (ON time and OFF time) and these relate to the hours only (0 = midnight, 23 = 11PM).

    1. So if ON is set to 8 and OFF is set to 23 (the default values), the display will only be active between 8 AM and 11 PM. (0800 and 2300 hrs).
    2. Setting both values to the same value turns the display off all of the time.After changing the values you must press the "Upload New Display Timer settings to EEPROM" to lock the changes in.

    Setting the correct WiFi logon details

    Note that you can only change the wifi settings using the offline server using the controllers Access Point, later you will see that you can also access these screens and parameters using the online web server when you are connected to the home wifi network but NOT the wifi settings.

    1. From the Main Screen, click on the Display System Settings hyperlink at the bottom of the page.
    2. Click on the Go to Wifi Settings Screen link.
    3. Box M will now display the available wifi networks and your own wifi SSID should appear in this list.
    4. Enter the SSID, Wifi password, the name that you wish your controller to be known by on your network (E.g. Geyser-Controller) and the new password that you wish to give your offline access point in box L.
      Note that you cannot use spaces or any non-alphanumeric characters in these fields, you can use - or _ to separate words if you wish. Do not forget your access point password as you will not be able to view this again without connecting your computer to the controller which can be difficult when the controller is mounted on the wall!
    5. Enable the Wifi settings button otherwise the controller will still not log on to the wifi network.
    6. When 4 & 5 are completed, click on the Upload New Settings To the Device button. You will see a message to indicate that the upload is complete. Return to the main menu screen, and then the Display Settings Screen and then select the Reset Controller link. This will cause the device to reset itself and the Controller should now reboot and log on to your own network as indicated on the OLED screen.
      Warning. If you did not do a power off cycle / hard reset after first uploading the program from the Arduino IDE, the controller will freeze at this point due to a well known bug in the ESP8266. Simply reset the device either by turning the power off then back on or more simply by pressing the reset button on the board.
    7. If the device does not log on successfully the most like reasons will be: incorrect network details being stored, wifi enabled, your chosen router is not compatible with the ESP8266 (5GHz rather than 2.4GHz)

    Heater Settings Screen

    Sections A & B on this screen allows you to set the setpoints for automatic ON and OFF control of the geyser heater. It displays the current stored values and allows you to change their values to suit your requirements.

    There are two pairs of ON/OFF Set 1 and Set 2. Set 1 is the "normal" set and is used at all times EXCEPT when timer 2 is active. Set 2 is active when Timer 2 is active.

    Section E gives you manual control of the temperature control. This is normally driven by Timers 1 and 2 so its state will be automatically be enabled/disabled depending on the timer values if the timers are enabled. At any time you can override this value with this parameter. So for example, if both timers are disabled and you manually enable the temperature control, then setpoint set 1 will permanently control the geyser temperature. However note that if any timer is enabled, then your manual intervention will be discarded as soon as the relevant timer has enabled or disabled temperature control.

    Section C gives you a temporary manual control switch directly to the Geyser switch WITHOUT the safeguard of the setpoint limits. The automatic temperature control parameter of section E must be disabled for this feature.
    Ie. If the Geyser is OFF, pressing the button will switch the Geyser heater ON for a maximum of 15 minutes, it will then switch off automatically. If the Geyser is already ON regardless of how it was switched on (manually or automatic), then pressing the button will switch the Geyser OFF. It will stay off until the next time a timer or manual intervention switches it back on.

    Timer Control Settings Screen

    This screen offers two timers, sections F & G offer independent On and Off times using the 24 hour clock system and indivdual day enables. The two timers should not overlap each over but can run together so that for example you could run Timer 1 on week days and timer two on weekends, another scenario is that you have both timers running with a time period in the morning and another in the afternoon. Timer 1 uses Setpoint set 1 and Timer 2 uses Setpoint set 2 so another scenario could be that you run a timer with high temperature settings during your peak hot water usage and use Timer 2 with lower temperature settings so that you ensure that you maintain the availability of hot water for normal activities. Either way, you can run your own hot water strategy just making sure that the start/stop times of each timer do not overlap.

    Section H is important in that they are the master enable switches for enabling each timer. The timers will only run when they are enabled from this section.

    Note that the "Press To Upload New Settings" button MUST be pressed before any changes to these settings are processed.

    Data Logging Screen

    This screen provides a list of the last 24 hour logs of the Geyser sensor and each skin sensor temperature readings plus the time in minutes that the Geyser has been switch ON. Each point is automatically recorded on the hour (ie. Midnight, 1 AM, 2AM, 3AM ….. 10PM,11PM and so on). It is a rolling list so at any time you will see the last 24 hours of logging. I.e. at 3 PM, you will see the results back to 4PM the previous day.

    Section I gives you a numerical summary of the last 24 hours data - Total time ON time of geyser in minutes and the same figure as a percentage of the total time possible over 24 hours.

    The ON time is the time that the Geyser is consuming power and therefore reflects your total power usage over the 24 hour period. If you know the power rating of your Geyser, you can easily calculate the Kwh consumed.
    E.g. if the geyser has been on for 90 minutes and your Geyser is 3 Kw, the total consumption is:

    90 x 3 Kwh = 4.5 Kwh


    If you have gone through all of these screens and set up any required parameters to suit your requirements of the control then the controller is ready to go. I assume for now that you did all this using the offline web server as you need to use this to initially set up the wifi log on details however the reality is that all of the pages described previously with the exception of the Wifi Screen can also be accessed and changed on almost identical screens using the online web server accessible when you are logged on to your local wifi. The main benefit is that the screens can be accessed anywhere within the range of the wifi coverage without you needing to be close to the controller to start the access point using the Program button.

    To use the online server you need to know the IP address of the controller once it has logged on so how do you do this?

    See the next section ….

    Step 9: Controller IP Address Management

    It is most probable that your router is utilising DHCP for its management of IP addessses throughout your home wifi setup. The "problem" with this is that the router does this invisibly to the user (that's you!) and as a security feature, the IP address of each device changes at regular intervals. Unless we manage this situation, every time you wish to log on to the controller to view or change settings you would need to identify the current controller IP address and use it in your browser to access the controller web server - this is not practical and we need to find a work around.

    There are more "sophisticated" ways for us to get around the issue but I have chosen arguably the easiest and the cheapest i.e. free.

    It involves 'simply" making the IP address that the router allocates to the controller permanent so that once you know what it is, it will not change.

    To do this we require access to the admin page of your router. Of course how to do this is specific to your router but I have found that the method is extremely similar in all of the routers that I have used and if you are able to build this project, it is certainly within your skill levels.

    All routers come with instructions and you can always download a set from the manufacturers web site if needed. These instructions relate to my router make TP-Link Model No MR6400 - a 300 Mbps Wireless N 4G LTE Router.

    1. Refering to the above diagrams, in this case the admin page is accessed through my web browser on (This address is commonly used by many routers). You will need your username and password (defaults often are admin and admin!) to access the settings.
    2. Go to your DHCP section and look at the client list and look for the entry using the name that you gave your controller when setting up the wifi settings. In my case it was "GeyserController". Here you will find the MAC address and the IP address currently allocated to the controller.
    3. Make an exact note of these two values and then go to the "Address Reservation" screen and add a new entry to the list using the MAC address and IP address that you have just noted.
    4. Save the new entry and then exit the procedure which will force the router to reset. After a short while, the router will have rebooted and restored the wifi network but this time the IP address allocated to the controller will be the same as last time and most importantly will not change. You can check this if you wish by relogging onto the admin page and looking at the client list again and noting that the router entry is now a permanent entry. Bingo - it is now locked and you know what it is.

    Now when the controller is logged back onto your network, you can access it from anywhere in your wifi coverage by entering the IP address in the address bar of your browser and the main controller screen will pop up. Save this as a favourite on your browser and you will have an easy and direct way to address the controller online server.

    Step 10: OLED Display and Time Keeping

    I am keeping this section short as frankly the best tutorial is just playing with the display and it's contents are intuitive.

    What do you need to know … ?

    1. The display is optional and only adds value if you can actually see it so if the controller is in a restricted position then the display will just be an attractive but under used feature.
    2. There are two normal screens that the controller toggles between, the main home screen is on for approx 6 seconds and the second screen on for approx. 4 seconds. Screen one displays the geyser temperature, the time (and date if the RTC is fitted), the controller name and wifi status (IP address or not connected).
    3. Page two displays the currently active set point values, min and max temperatures recorded over last 24 hours and all connected skin sensor temperature values
    4. Pressing the Program button for a couple of seconds will force the display to the next page and hold that display for around 20 seconds. Pressing the button again during this extended display time will step again to the next screen. The number of screens during this button pressing activity will extend from the normal two to include 4 extra screens that step through the data log values. Unless the button is pressed again, the screen will return to the first home page after the 20 second period.
    5. If the display is disabled by the screen ON/OFF clock, pressing the button will temporarily wake up the display for approximately 8 seconds before switching off gain.

    Even if you do not fit the screen on the final enclosure, it is worthwhile having one and connecting to the board during build testing as it presents a very easy way to track the devices operation especially if you run into a problem.

    The Clock

    Without a Real Time Clock (RTC) module fitted the controller MUST have the wifi connection to initiate the clock and keep it in sync in the longer term. The unit needs accurate time keeping and so it has upto 3 time "elements" in the algorithm. The main internal clock is a totally software based clock running on a one minute tick that maintains a minutes and hours clock. This is not SO accurate and so is synchronised with an NTP server on via the wifi/internet connection. The NTP synchronisation also brings in the day value as well so the controller is then running accurately with minutes, hours and day variables. The normal sync interval is 4 hours but if a sync update fails, it will retry every 3 seconds until it is successful and then it reverts to a 4 hour cycle. If the power is interrupted or the device is reset then it cannot function properly until it is re-connected to the internet and re-synchronised with the NTP server.

    With a RTC fitted, the device only relies on the internet at build time and RTC battery exchange time to initially set the RTC time and date. Thereafter it does not matter if the internet connection is broken, the controller power disconnected or reset as the RTC maintains the correct time internally and is protected during power down so long as the RTC battery is good. Using the RTC has several benefits namely allowing instant start up, not needing the internet at startup, consistent accuracy and it introduces date and year elements on the display. There are several types of RTC on the market with the DS1307 being arguably the most common and cheapest. The DS1307 RTC clock is not that accurate losing several minutes per day so the controller still does the NTP synchronisations every 4 hours as before to "top up" the RTC and thus maintain accurate time keeping. The DS3231 is a much more accurate RTC and is totally compatible with the DS1307 and if the unit is being used without wifi then I would recommend this device.

    Step 11: Download Files

    See the attached file for the Gerber files used for the project. You simply upload them to your chosen online manufacturer. I used SeedStudio this time around and a previous revision was made by OSHPark. Both companies were excellent in quality and delivery. there are many other alternative suppliers so it is worthwhile shopping around (online) as they often run special offers.

    As I mentioned earlier you can produce your own (smaller) PCB, leave out a a formalised PCB and just build on stripboard or even used a proprietary ESP8266 board as there are no special aspects of the design.

    The second download file is the sketch files for the ESP8266 firmware and the third file is STL files for all of the 3D printed items (OLED bezel, RTC holder and geyser terminal block holder) should you choose to use them.

    You will also need the following libraries installed in the Arduino IDE. I have attached links to their various locations should you need them.

    Arduino Contest 2019

    Participated in the
    Arduino Contest 2019

    2 People Made This Project!


    • Lamps Challenge

      Lamps Challenge
    • Rice & Grains Challenge

      Rice & Grains Challenge
    • Puzzles Challenge

      Puzzles Challenge



    2 years ago

    Very Neat!

    I'm also around Cape Town!

    Do you make & design your pc boards yourself?


    Reply 2 years ago

    Thanks. Yes, I design them currently with Fritzing and then purchase the boards using exported gerber files. Fritzing has its haters and lovers but from my view point Yes, it is dated but it is very easy to use and is fine for this type of project. I am currently just trying out Eagle CAD and EasyEDA - first impressions are that they are probably the way to go but they have a steep learning curve to begin with.


    Reply 2 years ago

    I should add that we have a very capable PCB manufacturer here in Cape Town (W.H.Circuits) BUT based on my own experience they are literally 3 times the cost of buying from China (JCLPCB & PCBWay)

    JJ Slabbert
    JJ Slabbert

    2 years ago

    Great intractable. I am building something similar, but it is cloud based. Your wifi setup method looks very professional.


    Reply 2 years ago

    Thanks. I recently upgraded the firmware to add MQTT communications that allow display on remote screen and remote control/logging. A friend has another version hooked up to his solar geyser so all in all, I am very pleased with the project. I also added Alexa voice control but that has broken a few months ago due to some Amazon upgrades not been compatible - I will fix it one of these days ....


    3 years 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....

    JJ Slabbert
    JJ Slabbert

    Reply 2 years ago

    I think this is especially for the americans😂


    Reply 3 years 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.


    3 years ago

    Awesome instructable - well done!


    Reply 3 years ago

    Thanks for the compliment - much appreciated.