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

Feature Article: IoT-Based Weather Monitoring

Development of a
Cost-Effective
IoT-Based Weather
Monitoring System
Debashish Mohapatra Bidyadhar Subudhi
National Institute of Technology Rourkela Indian Institute of Technology Goa

Abstract—This work explores the development and deployment of a cost-effective IoT


platform to monitor and archival weather data, namely temperature, humidity,
atmospheric pressure, and dust particles in a residential area, using open-source
technologies. The IoT device sends the data to a remote virtual private server (VPS) over
the Internet. A server application runs 24x7 to collect the data and logs it into a database.
The necessary steps to set up a VPS server, secure it and install the IoT server application
implementing the message queuing telemetry transport protocol are also described. The
complete system is verified by real-time implementation using IoT devices, namely
NodeMCU ESP 8266 and Raspberry Pi Zero W, along with suitable sensors. The work
demonstrates the proof-of-concept feasibility of developing and deploying a scalable
weather station from scratch using open-source technologies for faster time to market
and the privacy and safety concerns with the end product.

& IOT DEVICES ARE finding an ever-increasing use glucose, blood pressure, seizures, and industrial
in our everyday lives. From monitoring weather process monitoring, IoT devices are extensively
parameters across the globe for weather forecast- used to gather all sorts of data. One can use the
ing to health monitoring applications, such as blood commercially available solutions to use the data
from IoT devices in a specific field. However,
depending on certain situations, such as privacy,
Digital Object Identifier 10.1109/MCE.2021.3136833 security, and cost, one may choose to deploy his
Date of publication 4 January 2022; date of current version 17 own IoT platform using existing technologies.
August 2022.

September/October 2022 Published by the IEEE Consumer Technology Society 2162-2248 ß 2022 IEEE
81
Authorized licensed use limited to: Institut Teknologi Bandung. Downloaded on March 21,2023 at 07:45:44 UTC from IEEE Xplore. Restrictions apply.
IoT-Based Weather Monitoring

In this article, we explore such a deployment to IOT ARCHITECTURE


build a local weather station using IoT devices. Figure 1 shows the IoT architecture of the pro-
Recent works have been done in this field demon- posed weather station to be designed. The IoT
strating the successful use of IoT devices to moni- nodes consist of the IoT processor/microcontrol-
tor weather data for smart agriculture.1 The use of ler, such as a Raspberry Pi7 or a NodeMCU
open-source platforms has two crucial advantages. ESP8266.8 The sensors are connected to the
First, being open source, their design can be inte- nodes via different interfaces, such as analog-to-
grated into a consumer product with ease. All the digital converter, I2C, one-wire, or Serial Periph-
design schematics are readily available without eral Interface Bus. The IoT nodes are connected
any significant investments to buy Intellectual to the IoT server via the Internet. The IoT server
property rights, which keeps the cost of the end runs on a remote computer, in this case, a VPS.
product low. This also makes the time-to-market The IoT server consists of a service that listens to
faster than developing the hardware from the new data incoming from the IoT nodes. MQTT
scratch.2 This helps a producer who is just ventur- is one such protocol that handles transmitting
ing out into producing consumer technology and receiving data to and from IoT devices. A
instead of being a passive consumer. Second, the database is installed on the IoT server to store
producer can ensure no hidden loopholes or back the device telemetry data for future analysis. The
doors in any of the hardware or software by using Thingsboard application programming interface
open-source technologies. The developers have a (API) provides user commands to access the data
clear picture of developing or improving upon the or modify any settings of the IoT server. The
low-level open-source codes for the programmable Thingsboard server has a real-time dashboard,
IoT devices,3 which increases privacy and safety. via which users can see and configure the real-
High-volume production of the consumer product time device telemetry data and historical data.
will benefit the producer in terms of profit gener- The Thingsboard API also provides the means to
ated from increased sales, whereas it will become query the server’s data via secured hypertext
more affordable for the consumer. transfer protocol (HTTPS) post commands, which
This article describes how we have chosen helps analyze the data using external tools, such
between the widely available IoT devices and as machine learning tools available with Python.
sensors. The setup of an IoT server with the
MQTT protocol4,5 from the ground-up has also
been explained. A real-time dashboard has been IOT HARDWARE
configured to show the incoming data from the For every IoT application, the IoT hardware is
IoT devices using the Thingsboard application.6 that interacts with the environment. The first
component of any IoT hardware is the one that
receives some input from the environment.
MOTIVATION Depending on the desired input, it can be a
Commercially available IoT weather-monitor- microphone, a motion sensor, or a sensor
ing systems are closed source in nature. We designed to measure any environmental parame-
believe closed-source software lead to monopoly ter such as temperature, barometric pressure,
of corporations. Open-source software enables humidity, and dust particulates. The IoT device
other manufacturers to modify, develop, and can also be an end-user device, such as a smart
improve upon it. Moreover, for a privacy con- light bulb or a smart speaker. What is common
cerned consumer, he/she can look into the source with IoT devices is communicating with a server
code of the open-source software to ensure his or with each other over the Internet.
rights to privacy are honored by the device manu- There are many choices available to choose IoT
facturer, whereas in closed-source software it is hardware. In this demonstration, it was decided to
not possible. design a weather station on an IoT platform using
open-source and low-cost sensors.
CONTRIBUTION
The contribution of this work is to demonstrate Choosing the IoT Client/Node
the feasibility of developing and deploying a proof- Any embedded microprocessor or microcon-
of-concept scalable IoT weather station using troller can be used as the IoT client to send the
open-source technologies, which can be adapted data to the server/logger. One can choose from
and extended by consumer technology producers. many available open-source hardware platforms.

82 IEEE Consumer Electronics Magazine

Authorized licensed use limited to: Institut Teknologi Bandung. Downloaded on March 21,2023 at 07:45:44 UTC from IEEE Xplore. Restrictions apply.
Figure 1. Typical IoT architecture utilizing MQTT.

One can choose the IoT platform based on the target IoT platform because of its ability to pro-
allowable portability, power consumption, and gram it remotely using the Jupyter integrated
device cost. A few of these widely available plat- development environment (IDE) for Python.
forms are noted in Table 1.
Since it was decided to use the existing Internet
connection for transmitting the data, any IoT plat- Choice of the Sensors for Weather Station
form with the Wi-Fi connectivity option could be For the demonstration purpose, we decided
selected. Table 1 shows that for a small weather to report the temperature, atmospheric pres-
station with four–five sensors, the best option is sure, and humidity. However, one can add ambient
the NodeMCU IoT board with ESP8266 system on a light, wind-speed, and various pollution indicators,
chip. However, the Raspberry Pi Zero W single- such as PM 2.5 particulates (or dust sensor), car-
board computer (SBC) was also selected as the bon dioxide, carbon monoxide, etc. Some of the
widely available sensors are listed in Table 2.

Table 1. Some popular open-source IoT hardware platforms.

Programming Connectivity Approx. cost


IoT platform Processor
environment option (USD)
1.5 GHz Quad Core 64-bit ARM
Raspberry Pi 4 SBC7 Python, C/C++ Wi-Fi, Ethernet 35
Processor

Raspberry Pi Zero W 1 GHz, Single Core CPU Python, C/C++ Wi-Fi 15

Arduino Uno/Pro/ Add-on GSM/


16 MHz, 8-bit MCU C++ via Arduino IDE 5–15
Mini Wi-Fi

84 MHz, 32-bit ARM Cortex M0 Add-on GSM/


Arduino Due C++ via Arduino IDE 40
MCU Wi-Fi

Node MCU ESP 8266 Arduino IDE,


32-bit RISC CPU Wi-Fi 05
Board8 MicroPython

Linkit One9 260 MHz, ARM7 MCU Arduino IDE Wi-Fi, GSM 60

September/October 2022
83
Authorized licensed use limited to: Institut Teknologi Bandung. Downloaded on March 21,2023 at 07:45:44 UTC from IEEE Xplore. Restrictions apply.
IoT-Based Weather Monitoring

Table 2. Available sensors. Figure 2 shows the IoT device’s operational


flowchart used to publish/transmit the weather
Cost telemetry data to the MQTT broker/server. During
Parameter Sensor Interface
(USD)
the IoT device’s programming/development, it is
Temperature LM 35 Analog 0.5 useful to have serial debugging to identify any pro-
Barometric gram faults. However, once the program works
BMP180 I2C 1
Pressure fine and the device is ready for deployment, the
extra commands for serial printing and debugging
Humidity DHT22 1-Wire 4
should be removed to minimize the power usage.
Dust Sensor GP2Y1010AU0F Analog 5

In this experiment, three sensors are used: a CHOOSING THE IOT SERVER
DHT22 humidity sensor, a BMP085 atmospheric All IoT devices must either communicate to
pressure sensor, and a Sharp GP2Y1010AU0F dust a central server or with each other based on
sensor. Both DHT22 and BMP085 can provide tem- the requirement. Many different techniques can
perature readings, which reduces the number of be employed to establish communication with
sensors needed with the microcontroller. the IoT server. The MQTT protocol is the most
popular method to implement communication
Internet Connectivity Options between IoT devices over the Internet. In this
All IoT devices must talk over the Internet. experiment, it was decided to set up an IoT
Depending on how they are deployed in the field, server using open-source software.
one may choose any available option, enabling
the IoT device to communicate to the IoT server
over the Internet successfully. Therefore, if the Setting Up a Low-Cost VPS
IoT device is deployed in a remote area, global For a weather station to work as expected, the
system for mobile communications (GSM) can be IoT server needs to be running 24x7 and have a reli-
chosen. A GSM module can be used with all the able Internet connection. The IoT server need not
IoT devices mentioned previously to provide a have high hardware specifications, such as a dedi-
general packet radio service connection. More- cated server used to host commercial websites.
over, if an SBC such as the Raspberry Pi is chosen One can choose to deploy a virtual private server
as the IoT hardware, then a 3G/4G USB dongle for this purpose. Many reputed commercial VPS
can be used to provide the necessary Internet providers provide a VPS with limited resources for
connectivity. In this case, since the IoT device a reasonable and minimal fee. The most important
was to be kept just outside the laboratory’s win- feature of a VPS is that it remains online 24x7 so
dow, it was decided to use the existing Internet that when the IoT device reports the data, it is
connection of the lab via Raspberry Pi Zero W received by the IoT server and gets logged into the
and ESP8266’s integrated Wi-Fi connectivity. database for future analysis.

IoT Device Programming


Based on which platform is chosen as the IoT Installing and Configuring the IoT Server
client, the device’s programming will differ. Even Application
though it has a minimal form factor, the Raspberry Many open-source software bundles provide
Pi is a full-fledged computer, with a powerful quad- the MQTT protocol for IoT applications. The
core processor and sufficient RAM to run a Linux “Thingsboard” platform was chosen as the desired
operating system quite well. The Jupyter Note- software suite to act as the IoT server software. It
book can be configured on the Raspberry Pi, acts as an MQTT broker and has many additional
which can be accessed from the local area net- features such as real-time data streaming analytic
work, just by providing the IP address of the SBC. and a front-end to display the telemetry data as
This allows users to write Python programs for interactive graphs, charts, and gadgets. The
the Raspberry Pi remotely. Once the program is “PostgreSQL” database was chosen as the data
ready, it is converted into a script to run on sys- storage software for storing the IoT device data.
tem boot continuously, which reports the sensor The “Thingsboard” front-end can be accessed
data to the IoT server on the cloud. from the configured domain/subdomain.

84 IEEE Consumer Electronics Magazine

Authorized licensed use limited to: Institut Teknologi Bandung. Downloaded on March 21,2023 at 07:45:44 UTC from IEEE Xplore. Restrictions apply.
Figure 3. IoT devices interfaced with an
atmospheric pressure sensor (BMP085) and a
humidity sensor (DHT22/AM2302). (a) Raspberry Pi
Zero W as IoT device. (b) ESP 8266 IoT device.

IoT Device Streaming Telemetry


Once the devices were set up successfully, the
reported data were verified on the Thingsboard
dashboard on the VPS. Figure 4 shows the config-
ured dashboard to show the charts, graphs, and
widgets with a real-time update from the last three
days. The user can also query a specific range of
data displayed on the graphs by setting a query
window within a range of dates and times.

Extraction of the Telemetry History


The Thingsboard API provides an HTTP/HTTPS
POST command to retrieve the data for any teleme-
try data for any device from the PostgreSQL data-
base on the VPS after successful authentication
with the Thingsboard IoT server instance. The data
between a specific range of dates and times can be
Figure 2. Operational flowchart of the IoT weather
queried using the Requests library in Python, which
station. results in a JSON file. After converting the JSON file
RESULTS AND DISCUSSION to a Pandas data-frame, it becomes easy to analyze
the data using appropriate software tools to
IoT Hardware Implementation deduce essential information, which can help
Figure 3 shows two different hardware imple- design better consumer technologies.
mentations of the IoT devices. The first one uses
a Raspberry Pi Zero W board, as shown in
Figure 3(a), and the second one is using an
ESP8266 Module, as shown in Figure 3(b). CONCLUSION
It should be noted that both the IoT device A weather monitoring system was developed
implementations are connected to a 5 V power with temperature, humidity, pressure, and a
supply through a micro-USB interface. Both of the dust sensor using embedded IoT devices. A VPS
IoT devices require about 100 to 400 mA current, was configured to run the IoT server software
depending on the usage. However, suppose low “Thingsboard” utilizing the MQTT protocol.
reporting rates (e.g., one sample per second or Important weather parameters were gathered in
slower) is acceptable. In that case, the ESP 8266 a residential area, which can be further extended
device can be configured for deep-sleep modes, and used in different ways as identified by the
which reduces the overall power consumption sig- consumer technology producers. This paves
nificantly. The deep-sleep mode is a desirable fea- ways to develop new consumer technologies, as
ture for the remote implementation of IoT devices. well as to improve upon the existing ones.

September/October 2022
85
Authorized licensed use limited to: Institut Teknologi Bandung. Downloaded on March 21,2023 at 07:45:44 UTC from IEEE Xplore. Restrictions apply.
IoT-Based Weather Monitoring

Figure 4. Screenshot of the configured Thingsboard dashboard.

& REFERENCES 7. R. Pi, “Raspberry Pi 3 model B,” 2015. [Online].

1. P. K. Tripathy, A. K. Tripathy, A. Agarwal, and Available: https://www.raspberrypi.org


S. P. Mohanty, “MyGreen: An IoT-enabled smart 8. M. Kashyap, V. Sharma, and N. Gupta, “Taking MQTT

greenhouse for sustainable agriculture,” IEEE Consum. and NodeMcu to IoT: Communication in Internet of
Electron. Mag., vol. 10, no. 4, pp. 57–62, Jul. 2021, Things,” Procedia Comput. Sci., vol. 132, pp. 1611–1618,
doi: 10.1109/MCE.2021.3055930. 2018, doi: 10.1016/j.procs.2018.05.126.
2. I. V. McLoughlin, “Open-source and consumer 9. H. Jiang, Y. Li, and D. Li, “Indoor environment
electronics—The back door to world domination: Why monitoring system based on Linkit One and Yeelink
reinvent the wheel (especially when nice people are platform,” in Proc. 2nd IEEE Int. Conf. Comput.
giving wheels away for free)?,” IEEE Consum. Commun., 2016, pp. 933–937, doi: 10.1109/
Electron. Mag., vol. 1, no. 2, pp. 53–58, 2012, compcomm.2016.7924841.
doi: 10.1109/MCE.2011.2181882. Debashish Mohapatra is currently an embedded
3. E. Moguel, M. Linaje, J. Galan-Jimenez, and C. systems developer at Pragathi Solutions, Bengaluru,
Vicente-Chicote, “Can consumer electronics be truly India. Mohapatra received the B.Tech. degree in
open,” IEEE Consum. Electron. Mag., early access, applied electronics and instrumentation engineering
May 17, 2021, doi: 10.1109/MCE.2021.3080660. from the Biju Patnaik University of Technology, Rour-
4. U. Hunkeler, H. L. Truong, and A. Stanford-Clark, “MQTT- kela, India, in 2005, and the M.Tech. degree in control
S—A publish/subscribe protocol for wireless sensor and automation and the Ph.D. degree in electrical
networks,” in Proc. 3rd Int. Conf. Commun. Syst. Softw. engineering from the National Institute of Technology
Rourkela, Rourkela, in 2015 and 2021, respectively.
Middleware Workshops, 2008, pp. 791–798, doi: 10.1109/
Contact him at admin@debashish.info.
COMSWA.2008.4554519.
5. R. A. Light, “Mosquitto: Server and client implementation Bidyadhar Subudhi is currently a professor with the
of the MQTT protocol,” J. Open Source Softw., vol. 2, School of Electrical Sciences, Indian Institute of Tech-
no. 13, p. 265, 2017, doi: 10.21105/joss.00265. nology Goa, Ponda, India. Subudhi received the B.S.
6. L. T. De Paolis, V. De Luca, and R. Paiano, “Sensor degree from the National Institute of Technology Rour-
data collection and analytics with Thingsboard and kela, Rourkela, India, in 1988 and the master’s degree
Spark streaming,” in Proc. IEEE Workshop Environ., from the Indian Institute of Technology Delhi, New Delhi,
Energy, Struct. Monit. Syst., 2018, pp. 1–6, India, in 1994, both in electrical engineering, and the
doi: 10.1109/eesms.2018.8405822. Ph.D. degree in control and instrumentation from the
University of Sheffield, Sheffield, U.K., in 2003. Contact
him at bidyadhar@iitgoa.ac.in.

86 IEEE Consumer Electronics Magazine

Authorized licensed use limited to: Institut Teknologi Bandung. Downloaded on March 21,2023 at 07:45:44 UTC from IEEE Xplore. Restrictions apply.

You might also like