Вы находитесь на странице: 1из 6

International Conference on Computing, Communication and Automation (ICCCA2017)

An Internet of Things based Prototype for Smart


Appliance Control
*
Aniruddha Sinha Shubham Sharma M. R. Mahboob
*
Department of Electronics & Communication Engineering, Electrical Engineering, Tezpur University (A Central University)
Tezpur University (A Central University), Napaam, Assam, India

Abstract— The Internet of Things (IoT) is increasingly being is to say smart home has highly advanced automatic system for
recognized by researchers, companies and analysts all over the sensing the surrounding and many other function [8]. There
world as one of the most advanced technologies that has the are so many challenges in the modern home automation such
capacity to revolutionize the behaviour of everything around us.
It possesses the potential to not only affect the health, safety and as temperature, gas, light, fan, obstacles and human healthcare
productivity of billions of people but also has a major economic for smart home[9].
impact. Inspired by the idea of “smart technologies” and “home The IoT applications can be found in various vital fields
automation”, we propose an IoT framework with smart-sensing such as: energy, health, transportation, environment, etc.
based automatic appliance control. This paper presents a method Millions of application in all these fields can work optimally
and an implementation technique for the management of smart- if there is a strong interconnection among IoT enabled
appliances. A prototype has been developed and tested to verify
the efficacy of the implemented technique. The results show that devices[10]. Development of IoT enabled technologies
such prototypes can be influential in making home appliances results in a great deal of economic savings too, and
smart enough to operate only when required. The broad companies all over the world are investing in this technology
application of the proposed work will lead to greater economic to make smart technologies scalable for everyone. This will
benefits, in terms of increasing infrastructure intelligence, and eventually result in leading a life with much more ease, when
will also have social impacts in terms of global sustainability.
the daunting tasks will be dealt automatically and smartly by
Index Terms - Internet of Things (IoT), MQTT, nodeMCU, devices themselves.
Eclipse Paho client, Smart Systems, Automated Appliance Control. Data acquisition and controlling smart devices based on
acquired data plays vital role in the successful implementation
of IoT applications. In recent years, many implementations for
smart home system have been in practice to make residential
I. INTRODUCTION
buildings smart day by day. Many researches are finding
Over the past several years, there has been an immense means for effective implementation and monitoring of
domestic appliances by means of low cost sensing system [11].
increase in the use of autonomous sensing systems due to the
The implementation of web services and cloud computing in
reduction of the on-state power consumption of the electrical
controlling smart and intelligent home equipment has
components and the spread of the wireless communication
introduced a reliable security mechanism in the field of IoT
technologies. The world is going through a dramatic
[12]. However, from a system perspective, the realization of an
transformation from an isolated system to pervasive internet
IoT network, together with the required backend network
enabled thing capable of generating, transmitting and receiving
services and devices, still lacks an established best practice
valuable information. The next wave in the era of computing
because of its novelty and complexity.
will be outside the realm of the traditional desktop [1].
This paper offers an analysis report of a smart prototype
Commonly referred to as the Internet of Things (IoT), is a
developed by the authors using the concept of IoT.
novel paradigm shift in IT arena. With the advancement of
Accordingly, the rest of the paper is organized as follows:
technology many research projects are done based on IoT and
Section II provides an overview of the main elements that
home automation is one of them [2].
constitute the framework of our sensing based automated
Internet of Things (IoT) conceptualizes the idea of
appliance control. Section III provides a brief idea about the
remotely connecting and monitoring real world objects
main features of every hardware component and element,
(things) through the Internet [6]. When it comes to our house,
including the software that is used in making the prototype.
this concept can be aptly incorporated to make it smarter, safer
Section IV consists of the screenshots of the user-interface
and automated [7]. A home which is smart, is the technology
windows that were instrumental in monitoring the
used to make all the electronics equipment around the home
performance of the prototype. Section V presents a detailed
act smart or intelligent, is the technology used to make all
explanation of the screenshots shown in Section IV. Section
electronics around the home act smart or more automated that
VI gives the conclusion to the paper.

ISBN: 978-1-5090-6471-7/17/$31.00 ©2017 IEEE 1358


International Conference on Computing, Communication and Automation (ICCCA2017)

II. METHODOLOGY

This section presents our smart-sensing based automated


appliance control IoT framework. It basically gives the
pictorial representation of the system.

A. Overall structure

The framework consists of multiple elements in order to


help the system achieve its goals. The basic skeleton structure
envisioned by us is depicted in Fig.1.

Fig. 2: Design of the complete schematic of the circuit of the prototype.

D. IoT Broker & Data Processing

This section constitutes the soul of our whole IoT


framework. It consists of a broker that works on the MQTT
(Message Queuing Telemetry Transport) protocol and receives
the data from Section 2 wirelessly over the Internet. The
Fig. 1: Complete block diagram of the working of the prototype. broker forwards the signal or data to the Data Processing end,
which is hosted at another device, perhaps a GUI or a Linux
The system is comprised of mainly four core sections, viz.
terminal or a Smartphone. The Data Processing unit hosts the
Data Acquisition, Data Communication & Recipiency, IoT
software or scripts of code that analyze the signal and
Broker & Data Processing, and Output Operations. We discuss
accordingly generate the necessary output signals. The broker
these below.
helps in successfully publishing the output signals to the
Recipient end from the Data Processing end.
B. Data Acquisition
The framework employs a Raspberry Pi 3 Model B as the
MQTT broker. As is evident from Fig. 1, Section 3 represents
The first step in making any system smart is to make the
the IoT Broker & Data Processing unit of our prototype.
real life quantities and parameters available to it, based on
which it can take smart actions. This section is responsible for
E. Output Operations
acquiring the physical values of temperature, humidity and
motion detection through mainly two sensors - the temperature
The last stage of our Smart System is its physical
and humidity DHT11 sensor, and the PIR motion sensor HC-
implementation visualized through few output operations, the
SR501. The Data Acquisition section of the prototype is
instructions for which are received after the smart analysis of
depicted in Fig. 1 as Section 1.
the input values at the Data Processing unit. As this is a small
scale implementation of the automated appliance control
C. Data Communication & Recipiency
technique, we have used two AC bulbs and a buzzer as the
output units. One AC bulb switches ON when the humidity at
The next section in this project consists of an Arduino unit
the sensing location exceeds a certain threshold and likewise,
called nodeMCU having an overhead Wi-Fi client called
the other bulb switches ON if the temperature exceeds the
ESP8266 [13]. The ESP8266 Wi-Fi module is a self-contained
predefined threshold value. The buzzer acts as an alarm to
system on chip (SoC) with integrated TCP/IP protocol stack
alert the user if a person enters the room or comes in the
that can give any microcontroller access to the Wi-Fi network.
vicinity of the sensing unit. If there is no more change in
It is an extremely cost effective board with a huge and ever
motion, the buzzer stops beeping. Similarly, once the humidity
growing community, and uses the Lua scripting language[15].
and the temperature goes below the set threshold values, each
This part of the prototype is depicted in Fig. 1 as Section 2.
of the bulbs turns OFF. This section is presented as Section 4
The main purpose of Section 2 is to measure the
in Fig. 1.
surrounding temperature, humidity and any change in motion
Fig. 2 depicts the design of the complete schematic
nearby, transfer this data wirelessly over MQTT broker to the
employed in developing the Smart System.
Processing end, receive the processed signal and control the
output operations.

1359
International Conference on Computing, Communication and Automation (ICCCA2017)

III. PROTOTYPE SYSTEM AND SYSTEM MODELING

This section focuses on the technical specifications of the


elements used in developing the prototype of the system, i.e.,
Fig. 3: General communication process in MQTT protocol.
the software and hardware used.

A. DHT11 Temperature and Humidity sensor to-machine (M2M) communication and plays an important
role in the Internet of Things (IoT) [5]. MQTT allows devices
DHT11 temperature & Humidity Sensor features a to send (publish) information about a given topic to a server
temperature & humidity sensor with a calibrated digital signal that functions as an MQTT message broker, as shown in Fig 3.
output. Its exclusive digital-signal-acquisition technique, and The broker then pushes the information out to those clients
temperature and humidity sensing technology ensures high that have previously subscribed to the client's topic. To a
reliability and excellent long term stability. The sensor human, a topic looks like a hierarchical file path [14]. Should
includes a resistive type humidity measurement component the connection from a subscribing client to the broker get
and NTC (Negative Temperature Coefficient) temperature broken, the broker will buffer messages and push them out to
component offering excellent quality, fast response, anti- the subscriber when it is back online. Should the connection
interference ability and cost effectiveness. It can measure from the publishing client to the broker be disconnected
temperature from 0-50 °C with an accuracy of ±2°C and without notice, the broker can close the connection and send
relative humidity ranging from 20-90% with an accuracy of subscribers a cached message with instructions from the
±5%. The sensor provides fully calibrated digital outputs for publisher [13].
the two measurements [3]. There are many MQTT platforms available for IoT
implementations, however the most popular are the mosquitto
B. HC-SR501 PIR Motion Sensor and the hivemq clients.
By default, the Raspberry Pi doesn’t come equipped with
Every object that has a temperature above perfect zero emits the MQTT protocol and needs to be installed manually.
thermal energy (heat) in the form of radiation which lies in the
infrared region. The PIR sensors are tuned to detect this IR E. Eclipse Paho library
wavelength which only emanates when a living being arrives
in their proximity[4]. Interfacing HC-SR501 with nodeMCU is The Paho project was created to provide scalable open-
easy as the output of the sensor is MCU friendly i.e., gives a source implementations of open and standard messaging
3.3V when HIGH and it can be powered from the 5V rail of protocols aimed at new, existing, and emerging applications
the MCU. for Machine-to-Machine (M2M) and Internet of Things (IoT).
Paho initially started with MQTT publish/subscribe client
C. nodeMCU & ESP8266 implementations for use on embedded platforms, and in the
future will bring corresponding server support as determined
In the prototype, whenever DHT11 senses any change in by the community [17]. Paho client libraries can be written in
temperature and/or humidity, it converts the sensed data to many programming languages, viz. C, C++, Java, Python, etc.
digital data and sends it to nodeMCU through the pin no. For this project, we performed Paho client programming in C
GPIO-05. Again, if HC-SR501 detects any change in motion, [18].
it instantly sends a high signal (3.5V) to the pin GPIO-12 of
the nodeMCU. In the following steps, the sensed values i.e.
temperature, humidity and motion detection output are IV. SYSTEM IMPLEMENTATION
published through three different topics using ESP8266. The
subscribers at the Raspberry Pi end receive the data and based In this section, we demonstrate the steps in integrating the
on various analyses, control signals are published to control various components of the prototype, the flow of the hardware
the appliances or the output units which are placed at the control scripts, and the results observed after implementation.
nodeMCU end. We describe these below.

D. Raspberry Pi and the MQTT Broker:


A. Flow of the hardware control scripts
In the field of Information Technology, a protocol is the
special set of rules that end points in a telecommunication Any programming language capable of communicating
connection use when they communicate. Protocols specify directly with controller hardware can be used. As already
interactions between the communicating entities. MQTT is a mentioned, we used the C programming language enabled
lightweight messaging protocol that provides resource- with the Paho client for MQTT communication at the Data
constrained network clients with a simple way to distribute Processing unit, while the Data Communication and
telemetry information. The protocol, which uses a Recipiency unit, i.e. the nodeMCU was coded and made
publish/subscribe communication pattern, is used for machine- equipped with MQTT controls using the Arduino IDE.
1360
International Conference on Computing, Communication and Automation (ICCCA2017)

Fig. 5: Program Flow diagram at the analyzer end.


Fig. 4: Program Flow diagram at the sensing end.

nodeMCU to switch on the corresponding bulb, else a “5” is


transmitted to either switch off the bulb or to maintain it in the
1) Program Structure: Applications that use the Paho off state.
client library typically use a similar structure: • Arduino/humidAck: The analyzer sends the output signal
ƒ Create a client object for switching on or off the humidity based light bulb over this
ƒ Set the options to connect to an MQTT server topic. As soon as the humidity goes beyond 60% RH, the
ƒ Set up callback functions if multi-threaded corresponding bulb turns on and vice-versa.
(asynchronous mode) operation is being used. • Arduino/pirAck: This topic delivers a high signal to beep
ƒ Subscribe to any topics the client needs to receive the buzzer as soon as motion is detected in a radius of 5 meters
ƒ Repeat until finished: from the PIR sensor, and vice-versa.
ƒ Publish any messages the client needs to The flowcharts shown in Fig. 4 and Fig. 5 re-iterate until
ƒ Handle any incoming messages there is a fault in MQTT connection or the Processing end is
ƒ Disconnect the client voluntarily closed by someone. For a break in the MQTT
ƒ Free any memory being used by the client connection from either sides, the particular side tries to re-
connect with the broker and keeps trying till the time the
2) Program Flow: The basic flowchart of the source code connection is successfully established.
at the Data Sensing unit (nodeMCU) is shown in Fig. 4 while
that at the Data Processing unit (Raspberry Pi or Ubuntu B. Data Collection and Analysis
system) is demonstrated in Fig. 5. There are mainly six MQTT
topics used in the prototype for communication : The data from the DHT11 sensor to the nodeMCU
• Arduino/temp: If the sensing element senses a change in contains 40 bits. The structure of these 40 bits is shown here
the surrounding temperature, it transmits the current under:
temperature value to the Data Processing unit through this
topic. The minimum threshold temperature value for switching
on the bulb was set to 26 °C in the prototype, as presented in Out of these 40 bits,
Fig. 11. • Decimal Byte of RH, Decimal Byte of Temp. = 0
• Arduino/pir: For any change in motion in the vicinity, this (always). Therefore, the first and third bytes of received data
topic is used by the sensing element to send the detected actually give the numeric values of the measured relative
motion input to the analyzer for processing. humidity (%) and temperature (°C).
• Arduino/humid: The DHT11 senses the change in • The last byte is the Checksum byte which is used for error
humidity levels and transmits the current humidity value to the correction. If all the five bytes are transferred successfully then
data processing unit over this topic. The corresponding bulb the checksum byte will be equal to the last 8 bits of the sum of
turns on if the humidity exceeds 60% RH, which was the the first four bytes, i.e.,
threshold used while testing the prototype. Checksum = Last 8 bits of (Integer Byte of RH + Decimal
• Arduino/tempAck: The data processing unit uses this topic Byte of RH + Integer Byte of Temp. + Decimal Byte of Temp.)
for sending the acknowledgement signals to the nodeMCU
after analysis of the received temperature value. If the Whenever DHT11 senses any change in temperature and/or
temperature exceeds 26 °C, a “4” is transmitted to the humidity, it converts the sensed data to digital data and sends
1361
International Conference on Computing, Communication and Automation (ICCCA2017)

Fig. 6: Process flow of output operation in this prototype

Fig. 9: Screenshot of the extended terminal window at


the analyzer’s end

Fig. 7: Screenshot of the terminal window at the analyzer’s end Fig. 10: Encircled portion indicates the smart nature of the analyzer
to reconnect with the broker

operation. The pins GPIO-04 (temperature controlled output)


and GPIO15 (humidity controlled output) are used to control
the LAMP1 and LAMP2 respectively. On the other hand, the
buzzer is directly controlled by the GPIO-13 pin of the
nodeMCU.
Images in Fig. 7, Fig. 8, Fig. 9 and Fig. 10 depict the
dashboard screenshots of the interfaces that were in use during
the system operation. There are two dashboards on which the
system as well as the MQTT communication between the
clients is being monitored. The first dashboard is the terminal
window of the Raspberry Pi (Data Processing unit) and the
Fig. 8: Screenshot of the dashboard window at the sensing end second dashboard is the serial monitor of the Arduino IDE
running the program on nodeMCU (the sensing unit).
it to nodeMCU through the pin no. GPIO-05. Again, if PIR
sensor detects any change in motion it instantly sends a high
signal (3.5V) to the pin GPIO-12 of the nodeMCU. This is the V. EXPERIMENTAL RESULTS
method of data collection and analysis in the proposed
prototype. This prototype is an automated system and developed in
such a manner to have zero human involvement unless there is
C. System Operation and Dashboard screenshots some system maintenance, either in the sensing element or the
data processing unit, or perhaps when the broker needs to be
As mentioned in III, the output devices installed in this restarted. For monitoring all such operations at every step, we
prototype are two AC lamps and one buzzer. Fig. 6 shows the need to use few user-interfaces. Fig. 7 is the screenshot of the
pictorial representation of the output realization in this terminal view of the messages received and acknowledged at
prototype. the Data Processing unit when it is started, and the MQTT
As the output of nodeMCU is a 3.3 V signal, so AC connection is established with the broker wirelessly. Once the
appliances cannot be controlled by the output signal of connection is established, it restarts subscribing to the data that
nodeMCU directly. To solve this problem, a circuit containing would be sent by the nodeMCU. Fig. 8 represents the serial
a relay and a transistor is used. The transistor amplifies the monitor view of the sensing end, with the messages published
3.3V signal to provide adeqaute voltage to the relay for and output operations received. The bottom portion also
1362
International Conference on Computing, Communication and Automation (ICCCA2017)
signifies how the client smartly tries to reconnect with the
broker when MQTT connection is lost. Fig. 9 is again a
continuation of the messages at the analyzer's end. The
encircled portion shows that when a humidity value equal to
62% RH is received by the analyzer on the topic
Arduino/humid, which is greater than the set threshold value
60% RH, an acknowledgement message “1” is broadcasted to
the nodeMCU over the topic Arduino/humidAck to switch on
the corresponding light bulb. The bottom portion of the image
in Fig. 10 shows the smart nature of the client to reconnect
with the broker when connection is lost in between. Fig. 11 is
a real-time image developed prototype.

VI. CONCLUSION

A framework has been successfully implemented for smart


communication between various appliances in a building or
home at a small scale. The developed prototype can be
implemented in rural areas or in agricultural applications. The
developed technique ensures energy saving as well as having
the potential to play a crucial role in informing the farmers
Fig. 11: Real-time image of the prototype developed
about the best crop to be cultivated depending on the soil
humidity or automatically distributing water to the farms as
[8] Jackie Craven, “What Is a Smart House?”[Online],Available:
and when required. Industries are also using such technologies http://architecture.about.com/od/buildyourhous1/g/smarthouse.htm.
to monitor the use of every machinery and large equipment in [9] G. Kesavan, P. Sanjeevi and P. Viswanathan, "A 24 hour IoT framework
their campuses. However, the proposed prototype has a few for monitoring and managing home automation," 2016 International
Conference on Inventive Computation Technologies (ICICT), Coimbatore,
limitations that it is operational only in a closed network and is
2016, pp. 1-5.
inaccessible from outside the network. In case of connection [10] G. Eason, B. Noble, and I.N. Sneddon, “On certain integrals of
interruption, there is a delayed response when the nodeMCU Lipschitz-Hankel type involving products of Bessel functions,” Phil.
tries to reconnect with the MQTT broker. Trans.Roy. Soc. London, vol. A247, pp. 529-551, April 1955.
(references)
With the inception of the concept of Smart Cities, in the
[11] M. Kovatsch, M. Weiss and D. Guinard, “Embedding internet
coming next decade India is also going to witness a revolution technology for home automation” , IEEE 15th Conference on Emerging
in the way its cities are planned. If these prototypes are Technologies & Factory Automation (ETFA 2010), Bilbao,pp.1-8, 2010.
brought to use at every home, office, government institutions, [12] A. Zanella, N. Bui, A. Castellani, L. Vangelista and M. Zorzi, "Internet
of Things for Smart Cities," in IEEE Internet of Things Journal, vol.1
educational institutes, etc., a city will automatically achieve
,no.1, pp.22-32, Feb.2014.
the tag of being a Smart City. Though many IT companies are [13] “NodeMcu” Internet: https://en.wikipedia.org/wiki/NodeMCU,Mar
now busy in addressing interoperability issues and the 2017.
challenge of controlling hardware devices through software, [14] “MQTT Essentials Part 3: Client, Broker and Connection
Establishment”, Internet: http://www.hivemq.com/blog/mqtt-essentials-
the world community is now moving towards creating
part-3-client-broker-connection-establishment, 2017.
opportunity to live in a "connected life" environment. [15] “Eclipse Mosquitto”, Internet: https://mosquitto.org/, 2016.
[16] “MQTT”, Internet: http://mqtt.org/, 2016.
[17] “Eclipse Paho”, Internet: http://www.eclipse.org/paho
[18] “MQTT Client for Posix and Windows”, Internet:
https://eclipse.org/paho/clients/
REFERENCES

[1] Waher, Peter. Learning Internet Of Things. Birmingham, UK: Packt


Publishing, 2015. Print.
[2] Lampkin, Valerie et al. Building Smarter Planet Solutions with MQTT
And IBM Websphere MQ Telemetry. 1st ed. [S.l.]: IBM, 2012. Print.
[3] Electronilab, “HC-SR501 PIR Sensor”, HC-SR501 Datasheet, Jun. 2011.
[4] D-Robotics UK,”DHT11 Humidity and Temperature Sensor”, DHT11
Datasheet, Jul. 2010.
[5] “NodeMcu Connect Things EASY” Internet:
http://nodemcu.com/index_en.html, 2014.
[6] M. N. N. A. Asghar M.H. "Principle application and vision in internet of
things (iot)" Global Conference on Communication Technologies
(GCCT) 2015.
[7] R. K. Kodali, V. Jain, S. Bose and L. Boppana, "IoT based smart security
and home automation system," 2016 International Conference on
Computing, Communication and Automation (ICCCA), Noida, 2016, pp.
1286-1289.

1363

Вам также может понравиться