Home Automation Using Chatbot and Voice Assistant

. In a world with ever increasing needs for comfort, human race is relying more and more on technological advancements to ﬁnd solutions to their problems. Home Automation Systems have become a go-to arena in the recent years. In the following paper, we propose a Home Automation system that uses a wholesome blending of some technologies like Internet of Things, Natural Language Processing and Machine Learning. The prime feature of this system is that, it provides two modes of communication to the user : Text and Voice. The text input from the user will be given via a Chatbot Application and the voice input from the user will be given via a voice assistant. The input will undergo Natural Language Processing to ﬁnd the action that the user wants the system to perform. The IoT component, Raspberry Pi would perform the actuations in the form of switching On or O ﬀ of Lights and Fans of a room in the house.


Introduction
We live in a rapidly evolving environment. With advancement in technology fields, humans needs w. r. t. to efficiency and comfort are reaching a new high every day. People are leaving behind the conventional methods of operation and opting for Smart solutions, not only in industrial zones but also for the domestic environment.
Home Automation seems like a perfect solution for the current scenario where we want every small task to happen with a click of a button. The need for a centralized system which could remotely monitor home appliances is arising with the increase in the working population of nations. We have to consciously take efforts to move towards a sustainable future where technology meets the need to make use of resources, sustainably. Our project is a small attempt towards an affordable and efficient home automation system which specifically focuses on the switching on and off of electrical appliances like fans and lights of a house.
Home Automation with Chatbot Application and Voice Assistance -Our project intends to allow users to control electric home appliances, over internet using Internet of Things ( IoT ), thus increasing the efficiency and ease of use. We intend to make efficient use of Internet of Things (IoT) to provide a congruent zone for a two way conversation between the user and the system.
The proposed system will take input query from the user in the form of : * e-mail: bhavyakadali21@gmail.com * * e-mail: nehaprasad2912@gmail.com * * * e-mail: pran12698@gmail.com * * * * e-mail: mmdeshpande@acpce.ac.in • Text ( via the Chatbot Application ) The input will be processed in the IoT component ( Raspberry Pi ) leading to actuation based on the decision formulated. The Proposed system will give outputs to the user after actuating as per the processed query, in the form of text message or voice reply. The user will be given the flexibility of using the Chatbot Application for controlling the appliances ( fans and lights ) remotely, and/or to use a voice command when in vicinity.

Literature Review
Home Automation systems have been implemented earlier using different technologies like GSM, Bluetooth and Internet. Having a higher rate of power consumption, Bluetooth based system requires each component to have a Bluetooth adapter for communication, but its limitation lies in the minimum range of 100 meters. GSM based system involves transducers to take inputs ( mostly physical quantities ) via sensors and convert them into understandable commands using microcontrollers. But DTMF processing, one of the communication method used in GSM based system is susceptible to fuzzing attacks. Using a Internet based system via a Web browser opens up the possibilities of numerous browser based security issues. [1] A Chatbot is an artificial intelligence (AI) software that can simulate a conversation (or a chat) with a user in natural language through messaging applications, websites, mobile apps or through the telephone. Ideal chatbots are expected to understand context of a conversation, learn from the conversations and improve themselves over time. This can be achieved through various machine learning and deep learning techniques. Chatbots provide a medium to remotely access the Automation system while giving the end user a visual interface to maintain ease of use. This technology is experiencing an exponential growth since it is also inclusive of multi-language support. [2] Voice assistants react to voice commands and give the user relevant information about his/her inquiry. Voice assistants use natural language processing (NLP) to match user voice input to executable commands.Use of both, Chatbot Application and Voice Assistant reduces single input dependency to a considerable extent. The entire framework can be extended further, in future to reach out to the needs of the differently abled section of the society. [3] Natural Language Processing is the processing of natural language in order to derive meaning from it. In the proposed system, some basic techniques of Natural Language Processing like tokenization, removal of stop-words and lemmatization are used.

Proposed system 3.1 Architecture
The following architecture diagram shows the integrated working of all the modules in the Home Automation System : Chatbot module, Voice assistant module, Speech Recognition which is inclusive in the former module, and the NLP module. The Chatbot module provides input in Figure 1: Architecture of the proposed system textual format whereas the Voice Assistant module will provide the input as a voice command. These inputs will be sent to the Internet of Things ( IoT ) component, Raspberry Pi. The entire processing of the acquired input happens in this unit. The Raspberry Pi unit contains Natural Language Processing ( NLP ) unit. This unit is responsible for processing the textual input to find the intent. The speech input from the Voice Assistant module will undergo speech-to-text processing, hence providing a text input to the NLP module.
Inside the NLP module, the intent generated acts as the deciding factor for defining the actuations based on the rules and/or constraints defined. The NLP module leads two processes simultaneously : • Actuation based on evaluation of input.
• The output response generated for the user The output signals regarding the actions that need to be performed on the electronic devices are sent to them through the relays.

Software requirements
• Python NLTK library : Natural Language Toolkit is a free and open source platform for building Python programs to work with human language data. It provides easy-to-use interfaces along with a suite of text processing libraries for classification, tokenization, stemming, tagging, parsing, and semantic reasoning and wrappers for industrial-strength NLP libraries. [2] • Python Pyaudio library : PyAudio provides Python bindings for PortAudio, the cross-platform audio I/O library. PyAudio uses Python to play and record audio on a variety of platforms.
• Python GPIO library : Used to control General Purpose Input Output devices using Python.
• Raspbian OS : Raspbian is a free operating system based on Debian, optimised for the Raspberry Pi hardware.
• Telegram Bot API : The Bot API is an HTTPbased interface created for developers to build bots for Telegram.[3]

Figure 2: Flow Chart of the system
Step1 : Setup and Installation of Raspberry Pi. This is followed by installing some necessary tools and libraries : Telepot required to build application for Telegram Bot API for to and fro of messages. NLTK (Natural Language Tool Kit) is a suite of libraries required for natural language processing. The working of Voice Assistant makes use of Speech Recognition, pyttsx/gTTS. Some of the machine learning techniques used require the installation of Scikit Learn.

• Speech Recognition
• NLTK • scikit-learn • pyttsx/gTTs Step 2 : Implementation of a chatbot using Telegram server to control the home appliances via GUI( custom keyboard) and/or sending a sentential input.
Step 3 : Implementation of a voice recognition module to accept voice input via microphone. Convert this speech input to textual format via Speech recognition module which will undergo NLP processing to find intent. Output generated as a response to the input query will be converted from text to speech using pyttsx/gTTs.
Step 4 : Input from the user undergoes NLP processing as shown in figure 3 .
Step 5 : Establishing connections between Raspberry Pi and home appliances.

Result and Analysis
The testing and result analysis includes the following Three interfaces : • Chatbot Interface • Terminal Interface ( for Voice Assistant ) • Working Model Interface The system is currently customized for three rooms : Living Room, Kitchen, Bedroom.
Each of the aforementioned rooms have four appliances each, namely : Fan, LED, Bulb, TubeLight.
As far as the model is concerned, it uses LEDs to represent all the appliances hence, providing the visuals for Switching On and Off actions.
The following images show the Switching On of LED in Bedroom using Chatbot.
The initial state of all appliances is considered to be Switched Off.

Conclusion and Future Work
This project is a small attempt at delivering an efficient but affordable Home Automation System with a flexibility to acquire input through two means alternatively, text and speech. This will contribute in removing the dependency on either forms of input i.e speech and text.
The system can be further made inclusive of extensions such as attaching of email services as an alternate form of message delivery, in situations of utmost importance. The number of devices that can be connected to the system can be expanded to a larger range. The proposed system is based on the inputs in English language, which could further be expanded to accommodate several other regional languages as well.
This would also prove to be a small step in consideration of ease in access of modern technology for the differently abled section of the society as well.