Internet of things: Home is where the Smartphone is
Recently a problem was put to me regarding some electric heaters in our office. How can we remotely monitor and control them? The reason was all the switches are in the corner of the building that everybody hates to walk to.
The scenario is pretty straight forward. A mechanical switch controls 5 heaters, and there are several of those switches. Many times the heaters are left on when no one is working, which is a waste of energy not to mention cost. I decided to find a way to automate the system with cloud control. I found NodeMCU’s ESP8266 Wi-Fi Module, Fotek’s DC to AC Solid State Relays (SSR) suitable for my need. The challenge was to find the right SSR module that meets the ratings for our heaters’ power specs. Each of those heaters are 1 kWatt at max and at 110V they draw 1000 Watt/110V=9Amps. So for 5 Heaters from a single line that is almost 50Amps. I decided to put a single SSR for each line so that it can control 5 heaters, just like the old switch used to do.
Here’s an illustration to make it clearer.
You can see in the schematic that all I did is put a SSR module in series with the switches that control the heaters. I like using overrated SSRs, so I bought a 90Amps SSR from Fotek. The SSRs are controlled via the NodeMCU’s ESP8266 Wi-Fi module which is connected to the cloud through a local gateway.
While I was working toward this solution, our mobile development team created an app that allows the user to control the SSRs through the Internet. And there it is. No more worries about leaving the office with the heaters on and no more trips to that remote building corner.
But, there are still some issues with this setup that we are working to solve.
What if the ESP module fails or simply gets disconnected from the local access point? Then you have no control through the Internet. I had a simple solution, program a GPIO pin to be always ‘on’ whenever it is connected to the Internet or if the main program inside the ESP is running with no exception thrown. Later the state of this pin is input to a Boolean logic circuit along with the SSR control signal.
The Boolean circuit makes the final decision and either allows the user to control the heaters or the circuit itself to set them to ‘on’, ‘off’ or the ‘previous state’. The user has the control when the Wi-Fi is connected to the Internet, but the Boolean circuit takes control when it’s disconnected. It can set either of three outputs: on, off or the previous state. Which output state will be chosen is configured via onboard switches.
The illustration below shows how the heaters can be kept ‘on’ in case of a Wi-Fi failure.
Both the CONN-STATE and SSR-CTRL signal will be coming from the Wi-Fi module. The CONN-STATE is 5V when the Wi-Fi Is connected, 0V when it’s disconnected. The Inverter simply reverses the signal. So, when it’s connected, the inverter makes it 0V and 5V when the Wi-Fi is disconnected.
When a user sends an ‘on’ command from his/her phone, the SSR-CTRL carries 5V. SSR-CTRL will be 0V if the user sends the ‘off’ command. Finally the inverted CONN-STATE and the SSR-CTRL is input to an OR gate. An OR gate mathematically adds two logic signals. It interprets 5V as 1 and 0V as 0. Unless both of the input signals are 0V, the OR gate outputs 5V (or mathematically 1). It only outputs 0V when both of the inputs are 0V.
Whenever the Wi-Fi is down or damaged, there will be no signal (in another sense 0V) at CONN-STATE and the inverter will make it 5V. Therefore the OR gate will see a 1 at its input. In Boolean circuits, anything added to 1 yields 1.
So in case of Wi-Fi failure, the OR gate will always add the SSR-CTRL signal to 1 and output 1 (or 5V), regardless of the input at SSR-CTRL. Therefore, the heaters will be always on.
When the Wi-Fi is connected, the inverted CONN-STATE will be always 0V; so, whatever the user sends through SSR-CTRL will be added to 0V and given to the SSRs. If the user sends 0V (off command) or 5V (on command) than the OR gate will add them to 0V and output 0V or 5V respectively.
The SSRs will turn off the heaters if it gets 0V or turn them on if it gets 5V.
However I have expanded this idea and now the user can decide what the Boolean circuit will do in case of a failure.
What if I’m out at dinner and completely forgot to turn off the heaters from my phone? Another simple solution, there is a scheduler in the app that will allow the heaters to turn on or off automatically on any date and time in the year including holidays, weekends or on any customized days.
What if the power fails and the Wi-Fi device simply gets reset and starts the program running from the beginning? This is simply another technical problem. The ESP module stores locally inside itself each of its necessary pin states and other data. It also sends them to the database on the cloud. So it can regain its previous state on each reset very easily without letting you know any difference from the load side. Nothing is lost actually. Here’s an interesting side note. This setup lends itself to other useful functions like heat billing calculation and power usage tracking.
All these came from a simple idea. None of us in our office wanted to walk. Jokes aside, our solution has advanced far from this initial stage. It promises that our next revisions will be even more robust and user suitable.
I think by now you’ve seen this isn’t just about a few heaters. It’s about life, our habits of using things and how we want to use them.
It’s about controlling your TV, air conditioner, refrigerator, the garage door you hate to open. It is your life connected by your Smartphone no matter wherever you are. Home is where the Smartphone is. We welcome your opinions on what we should bring to such a system.
Feel free to contact/comment in the section.