In this article, we will control our home geyser from anywhere in the world. Life is fast and busy, and we all want to leverage the benefits of technology in our day-to-day life by automating where and when we can.
In this experiment, we will automate our geyser in integration with our alarm app so that whenever we wake up, we can get instant hot water. We will achieve this using the MQTT IoT protocol. MQTT is low weight low bandwidth data transmission protocol. For more details, you can refer to our previous articles.
Using IoT, it is possible to control any physical object connected to the internet. When you connect your house with sensors then connect those sensors with the internet, you can control them from your cellphone from your laptop.
An IoT-based water geyser gives you control from your mobile device and uses the MQTT protocol as a communication protocol. You can control the geyser from an app, which can be installed on your cellphone as well as a laptop.
Basic network of our geyser’s control system
The geyser is connected to a unit with an ESP module programmed with an MQTT client program to connect to an MQTT broker. The ESP module connects to a Wi-Fi router for internet connectivity. The broker is hosted on the cloud, so there will be no need to open any port in-house router.
The anatomy of complete project
Note: To understand basic about MQTT and IoT refer to previous articles.
ESP8266 is connected to the broker and received instructions through the mobile app.
Let’s discuss in details about the core functions:
- To control the geyser there is a mobile app which is basically a daily alarm app, you can set an alarm for any suitable time.
- The app calculates hours and minutes until the alarm sounds and send the minutes to the broker followed by “on” command, on topic “ToESP”, the ESP module is subscribed to the topic.
- When ESP module receives the “on” command it stores the minutes in a integer.
- The converted value then passes to a function that calculates the time in seconds and other formats and returns the second.
- To measure the time in ESP, there is a block of code containing a for loop that updates the value of a count variable every second. That’s how the time is compared with the received time.
- The “time _in_switch_on” variable is now modified from the time which is taken by the geyser to heat the water. When you set an alarm of 5:00 AM, the geyser will start at 4:50, and the water will be heated in 10 minutes.
- The variable “time_in_switch_on” stores the value in seconds and is compared with a variable “tick_seconds” in a function “function_to_trigger_gyeser_on()”.
- After the geyser is on, it starts to count till 15 minutes exact, and when 15 minutes are passed, the geyser turns off, and the message is sent to the App.
Note: We are using open source library for publish and subscription through ESP client. We are not changing anything on those public libraries.
You may also like:
Filed Under: Electronic Projects, More Editor's Picks