Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

2020 IEEE International Conference on Smart Internet of Things (SmartIoT)

Learning IoT: Basic Experiments of Home


Automation using ESP8266, Arduino and XBee
Annisa Sarah Theresia Ghozali Geraldo Giano
Electrical Engineering Electrical Engineering Electrical Engineering
Atma Jaya Catholic University of Atma Jaya Catholic University of Atma Jaya Catholic University of
Indonesia Indonesia Indonesia
Jakarta, Indonesia Jakarta, Indonesia Jakarta, Indonesia
https://orcid.org/0000-0001-8503-1380 theresia.ghozali@atmajaya.ac.id geraldo.giano@gmail.com

Melisa Mulyadi Sandra Octaviani Alfin Hikmaturokhman


Electrical Engineering Electrical Engineering Telecommunication Engineering
Atma Jaya Catholic University of Atma Jaya Catholic University of Institut Teknologi Telkom Purwokerto
Indonesia Indonesia Purwokerto, Indonesia
Jakarta, Indonesia Jakarta, Indonesia alfin@ittelkom-pwt.ac.id
melisa.mulyadi@atmajaya.ac.id sandra.oct@atmajaya.ac.id

Abstract— Extensive implementation of Internet-of-Things since early 2019. The MICT regulation: No. 1, 2019 about
(IoT) systems increases the needs of IoT engineers. However, Radio Frequency Spectrum Usage based on Class Permit, has
some available IoT-trainer modules, which needed to equipped been a kick-off for commercializing IoT service in Indonesia
engineers with IoT skills, are quite expensive and exclusive for [6]. An increase in productivity and efficiency of Indonesia’s
private institutions. This research proposes an IoT-trainer economy has expected by the IoT implementation. Thus, there
design that offers seven simple experiments to understand IoT will be a vast workforce needed in this new era to maintain
concepts, which classified into three aspects: IoT devices, and build the IoT systems in various sectors. Those people
connectivity, and cloud or application system. All devices are need to understand a fundamental knowledge of IoT.
available and purchasable from the market, low-price, and easy
to configure: ESP8266 (NodeMCU-12E, and ESP-01), Arduino IoT-trainer kit is a designated module to support learners
Uno, and Xbee. Moreover, the platforms that we use to tunnel a in experimenting with IoT projects. By a project-based-
network and processing data are also open source: Ngrok, learning, learners will eventually gain some insight to
ThingSpeak, and 000webhost. By exploiting this simple, understand the IoT concept. There are many IoT Trainer kits
inexpensive IoT-trainer design and experimenting with those available, from a simple IoT kit to an advanced trainer. The
seven scenarios, learners can study the basic concept of IoT as price of the available IoT trainer kits is ranging from 50 to 289
infrastructure. USD [7 – 11]. However, the cheapest IoT trainer kit only
provides limited experiments and exclusive in terms of
Keywords—Internet-of-Things, Prototype, Trainer Board,
Home Automation
application or hardware modules, yet the advanced IoT trainer
kit might too expensive for beginners. Moreover, several
I. INTRODUCTION available IoT-trainers only introduce a single development
board, basic communication protocols (e.g., Wi-Fi and
A rapid transformation of the technology era has Bluetooth that consumes high power), and a single
introduced a new lifestyle. In the previous decade, we use the application. There is a need to provide an IoT experiment
internet mainly for communications: e-mail, chatting, video module that inclusively combines several modules or
calls. However, the internet helps us in almost every aspect of protocols to show simple variation infrastructure of IoT.
our daily lives, from online shopping, navigation, and work.
Recently, the internet is not only connecting people; it also The main contribution of this research is providing an IoT-
connects machines to facilitate social works and increase trainer design that affordable and able to inclusively introduce
productivity. Such a scheme is called Internet-of-Things (IoT) different types of devices, communication protocols, and web-
[1]. The IoT enables us to maintain services conveniently: based applications in IoT technology. As the initial project,
without any human intervention. For example, in agriculture, the IoT prototype supports remote home automation functions
we can automatically give nutrition to the plantations by such as controlling electronic devices remotely (LEDs) and
reading its temperature, humidity, and nutrition level. The monitor house environment (temperature and humidity).
actuators will then act to add more nutrition based on the Home automation projects have been chosen because of its
reading. Farmers can control and monitor the situation high reproducibility so students and learners can do
anywhere in the world since they can read all parameters by independent experiments at home.
using the internet. In 2020, an IoT technology would widely
implement in various objects: from connecting people, II. LITERATURE REVIEW
services, vehicles, to home and buildings. [2] The IoT system is a system that reads information about
Several Indonesian telecommunication access providers the environment through sensors, sends the data to other
have been introducing IoT Technology to the national market systems, and enables remote users to reach out or act through
[3]–[5]. They mostly offer a narrowband IoT technology (NB- actuators. We can look at IoT from two perspectives: IoT-as-
IoT), and some of them also propose a low power wide area a-Service and IoT-as-an Infrastructure.
network (LPWA) solution for customers. Moreover, the
Ministry of Information and Communication Technology of
Indonesia made roadmap and regulation of IoT for Indonesia

978-1-7281-6514-1/20/$31.00 ©2020 IEEE 290


DOI 10.1109/SmartIoT49966.2020.00051

Authorized licensed use limited to: Cornell University Library. Downloaded on September 11,2020 at 04:16:35 UTC from IEEE Xplore. Restrictions apply.
A. IoT-as-a-Service
The IoT systems give us a service to improve a business
or process. IoT-as-a-Service can be described as things
(devices) that send data that generate insights, and those
insights will later trigger actions to improve a process [12].
These things consist of hardware and software that interact
directly with the world. Next, the data is processed by a stream
processing platform and will be reported to the user. Users can
manage and monitor all the information from the user
management platform. Lastly, users could also integrate
several systems and take actions by using machine learning to
improve the business process. There are several IoT platforms
as a service (PaaS) that give us an end-to-end solution such as
Microsoft Azure IoT, Amazon AWS IoT, Oracle IoT Cloud.
B. IoT-as-an-Infrastructure
As an engineer, we need to understand the architecture of
IoT systems. IoT architecture can be classified as three
essential components: device, gateway or connectivity, and Fig. 1. Methods taken to develop basic experiments
cloud or application [13]. On-site devices consist of sensors,
actuators, and microcontrollers (or microprocessors) to interface. The schematic designed IoT-trainer, code, and
control all the connected sensors and actuators. Then those documentation isis available online 1 . The method of this
devices communicate with each other by specific protocols. research is shown in Figure 1.
By using a gateway, the information gathered from devices is The literature study shows that NodeMCU and Arduino
being sent to the cloud for further processing. As a beginner, are the simplest micro-controller (and also cheapest). The
we may build a web server for the data stream processor and NodeMCU and Arduino are programmed by using the open-
user interface. source Arduino Software (IDE), which uses C and C++
C. Home Automation language. For the communication protocols, we choose Wi-Fi
as it is widely available everywhere, and introduce Xbee, the
Though there are many IoT application scenarios, home
popular low power consumption module. Lastly, we use open-
automation or Smart Home is one of the simple yet essential
source application to process and show data to users.
aspects of realizing a smart city in the future.
A. Depicting Basic Smart Home Application
A smart home means to enable an automation system of
the home features (windows, lighting, air conditioner, doors, NodeMCU and Arduino UNO are the main
washing machine, and other appliances), by integrating microcontroller, it is cheap, breadboard-friendly. The
information and communication technologies (ICT) for NodeMCU has Wi-Fi on board. NodeMCU is a development
controlling those appliances [14]. An impressive development board which runs on ESP8266 and use ESP-12 module, and
of electronics enables people to implement such a system in Arduino Uno is powered by ATMega 328P. As an
their houses since the expense of deploying a smart home introduction for the home automation project, we learn to read
system is cheaper than 10 or 20 years ago. The home temperature and humidity by using DHT11 sensor with a
automation is expected to be widely implemented in a global temperature range 0°C to 50°C, and humidity range 20% to
market in 2022. 90% [16]. Houses also need lighting management, and we
mimic the house lighting by using LED modules. A display
Moreover, the smart home is not only applied for module is also important, as it can ease users to read the data
convenience to manage lighting or entertainment. Stojkoska on-site without the needs of checking mobile-phone to browse
and Trivodaliev in [15] show that the smart home could be via website. We use OLED Display. In this project we also use
integrated into a smart grid system to maintain efficient power Xbee shield, to ease the connectivity of Xbee to Arduino Uno.
consumption. We use a Google Chrome as our main web browser, Ngrok as
the multiplatform tunneling, and a free hosting at
III. METHODS
000webhost.com. To analyze and display the data reading, we
To design an IoT trainer that depict the IoT concept in use website and ThingSpeak.
general, we firstly study several publications and then carried
basic projects to understand IoT infrastructure. Then, we IV. RESULT AND DISCUSSION
deployed some projects to understands devices A schematic of the IoT-trainer module is depicted in Figure
(sensors/actuators and micro-controllers), connectivity and 2. These devices are chosen because it meets our requirement
gateway, cloud, and application concept. These project to introduce several types of IoT devices; familiarize learners
materials then summarized as one comprehensive IoT-trainer to types of connectivity and web applications. This IoT-
design. We define the essential devices that we need and
trainer provides seven basic experiments which classified in
prepare all the installation and components. We begin by
connecting those electronic circuits to other devices or the three categories: understanding device; understanding
Internet, then finally showing the data out through any user connectivity gateway, and understanding

1
Annisa Sarah (annisarah “Documentation of “Learning Internet-of-Things: IoT
Basic Experiments using ESP8266, Arduino and Xbee”,” GitHub. [Online] Available:
https://github.com/annisasarah/iot-trainer-module-2019

291

Authorized licensed use limited to: Cornell University Library. Downloaded on September 11,2020 at 04:16:35 UTC from IEEE Xplore. Restrictions apply.
Fig. 2. IoT-trainer Schematic design, running the fifth experiment

connected to Internet yet. The third project complement the


A. Understanding Device
first and second experiment experiences by completely able
1) Experiment 1, DHT sensor with OLED display: The first to control local electronic devices.
experiment is to read the data from a sensor (DHT11), and
show the current temperature and humidity on the OLED B. Understanding Connectivity Gateway
display. The data has not been sent to any server yet. Learners In this section, we connect our device to Internet. Learners
can familiarize themselves to wires connections from can control or monitor the data through a web browser or
development board, input (sensor), and output (display) application outside the network. These are the projects that
enable us to learn the connectivity concept in Internet-of-
2) Experiment 2, DHT 11 with Xbee Connectivity: The Things. There are two ways of publishing our local network.
second experiment is reading DHT Sensor that connected to The first one is by using a tunnelling application such as
Xbee and Arduino. In the experiment 5 later, the Xbee will Ngrok. Ngrok is a multiplatform tunnelling, reverse proxy
be connected to other Xbee, in which combined with an software that provide secure tunnels from locally running
ESP8266. The devices that we need are: Arduino Uno, Xbee,
and Xbee Shield, as can be seen on Figure 2. the DHT11 data
pin is connected to D7 on Arduino, and the Arduino’s GND,
pin 3.3 V, TX and RX are automatically connected to Xbee’s
GND, pin 3.3 V, TX and RX, by using Xbee shield. We need
Xbee S2C (shield), Xbee USB adapter, and XCTU software
to configure the Xbee. At this moment, we only monitor the
DHT reading on a serial monitor. With this experiment,
learners understand how to configure IoT specific
communication protocol which classified in Zigbee Standard.
3) Experiment 3, LED with local host: The third Fig. 3. Experiment 3: Authentication (left), web display (right)
experiment is local web-controlled LED project. We need: 1
Breadboard, 1 nodeMCU, 2 LEDs, jumpers, USB Cable
Type B. To program the NodeMCU, several initialitation
steps such as incude library, set up variables, and pins setup,
are taken. Using Arduino IDE, we config the NodeMCU and
upload the code via serial USB Cable. We can save the IP
address which shown on the COM5, and search the address
on a web browser. We need to connect to the same Wi-Fi
hotspot, since this device only connected locally. A security
in IoT system is important, so we provide an authentication
procedure as can be seen in Figure 3. If the person that
accessing the local host has been authenticated, we can see
control buttons as shown in the same figure. We can turn on
and off the LED, and the web page shows current status of
LED that being controlled. By this experiment, learners able
to make a complete microcontroller project, but not Fig. 4. Experiment 3 LED control

292

Authorized licensed use limited to: Cornell University Library. Downloaded on September 11,2020 at 04:16:35 UTC from IEEE Xplore. Restrictions apply.
Fig. 5. Recorded data on Thingspeak for experiment 6

network to a public endpoint such as internet. The second


option is by hosting our web through a web hosting service.
We use a free hosting at 000webhost.com.
1) Experiment 4: Tunneling with Ngrok: This experiment
aims to understand the connectivity in IoT, by tunneling our
previous project devices network, Experiment 1 and 2, via
Ngrok so it can be accessible to Internet. First, we need to
create ngrok account on https://ngrok.com, download the
ngrok. We need to save a copy of our AUTH token from
ngrok’s website. To connect our Ngrok software to our
account, we need to copy the AUTH token on the ngrok
software. In the terminal, write the following command:
ngrok tcp 192.168.43.99:8888 –authtoken
1W3dJhGWW5q7MYsMljaaT9CydtX_3hRTjErX1xWjqB7AW1qpj
Fig. 6. Web display for experiment 6
noted that the TCP IP Address is unique to each ESP8266,
and the Auth Token is unique to each Ngrok account. If the a free web hosting, which will be explained on the next
connection is successful, we can see the Tunnel Status as section. The Tx and Rx on ESP8266 is connected to D6 and
online. On our web browser, we may copy the Forwarding
D7 of Arduino board. To power the ESP8266, we need
Address tcp://0.tcp.ngrok.io:13962 to monitor our ESP8266
additional AMS1117 5V DC Power Module. Noted that the
DHT Server, or tcp://0.tcp.ngrok.io:18922 to a control our
ESP8266 is ESP-01 type, not the ESP8266-12E (NodeMCU)
LEDs from anywhere in the world. However, the Ngrok must
that we use for other experiments. The ESP-01 is consume
be always on. The result of this experiment can be seen on
Figure 4. In this experiment, we also introduced control less energy than the ESP8266-12E. But the ESP-01 does not
buttons that operate on Android in mobile phone. The comes with its own microcontroller chip, like the ESP8266-
application to make this button is called HTTP Shortcuts, 12E do. By this experiment, learners able to learn how to
which is free and available on Google Playstore. To configure connect sensor module, to gateway module, and publish the
these buttons, we need the ESP8266 address for the basic data to internet.
request setting and input the authentication credentials. C. Understanding Cloud System
However, we cannot see the current status of both LEDs, we
can only control it remotely. By this experiment, learners can 1) Experiment 6, ThingSpeak: ThingSpeak is an IoT
understand how to publish their local network to the world. analytics platform that enables users to aggregate, visualize,
and analyze data streams. This platorm also powered by
2) Experiment 5, Xbee network connected to ESP8266: MATLAB® analytics, and users can write and execure
This experiment is an expansion of Experiment 2. There are MATLAB code to perform advance processing [17]. We
two modules: DHT-Xbee module, and ESP8266-Xbee create an account on https://thingspeak.com, then create a
module. The main idea is to place the DHT 11 sensor at some new channel. We create two fields: temperature and
distance to the server (ESP8266-Xbee), so the DHT-Xbee humidity. Each channel has unique Channel ID, that we need
module will send the temperature and humidity data to the to write on our devices. We use:
router, and the router module will upload it to the internet via

293

Authorized licensed use limited to: Cornell University Library. Downloaded on September 11,2020 at 04:16:35 UTC from IEEE Xplore. Restrictions apply.
ThingSpeak.setField(1,t); ThingSpeak.setField(2, h); and humidity, and controlling LED via internet, by using
ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey); ESP8266 (12E or NodeMCU and ESP-01), Arduino Uno, and
Where t and h is a variable to save temperature and humidity Xbee. We also use ThingSpeak and free web hosting for
reading. myChannelNumber is the unique Channel ID, and processing data. For the future research, more variety of
myWriteAPIKey is a command to write the field. The result connectivity should be introduced, such as LoRa, NB-IoT,
BLE, and many others. Moreover, we also will conduct one
is shown in Figure 5. This shows learners how to process and
practical case, e.g. smart hydroponics system, or any other
present data online by using existing platform.
application. The more advance application may give learners
2) Experiment 7, Web Hosting: In practical, many IoT more skills and deeper their understanding.
applications use an online website to monitor and control
REFERENCES
their devices. For beginners, it recommended to build a free
[1] R. Minerva, A. Biru, and D. Rotondi, “Towards a Definition of the
website with limited features just to have a grasp of Internet of Things (IoT),” IEEE Internet Initiat., pp. 1–86, 2015.
understanding how the data has been collected, stored and [2] Sukode, Sagar., et.al. “Context Aware Framework in IoT: A Survey,”
process in the cloud. We use a free website hosting, that has International Journal of Advanced Trends in Computer Science and
a capability to have its own server and front-end design. Engineering 4(1):1-9, February 2015
Firstly, we must create an account, create database, set the [3] S. Khafid, “XL Axiata Perkenalkan NB IoT di 31 Kota se Indonesia,”
Tempo.co, 2019.
fields, and finally design the user interface. To mimic the
[4] L. D. Jatmiko, “Cakupan NB-IoT Telkomsel Jangkau 22 Kota,”
ThingSpeak capability of showing the recorded data as a Bisnis.com, 2019. [Online]. Available:
table, we also provide the table that will be updated each 5 https://teknologi.bisnis.com/read/20190930/101/1153576/cakupan-
seconds. The website display is shown in Figure 6. This nb-iot-telkomsel-jangkau-22-kota. [Accessed: 18-Dec-2019].
shows learners how build IoT web platform from scratch. [5] L. Anggraeni, “Indosat Ooredoo Siap Gelar 5G, Tinggal Tunggu
Regulasi” Medcom.id, 2019. [Online]. Available:
D. Final IoT Trainer Kit for Home Automation https://www.medcom.id/teknologi/news-teknologi/lKYBOmAN-
indosat-ooredoo-siap-gelar-5g-tinggal-tunggu-regulasi. [Accessed:
The final IoT-trainer is depicted previously in Figure 2, and 18-Dec-2019].
the detailed specification is shown in Table 1. Platforms that [6] Viva, “Regulasi Disahkan, Perusahaan IoT Sudah Bisa Komersialisasi"
we used are Arduino IDE, Ngrok, HTTP Shortcut, Viva.co.id, 2019. [Online]. Available:
https://www.viva.co.id/digital/teknopedia/1149573-regulasi-disahkan-
ThingSpeak, and 000Webhost. The total cost to deploy this [Accessed: 2-Feb-2020].
IoT-trainer is approximately 76 USD. It can still be [7] “Myduino IoT Training Kit,” Accessed on: Jun. 19, 2020. [Online].
considered as cheap (in the range of 50 – 289 USD) but can Available: https://myduino.com/product/myd-002/
offer inclusive IoT projects to enrich engineers' knowledge in [8] “IoT Trainer Kit V1.0,” Accessed on: Jun. 19, 2020. [Online].
IoT fundamentals. Available: https://digiwarestore.com/en/educational-trainer/iot-
trainer-kit-v10-642522.html
TABLE I. IOT TRAINER KIT HARDWARE DETAILS
[9] “ETS IoT Trainer Kit, for Laboratory,” Accessed on: Jun. 19, 2020.
Category Specification [Online]. Available: https://www.indiamart.com/proddetail/iot-trainer-
Development board ESP 8266-12E (Node MCU) 1 pc, Arduino Uno kit-13388313933.html
Communication ESP 8266 (ESP-01), Xbee S2C XB24C, 405F [10] “SparkFun IoT Starter Kit with Blynk Board,” Accessed on: Jun. 19,
board and Firmware, Xbee Shield for Arduino Uno, Xbee 2020. [Online]. Available: https://www.sparkfun.com/products/14682
supporting module Adapter [11] “Atmega328 IoT Trainer Kit,” Accessed on: Jun. 19, 2020. [Online].
Power AMS1117 5V DC Power Module Available: https://www.sparkfun.com/products/14682
Input/sensors DHT 11 [12] “Arduino MKR IoT Bundle [GKX00006] Accessed on: Jun. 19, 2020.
Output LEDs, 0.96-inch OLED Display [Online]. Available: https://www.amazon.com/gp/offer-
Resistors 330 Ohm (2 pcs), 4.7 k Ohm (1 pc) listing/B076VPGKNK/ref=dp_olp_new_mbc?ie=UTF8&condition=n
Cables Cable Micro B USB, Mini B USB Cable, USB 2.0 ew
Cable Type A/B [13] Microsoft, "Azure IoT Reference Architecture" docs.microsoft.com,
additional 1 set jumper wires, protoboard and acrylic 2019. [Online]. Available: https://docs.microsoft.com/en-
us/azure/architecture/reference-architectures/iot/ [Accessed: 2-Feb-
V. CONCLUSION 2020]
[14] Google Cloud, "Overview of Internet of Things" Google Cloud
The Internet-of-Things technology has been rapidly Documentation. [Online]. Available:
implemented. Ministry of Information and Communication https://cloud.google.com/solutions/iot-overview [Accessed: 2-Feb-
Technology of Indonesia has been compiling a roadmap and 2020].
regulation of IoT for Indonesia. Therefore, hundreds skilled [15] Gaurav, S, "The Evolution of Smart Home Technology". BCC
man powered must be available to meet industry needs. Research, 2018. [Online]. Available: http://blog.bccresearch.com/the-
However, providing a commercial IoT trainer kit is costly, and evolution-of-smart-home-technology [Accessed: 2-Feb-2020].
exclusively available for private institutions. A simple, open- [16] Risteska Stojkoska BL, Trivodaliev KV, A review of Internet of Things
for smart home: Challenges and solutions, Journal of Cleaner
source, and low-cost trainer kit may help beginners to Production (2016), doi: 10.1016/ j.jclepro.2016.10.006
understand the basic concept of IoT infrastructure, and learn [17] Mouser Electronics. "DHT11 Humidity & Temperature Sensor".
skills that are needed to entry the IoT job market. We propose [Online].
an affordable and inclusive IoT-trainer which able to run Available:https://www.mouser.com/datasheet/2/758/DHT11-
several experiments in three categories: device, connectivity Technical-Data-Sheet-Translated-Version-1143054.pdf [Accessed: 2-
and cloud. There are in total seven experiments: three Feb-2020].
experiments of understanding device, two experiments of [18] The Things Network. "ThingSpeak".
[Online].Available:https://www.thethingsnetwork.org/docs/applicatio
understanding connectivity, and two experiments of ns/thingspeak/ [Accessed: 2-Feb-2020]
understanding cloud or application. The services that
introduced in these experiments are reading the temperature

294

Authorized licensed use limited to: Cornell University Library. Downloaded on September 11,2020 at 04:16:35 UTC from IEEE Xplore. Restrictions apply.

You might also like