You are on page 1of 12

Applying Automated Chatbots to Internet of

Things

Yashaswi Pasbola Pankaj Kumar


Btech – CSE Btech – CSE Btech – CSE

Abstract INTRODUCTION
Artificial intelligence is the best solution to
manage huge data flows and storage in the IoT 1.Objective :-
network. Artificial Intelligence is still considered
the best solution to the data mining, manages Internet of Things (IOT) is of the latest or
and controls the congestion in the network. The upcoming trend of today’s generation. It involves
aim of this paper is to present the application of the use of interconnected smart objects or
artificial intelligence system in the IoT. The ‘things’ developed upon existing internet
importance of data mining and management will
architectures . By using standard communication
be highlighted in the paper. The self-optimizing
protocols, IOT interconnects these things or
network and software defined network are parts
of the important parameters in the Artificial objects thereby creating a varied range of
Intelligence IoT System technologies that are able to interact with each
other.

The Internet of things (IoT) is the network of


devices, vehicles, and home appliances that contains
electronics, software, actuators,
and connectivity which allows these things to
connect, interact and exchange data.
IoT involves extending internet connectivity beyond
standard devices , such
as desktops, laptops, smartphones and tablets, to any
non-internet-enabled physical devices and everyday
objects.

Building or home automation, social smart


communication for enhancement of quality of
life, that could be considered as one of the
application of IoT where the sensors, actuators
and controllers can be connected to internet and There has been a trend in home automation. The
controlled.
current trend of research is based on Applying
Keywords – Internet of Things, Human-
computer interaction , conversational user Automated Chatbot to IOT. Several variants of
interfaces, software agents. these algorithms have been developed. The
current research is to study and develop
algorithms that are used for turning the light microcontroller. The main purpose of this prototype is to
save electricity. The prototype only uses temperature
on/off through chatbot.
and infrared sensors. The temperature sensor is used
to regulate the air conditioning and infrared sensors to
Chatbots are being made to ease the pain that the detect human presence in the room. The
industries are facing today. The purpose of chat microcontroller will decide whether the air conditioner
and the lights should be on or off based on the sensor
bots is to support and scale business teams in their readings. The estimated the cost of electricity usage will
relations with customers. It could live in any major be recorded into a database that can be accessed by
the user.
chat applications like Facebook Messenger, Slack,
Yasirli Amri and Mukhammad Andri Setiawan in their
Telegram, Text Messages, etc.
research paper “Improving Smart Home
Chatbots may sound like a futuristic notion, but Concept with the Internet of Things
Concept Using RaspberryPi and
according to Global Web Index statistics, it is said
NodeMCU“ proposes an IoT based Smart home
that 75% of internet users are adopting one or more system which is not only limited to the automation of the
messenger platforms appliances but it also provides monitoring and security
features. The system monitoring features monitors the
In an IoT environment, chatbots can function as an power consumption of each electronic appliance and
gives its individual cost of electricity. The security
interface to make sense of all the data and also make
feature is to prevent burglars and thieves from entering
it more accessible. the house. If any unauthorized person do enters the
house, the system is designed so as to immediately
report this to the home owner.
Facebook Messenger’s chatbot SDK provides From all these researches we can see that all those
companies a platform where they can integrate their systems which were designed in the past utilized many
hardware components and their circuit designs were
own service within the accessibility of the
complex. In this paper we propose a simple IoT based
Messenger app. home automation system which will utilize only one
hardware component i.e a NodeMCU ESP8266
development board and the internet. We are also using
Literature Review a facebook messenger bot which will take up the
requests from user in form of chat messages and will
Home automation system is a topic which is most direct it to to the NodeMCU board via internet. The
desired by people so it is taken up by many researchers NodeMCU board is connected to internet through the
in the past. Rajiv Pyare and Seong Ro Lee in their WiFi network of the home.
paper “Smart Home Control and
Monitoring System” proposed a smart home
control system which uses micro web server and
smartphones. Micro web-server installed on arduino
used to transmit data from the sensor to smartphone
user and then the user can send commands to arduino
to control electronic devices.
R. Panna, R. Thesrumluk and C. Chantrapornchai in
their research developed the “Development of
Energy Saving Smart Home
Prototype”. This research discusses the building of
a smart home prototype using PIC18F458
Here is how PHP or ASP handles a file request:
TECHNOLOGIES USED
i. Sends the task to the computer's file
system.
2. NODE . JS ii. Waits while the file system opens and
reads the file.
Node.js is an open-source, cross- iii. Returns the content to the client.
platform JavaScript run-time environment that iv. Ready to handle the next request.

executes JavaScript code outside of a browser. Here is how Node.js handles a file request:
Typically, JavaScript is used primarily for client-
i. Sends the task to the computer's file
side scripting, in which scripts written in JavaScript system.
are embedded in a webpage's HTML and run ii. Ready to handle the next request.
iii. When the file system has opened and read
client-side by a JavaScript engine in the user's web the file, the server returns the content to
the client.
browser. Node.js lets developers use JavaScript to
write Command Line tools and for server-side Node.js eliminates the waiting, and simply
continues with the next request.
scripting—running scripts server-side to
produce dynamic web page content before the Node.js runs single-threaded, non-intenting,
asynchronously programming, which is very
page is sent to the user's web browser. memory efficient.

Though .js is the conventional filename 2.1.1 What Can Node.js


extension for JavaScript code, the name "Node.js" Do?
does not refer to a particular file in this context
and is merely the name of the product.  Node.js can generate dynamic page
content
 Node.js is an open source server
environment  Node.js can create, open, read, write,
 Node.js is free delete, and close files on the server
 Node.js runs on various platforms
(Windows, Linux, UNIX, Mac OS X, etc.)  Node.js can collect form data
 Node.js uses JavaScript on the server  Node.js can add, delete, modify data in
your database

2.1.2 What is a Node.js


File?

 Node.js files contain tasks that will be


executed on certain events
 A typical event is someone trying to access
2.1 Why Node.js?
a port on the server
A common task for a web server can be to open a
 Node.js files must be initiated on the server
file on the server and return the content to the
client. before having any effect
 Node.js files have extension ".js" SDK's contain voice recognition, natural language
understanding, and text-to-speech. Api.ai offers a
3. GIT web interface to build and test conversation
Git was created by Linus Torvalds in 2005 for scenarios. Api.ai allows Internet of Things
development of the Linux kernel, with other kernel developers to include natural language voice
developers contributing to its initial interfaces in their products.
development.[12] Its current maintainer since 2005 Google bought the company in September 2016
is Junio Hamano. and was initially known as API.AI; it provides tools
As with most other distributed version-control to developers building apps ("Actions") for
systems, and unlike most client–server systems, the Google Assistant virtual assistant. It was
every Git directory on every computer is a full- renamed on 10 October 2017 as Dialogflow. The
fledged repository with complete history and full organization discontinued the Assistant app on
version-tracking abilities, independent of network December 15, 2016.
access or a central server.

5. CloudMQTT
MQTT (Message Queuing Telemetry Transport) is
an ISO standard (ISO/IEC PRF 20922) publish-
subscribe-based messaging protocol. It works on
4. Dialogflow top of the TCP/IP protocol. It is designed for

Dialogflow (formerly Api.ai, Speaktoit) is a connections with remote locations where a "small

Google-owned developer of human–computer code footprint" is required or the network

interaction technologies based on natural bandwidth is limited. The publish-subscribe

language conversations. The company is best messaging pattern requires a message broker.

known for creating the Assistant (by Speaktoit), a


virtual buddy for Android, iOS, and Windows
5.1 Message types
Phone Smartphone that performs tasks and  Connect
answers users' question in a natural language. Waits for a connection to be established with the
server and creates a link between the nodes.
In September 2014, Speaktoit released api.ai (the
 Disconnect
voice-enabling engine that powers Assistant) to
Waits for the MQTT client to finish any work it
third-party developers, allowing the addition of must do, and for the TCP/IP session to disconnect.
voice interfaces to apps based
on Android, iOS, HTML5 and Cordova. The
 Publish 1. ESP8266 NodeMCU Wi-Fi development
Returns immediately to the application thread after board manufactured by Amica.
passing the request to the MQTT client.

5.2 Heroku Platform


Heroku is a cloud platform based on a managed
container system, with integrated data services
and a powerful ecosystem, for deploying and
running modern apps. The Heroku developer
Figure 1 ESP 8266 NodeMCU board
experience is an app-centric approach for
software delivery, integrated with today’s most
popular developer tools and workflows.

2. USB Micro cable to program ESP8266


12e from a laptop or PC. Most Android
phones use this type of cable.

COMPONENTS USED

Figure 2: USB Micro Cable


IMPLEMENTATION 2. Architecture of Project

1. DATA FLOW DIAGRAM

LEVEL 0 :

Flow Diagram level 0

LEVEL 1: Complete Architecture

The proposed system is developed with Facebook


messenger and NodeMCU ESP8266 development
board. The complete home automation system
architecture is divided in 3 separate parts. The first part
involves the communication between the user and the
facebook messenger. It is done in form of chat
Data Flow Diagram level 1
messages. To design the chatbot we have used the
LEVEL 2: Dialog flow technology which helped us to create
simple AI based chatbot for our facebook page.
The second part of the architecture involves the
integration of the NodeMCU ESP8266 development
board and Adafruit.IO to form an IoT system.
Adafruit.IO is an IoT server and MQTT broker that
stores data from certain sensor through a
microcontroller board in their feed and toggle/activate
commands using their dashboard widgets.
The last part of the system architecture is the
connection of NodeMCU development board and the
face book messenger through CloudMQTT server. The
CloudMQTT is a free web based service which creates
applets that get triggered once a request has been
made to it. It is used to receive the user requests from
the facebook messenger and then forwarding them to
Data Flow Diagram level 2 the Adafruit.IO which it turn pass it on to the NodeMCU
ESP8266 board.
To pass on the user requests to the NodeMCU board Challenges in IOT Adoption
we are using MQTT protocol. Message Queue
Telemetry Transport (MQTT) is a Machine-to-Machine
(M2M) / "Internet of Things" connectivity protocol. In this
IoT based system, MQTT performs better than HTTP
because here we only publish or subscribe small
amount of data and it occupies only 80 bytes of data
which is light weight in comparison to the HTTP.

CHATBOT DEMO WITH


IOT INTEGRATION

Use Case (A)


User : Hi techieRobo

Chatbot : Greetings!! How can I assist?

Use Case (B)


User : Could u please turn on LED?

Chatbot : Turned on

1. Security
The main purpose of IoT is to connect devices to
Use Case (C) each other via the Internet. With more devices
acquiring connectivity, there are potential risks of
User :Now could u plz turn off LED?? digital burglary, malware ingestion, and data
breaches. Reports and surveys of IoT security
Chatbot : Turned off breaches are enough to clear the confusion around
the security risks. A hacker’s lust for end user data
will never end, and so industries should leverage
modern technologies, such as biometrics or
cryptography to overcome this hurdle.

Note : For running all types of demo


ESP8266 and Laptop with running facebook
messenger must be connected to two
different networks.All this requires an active
internet connection.
under-resourced in comparison to the potential
2. Network connectivity scale of the threat. To get some kind of idea of
To ensure success in IoT adoption, there is a need
for powerful and reliable network connectivity. But, the problem, the World Economic Forum report
the fact is, even today, the rural population of the cites analysis that suggests that the takedown of
INDIA faces an Internet problem. About 39% of
a single cloud provider could cause $50 billion to
India’s rural population does not have access to fast
and speedy Internet connectivity. Hence, no proper $120 billion of economic damage.
Internet connectivity is one of the many challenges
faced by industries in IoT adoption.

3. A Team of IT Experts
We already know that IoT devices gather a large
volume of data. But, for industries to gain meaningful
and actionable insights from the data to make
informed business decisions, there is a need for the
right analytics tool and skillful analysts. Hiring the
right talent having good skills is crucial for IoT
implementation.

4. Infrastructure
Due to continuously growing data in real-time,
companies should find a sustainable solution for data
storage. A centralized data storage for storing real-
time data is unsustainable. Hence, companies should
switch from a centralized data storage to a distributed
cloud platform. Besides, companies should ensure
that they have the right infrastructure that manages
IoT connected devices, sensors, and the data coming 7. Botnet Problems
from it.
Millions of new connected consumer devices
make a wide attack surface for hackers, who
5. IoT Vendors
will continue to probe the connections
Most of the companies outsource IoT solutions.
Choosing the right IoT vendor is one of the most between low-power, somewhat dumb devices
critical decisions they have to make. IoT platforms and critical infrastructure. The biggest
that offer high scalability, right infrastructure,
security challenge is the creation of
optimized results, and disaster recovery, without
compromising precision and efficiency are your best Distributed Destruction of Service (DDoS)
bet. Finding out which IoT vendor provides the best attacks that employ swarms of poorly-
IoT solution is challenging.
protected consumer devices to attack public
Even though there are several challenges in IoT infrastructure through massively coordinated
adoption, it is necessary that companies leverage IoT misuse of communication channels.
to maintain their relevance in today’s competitive
landscape. With the help of highly skilled IoT botnets can direct enormous swarms of
professionals and modern technologies, companies connected sensors like thermostats or
should analyze all the hurdles and find an appropriate sprinkler controllers to cause damaging and
solution for implementing IoT successfully.
unpredictable spikes in infrastructure use,
6. Cloud Attacks leading to things like power surges,
destructive water hammer attacks, or reduced
Given that a large amount of the data that will run
availability of critical infrastructure on a city or
the Io T will be stored in the cloud it is likely that
state-wide level. Solutions for these attacks
cloud providers will be one of the principle targets
do exist, from smarter control software that
in this kind of war. While there is growing
can tell the difference between emergency
awareness of this problem, cybersecurity is still
and erroneous sensor data, and standards
that put bounds on what data devices are #Screenshots of project in working:-
allowed to send, or how often they're allowed
to send it. Sending messages through Facebook messenger to
Esp8266 development board to perform actions.

8. Understanding IoT
In 2018, the real issue is how to increase the
ability for people to understand the changes
and their implications more clearly, and to
take concrete actions to take advantage of
the potential upside.

Internet of Things is moving into it’s


Facebook messanger
adolescence as connected devices become
smarter and more immersive, and We can see all the connection messages on the
expectations to convert IoT data to insights serial monitor of Visual Studio Code (where our
and financial value increase. Also, algorithms
Node.js code is compiled). Also we can see the
and data visualization templates have
evolved so that new use cases can take messages it receives from Facebook messenger.
advantage of earlier ones. The exponential
adoption of IoT will drive down sensor and
acquisition costs, enabling more and more
viable business cases that have previously
been too expensive.
FUTURE SCOPES AND BENEFITS OF
INTERNET OF THINGS

IoT devices are becoming a part of the


mainstream electronics culture and people
are adopting smart devices into their homes
faster than ever. By 2020, it is estimated that
there will be up to 21 billion connected
Terminal
devices to the internet. IoT devices will be a
The messages are also displayed on our huge part of how we interact with basic
CloudMQTT server.
everyday objects.

In just one year alone, we went from having 5


million IoT devices connected to the internet
to billions. The future is happening now, and
these devices are getting smarter every day
through machine learning and artificial
intelligence. There is big money in the IoT
CloudMQTT space currently, and it will only continue to
grow as technology improves.

The more data that IoT devices collect, the


smarter they will become. Cities will transform
into smart cities through the use of IoT
connected devices. Think of smart traffic
lights that collect data on traffic, and use that
data to sync lights to peak traffic times.

Light On Overall, this improves cities overall efficiency


and saves the government money since
everything can be remotely managed. Smart
homes, thermostats, lighting systems and
coffee makers will all collect data on your
habits and patterns of usage. All this data will
be collected to help facilitate machine
learning.

Light Off
CONCLUSION REFERENCES

The IoT has the potential to dramatically [1] R. Panna, R. Thesrumluk and C. Chantrapornchai
2013 “Development of Energy Saving Smart
increase the availability
Home Prototype” International Journal of Smart Home
of information, and is likely to transform
[2] Rajiv Piyare and Seong Ro Lee 2013 “Smart Home-
companies and organizations
Control and Monitoring System using Smart Phone”
in virtually every industry around the world.
ICCA

As technology evolves more and more [3] Yasirli Amri and Mukhammad Andri Setiawan 2018
opportunities arise for integrations (like you see “Improving Smart Home Concept with the Internet of
every day with APIs, IoT etc.). Chatbots can be a Things Concept Using RaspberryPi and NodeMCU” IOP
great hub of these, translating to us, keeping us Conf. Ser.: Mater. Sci. Eng. 325 012021
updated and waiting for us to give certain
commands. [4] Rohan Kar and Rishin Haldar 2016 “Applying Chatbot
to Internet of Things: Opportunities and Architectural
Basically, everything that you use, interact with elements” International Journal of Advanced Computer
now in your everyday life could communicate with Science and Applications
you and each other via a chatbot in the future.
[5]www.github.com
On the longer term, as technology evolves and we
go with the flow, more AI and auditory (speech [6]www.heroku.com

based) chatbots will come to our lives.


[7]www.cloudmqtt.com

Only with the integration of AI & IOT its


possible to build smart homes where
communication between user and chatbot
could be done instantly and user may spend
more time on focusing other things.The use
of UBER & OLA have built a great platform
on working of smart transportations.Cities can
become smart cities by connecting
themselves through new ideas and
evolutions.The use of traditional methods in
industry are nowdays replaces by modern
advance techniques/methods to finish work
faster on time.

You might also like