Implementing IoT Technology in Practice:
Monitoring the Supply Chain for Sustainable Operation
CHRISTOS PECHLIVANIS
Sector of Industrial Management and Operational Research, School of Mechanical Engineering,
National Technical University of Athens,
9, Iroon Polytechniou str., 15772, Zografou, Attica,
GREECE
Abstract: The Internet of Things (IoT) is proliferating, with thousands of new sensors and equipment going live
each month. Despite its lengthy evolution, the Internet of Things has only recently begun to take off in the mass
market due to low-cost, reduced-power elements, ubiquitous web access, and high business and consumer
interest. The Internet of Things includes anything from intelligent kitchen appliances to smart buildings, smart
lighting on streets to automated manufacturing processes, and adaptive home heaters to autonomous vehicles.
This research concerns studying and applying Internet of Things (IoT) technology to monitor the supply chain
and achieve more sustainable operations by ensuring accurate and real-time data monitoring. In this context, an
experimental device is developed to read the values of selected physical quantities from the wine supply chain
environment through appropriate sensors. The values are then sent to an IoT platform to facilitate the remote
monitoring of the above physical quantities and extract valuable insights from the large volume of data
generated. The results show that crucial information can be gathered in real-time, enabling quick decision-
making and ensuring safer and more sustainable supply chain operations.
Key-Words: Internet of Things; Supply Chain; Sensors; Real-time Monitoring; Sustainability
Received: July 9, 2022. Revised: March 1, 2023. Accepted: March 17, 2023. Published: March 24, 2023.
1 Introduction
The Internet of Things (IoT) is a system of linked
devices, electronic and mechanical machines, items,
and living beings, that have unique identifiers
(Unique Identifiers UIDs) and can transfer
information through a network without the
requirement of human-to-human or human-to-
computer interaction. A thing in the internet of
things could be a human wearing a smartwatch, a
farm animal with a micro / nano transmitter, a
vehicle with integrated sensing devices that alert
people when gas leakage is detected, or any other
organic or artificial entity that can be appointed an
Internet Protocol (IP) identifier and can transfer data
over a network [13].
IoT enables individuals to live and work more
efficiently and acquire total control over their life.
IoT is vital for companies in addition to providing
mobile smart devices for operation automation [4].
IoT enables organizations to monitor their systems'
performance in real-time, delivering data on
anything from machine performance to supply chain
and logistics procedures[5]. The Internet of Things
allows companies to streamline operations and cut
personnel expenses. In addition, it lowers waste and
enhances service delivery, reducing the cost of
production and delivery of goods and enhancing the
transparency of consumer interactions.
Consequently, IoT has become an essential
technology and will keep growing as increasing
numbers of organizations see the possibilities of
interconnected devices to enable them to survive
and thrive[6].
The IoT network is rapidly expanding, with
countless new devices and sensors coming into play
each month. Despite its relatively long track record,
the Network of Things is only now commencing to
take off due to the availability of low-cost, low
energy needing solutions, extensive network access,
and the high level of business and consumer interest
[7, 8]. The Internet of Things includes anything
from intelligent kitchen appliances to smart
buildings, tracking devices in distribution networks
to healthcare monitoring devices, and adaptive
heaters to self-driven vehicles [9, 10].
Today, more than ever, developing IoT
applications is becoming more cost-effective,
simpler, and much more generally accepted than
ever before, resulting in modest waves of
advancement throughout the market. IoT is
advancing as an intriguing premise for the coming
years. This can be seen in today's applications, such
WSEAS TRANSACTIONS on SYSTEMS
DOI: 10.37394/23202.2023.22.38
Christos Pechlivanis
E-ISSN: 2224-2678
349
Volume 22, 2023
as automated vehicles and smart homes, which are
constantly becoming more effective and accessible
[11, 12]. The retail industry and the supply chain
generally have a considerable potential to become
more intelligent. Proximity advertising through
Beacons and innovative inventory management
technologies used in stores with no cash registers
are prime examples [6,13]. However, IoT devices
and apps in retail usage extends beyond the buying
experience. It allows hotel, food, and
beverage service providers and other companies to
monitor their resources and gather valuable data.
This can give merchants complete control over their
supply chain operations by automating many
manually performed actions. [14]. Thus, business
owners can avoid placing large orders, effectively
limit staff members who abuse their privileges and
manage logistics and trade costs more efficiently.
The above benefits, in turn, lead to high adoption
rates of all IoT products along the supply chain [15].
The benefits of IoT in supply chain management are
summarized as follows [16–18]:
enhanced supply chain transparency
automated check-in and check-out of goods
monitoring the location of the goods and the
storage conditions in the warehouse
preventive maintenance of the equipment
inventory management and theft prevention
improving the shopping experience and customer
service
detection and early notification of any problems
during transport
warehouse demand notification
route optimization
This research builds on the massive potential of the
supply chain sector and presents an application of
Internet of Things (IoT) technology to monitor the
supply chain and achieve more sustainable
operations by ensuring accurate and real-time data
monitoring. To achieve this goal, it is necessary to
use a few critical parts of an Internet of Things
application, such as Sensors and Deployment
Boards, for reading the potential of physical
quantities, converting them into electrical
potential/voltage, translating them into data,
processing and sending them, and IoT Platforms,
which allow the end user to monitor the desired
variable within the supply chain. This research
differs from most existing ones by connecting
theory with practice as it has a theoretical
contribution and presents a working IoT application
developed to demonstrate a simple, flexible and
cost-effective solution for more sustainable supply
chain operations.
In the remainder of the paper, in section 2, the
architecture of the Internet of Things is analyzed,
including the necessary components and some
information on how each layer works. Section 3
presents the basic parts that make up a typical
Internet of Things application. More specifically,
this section provides information on the sensors,
actuators, development boards and IoT platforms
necessary to develop any IoT application. Finally,
section 4 concerns the case study of the research and
includes a description of the parts that make up the
developed experimental setup, as well as the way of
its implementation, i.e., the circuit and the codes
that were created for connecting devices and
communicating. Finally, the developed dashboard is
presented through which users can monitor, in real-
time, the values of the selected physical quantities.
2 ΙοΤ Architecture & Characteristics
As seen in Figure 1, an IoT ecosystem includes
internet-enabled, smart devices that employ
intelligent systems such as processing units, sensors,
and devices that communicate to collect, transmit,
and act on environmental data. IoT devices
exchange the sensor data they acquire by connecting
to an IoT Gateway, from which the information is
either transferred to the Web or processed in a local
environment. Occasionally, these devices connect
with other interconnected smart objects and act in
response to the data they receive [19]. Most tasks
are performed by equipment without interaction
between people; however, individuals can engage
with these devices to make them work, provide
them with directions, or monitor the information.
These web devices' connection, infrastructure, and
protocols significantly rely on the deployed IoT
applications. IoT may also utilize artificial
intelligence (AI) and machine learning (ML)
technology to make data-collecting procedures more
dynamic and efficient [20].
Fig. 1: IoT Ecosystem
Established decades ago, the Transmission Control
Protocol (TCP) / IP protocol stack is currently used
WSEAS TRANSACTIONS on SYSTEMS
DOI: 10.37394/23202.2023.22.38
Christos Pechlivanis
E-ISSN: 2224-2678
350
Volume 22, 2023
by the World wide web to interact among nodes.
Nevertheless, the Internet of Things links thousands
of items, increasing bandwidth and necessitating
significantly greater storage space. Moreover, IoT
confronts several privacy and security
difficulties[19]. Thus, the newly suggested Internet
of Things (IoT) infrastructure must handle various
elements, such as scaling, interoperability,
dependability, service quality, etc. [20]. Considering
IoT links each and every individual in order for
them to exchange information, internet traffic and
data transfer will expand dramatically. Therefore,
the growth of IoT depends on technological
progress and the creation of new applications and
economic models. The fundamental IoT architecture
consists of five levels, as seen in Figure 2.
Fig. 2: Basic IoT Architecture
This basic IoT architecture consists of five main
layers [21]:
1. Perception Layer: This is also referred to as the
"device layer". Material entities and sensing
devices constitute its composition. Depending on
the manner of object detection, the sensors may
be RFID, 2D-barcode, or infrared sensors. This
layer is primarily focused on the recognition and
information gathering of entities via sensing
devices. Depending on the kind of devices, the
information may be associated with a plethora of
physical aspects. The gathered information is
subsequently sent to the network layer for safe
transmission to the data processor.
2. Network Layer: This is often referred to as the
transport layer. This layer transmits the
information collected by the sensing devices to
the data processor securely. The communication
method may be cable or wirelessly, depending on
the sensing devices. Consequently, the network
layer sends data from the perception layer to the
middleware layer.
3. Middleware Layer: This layer oversees managing
IoT services and database connections. This layer
gathers information from the network layer and
stores it in a repository. It analyses the input,
performs omnipresent computations, and makes
choices automatically based on the outcomes.
4. Application Layer: This layer enables global
application administration based on item
information processed in the middleware layer.
Applications of IoT have a vast variety and may
include smart buildings and cities, smart
cultivations, smart supply chains, etc.
5. Business Layer: This layer is accountable for
controlling the IoT ecosystem, encompassing
apps and data. It develops business strategies and
models using information collected from the
application layer, including graphs, diagrams,
etc. The true success of an IoT ecosystem also
depends on effective business strategies, and this
level helps determine subsequent decisions and
business strategies based on examining the
outcomes.
3 Components of an IoT Application
The world of the Internet of Things (IoT) continues
to grow and evolve rapidly, effectively framing the
capabilities of the cloud. Broadly speaking, IoT is a
network of physical objects that exchange data over
the internet. Every advancement in the IoT market
leads to an increase in businesses benefiting from
the technology, which is becoming more and more
advanced over time. The benefits of IoT cannot be
ignored, with its use in sectors ranging from home
automation and agriculture to medicine and supply
chains. Technology has the potential to assist
different businesses with multifaceted requirements
[22, 23]. This section presents the main components
necessary for developing any IoT application.
Sensors are the leading component, and today,
more than ever, are used in a plethora of industrial
operations. Industrial enterprises and organizations
have been using various kinds of sensors, but the
invention of the Internet of Things has taken the
evolution of sensors to a whole different level. IoT
platforms operate and deliver various types of
intelligence and data using a wide range of sensors.
They serve to collect data and send and share it
across a whole network of connected devices. All
this collected data allows devices to operate
autonomously, and the entire ecosystem is
becoming increasingly "intelligent" every day [24].
WSEAS TRANSACTIONS on SYSTEMS
DOI: 10.37394/23202.2023.22.38
Christos Pechlivanis
E-ISSN: 2224-2678
351
Volume 22, 2023
By combining a set of sensors and a
communication network, devices share information
with each other and improve their efficiency and
functionality. For example, Tesla vehicles. All the
sensors in a car record the information they receive
from the environment, which they upload to a vast
database. The data is then processed, and all
important new information is sent to all other
vehicles. It is an ongoing process through which an
entire fleet of Tesla vehicles becomes smarter every
day [25, 26]. The primary sensors used in industrial
IoT applications are for receiving data and
monitoring the following physical aspects:
1. Temperature
2. Proximity
3. Pressure
4. Water Quality
5. Chemical Properties
6. Gas
7. Smoke
8. Infrared Rays
9. Fluid Level
10. Image Transformation
11. Motion Detection
12. Acceleration
13. Gyroscope
14. Humidity
15. Optical Rays
Another critical component is the actuators. In IoT,
actuators provide the ability to perform a physical
action or movement based on data coming from one
or more sensors. The transformation of the data
collected by the sensors into action follows the
following sequence [27]:
Sensors that detect sense a change occurring in the
natural world.
Sensors turn event-related data into electrical
impulses sent to a controlling device, whose
system calculates when and what action is
required.
The controlling device commands the actuator to
execute the needed motion.
The actuator performs its function by transforming
electricity into real action.
For instance, an Internet of Things application that
controls a fridge contains sensing devices that read
its temperatures. As designed, the sensors provide
heat information to the management unit. The
control mechanism checks these measured data
compared to the preset ideal temperature range. If
the data is above or below this spectrum, the
management system transmits an order to an
actuator to activate or deactivate the fans. In several
IoT solutions, the sensor, controller, and actuator are
distinct physical components that connect through
wireless or cabled networking and a Web service. In
other instances, these three components are
incorporated into a single physical device. A basic
definition of an actuator is a mechanism that
converts power into activity or movement [28, 29].
As the IoT ecosystem grows, so does the need for
IoT development boards, which can be used for both
testing and mass production. A development board
is only a component that connects containing
electrical circuits and hardware intended to facilitate
experimentation with a specific microcontroller. IoT
developers mostly utilize them to construct trials
before launching the finished versions. There are
three classes of IoT boards [30, 31]:
1. Microcontroller-based boards: These boards
include a miniature computer built on a metal
oxide semiconductor circuit chip.
2. System-on-chip (SoC) boards: An SoC board
incorporates all the required electrical parts and
circuit system components on a single Si chip.
3. Single Board Computers (SBC): A SBC is a
computer constructed entirely on a single printed
circuit board. It contains all functional computer
components and is mainly used for
demonstrating purposes.
IoT platforms are the last component essential for
every IoT solution. The Internet of Things (IoT)
platform industry is expanding, with the value of the
worldwide IoT market anticipated to reach $1.1
trillion by 2026 [32]. This significant growth in
demand for IoT applications is due to the rise of IoT
solutions and other associated components. IoT
sensors and many connected components need a
coordinator - IoT platforms - to collaborate and
operate smoothly within the same ecosystem and
provide the highest potential competitive
advantages. IoT platforms are middleware systems
that link IoT solutions to the cloud and enable
smooth data interchange across the network. They
serve as intermediaries between the application
layer and the hardware resources. There are
currently several IoT platform suppliers on the
marketplace and every one of them has its unique
method for simplifying and scalability IoT
integration and administration [33].
WSEAS TRANSACTIONS on SYSTEMS
DOI: 10.37394/23202.2023.22.38
Christos Pechlivanis
E-ISSN: 2224-2678
352
Volume 22, 2023
4 Case Study: Developing an IoT
Application for the Wine Supply
Chain
It was decided to select the wine supply chain as a
case study for developing an IoT application. This
specific supply chain needs significant
improvements for traceability and protection against
counterfeit activities as it is highly vulnerable.
Moreover, ineffective traceability may lead not only
to economic losses but also to severe health risks as
wines are found to be frequently adulterated. In the
present case study, it was decided to monitor the
temperature and humidity conditions of wines to
ensure that no quality deterioration exists during the
aging process of the wines. However, to effectively
combat counterfeit activities, many more physical
aspects would be required to be monitored.
Figure 3 presents the selected IoT components as
they were analyzed in section 3.
Fig. 3: Selected IoT Components for the Case Study
A Digital-output, relative Humidity, and
Temperature (DHT11) sensor monitors the
temperature and humidity prevailing inside the
storage area. There are many different versions of
this sensor. In the present work, a sensor of this type
with four pins was used. The DHT11 is a relative
humidity meter. The definition of relative humidity
is the ratio of the quantity of water vapor in the air
to its saturation point. At the saturation point, water
vapor condenses and collects on surfaces,
generating dew. The saturation point varies with air
temperature. Cool air can trap less water vapor
before saturation occurs, unlike warm air which has
a higher saturation point. The relative humidity is
expressed as a percentage. In other words,
condensation occurs when we have 100% relative
humidity, while when we have 0% relative
humidity, the air is completely dry.
The DHT11 measures the electrical resistance
between two electrodes to detect water vapor. The
moisture sensing device is a moisture-retentive
substrate with surface-mounted electrodes. When
the substrate absorbs water vapor, ions are
discharged from its surface, increasing the
conductivity between the electrodes. The ratio of the
change in resistance between the two electrodes to
the relative humidity is proportionate. Lower
relative humidity raises the resistance between the
electrodes, while higher relative humidity reduces
the resistance. The DHT11 uses a Negative
Temperature Coefficient (NTC) temperature sensor
to monitor temperature (thermistor). Thermistors are
a type of resistor whose value is affected by
temperature much more than ordinary resistors. The
thermistor used in the DHT 11 is NTC, which
means that the resistance decreases with increasing
temperature.
Using jumper cables and a breadboard, the
DHT11 sensor is connected to the Raspberry Pi
through the General-Purpose Input/Output (GPIO)
pins. Specifically, pin 2 is a serial data (SDA) pin
used for data transfer and is connected to GPIO 17,
pin 1 is a Voltage Common Collector (VCC) pin
related to power and is connected to GPIO 3V3
power, which provides an output voltage of 3.3V,
pin 4 is a Ground (GDN) pin connected to GPIO
Ground, while pin 3 is Not Connected (NC)
somewhere as it has no functional purpose for the
external circuit. To get the data from the sensor, the
dht11.py library was used which is imported at the
beginning of the code. First, the numbering method
that will be used to determine the GPIO pins
through which communication takes place between
the sensor and the Raspberry Pi, specifically GPIO
17, is determined. In this particular case, the
Broadcom (BCM) numbering method GPIO.BCM is
used where the various GPIO pins are identified by
their number, i.e., for GPIO 17 we simply write 17.
Another way of numbering is GPIO.BOARD in
which the identification of GPIO pins is done by
writing the number of the position as they are
physically arranged with the numbering starting
from 1 and reaching up to 40. Then, using the
dht11.py library, we construct an object of the
DHT11 class inside the above library. Creating the
above object requires determining the GPIO pin to
which SDA pin 2 of the sensor is connected.
Finally, it is possible to read the temperature and
humidity values through the read method.
WSEAS TRANSACTIONS on SYSTEMS
DOI: 10.37394/23202.2023.22.38
Christos Pechlivanis
E-ISSN: 2224-2678
353
Volume 22, 2023
Raspberry Pi 4 Model B was used as a development
board in this work. Raspberry is a credit card-sized
computer developed by the Raspberry Pi Foundation
in Great Britain and first sold in 2012. Although
initially promoted as a means of teaching computer
science in developing countries, it has also seen
great commercial success in other areas, such as
robotics. This has led to the release of several
versions, including improvements over previous
versions in terms of computing power, using a faster
processor and more RAM, as well as Raspberry
connectivity, with Wi-Fi and Bluetooth integration,
without the need to add an external adapter.
Finally, Ubidots was used as a development
platform. Ubidots is a platform that supports the
development of IoT applications. It enables the user
to record, monitor, and manage in real-time the data
collected by the sensors through any networking
technology, and turn it into useful information. In
addition, it allows configuring actions and alerts
based on the state of the system as determined
through sensor readings. It also offers powerful data
visualization tools, some of which were utilized in
the current implementation. Finally, the platform is
available in two versions. The first is for personal or
academic use and is complimentary, while the
second, which comes with more features, is for
businesses and requires paying fees. The
complimentary version of the Ubidots platform,
Ubidots STEM, was used in the current work.
To transfer the data from the sensor through the
Raspberry Pi to the Ubidots platform, the MQTT
communication protocol was used, which is a
publish-subscribe protocol as opposed to the more
widespread HTTP communication protocol, which
is of the get-request type. This protocol consists of
three entities, the publisher, the subscriber, and the
broker. Communication using this protocol is done
through topics. Specifically, the publisher publishes
some values on a topic. On the other hand, the
subscriber subscribes to a topic to be informed about
its prices. Finally, the broker manages all the
publications in the various topics from the
publishers and then informs the subscribers in each
topic about the new prices.
To connect the Raspberry Pi to the Ubidots
platform through the MQTT communication
protocol, we first created a device on the Ubidots
platform named "raspberrypi". Then we created two
variables in this virtual device, one with the name
"temperature" and one with the name "humidity". In
this way, we created the necessary topics in which
the Raspberry Pi will publish the new temperature
and humidity values that the sensor reads. Finally,
The UbidotsIoTDevice class was developed as a
wrapper of the "paho mqtt" library, which enables
connection to an MQTT broker to publish and
receive messages by subscribing to topics using the
MQTT communication protocol. The above class
aims to hide, as much as possible, the complexity
involved in the process of creating code to establish
communication between an internet-enabled
computing device and the Ubidots STEM platform
from the user-programmer. The body of the
UbidotsIoTDevice class is listed in Appendix A.
Figure 4 presents the physical circuit as it was
developed. In addition to the sensor and the
Raspberry Pi, together with its GPIO Extension
Board to avoid damage to the GPIO pins, a
breadboard and jumper wires were used to
implement the circuit.
Fig. 4: The Physical IoT Circuit
A breadboard is a board used to make temporary
circuits. It has multiple holes in horizontal or
vertical groups that share the same potential through
metal cables that connect them and are under the
plastic cover. The great advantage of this board is
that it offers a quick, direct, and non-permanent way
of connecting and disconnecting electronic
components to each other without any risk of
damaging them, provided that the various
components are handled with the required care. This
makes it the most efficient way to test circuits.
As far as jumper wires are concerned, they are
simple cables with the appropriate configuration at
their ends, either pins or recesses, thus allowing the
possibility of connecting two points without
welding. They are usually used together with a
breadboard to change the wiring of a circuit directly.
There are three types of jumper wires: Male to
Male, Male to Female, and Female to Female. The
difference is that the male termination corresponds
to a pin, while the female termination corresponds
to a socket (each cable has two terminations).
Additionally, an appropriate code was
developed in the PYTHON programming language
to read the temperature and humidity values from
the Raspberry Pi 4 Model B development board
through the DHT11 temperature and humidity
sensor. This code is also used for sending the values
from the Raspberry Pi 4 Model B development
board to Ubidots STEM platform using the
WSEAS TRANSACTIONS on SYSTEMS
DOI: 10.37394/23202.2023.22.38
Christos Pechlivanis
E-ISSN: 2224-2678
354
Volume 22, 2023
UbidotsIoTDevice class. This code is presented in
Appendix B.
Finally, to create the interface through which
the user will be able to monitor the temperature and
humidity values in real-time during the transfer
stage, the tools offered by the Ubidots STEM
platform environment were used. The interface is
shown in Figure 5. On the left, in the two widgets,
the user can read the temperature and humidity
values in real-time, while on the right, in the two
graphs, they can monitor the evolution of these
values over the last 24 hours.
Fig. 5: Dashboard for Monitoring Temperature and
Humidity Values
5 Conclusion
It has been predicted that the demand for IoT
technology will grow much faster to cover billions
or even trillions of wireless devices and sensors in
the coming years. However, this increase will
depend to some extent on the ability of
manufacturers to reduce the cost of IoT devices
while also meeting all users' needs. The developed
IoT application attempted to present a cost-effective
solution for measuring temperature and humidity in
the wine supply chain. The application uses a
DHT11 sensor that measures temperature and
humidity. The sensor is connected to the Raspberry
Pi 4 Model B development board using a GPIO
Extension Board, a breadboard, and jumper wires.
The development board connects to the Ubidots
platform through the developed UbidotsIoTDevice
class. Finally, the appropriate PYTHON code
enables reading temperature and humidity data from
the sensor. The IoT application was tested in a lab
environment and both the temperature and humidity
data were confirmed to be highly accurate.
The developed application is a simple, flexible,
and cost-effective method to monitor temperature
and humidity in the wine supply chain. Applying
such solutions in business operations presents a
massive opportunity to build a sustainable and
prosperous future. IoT technology may help
organizations reduce their environmental effect,
adjust to a new context, and increase their
production and effectiveness. Notably, in the supply
chain, IoT technology can significantly reduce the
carbon footprint of activities and lead to a more
efficient use of available resources.
The application proposed in this work can be
used, with some additions and improvements,
throughout the supply chain, even in crops or fields,
to monitor soil temperature and humidity. To install
the device in an outdoor environment, it is necessary
to place it in a waterproof housing and to be
powered by a rechargeable battery, possibly
connected to a photovoltaic panel, so that charging
is done automatically. It can also be expanded so
that, in addition to the monitoring part, it also
implements automation, such as the automatic
notification of companies when the temperature and
humidity levels go beyond the permissible limits. In
fact, the notification can be made in real-time so that
the necessary measures are taken immediately, and
the quality of the products is not altered.
In addition, the application can be enriched
relatively quickly with a variety of other suitable
sensors to enable efficient monitoring of the entire
supply chain. Examples of sensors that could be
used are motion sensors to detect attempted
sabotage, chemical sensors to detect changes in the
quality of wine, fluid level sensors to detect
attempts to dilute wine, accelerometers, and
gyroscopes to detect unwanted movements and even
location devices to monitor the wine transportation.
Therefore, as it becomes clear, IoT technology
presents a massive potential for more accurate, safe
and sustainable supply chain operations.
6 Appendix A: UbidotsIoTDevice
Class
---Start of Code---
import paho.mqtt.client as mqtt
import socket
import time
# Ubidots
HOST = "things.ubidots.com"
PORT = 1883
TOPIC = "/v1.6/devices/"
class UbidotsIoTDevice:
WSEAS TRANSACTIONS on SYSTEMS
DOI: 10.37394/23202.2023.22.38
Christos Pechlivanis
E-ISSN: 2224-2678
355
Volume 22, 2023
def __init__(self, device_token: str,
device_label: str, *variables_to_subscribe:
str):
self.__connected = False
self.__subscribed = False
self.__published = False
self.__reconnected = -1
self.__device_token = device_token.strip()
self.__device_label =
device_label.strip().lower()
self.__variables = dict()
for variable in variables_to_subscribe:
self.__variables[variable.strip().lower()] = -1
self.__client = self.__create_mqtt_client()
self.__create_subscriptions()
def __del__(self):
self.__client.loop_stop()
self.__client.disconnect()
def __on_connect(self, client, userdata, flags, rc):
if rc == 0:
self.__connected = True
self.__reconnected += 1
if self.__reconnected:
self.__create_subscriptions()
def __on_subscribe(self, client, userdata, mid,
granted_qos):
self.__subscribed = True
def __on_publish(self, client, userdata, mid):
self.__published = True
def __create_mqtt_client(self):
client = mqtt.Client()
client.username_pw_set(username=self.__devi
ce_token, password="")
client.on_connect = self.__on_connect
client.on_subscribe = self.__on_subscribe
client.on_publish = self.__on_publish
while not self.__connected:
try:
client.connect(host=HOST, port=PORT)
client.loop_start()
time.sleep(1)
except socket.gaierror:
pass
return client
def __create_subscriptions(self):
for variable in self.__variables.keys():
callback = self.__create_callback(variable)
self.__client.message_callback_add(TOPIC
+ self.__device_label + "/" + variable +
"/lv", callback)
while not self.__subscribed:
self.__client.subscribe(TOPIC + self.__device_label
+ "/" + variable + "/lv", qos=1)
time.sleep(1)
self.__subscribed = False
def __create_callback(self, variable):
def on_message(client, userdata, message):
self.__variables[variable] =
float(message.payload.decode("utf-8"))
return on_message
def read(self, variable: str):
return self.__variables[variable.strip().lower()]
def write(self, variable: str, value):
while not self.__published:
self.__client.publish(TOPIC +
self.__device_label + "/" +
variable.strip().lower(), value, qos=1)
time.sleep(1)
self.__published = False
---End of Code---
7 Appendix B: PYTHON Code for
Data Gathered from the Raspberry Pi
4 Model B
---Start of Code---
# modules
import RPi.GPIO as GPIO
import dht11
import time
from Ubidots_IoT_Device import
UbidotsIoTDevice
# numbering scheme
GPIO.setmode(GPIO.BCM)
WSEAS TRANSACTIONS on SYSTEMS
DOI: 10.37394/23202.2023.22.38
Christos Pechlivanis
E-ISSN: 2224-2678
356
Volume 22, 2023
# pins
dhtPin = 17
# sensors
myDHT = dht11.DHT11(dhtPin)
# globals
delay = 10
# Ubidots IoT Devices
raspberrypi = UbidotsIoTDevice("BBFF-
iGovTvMQDrbISlaUE5KkEs6qyZhTcJ",
"raspberrypi")
# main
while True:
result = myDHT.read()
if result.is_valid():
raspberrypi.write("temperature",
result.temperature)
raspberrypi.write("humidity", result.humidity)
time.sleep(delay)
---End of Code---
References:
[1] Lynn, T.; Endo, P. T.; Ribeiro, A. M. N. C.;
Barbosa, G. B. N.; Rosati, P. The Internet of
Things: Definitions, Key Concepts, and
Reference Architectures, Palgrave Studies in
Digital Business and Enabling Technologies,
pp. 1–22, Palgrave Macmillan, 2020.
doi:10.1007/978-3-030-41110-7_1/TABLES/3
[2] Alam, S.; Siddiqui, S. T.; Ahmad, A.; Ahmad,
R.; Shuaib, M., Internet of things (IoT)
enabling technologies, requirements, and
security challenges, Lecture Notes in Networks
and Systems, Vol.94, No.1, 2020, pp. 119–
126. doi:10.1007/978-981-15-0694-
9_12/COVER
[3] Evtodieva, T. E.; Chernovа, D. v.; Ivanova, N.
v.; Wirth, J., The internet of things:
Possibilities of application in intelligent
supply chain management, Advances in
Intelligent Systems and Computing, Vol.908,
No.1, 2020, pp. 395–403. doi:10.1007/978-3-
030-11367-4_38/COVER
[4] Lele, A., Internet of things (IoT), Smart
Innovation, Systems and Technologies,
Vol.132, No.1, 2019, pp. 187–195.
doi:10.1007/978-981-13-3384-2_11/COVER
[5] Ben-Daya, M.; Hassini, E.; Bahroun, Z.,
Internet of things and supply chain
management: a literature review, International
Journal of Production Research, Vol.7,
No.15–16, 2017, pp. 4719–4742.
doi:10.1080/00207543.2017.1402140
[6] Manavalan, E.; Jayakrishna, K., A review of
Internet of Things (IoT) embedded sustainable
supply chain for industry 4.0 requirements,
Computers & Industrial Engineering, Vol.
127, No.1, 2019, pp. 925–953.
doi:10.1016/J.CIE.2018.11.030
[7] Landaluce, H.; Arjona, L.; Perallos, A.;
Falcone, F.; Angulo, I.; Muralter, F., A
Review of IoT Sensing Applications and
Challenges Using RFID and Wireless Sensor
Networks, Sensors, Vol.20, No.9, 2020,
pp.2495 doi:10.3390/s20092495
[8] Sehrawat, D.; Gill, N. S., Smart sensors:
Analysis of different types of IoT sensors,
Proceedings of the International Conference
on Trends in Electronics and Informatics,
University of Ulsan, Uslan, South Korea, pp.
523–528, 2019.
doi:10.1109/ICOEI.2019.8862778
[9] Poongodi, T.; Rathee, A.; Indrakumari, R.;
Suresh, P., Iot sensing capabilities: Sensor
deployment and node discovery, wearable
sensors, wireless body area network (WBAN),
data acquisition, Intelligent Systems Reference
Library, Vol.174, No.1, 2019, pp. 127–151.
doi:10.1007/978-3-030-33596-0_5/COVER
[10] Cui, Y.; Liu, F.; Jing, X.; Mu, J., Integrating
Sensing and Communications for Ubiquitous
IoT: Applications, Trends, and Challenges,
IEEE Network, Vol.35, No.5, 2021, pp. 158–
167. doi:10.1109/MNET.010.2100152
[11] Popa, A.; Hnatiuc, M.; Paun, M.; Geman, O.;
Hemanth, D. J.; Dorcea, D.; Son, L. H.; Ghita,
S. An Intelligent IoT-Based Food Quality
Monitoring Approach Using Low-Cost
Sensors, Symmetry, Vol.11, No.3, 2019, pp.
374. doi:10.3390/SYM11030374
[12] Sunny, A. I.; Zhao, A.; Li, L.; Kanteh
Sakiliba, S., Low-Cost IoT-Based Sensor
System: A Case Study on Harsh
WSEAS TRANSACTIONS on SYSTEMS
DOI: 10.37394/23202.2023.22.38
Christos Pechlivanis
E-ISSN: 2224-2678
357
Volume 22, 2023
Environmental Monitoring, Sensors, Vol.21,
No.1, 2021, pp. 214. doi:10.3390/S21010214
[13] Malik, R., Retail and Internet of Things: A
Digital Transformation, IGIGlobal, 2022.
doi:10.4018/978-1-7998-8367-8.CH014
[14] Nagarajan, S. M.; Deverajan, G. G.;
Chatterjee, P.; Alnumay, W.; Muthukumaran,
V., Integration of IoT based routing process
for food supply chain management in
sustainable smart cities, Sustainable Cities and
Society, Vol.76, No.1, 2022, pp. 103448.
doi:10.1016/J.SCS.2021.103448
[15] Lee, K. L.; Romzi, P. N.; Hanaysha, J. R.;
Alzoubi, H. M.; Alshurideh, M., Investigating
the impact of benefits and challenges of IOT
adoption on supply chain performance and
organizational performance: An empirical
study in Malaysia, Uncertain Supply Chain
Management, Vol.10, No.2, 2022, pp. 537–
550. doi:10.5267/J.USCM.2021.11.009
[16] Rad, F. F.; Oghazi, P.; Palmié, M.;
Chirumalla, K.; Pashkevich, N.; Patel, P. C.;
Sattari, S., Industry 4.0 and supply chain
performance: A systematic literature review of
the benefits, challenges, and critical success
factors of 11 core technologies, Industrial
Marketing Management, Vol.105, No.1, 2022,
pp. 268–293.
doi:10.1016/J.INDMARMAN.2022.06.009
[17] de Vass, T.; Shee, H.; Miah, S. J., IoT in
Supply Chain Management: Opportunities and
Challenges for Businesses in Early Industry
4.0 Context, Online) OPERATIONS AND
SUPPLY CHAIN MANAGEMENT, Vol.14,
No.2, 2021, pp. 148–161
[18] Aich, S.; Chakraborty, S.; Sain, M.; Lee, H. I.;
Kim, H. C., A Review on Benefits of IoT
Integrated Blockchain based Supply Chain
Management Implementations across
Different Sectors with Case Study,
International Conference on Advanced
Communication Technology, ICACT,
Vol.2019, No.1, 2019, pp. 138–141.
doi:10.23919/ICACT.2019.8701910
[19] Aswale, P.; Shukla, A.; Bharati, P.; Bharambe,
S.; Palve, S., An overview of internet of
things: Architecture, protocols and challenges,
Smart Innovation, Systems and Technologies,
Vol.106, No.1, 2019, pp. 299–308.
doi:10.1007/978-981-13-1742-2_29/COVER
[20] Alshohoumi, F.; Al-Hamdani, A.; Sarrab, M.;
Alhamadani, A.; Al-Abri, D., Systematic
Review of Existing IoT Architectures Security
and Privacy Issues and Concerns, Article in
International Journal of Advanced Computer
Science and Applications, Vol.10, No.7.,
2019, pp. 1–20.
doi:10.14569/IJACSA.2019.0100733
[21] Kumar, N. M.; Mallick, P. K., The Internet of
Things: Insights into the building blocks,
component interactions, and architecture
layers, Procedia Computer Science, Vol. 132,
No.1, 2018, pp. 109–117.
doi:10.1016/J.PROCS.2018.05.170
[22] Asemani, M.; Abdollahei, F.; Jabbari, F.,
Understanding IoT Platforms: Towards a
comprehensive definition and main
characteristic description, 5th International
Conference on Web Research, Institute of
Electrical and Electronics Engineers (IEEE),
Teheran, Iran, pp. 172–177, 2019.
doi:10.1109/ICWR.2019.8765259
[23] Farhan, L.; Kharel, R.; Kaiwartya, O.; Quiroz-
Castellanos, M.; Alissa, A.; Abdulsalam, M.,
A Concise Review on Internet of Things
(IoT)-Problems, Challenges and
Opportunities, 2018 11th International
Symposium on Communication Systems,
Networks and Digital Signal Processing,
Institute of Electrical and Electronics
Engineers (IEEE), Budapest, Hungary, pp. 1
6, 2018. doi:10.1109/CSNDSP.2018.8471762
[24] Khujamatov, K.; Lazarev, A.; Akhmedov, N.,
Intelligent IoT Sensors: Types, Functions and
Classification, International Conference on
Information Science and Communications
Technologies: Applications, Trends and
Opportunities, Institute of Electrical and
Electronics Engineers (IEEE), Tashkent,
Uzbekistan, pp. 1–6, 2021.
doi:10.1109/ICISCT52966.2021.9670340
[25] Rayes, A.; Salam, S., The Things in IoT:
Sensors and Actuators, Internet of Things from
Hype to Reality, Vol1, No.1, 2022, pp. 63–82.
doi:10.1007/978-3-030-90158-5_3
[26] Srinivasan, C. R., Rajesh, B., Saikalyan, P.,
Premsagar, K., & Yadav, E. S., A review on
the different types of internet of things (IoT),
Journal of Advanced Research in Dynamical
and Control Systems, Vol. 11, No.1, 2019, pp.
154–158. doi:10.2/JQUERY.MIN.JS
[27] González García, C.; Meana-Llorián, D.;
Cristina, B.; García-Bustelo, P.; Manuel, J.;
Lovelle, C., A review about Smart Objects,
Sensors, and Actuators IoT Protocols and
Applications for Improving Industry,
Environment, and Society View project,
International Journal of Interactive
Multimedia and Artificial Intelligence., Vol.4,
WSEAS TRANSACTIONS on SYSTEMS
DOI: 10.37394/23202.2023.22.38
Christos Pechlivanis
E-ISSN: 2224-2678
358
Volume 22, 2023
No.3, 2017, pp. 7–10.
doi:10.9781/ijimai.2017.431
[28] Gubbi, J.; Buyya, R.; Marusic, S.;
Palaniswami, M., Internet of Things (IoT): A
vision, architectural elements, and future
directions, Future Generation Computer
Systems, Vol.29, No.7, 2013, pp. 1645–1660.
doi:10.1016/J.FUTURE.2013.01.010
[29] Madakam, S., Ramaswamy, R. and Tripathi,
S., Internet of Things (IoT): A Literature
Review, Journal of Computer and
Communications, Vol.3, No.5, 2015, pp. 164–
173. doi:10.4236/JCC.2015.35021
[30] Raza, A.; Ikram, A. A.; Amin, A.; Ikram, A.
J., A review of low cost and power efficient
development boards for IoT applications, FTC
2016 - Proceedings of Future Technologies
Conference, Hyatt Fisherman's Wharf, San
Francisco, United States, pp. 786–790, 2017.
doi:10.1109/FTC.2016.7821693
[31] Plaza, P.; Sancristobal, E.; Carro, G.; Castro,
M.; Ruiz, E., Wireless development boards to
connect the world, Lecture Notes in Networks
and Systems, Vol.22, No.1, 2018, pp. 19–27.
doi:10.1007/978-3-319-64352-6_2/COVER
[32] Ahmad, N.; Laplante, P.; Defranco, J. F., Life,
IoT, and the Pursuit of Happiness, IT
Professional, Vol.22, No.6, 2022, pp. 4–7.
doi:10.1109/MITP.2019.2949944
[33] Singh, D.; Thakur, A.; Sandhu, A.; Priyank,
N., An Overview of IoT Hardware
Development Platforms, International Journal
on Emerging Technologies, Vol.11, No.5,
2020, pp. 155–163.
Contribution of Individual Authors to the
Creation of a Scientific Article (Ghostwriting
Policy)
Christos Pechlivanis carried out the
conceptualization, formal analysis, investigation,
project administration, supervision, validation, data
curation, methodology, resources, software,
visualization, writing of the original draft, and
review and editing of the paper.
Sources of Funding for Research Presented in a
Scientific Article or Scientific Article Itself
The author declare no funding sources.
Conflict of Interest
The authorshas no conflict of interest to declare
that is relevant to the content of this article.
Creative Commons Attribution License 4.0
(Attribution 4.0 International, CC BY 4.0)
This article is published under the terms of the
Creative Commons Attribution License 4.0
https://creativecommons.org/licenses/by/4.0/deed.en
_US
WSEAS TRANSACTIONS on SYSTEMS
DOI: 10.37394/23202.2023.22.38
Christos Pechlivanis
E-ISSN: 2224-2678
359
Volume 22, 2023