A Novel Approach for Wireless Home Automation System using IoT Pardeep Singh1, Gourav Bathla2, Rahul K. Singh3 and Alankrita Aggarwal4 1,2,3 University of Petroleum and Energy Studies, Energy Acres, Bidholi, Dehradun, Uttarakhand, 248007, India 4 IKGPTU, Kapurthala, Jalandhar-Kapurthala, Highway, Vpo, Ibban, Punjab 144603, India Abstract The world is rapidly changing and adopting automation systems in various fields. Home Automation is one of the fields that is working for improving the quality of life and performing house chores in an automated way using IoT. Many home automation systems have been proposed and developed by various researchers based on different hardware and software technologies. And, improvement is still in process to make these systems more economical and easy to access. This work has focused on developing a Home Automation System which can be accessed over the internet using software from anywhere and control various home appliances connected with a centralized Wi-Fi server. This IoT-based system has been designed using NodeMCU over a Wi-Fi network, that can control and monitor various home appliances and sensors. Programming is performed in Arduino IDE and Flask Framework is implied to connect with a server. This system would not only replace the conventional wall switches but also be helpful to save electricity and reduce cost with a web- based remote control application. Keywords 1 Home Automation System, IoT, Smart Device Control, NodeMCU, Flask 1. Introduction In the last few decades, Internet has played an immense role in the growth of various sectors related to human life such as education, business, entertainment, living standards, transportation, traveling, social life, etc. This high-scale development in different areas has developed an idea to connect multiple devices of the same or different fields with each other but, in a controlled way to form an Internet of Things (IoT) [1]. IoT can manage and monitor various electronic, electrical, and mechanical systems used for a specific purpose of automation in a field [2]. Data collected from all the devices connected over IoT is stored and processed by cloud computing, which further assists these networked devices to perform the tasks accordingly [3,4]. Figure 1 is showing an example of a Home Automation System, where various hardware and software components are connected and contributing to perform a specific task or objective. A Home Automation System is mainly comprised of three different technologies designed for a specific purpose such as communication medium between devices and controller, controller hardware or software to control the devices, and user interface to provide input and output of user [5]. This work has defined a similar type of automation system which is easy to access remotely using a web browser over a laptop or smartphone and can fully control the home devices. In summary, the proposed system makes the following contributions: International Conference on Emerging Technologies: AI, IoT, and CPS for Science & Technology Applications, September 06–07, 2021, NITTTR Chandigarh, India EMAIL: pardeep.maan@gmail.com (A. 1); gouravbathla@gmail.com (A. 2); rahulsinghcse25@gmail.com (A. 3); alankrita.agg@gmail.com(A. 4) ORCID: 0000-0002-0368-4757 (A. 1); 0000-0003-4198-9647(A. 2); 0000-0002-4996-5300(A. 3)0000-0002-0931-1118(A. 4) ©2021 Copyright for this paper by its authors. Use permitted under Creative Commons License Attribution 4.0 International (CC BY 4.0). CEUR Workshop Proceedings (CEUR-WS.org) 1. A microcontroller-based (NodeMCU) based home automation system is designed and implemented that can sync the data to a web server, display the current state of electrical devices and provide control to change the state according to the requirement. 2. A Control Program is defined using Arduino IDE and Flask API is created to connect with the server and transfer data from the microcontroller. 3. A web-based application is designed to provide GUI to users on the front end. Figure 1: Home Automation System Using NodeMCU 2. Related Work Researchers have been working on all automation technologies from 1970 and tried to upgrade them with each passing year. IoT comprised of three prime layers i.e. Application Layer, Transmission layer and Perception Layer, which are further divided into different sub-layers [6]. Technologies and protocols at these sub-layers are continuously in development e.g. for communication infrared, Bluetooth [7], Zigbee[8], GSM [9], Wi-fi, Wireless Sensors, etc. are used. Similarly, for controller different microcontrollers, home gateway, smart routers, PCB circuits, Arduino, Raspberry pi, etc. devices have been invented, and for user interface simple LED, PC, Laptop, Smartphones, Web Applications, Mobile Applications have been introduced. In this way, several combinations of these technologies have been experimented with achieving various objectives such as cost, latency, security[10,11], ease to handle, accessibility[12], authenticity [13], etc. Further, there are some latest research methodologies used in designing the automation system are defined. Table 1 Literature Review Summary Reference Communication Microcontroller GUI Merits Module [1,18] Wi-Fi Network Ardino UNO, Android Less costly than ESP8266-01 Application or conventional approach Web Application [14,17,19] Wifi Network, Node MCU IFTT, Android Voice based command Adafruit, MQTT Application, Web via Google Assistant Browser [15] Gateway, MQTT ESP8266 Wi-Fi Android Less expensive module, Atmel Application ATmega [16] Local Wi-Fi Raspberry Pi HTTP web Low Cost, Affordable for Network, JSON file interface, Android low-income houses Application [17] Wi-Fi Network NodeMCU IFTT, Android Voice based command Application via Google Assistant [20] Wi-Fi Network ESP8266, Android Multiple Raspberry Pi Application, Web homesAutomations Application indoor and outdoor, Google Assistant 3. Proposed Work This work has analyzed the working of a NodeMCU ESP8266 microcontroller-based home automation system that can be controlled through a browser over the same network or internet to activate or deactivate devices based on sensor readings or directly. For this purpose, aHttpClient module has been programmed over NodeMCU using Arduino IDE. This module will receive the data of different devices and accordingly respond back to perform the tasks over the devices connected through a controller. Figure 2 is representing the flowchart for controlling devices over the designed system which starts with making a connection to the browser through HTTP protocol. NodeMCU continually monitors the device sensors connected wirelessly and transfers the measurement data over the server or cloud at regular intervals. Servers are responsible for executing the command/response based on the data received and activate the respective actuator or device to perform the task. A Sensor’s data is analyzed by the program and checked against the respective threshold value. The responding signal to the respective device is activated only after the threshold is attained. Figure 3 is representing the I/O Pins of NodeMCU and its connectivity with two relay devices. In the example shown in the figure, relay devices are connected with pin D13 and D15, from which they received the signals to ON or OFF. The system is using the circuit connections similar to this for the proposed system where relay devices are connected with some appliances to control them. Figure 2: Flowchart for Proposed Home Automation System Figure 3: Circuit diagram for connecting NodeMCU with devices 4. Implementation and Results Proposed Home Automation System is implemented by making a connection of the NodeMCU ESP8266 wifi module with two relays on D13 and D15 pin. The controller is connected via USB to the laptop for programming over the Flask framework. The flask is helpful in making connectivity using Python Programming. Following are the steps that need to be processed in programming: 1. Make all the hardware connections using a breadboard, jumper wires, and voltage input. 2. Open the Arduino IDE and set up the driver for connected hardware. 3. Import the required library modules ESP8266WiFi.h and ESP8266HTTPClient.h. 4. Setup Wi-Fi network authentication and Wi-Fi server’s port number. 5. Map the General Purpose Input Output (GPIO) pins with microcontroller. 6. Wait till the Wi-Fi connection is not connected. 7. Start the server and obtain the IP address. 8. Create a HTTP Client and initialize HTTP request parameters containing sensor’s data and send to web server’s URL. 9. If the parameters are successfully received by the server, prepare the responding parameters in the HTTP response and send it back. 10. Create the Flask API using Python and Flask Framework. 11. Flask API is responsible for receiving and transmitting data to the browser. Figure 4: Output Screen showing successfully connected server and device Figure 4 is showing the console output generated by the Flask framework and it is showing the effective connection with the HTTP server and generated response. Figure 5 is showing the screenshot of a web application designed to retrieve and control the status of home appliances. Figure 5: Web Application (GUI) to control devices remotely 5. Conclusion and Future Work The work has put forwarded the design and implementation of a Wireless Home Automation System. Comparing to other automation systems, the proposed design has reduced the latency in the system and cost of implementation. Moreover, the system provides the freedom to control the devices over browser from anywhere in the world. The web application to control the home appliances and reading sensors’ data can be further connected to any database server to store this data for future analysis. So, the work can be extended to include machine learning-based decision-maker servers that can predict the emergency and take timely actions. 6. References [1] Satapathy, Lalit Mohan, Samir Kumar Bastia, and Nihar Mohanty. "Arduino based home automation using Internet of things (IoT)." International Journal of Pure and Applied Mathematics 118.17 (2018): 769-778. [2] Atzori, Luigi, Antonio Iera, and Giacomo Morabito. "The internet of things: A survey." Computer networks 54.15 (2010): 2787-2805. [3] Dey, Shopan, Ayon Roy, and Sandip Das. Home automation using Internet of Thing. In 2016 IEEE 7th Annual Ubiquitous Computing, Electronics & Mobile Communication Conference (UEMCON), IEEE, 2016, pp. 1-6.. [4] Reddy, Vishwateja Mudiam, Naresh Vinay, Tapan Pokharna, and Shashank Shiva Kumar Jha. Internet of Things enabled smart switch. In 2016 Thirteenth International Conference on Wireless and Optical Communications Networks (WOCN), IEEE, 2016, pp. 1-4. [5] Shet, G. Building IoT based Door sensor from NodeMCU or ESP8266, 2021. URL: https://www.linkedin.com/pulse/building-iot-based-door-sensor-from-nodemcu-esp8266- gurudas-shet/ [6] Gupta, Brij B., and Megha Quamara. "An overview of Internet of Things (IoT): Architectural aspects, challenges, and protocols." Concurrency and Computation: Practice and Experience 32, no. 21 (2020): e4946. https://doi.org/10.1002/cpe.4946 [7] Ngerem, Elvis, Sanjay Misra, Jonathan Oluranti, Hernán Castillo-Beltran, Ravin Ahuja, and Robertas Damasevicius. "A Home Automation System Based on Bluetooth Technology Using an Android Smartphone." In Evolving Technologies for Computing, Communication and Smart World, Springer, Singapore, 2021, pp. 527-536 [8] Gill, Khusvinder, et al. "A zigbee-based home automation system." IEEE Transactions on consumer Electronics 55.2 (2009): 422-430. [9] Anandhavalli, D., Noorul S. Mubina, and P. Bharathi. "Smart home automation control using Bluetooth and GSM." International Journal of Informative and Futuristic Research 2.8 (2015). [10] Tewari, Aakanksha, and Brij B. Gupta. "Security, privacy and trust of different layers in Internet- of-Things (IoTs) framework." Future generation computer systems 108 (2020): 909-920. [11] Tewari, Aakanksha, and Brij B. Gupta. "Secure Timestamp-Based Mutual Authentication Protocol for IoT Devices Using RFID Tags." International Journal on Semantic Web and Information Systems (IJSWIS) 16, no. 3 (2020): 20-34. [12] Sejdiu, Besmir, Florije Ismaili, and Lule Ahmedi. "Integration of Semantics Into Sensor Data for the IoT: A Systematic Literature Review." International Journal on Semantic Web and Information Systems (IJSWIS) 16, no. 4 (2020): 1-25. [13] Salhi, Dhai Eddine, Abelkamel Tari, and Mohand Tahar Kechadi. "Using Clustering for Forensics Analysis on Internet of Things." International Journal of Software Science and Computational Intelligence (IJSSCI) 13, no. 1 (2021): 56-71. [14] Vishwakarma, Satyendra K., Prashant Upadhyaya, Babita Kumari, and Arun Kumar Mishra. Smart energy efficient home automation system using iot. In 2019 4th international conference on internet of things: Smart innovation and usages (IoT-SIU), IEEE, 2019, pp. 1-4. [15] Vikram, N., K. S. Harish, M. S. Nihaal, Raksha Umesh, and Shetty Aashik Ashok Kumar. A low cost home automation system using Wi-Fi based wireless sensor network incorporating Internet of Things (IoT). In 2017 IEEE 7th International Advance Computing Conference (IACC), IEEE, 2017, pp. 174-178. [16] Ashraf, Imran, Muhammad Umer, Rizwan Majeed, Arif Mehmood, Waqar Aslam, Muhammad Naveed Yasir, and Gyu Sang Choi. "Home automation using general purpose household electric appliances with Raspberry Pi and commercial smartphone." Plos one 15.9 (2020): e0238480. [17] Jabbar, Waheb A., Tee Kok Kian, Roshahliza M. Ramli, Siti Nabila Zubir, Nurthaqifah SM Zamrizaman, Mohammed Balfaqih, Vladimir Shepelev, and Soltan Alharbi. "Design and fabrication of smart home with Internet of Things enabled automation system." IEEE Access 7 (2019): 144059-144074. [18] Mahamud, Md Sadad, Md Saniat Rahman Zishan, Syed Ishmam Ahmad, Ahmed Rezaur Rahman, Mehedi Hasan, and Md Lutfur Rahman. "Domicile-an IoT based smart home automation system." In 2019 International Conference on Robotics, Electrical and Signal Processing Techniques (ICREST), IEEE, 2019, pp. 493-497. [19] Kodali, Ravi Kishore, Sasweth C. Rajanarayanan, Lakshmi Boppana, Samradh Sharma, and Ankit Kumar. "Low cost smart home automation system using smart phone." In 2019 IEEE R10 Humanitarian Technology Conference (R10-HTC)(47129), IEEE, 2019, pp. 120-125.. [20] Stolojescu-Crisan, Cristina, Calin Crisan, and Bogdan-Petru Butunoi. "An IoT-Based Smart Home Automation System." Sensors 21, no. 11 (2021): 3784.