Introduction: Wi-Fi Water Heater: Sonoff Basic IoT

About: I like to make stuff. All kinds of stuff! ZepLabs HandCrafted Nikos Zepidis

Hello all!

And welcome back to another project!

We live in an era where things are constantly getting smarter, faster, more convenient, more interconnected, and generally, life amongst soul-less things is getting easier and easier. And your water heater shouldn't be an exception to that!

I live in Athens, Greece, where we get a lot of sun all year round. This, in combination with the fact that I had a solar water heater in my previous place, made bathing an effortless, easy-going task most of the time. Quite automatic! With just a few cloudy day exceptions, taking a bath never took any programming, nor waiting!

Things changed though! I moved to a new place, where I don't have a solar heater (for the time being at least), so bathing became a totally different experience..

I have a quite busy lifestyle, being constantly on the move, and in between of something! So the way I see things, whenever I am called to get my self clean, I will either be during my day run, where the situation will be something like: hop in the shower-get clean-hop out-put something on-hit the road again, or it will be at the end of one of those day runs, where you usually want to chill, until you finally go to bed, to start another cycle in the morning. (or night! if you work shifts..) Anyways, waiting for the water to warm up is always a bummer!

And the whole problem sums to a small little fact. You have to be home to turn on the heater, traditionally. So either this works ,or you..

So we are turning the water heater Wi-Fi! And we are doing it cheap!


You are not gonna need much! Just two things. A Wi-Fi switch and a contactor!

Wi-Fi switch

Things are quite simple here. It needs to switch something on/off, and it needs to connect to WiFi!

There is quite a number of solutions to that, and you cant go wrong with any one of them! In my case, I will be using a sonoff switch. Basic edition!

Sonoff is the brand name for a variety of such products. The one we 'll be using here is called sonoff basic, it is based on an esp8266 microchip, which comes with a TCP/IP stack and microcontroller capabilities. It costs around 5 dollars, and it can be found pretty much all around the planet! It comes programmed to work with an app you can download in your according play store and it both works on and controls mains voltage. Seems like a perfect fit!

I am leaving you here a link to get an idea, or even get yourself one of those through there! Just keep in mind that all the links in here are affiliates, meaning that if you purchase something through those, I also make a dime! Just saying..

20 A 2 pole contactor MCB

The sonoff switch I am using is supposed to be able to control 10 Amps. This means that you can you can hook up there a load that draws up to 10 Amps (2.2 kW in my case, 220 Volts network) and switch it on and off. And we have two problems with that!

First of all, a typical water heater is usually connected to a 20 Amp breaker, which is because that it is a much bigger load than those 2.2 kWs. More like 4 of them!

Apart that, the sonoff switch may claim to do 10 Amps, but if you have a look inside, on the copper-ways, relay and all, this sounds a little far- fetched to my ears! Keep in mind that it is a Chinese product, and the business model the guys follow there tends to exagurate a bit on those kind of specs...

Just have a look on those 200.000 mAh power-banks they sell, which have the size of a pack of cigarettes!

Anyways, to solve this problem we are introducing a second relay! 20 Amps, 2 poles.

This one is shaped especially so that it can be mounted inside your electrical pannel, and take care of the heavy work, which is actually making and braking the electrical contact, in order to put your water heater on and off, in the way the sonoff dictates!

Again, you can find a link to that here.

Step 1: Lets Wire Everything!

At this point, I feel obliged to point out that:

Working with mains voltage can be dangerous! Even though this is a tutorial, I strongly advise you not to work with mains voltage, unless you have an understanding of what you are doing. There is no point in having hot water if you won't be here to bathe with it!

With that said, let's move on to wiring everything...

Above I've left you some diagrams with the before/after. There is not much more to say on that, except a few comments on the method preferred!

As you can see I wired the contactor to be connected in parallel with the double switch that was previously controlling the water heater and to be controlled by the sonoff's output, which connects on the A1 and A2 pins of the contactor. The pins where it triggers! And I did all those for various reasons!

Firstly, it is only my second time using a wifi switch, so I couldn't say we've come to a point to completely trust each other! I wanted to be able to use the old switch, in case sonoff fails, or just in case I don't know where my smartphone is, or it has a dead battery, or my home's router is dead or whatever! (sonoff also comes with a push-button for such cases, but I will be burying it inside the electrical panel, and won't have direct access to it!).

The second reason for choosing this wiring method is that I don't own the place. I just hire it! So if I am soon called to move for whatever reason, I can take all the automation systems with me, and leave the place intact!

On the downside with this setup, where I put the old switch in parallel with the contactor, is that if I have the water heater powered up through the switch, and later I leave the apartment to remember I forgot to turn it off, I cannot do that through the sonoff, and vise versa..

Another thing I would like to point out is that I didn't touch the 20 A breaker the heater had there in the first place!

Most water heaters have an internal thermal breaker, which interrupts the power supply in case something goes wrong, but apart from that, this little breaker you have in there is the only safety precaution you have in case your water heater overloads. So, sonoff or not, make sure to have a breaker, connected in series with the line that feeds your water heater, and positioned just before it!

Step 2: Wi-Fi Control!

Now that we are all wired up, the time has come to wirelessly control the thingy!

As I said, there is already an app that works with sonoff's default programming and it can be downloaded through play store. It is called eWelink and it is already pretty neat!

It comes with various features built-in, so apart from changing the state of your device to on and off, you can also set timers for it, time schedules, you name it!

It is also compatible with Alexa and Google Home, which means that if you are already into making your place a bit smarter, you can now also add the water heater we just converted onto your preferred system!

Apart from that, if you are more on the tinkerer's side, as we said sonoffs run on an ESP, which means you could flash it with another firmware, like TASMOTA or espEasy, you could program it as an access point or a client, you could write an app about it, also add a thermometer with a second ESP to report inside that app with the temperature inside your water heater, you name it! Sky is the limit among our projects and community!

With that said, hope I helped a bit from my side!

Feel free to subscribe to my account here on Instructables, or my youtube channel.

Until next time,

Happy making!