An IoT based Approach for Efficient Home Automation with ThingSpeak

With passage of time, technology is rapidly growing. People and daily life processes are highly dependent on internet. The Internet of Things (IoT) is an area of magnificent impact, growth and potential with the advent and rapid growth of smart homes, smart agriculture, smart cities and smart everything. Internet of Things (IoT) construct an environment in which everything is integrated and digitalized. People depend on smart phones and want to do their daily routine tasks in easy and quick way. Ordinary homes consist of multiple digital appliances that are controlled or managed by individual remote systems. It’s very hectic to use multiple individual remotes to control various component of homes. In current technological era, rather than home appliances, almost all type of home components available in digital forms. Various home automation systems with different specifications and implementations were proposed in literature. This research objective is to introduce an IoT based approach for efficient home automation system using Arduino and ThingSpeak. We have automated almost all essential aspects of smart home. Proposed system is efficient in terms of low power consumption, green building and increases the life of digital appliances. ThingSpeak cloud platform is used to integrate the home components; analyze and process the data. State of the art MQTT protocol is implemented for LAN communication. This paper will provide a path to IoT developers and researchers to sense, digitalize and control the homes in perspective of future IoT. Moreover, this work is serving as an instance of how life will be easier with the help of IOT applications. Keywords—Internet of Things (IoT); home automation; Arduino; ThingSpeak; sensors; cloud computing; mobile computing


I. INTRODUCTION
In current era, technology bring people and things towards adoption of internet. Life dependability on internet is massively increasing. The Internet of Things (IoT) became a domain of high potential, impact and learning [1]. Living cost is increasing day by day. The concentration of researchers is to implicate machinery to reduce this cost of living. IoT brings revolution by automation in agriculture [2], [3], sports [4], health [5], power management [6], industry [7] and assembly modeling [8], [9]. On the other hand, the increase demand of services also requires the data storage and exchange in wellorganized way over the internet. IoT improvement has progressed commonly over the most recent couple of years since it has added another estimation to the universe of correspondence and data movements [10]. IoT has done tremendous achievement and everything is going to be more smart and intelligent in next few years so ordinary home system will also move to the platform of IoT [11]. By keeping in mind, the home automation system will allow the users to maintain and build the house that keep power consumption low as well as providing more control over electronic devices [12]. Automated homes will get the benefits of implemented devices and give permission to control it, either user is present or far away [13]. A green building is one that is capable to change according to the environment. It efficiently controls the available resources of building throughout the life cycle from location to design, development and ready to use to, maintenance, redesign to devastation [14]. In closed scope, smart buildings can be considered green buildings because they pursue the same goals as at home. Green building must be economical, ease to use, durable, maintainable and comfortable by requirements [15]. That is why it just not demands a close cooperation between design teams, engineers, architects throughout the project but flexible integration and communication of all home appliances and components. Home automation systems provide comforts for handicap people to use every device without moving. The internet of things has promised to offer the effective way to store and interchange data by connecting high speed networks [16] and electronic sensors with physical devices [17]. The IoT has created the revolution throughout the world and remarkably it has become integral part of life [18]. Home Automation uses several control frameworks to control home machines and tools. With the help of automation in homes, users have more control over homes. NodeMCU, Arduino and other microcontroller are used to make it easy to control home appliances. Multiple sensors like gas sensor, flex sensor, water sensor, temperature sensor, soil moisture sensor, etc. are integrated over microcontrollers to perform specific functionalities [19]. The changing status of sensors will show the real time utilization or variation of system. Appliances status could be seen over cloud platform. Different engineering challenges like Wi-Fi, TCP/IP [20], legacy systems, security and privacy concerns of IoT [21] will be explored before implementation of any IoT based system. This home automation system will provide great insight of embedded systems. Fig. 1 shows the concept of home automation system that how multiple appliances will be connected and controlled. The concept of connecting and monitoring the real home appliances with the help of IoT is discussed in this research paper. This article is divided in to five sections. Section II extensively reviews the literature to read the available implementation of home automation systems and IoT concerns related to automation of homes. Section II also shows the need of this work by highlighting the motivation considered use cases. Section III provides detailed understanding with proposed system design what type of hardware devices, software tools, cloud and networking infrastructure needed to develop this system. Moreover, this section also elaborates experimental setup and environment. Section IV discusses the results with the help of diagrams and charts. Finally, Section V concludes the research by highlighting the contribution and briefs the future direction.

II. LITERATUER REVIEW
Various home automation systems were proposed in literature with different specifications and functionality. [22] proposed a home automation by implementing zigbee with Arduino to control the home appliances. This system controls small home appliances by using various till date technological sensors. Users are able to check the status of their home appliances using web server. A web application is designed to control and manage the system. Paper proposed by [23] shows how intelligent home automation is operated and controlled. In this paper the intelligent home automation system with low cost is presented by implementing Arduino UNO microcontroller. There are two main modules that are software communication module and hardware interface module. Arduino UNO microcontroller is used which works as micro web servers and interface of hardware modules and different sensors also used to sense the environment. [24] developed a home portal structure for interconnecting home components with IEEE 1394 AV framework and X10 control line interface with Internet. This gave remote access limits from Web for cutting edge AV mechanical components like Digital Video Camera, Digital VCR related with IEEE 1394 framework and home machines like TV, work zone light, electric fan related with X10 controller. A Java based home automation structure by using World Wide Web [25]. The home devices were controlled from ports of embedded structure board related with PC based server at home. Author in [26], in 2005 proposed Internet based remote control system where home digital devices are related with slave center point. The slave center points talk with expert center point through RF and pro center has successive RS232 interface with PC server. The center points rely upon PIC 16F877μc. This system is controlled by web page application. Author in [27] proposed a framework for controlling home electrical components over the Internet by using Bluetooth remote advancement to give an association from the machine to the Internet and Wireless Application Protocol (WAP) to give a data interface between the Internet and a phone. Another implementation of smart home is proposed by [28] using Arduino mega, Relay, RF module, WIFI module, cloud and mobile application. They are controlling fan and lights by sensing the environmental factors and manually by user. Another energy optimized home automation is proposed by [29] to minimize the energy use in resource limited environment. This system is based upon different digital devices like Multiband antenna, HVAC, Thermal Management, Energy efficient sensors. Energy optimization is elaborated by using different charts and graphs.
Multiple systems for home automation were developed and implemented in literature with different scope from complex to simple systems. A system controlling simple devices like fan or light is known as simple home automation while the system controlling heavy devices like automatic intelligent doors is known as complex system. In many current available systems, mostly fail to cover the basic functionality of home automation. Most of the systems do not provide user friendly environment to control the homes. Appropriate cloud selection is another perspective for secure and real time monitoring even the user is outside from home. So there is a need of an efficient home automation system that deals with above raised concerns in current high-tech era. Here, we are proposing an IoT based home automation system using Arduino with ThingSpeak that address the upraised issues. All other specification of this system, hardware, software or tools, networking architecture, cloud selection, mobile application are elaborated in next section. At initial level, this system implements following seven use cases. The proposed solution is not just cost effective but also it's easy and reliable when it comes in the terms of implementation and programming. All the hardware is integrated over microcontroller. Other sensors and devices sends data to microcontroller. These all devices and sensors used in this system helped in monitoring and controlling home appliances. This system will provide the real time feedback as user will be able to check what is happening at home.

III. SYSTEM DESIGN
The proposed system has low cost and efficient monitoring by utilizing IoT based devices. Different modules are used with Arduino UNO microcontroller. The home automation system is offering the features like monitoring the temperature, humidity, fire, gas and water level in tank. It similarly provides the switching functionalities that directs different kind of home appliances and linked with the system used for automation. It is essential need of today's era to improve our life condition. It provides advanced way of life by controlling doors, windows and curtains according to environmental parameters, all home appliances from turning on/off lights, fans to power supply and automatically water tank filling. ThingSpeak cloud is used to provide real time monitoring and controlling. Arduino can perceive surroundings with the help of input signals of different sensors and acts towards surroundings via actuators. Fig. 2 illustrates the working scenario of proposed system. Sensors collect data from home appliances and pass to microcontroller board that directs data to ThingSpeak. A real time notifications and status of different devices shown to user via mobile application. User can easily command and manage the home even from outside the home.

A. Hardware Requirements
Following hardware devices and sensors are used to build the proposed system: . It works as a control board and contains different set of pins for connecting other boards or devices with Arduino. Board contain 6 analog and 14 digital pins and programmed by using Arduino integrated development environment. Inbuilt WIFI facility is available on board for connecting with internet. In our system, all the sensors are integrated over Arduino that sense the data. Arduino transfer the data over ThingSpeak that offers realtime updates for user via mobile application or web interface. Fig. 4 illustrates the proposed design for Arduino microcontroller that integrates all sensors and other devices on board. As shown in figure, all sensors are directly connected with Arduino that sense the data and pass to Arduino board. The microcontroller collects data from sensors and transfers it to ThingSpeak cloud. Fans, lights and main power supply has high voltage so these devices are connected with a power relay board that control the voltages and pass only bearable voltage to Arduino for operations. Servomotor are connected with Arduino and doors/windows that managed by user to initiate the commands from mobile application. Slide retrofit curtain system is implemented with curtains and movement of curtains managed by user from mobile application. The main reason here to use the Arduino is that, it is low cost in term of price as well as computation and programming. The integration method of sensors and other devices over Arduino is explained further in sub headings. Fig. 5 is designed to control the positioning of specific devices. It is integrated with sensor to direct the actuator to precisely control the linear or angular position, acceleration and velocity [31]. It belongs to special class of motors that are used to build the closed loop control systems. It's widely used in automated systems, CNC systems and robotics. In our system, it is implemented on doors and windows to lock and control the movement through Arduino.

c) Stepper Motor:
Stepper motor is used to control curtain in automatic manner. It enables the automatic opening and closing of curtains according to specific times like morning or evening plus manual control is possible via mobile application. Servomotor can also be used for curtain control but it cannot move the curtains with exact torque. d) Light Dependent Resister (LDR): Fig. 6 shows the light depended register. LDR is often used in circuits where it's important to identify the existence of light level. In this research paper, we are using LDR to automate the light to control the switches and checking the present condition of appliances. Fig. 6. LDR. e) Power Relay Board: The most useful thing that can do with Arduino is to control voltage of appliances like light, fans, heaters, AC and others. Arduino operates at 5V and can't control voltage directly but can be done by using 5V relay to switch 120-240V. Some relays use electromagnet to operate automatically the switch nonetheless others use solid state relays. Fig. 7 shows he single channel 5 voltage relay board. Relays are used when it's necessary to detach low power signals. When certain event occur relays automatically turn on, for example when temperature gets higher than 25%. Other multiple sensors are integrated over Arduino to operate the system. ACS712 current sensor based upon hall effect principal is used to measure the both direct and alternative current. Magnetic sensor is used to determine the variance in magnetic fields of circuits. Flame sensor is integrated to detect the presence of fire or flame. The response of flame detector is fast and efficient rather than heat detector. Water level sensor is integrated over water tank to measure the level of water. After circuit level, it actuates signal to water motor for ON and OFF. DHT11 is a basic humidity sensor for efficient sensing. It is low cost and does efficient monitoring. It uses capacitive sensor to check out the environmental midair and releases advanced indication on information pin. Soil moisture sensor is used to check the soil parameters of current environment and generate real time results for decision making. Gas sensor is used to detect the presence of specific gases and their level in environment. It is used to check the gas leakage in house.

B. Tools and Protocols
Following Software and tools are used to build the proposed sy system, a) Arduino IDE: Arduino Integrated Development Environment (IDE) is used for functional sensor integration. Flame sensor attached with Arduino with 3 pin input interface and enabled with digitalRead() function that detect the presence of fire. Servomotor is connected with Arduino with 3 pins female connector via 3 jumper wires as shown in circuit diagram. Servomotor can rotate with 180 degree and we have set the rotation value in rotateLoop() user defined function according to our requirement. LDR is integrated with Arduino and analogRead() function is activated to read the current values of LDR sensor. Lights will manually or automatically operated based upon LDR sensor values even if a person is far away from home. Stepper motor is used to control the exact movement of curtains manually or automatically by setting time. motorLoop() function is implemented with conditional structure of time values and manual control. The input values of fan switches are controlled manually via mobile application trigger. The environmental parameters are recorded via environmental sensors like humidity, soil moisture and temperature sensor. Water level sensor is connected with Arduino and place in water tank. It will detect the level of water with analogRead() function and water pump will be started on specific value and off on specific value. Fig. 8 elaborates the circuit diagram of proposed prototype. It is used to show the actual integration of system that how multiple sensors and components are connected with back bone Arduino. Mostly sensors are operating on 5V so power relays are used to manage the voltage differences.

b) Wireless
Sensors Communication: Wireless communication of sensory data is required in IoT systems in effective and secure way [32]. Multiple Wireless Sensor Network protocols are available for data communication and transfer with different security features and other parameters. ThingSpeak communication API is used for sensory data communication. Data is transmitted over ThingSpeak channel in private or public manner. ThingSpeak communication API is based upon REST and MQTT protocol. Typically, the read and write operating time span is 15 seconds. c) Ionic Framework: Ionic framework is Cordova and AngularJS based cross platform mobile application development tool [33]. It provides easy cloud integration by implementing cloud APIs. Ionic have many distinguished features like cross platform, JS Components, Angular, Secure, Cordova, Ionic CLI, Elegant Designs, Native Experience, High Performance, Web Components, Interactive Paradigm, Automated Builds, Splash Screens, etc. d) MATLAB: MATLAB is multipurpose computing integrated development environment with hundreds of scientific libraries. It has various distinguished features of data visualization, plotting functions and comparative graphs. ThingSpeak provides built-in feature of MATLAB for data visualization [34]. MALTAB is used by more than 3 billion users with numerous background of economics, statistics, science and engineering. We have used MATLAB for data analytics and triggers are activated against analyzed data.

C. ThingSpeak
ThingSpeak is cloud platform specifically designed for IoT analytic services with wide range of data visualization options. It supports live stream data visualization. MATLAB is integrated with it that makes it highly recommended for IoT systems [35]. It provides easy configuration with channel analytics. It collects the sensed data from IoT systems, preprocess and analyze the data and trigger a reaction according to set instructions. MATLAB helps to build predictive triggers and models to automatically react in certain scenarios. Fig. 9 shows the simulated model of proposed home automation. At initial stage, kitchen and one room is automated along with main door. Gas sensor and Flame Sensor is integrated in kitchen at appropriate location. Water tank is also place in kitchen with water level sensor. Environmental sensors are integrated both in kitchen and room. Stepper motor is only integrated with room curtains and servo motor is fixed at main door. All the sensors and appliances are attached with main Arduino and real time sensed data is transferred over ThingSpeak. Data processing and analytics are performed on cloud and actions are activated as a triggers from mobile application. 122 | P a g e www.ijacsa.thesai.org Fig. 10 shows the implementation of proposed approach. As discussed earlier and elaborated in circuit diagram, all the sensors are integrated with Arduino. The sensed data is transferred over ThingSpeak. Mobile application fetches the real time statistics from cloud. All the triggers are imitated from mobile application. Triggers refer to manual control of lights, fans, curtains and door. Fig. 11 shows the dashboard of custom designed mobile application for home automation. The first activity of mobile app authenticates the user via channel id and password. Main dashboard activity is appeared after validation of the credentials. Dashboard shows the real time statistics from ThingSpeak. The current status of all appliances and sensors are visible via mobile application. User can manually operate any appliance via mobile application. Furthermore, user will be able to check the current environmental factors of home even if away from home. Main door, room curtains, lights and fans can be operated via mobile application. Water tank option show the current level of water in the tank. Fire alarm is activated if flame sensor detects high intensity flame within range.    12 shows the fan control option of proposed home automation system. The fan control option of dashboard leads to this activity. Initially the digital fans of living room and kitchen is automated. Digital fan supports multiple speed levels. User can easily on/off or set speed at multiple levels. Same as light, curtain and door is manually controlled by user.

IV. RESULTS AND DISCUSSION
The graph in Fig. 13 illustrates the profile of environmental factors. Environmental factors include temperature and relative humidity. In graph, x-axis shows the time slots while the y-axis shows temperature and humidity values. Graph shows the comparative temperature and humidity of kitchen and living room. This profile of temperature and humidity is taken form ThingSpeak.  This paper provides a state of the art method of home automation with ThingSpeak platform. ThingSpeak provides improved security, data management and data visualization. Wiring and switching cost is reduced by utilizing wireless networks. Power consumption also condensed inside the building when loads condition is off. The sensed data is analyzed at cloud and real time statistics provided via mobile application. A prototype is implemented to elaborate the performance and functionality of proposed approach. Fans, lights, curtains and door are automated. Home appliances can be easily controlled via mobile application. Furthermore, the proposed system provides the real time statistics of environmental factors.
In future, we will improve this system by reducing delay time, adding speech recognition, system automation by history learning and by security features. Furthermore, biosensors will be integrated within home to monitor and control air for better health.