0% found this document useful (0 votes)
5 views84 pages

Iot Monitoring Using Nodemcu

This document details the development of an IoT Environmental Monitoring System utilizing Arduino and NodeMCU ESP8266 to collect and transmit environmental data such as air quality and temperature to a web platform. The system aims to provide real-time monitoring and historical data analysis, facilitating informed decision-making regarding environmental conditions. The report includes the design, implementation challenges, and potential improvements for future research in environmental monitoring using IoT technology.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views84 pages

Iot Monitoring Using Nodemcu

This document details the development of an IoT Environmental Monitoring System utilizing Arduino and NodeMCU ESP8266 to collect and transmit environmental data such as air quality and temperature to a web platform. The system aims to provide real-time monitoring and historical data analysis, facilitating informed decision-making regarding environmental conditions. The report includes the design, implementation challenges, and potential improvements for future research in environmental monitoring using IoT technology.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 84

FINAL DEGREE THESIS

Bachelor’s Degree in Industrial and Automatic Electronic


Engineering

IOT ENVIRONMENTAL MONITORING SYSTEM USING


ARDUINO AND NODEMCU ESP8266

Report and Annex

Author: Alejandro Lezcano Sirre


Supervisor: Raúl Benítez
Department Automatic Systems Engineering and Industrial
Informatics
Company tutor: Kuczmann Miklós
Call: 2024 January
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

1
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

Abstract
This report shows the design, implementation and evaluation of an IoT (Internet of Things) based
environmental monitoring system. The main idea of the work is to be able to monitor and control
different physical properties through a web page.

The system uses an Arduino Mega board to collect data from multiple environmental sensors,
including MQ-2, MQ-135, DHT11, KY-037 and BMP180, to measure air quality, temperature,
humidity, sound and atmospheric pressure among others. The collected data is processed and sent
to the ESP8266 Node MCU, which transmits it to a web platform for visualisation. To do this, an IoT
network architecture has been implemented, where the Arduino Mega collects data from the
sensors and the ESP8266 Node MCU is responsible for communication with the server. The
communication between the devices is carried out through serial communication. A web interface
has been developed using HTML, CSS and JavaScript combined with XAMPP to display the data
collected in real time and at a historical level.

Experimental results show that the system is able to collect and transmit data effectively, providing
environmental monitoring thanks to an intuitive interface that allows users to access historical data
according to the selected day. This ability to access historical data provides a detailed view of
environmental conditions in the past, facilitating comparative analysis and tracking of patterns over
time. In addition, challenges encountered during implementation are discussed and possible
improvements for future research are proposed.

This work demonstrates the feasibility and usefulness of an IoT-based environmental monitoring
system, offering an effective and accessible solution for all users to monitor data.

2
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

Resum
Aquest memòria presenta com s’ha desenvolupat un sistema de Monitorització Ambiental IoT
utilitzant Arduino. La Internet de les coses es refereix, en termes d'informàtica, a una xarxa
d'objectes físics de la vida quotidiana interconnectats mitjançant sensors, per tal d'intercanviar
dades amb altres dispositius i sistemes a través d'Internet. Mitjançant l’ús de diferents sensors i
amb l’ajuda d’Arduino i un mòdul ESP8266 podrem enviar aquestes dades a una pagina web local
per tal de monitoritzar els resultats i fer-ne un anàlisi de les condicions ambientals.

Resumen
Esta memoria presenta cómo se ha desarrollado un sistema de Monitorización Ambiental IoT
utilizando Arduino. Internet de las cosas se refiere, en términos de informática, a una red de objetos
físicos de la vida cotidiana interconectados mediante sensores, con el fin de intercambiar datos con
otros dispositivos y sistemas a través de Internet. Mediante el uso de diferentes sensores y con la
ayuda de Arduino y un módulo ESP8266 podremos enviar estos datos a una página web local para
monitorizar los resultados y realizar un análisis de las condiciones ambientales.

Summary
This paper presents how an IoT Environmental Monitoring system has been developed using
Arduino. The Internet of Things refers, in computing terms, to a network of physical objects of
everyday life interconnected by sensors, in order to exchange data with other devices and systems
via the Internet. By using different sensors and with the help of Arduino and an ESP8266 module
we can send this data to a local web page to monitor the results and analyse the environmental
conditions.

3
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

4
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

Index

ABSTRACT ________________________________________________________ 2

RESUM ___________________________________________________________ 3

1. PREFACE _____________________________________________________ 8
1.1 Motivation ...........................................................................................................8

2. INTRODUCTION_______________________________________________ 10
2.1 Objective............................................................................................................10
2.2 Scope .................................................................................................................10

3 BACKGROUND________________________________________________ 11

4 METHODOLOGY ______________________________________________ 12
Working Method .........................................................................................................12

5 THEORETICAL UNDERPINNINGS __________________________________ 13


5.1 History and evolution of the Internet of Things ...............................................13
5.2 Basic concepts of IoT .........................................................................................14
5.3 IoT Layering Model ............................................................................................14
5.4 Interoperability..................................................................................................17
5.4.1 Types of Interoperability ................................................................................. 17
5.5 Web Services .....................................................................................................18
5.6 Publishing-subscription and messaging technologies ......................................18
5.7 Hardware and Software used in IoT .................................................................20
5.7.1 Sensors............................................................................................................. 20
5.7.2 Interfaces between Sensors and Microcontrollers/Devices........................... 22
5.7.3 Actuators ......................................................................................................... 23
5.7.4 Communication Protocols ............................................................................... 23

6 PROJECT DEVELOPMENT _______________________________________ 25


6.1 Data collection ...................................................................................................25
6.1.1 Configuration and Selection of Components .................................................. 25
6.1.2 Circuit Diagram ................................................................................................ 31
6.2 Data storage ......................................................................................................32
6.2.1 Creating a Database ........................................................................................ 32
6.3 Data visualisation ..............................................................................................34

5
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

7 RESULTS_____________________________________________________ 37
7.1 Results of the website interface .......................................................................37
7.2 Data collection, storage and visualisation results ............................................42

8 PRACTICAL APPLICATIONS ______________________________________ 44


8.1 Practical real-world applications .......................................................................44
8.2 Feasibility Study .................................................................................................45

9 SYSTEM BUDGET ______________________________________________ 46

10 IOT SECURITY AND PRIVACY_____________________________________ 47

11 SUSTAINABILITY STUDY ________________________________________ 48


11.1 Environmental Field ..........................................................................................48
11.2 Economic Field...................................................................................................49
11.3 Social Field .........................................................................................................49

12 CONCLUSIONS ________________________________________________ 51

13 BIBLIOGRAPHY _______________________________________________ 53

14 ANNEX 1: ARDUINO MEGA SPECIFICATIONS AND PINOUT ____________ 55

15 ANNEX 2: NODE MCU ESP8266 SPECIFICATIONS AND PINOUT _________ 59

16 ANNEX 3: DHT11 SPECIFICATIONS AND PINOUT _____________________ 60

17 ANNEX 4: MQ-2 SPECIFICATIONS AND PINOUT _____________________ 63

18 ANNEX 5: MQ-135 SPECIFICATIONS AND PINOUT ___________________ 65

19 ANNEX 6: KY-037 SPECIFICATIONS AND PINOUT ____________________ 67

20 ANNEX 7: BMP-180 SPECIFICATIONS AND PINOUT ___________________ 69

21 ANNEX 8: PROGRAMMING CODE FOR ARDUINO MEGA SENSORS ______ 73

22 ANNEX 9: ESP8266 PROGRAMMING CODE _________________________ 74

23 ANNEX 10: PROGRAMMING CODE OF THE WEB PAGE ________________ 76

6
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

7
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

1. Preface
This work represents the development of an Environmental Monitoring System based on Internet
of Things (IoT) technology. This initiative has focused on the use of low-cost and accessible devices
within the reach of any user, such as Arduino and NodeMCU ESP8266, to collect data from
environmental sensors and transmit them to a cloud platform for analysis and visualisation.

The main purpose of this project has been to explore the viability and applicability of these
technologies in the monitoring of environmental variables, being able to measure these types of
magnitudes in different places for later comparison. This research has also addressed the
implementation of practical solutions to present and store these data in an accessible and useful
way, allowing their historical and real-time analysis.

Throughout these pages, the process of system design, development and implementation will be
detailed, including hardware and sensor selection, circuit design, software development and
integration with cloud platforms for data visualisation and storage. Full details will be provided on
the challenges faced, decisions made and lessons learned during the development of this project.

It is hoped that this work will serve as an introductory guide and a starting point for those interested
in creating IoT-based environmental monitoring solutions using affordable and accessible
platforms.

1.1 Motivation

The motivation for this project comes from my interest in one of the branches that is taking more
prominence in the world of technology such as data processing. When I did my final project abroad,
I thought it would be a good idea to undertake a new project to learn about. Although it is true that
the development of the project is mostly covered with programming skills, which has nothing to do
with the title of the career that I am studying, when doing some electives during the last year the
idea of doing this project came up. Combining some notions of Arduino and the idea of making a
web page came up the idea of this project. It also supports one of the serious global problems such
as climate change. With this project also seeks to provide tools available to as many people as
possible to raise awareness about this problem.

8
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

9
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

2. Introduction
This project aims to encourage and raise awareness of the global problem of climate change. Over
the last few years, humanity is experiencing global changes in temperature levels. Among others,
this is one of the main problems affecting all ecosystems and wildlife on planet Earth. The
combination of Internet of Things (IoT) technology with low-cost and easily accessible devices, such
as the Arduino, introduces an affordable and accessible method for many to get a better view of
this critical situation. This type of system enables the collection and transmission of environmental
data in real time, providing valuable information for informed decision making and risk mitigation.
In doing so, it seeks to improve awareness of some habits that could help improve our ecosystem.

2.1 Objective

The main objective of this project is to develop an IoT Environmental Monitoring System using
Arduino and ESP8266 NodeMCU. The main objective of this system is to collect, analyse and
transmit data from environmental sensors, including air quality, temperature, humidity,
atmospheric pressure and other relevant parameters. The purpose is to provide a reliable, accurate
and accessible monitoring platform for all users allowing continuous monitoring of the conditions
of different environmental properties.

The scope of the project includes the implementation of sensors for air quality, smoke, sound,
temperature, humidity and atmospheric pressure. However, not all of these types of sensors are
necessary. The project is developed within the reach of any user economically speaking. Everything
will depend on the limits and objectives that the customer wants. We are looking for a frequency
of data sampling every so often and the transmission of this data to a web platform for visualisation
and storage. This requires an intuitive user interface that allows users to access historical and real-
time data. Accuracy and reliability of data are essential for informed decision making.

2.2 Scope

The project will focus on the implementation of a series of sensors connected to the Arduino Mega
to capture environmental data. This data will be visualised on a local website developed through
free platforms. The user interface will allow access to real-time data and visualisation of historical
information. Due to the easy adaptability of this sensor system, the customer will be able to make
different comparisons of environmental properties in different locations and perform
comprehensive analysis for a better conclusion.

10
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

3 Background
In the 21st century, the impact of human activities on the environment has generated a growing
need to monitor and understand the environmental conditions around us in order to address the
various problems that exist. Fluctuations in air quality, temperature, humidity and other
parameters have created challenges in resource management and informed decision making.

Internet of Things (IoT) technology has emerged as a promising solution to address these concerns.
The ability to connect devices and sensors via the internet has paved the way for the creation of
highly effective environmental monitoring systems.

In this context, the combination of hardware development platforms such as Arduino offers a
unique opportunity. Arduino Mega, with its versatility and ability to interface with multiple sensors,
and NodeMCU ESP8266, which facilitates Wi-Fi connectivity, form an ideal partnership for real-time
environmental data collection and transmission.

This project is set in an environment marked by a growing interest in environmental sustainability


and the need for innovative technological solutions. The proposed IoT Environmental Monitoring
System aligns with this demand, offering a comprehensive approach to monitor and manage
environmental conditions.

With technological advancement and the urgent need to take action for the environment, the use
of IoT devices as tools for environmental monitoring and management is gaining significant
importance in diverse fields, from conservation to urban planning and sustainable agriculture.

This project is set in this context, using the convergence of sensor technology, real-time connectivity
and intelligent data management to address contemporary environmental monitoring challenges.

11
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

4 Methodology
Working Method

During the implementation of our IoT-based environmental monitoring project, we have effectively
applied theoretical principles to ensure the accurate collection and efficient transmission of
environmental data. This project uses a combination of hardware, including Arduino
microcontrollers and ESP8266 Node MCU modules to create a monitoring system suitable for any
level of user.

For the development of this work, a method called Scrum has been followed. This method consists
of dividing the main task into several small blocks in order to be able to take on obstacles along the
way. This division of work is divided into three phases: data collection, data storage and data
visualisation.

Within these blocks the realisation of the project was initially reduced to a couple of sensors in
order not to try to overload the system at the beginning.

As a monitoring tool I have only used Google Drive. Drive is a web-based file hosting service.
Handling several blocks of work-related functions such as programming tests and web page files I
decided it would be the best option. Also, by making a local website that I would only have access
to I would keep my files secure.

12
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

5 Theoretical underpinnings
5.1 History and evolution of the Internet of Things

The first concepts of intelligent device networking were discussed in the 1970s and 1980s. In 1874,
several weather information devices were installed on the Mont Blanc Mountain to collect data and
transmit them via a radio link. And even earlier, in 1830 with the communication of telegraphs with
each other. Arguably, this was one of the first steps towards the beginning of the Internet of Things.

During the 1990s, several academic papers were published, popularising the term. In the late 1990s,
the term 'Internet of Things' was coined by Kevin Ashton while working on a radio frequency
identification (RFID) project at the Massachusetts Institute of Technology (MIT). In this early system,
each tag carried a simplistic microchip that stored only a basic serial number (to keep costs down),
which could be transmitted locally via wireless communication. The data associated with the tag's
serial number was stored separately in a database accessible online. Ashton introduced this phrase
to illustrate how objects in the physical world could be connected to the Internet and communicate
with each other.

In the 2000s, new concepts and techniques enabled wireless sensor/actuator networks (WSAN, or
WSN): tiny battery-powered computers first collaborate to establish wireless networks, then use
such networks to transport their sensors’ data, or to distribute actuator commands. Generalizing
such concepts, the term “pervasive computing” (somewhat analogous to ubiquitous computing)
was introduced to capture the trend of embedding some computational and communication
capabilities into everyday objects.

From that moment on, the concept of the Internet of Things and its evolution were related to the
incorporation of sensors and connections in any type of device that could support it. Basically, it
was about embedding "intelligence" in different electronic objects that could support it.

13
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

5.2 Basic concepts of IoT

The internet of things is defined as the interconnection of physical devices, everyday objects and
systems through the network, enabling remote and automated data collection, sharing and
analysis. Although IoT is a trending technology with unlimited future potential as yet, there is no
single or particular set of rules for IoT components. Several organisations have adopted IoT features
in their facilities as various benefits have emerged from its integrations.

Referred to as a system of interrelated objects connected to the internet that can collect and
transfer data over a wireless network without human intervention, the personal or commercial
possibilities are endless. A ‘thing’ can refer to a connected medical device, a biochip transponder, a
solar panel, a connected car with sensors that alert the driver to a host of potential problems (fuel,
tyre pressure, maintenance required and more) or any object, equipped with sensors, that has the
ability to collect and transfer data over a network.

There are many aspects that make up these types of systems, such as layers, applications and
network technology components. Therefore, the variety of such systems is very large. However,
there are certain essential elements that make up every system and allow them to work together
to enable connectivity, communication and data collection. Below we will look at some of the most
important aspects that make up these projects.

5.3 IoT Layering Model

In the same way that in other technologies an architectural division is made to present a functional
layer model, in IoT it is also possible to differentiate layers in which different activities are grouped
together. In the following, each of the layers of the depicted five-layer model and the main
functions they entail are described.

▪ Perception layer: At this level, the physical design components of the IoT Internet are
formed, acting as a medium between the digital world and the real world. Its main purpose
is to transform analogue signals into digital form and vice versa.
The function of collecting information from various devices and processing it is given by a
multitude of different shapes and sizes. Some of them and the most known are:
▪ Sensors: are very small devices or systems built to understand and detect change
in your environment and further optimise information to your system. Generally,
these sensors are quite small and require even less power to perform their task.
Sensors have the unique ability to detect physical parameters such as humidity or
temperature, and then transform them into electronic signals.

14
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

▪ Actuators: They represent a part of the machine that allows transforming an


electrical signal into physical actions. These actuators play a crucial role as
components of IoT networks.
▪ Machine and devices: these are the main devices that have actuators and sensors.
▪ Communication layer: deals with the transfer of data from an object to the support layer.
This layer must implement the functionalities of:
- Connectivity abstraction, to encapsulate the details of the underlying communication
technologies, using one or more common APIs to expose a set of connectivity services.
- Communications functions that allow independence of the access technology, for
which specific connectors with the main protocols used in the IoT world must be
available.
- Cybersecurity functions: Secure communication and management mechanisms are
used.

This communication takes place through two methods:

- First directly over TCP or UDP/IP stack;


- Secondly, gateways act as a link between the local area network (LAN) and the wide
area network (WAN), thus providing a path for information to pass through multiple
protocols.

There are a variety of network technologies, including Wi-Fi, Ethernet, Bluetooth, NFC,
LPWAN, ZigBee and mobile networks such as LTE-M and NB-IoT. Each technology is
highlighted in terms of its range, power consumption, data transmission capacity and main
applications.

Messaging protocols such as DDS, AMQP, CoAP and MQTT, are used to facilitate
communication between devices in an IoT system, are also available. Each protocol has its
own approach and advantages, suitable for devices with different power, memory and
network range requirements.

▪ Support layer: its main objective is the management of services from a first level. In the
early stages, with IoT networks gaining size and numbers, latency becomes one of the main
obstacles. And when multiple devices tried to connect to the main hub, it clogged the
system and slowed down the procedure. Here, edge computing offered a unique solution
that accelerated the growth of IoT systems in general. Now, with edge IoT layers, systems
can process and analyse information as close to the source as possible. Edge has now
become the standard for the fifth generation of mobile networks (5G), offering systems to
connect to more devices with lower latency than the prevailing 4G standards. All
procedures for IoT networks are carried out at the edge. This saves time, saves resources,
and also provides real-time feedback and improves performance.

15
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

This layer allows IoT solution developers to abstract from the hardware platform. The
functions involved are:
- Device management which involves the powers of storing the necessary characteristics
that define the device capabilities, provisioning and deployment, asset management and
control, and monitoring and diagnostic competence.
- Secure access management based on defined roles.
- Monitoring of system events (logs).
▪ Processing layer: At the processing layer, there are two main stages;
- Data accumulation: Each device sends millions of data streams across the IoT network.
Here data comes in various shapes, speeds and sizes. Separating the essential data
from these large streams is a primary concern that practitioners must prioritise at this
layer.
- Data abstraction: Once the data accumulation stage is completed, selected data is
abstracted from the big data for the application to optimise its business procedures.
Here, data abstraction follows the path as:
- Collect all data from all IoT and non- IoT systems (CRM, ERP and ERM).
- Using data virtualisation to make data accessible from a single location.
- Manage raw data in multiple forms.

Once data accumulation and abstraction are complete, it is easy for data analysts to use
business acumen to derive intelligence factors.

▪ Business layer: Used to provide the services that are being requested by the client. This
layer contains application management functions and specific services that interact with
the services exposed in the previous layer. The creation of different business verticals
therefore falls on this layer. Each IoT system is built with its particular goals and objectives
to match business specifications. Today, most IoT applications operate with varying
complexity and operate a multitude of technology stacks that perform specific tasks for
businesses. Some examples of the Application layer include:
- Business decision making software
- Device monitoring and control services
- Analytics solutions built with machine learning and artificial intelligence.
- Mobile application for downstream interactions.

16
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

5.4 Interoperability

Computer systems are often distributed and dynamic in nature. Moreover, these systems are based
on heterogeneous technologies and use different representations of information. These factors
hinder the exchange and processing of data between different actors (devices, machines,
controllers, sensors…). Therefore, to achieve full interoperability, the information exchanged must
not only have a common syntactic basis, but also a common structure and semantics (17).

Because of this, the term interoperability is used for those standards, protocols, technologies and
mechanisms that allow data to flow between different systems with minimal human intervention.
It allows different systems to communicate with each other and share information in real time.
5.4.1 Types of Interoperability

Interoperability can be classified from different perspectives. The most generic classification
describes four types:

- Technical interoperability: This one refers to the ability of systems, system components
or applications to establish communication and share messages, without necessarily
understanding their content. Hence, it does not imply awareness of data format and
meaning. It typically requires the existence of network connectivity. Technical
interoperability is strongly related with the elements that enable a machine-machine
communication (example: required protocols, hardware and software).
- Syntactic interoperability: This one refers to the ability of systems of correctly
interpreting the message structure of exchanged information and, thus, being capable
to read its content, although they may not be aware of the meaning of this information.
An example of syntactic interoperability is a smart city system that receives
information from a data center and is capable to properly recognise its specific data
format (e.g. CSV) and thus correctly extract the data from the message (e.g. a set of
values). Nevertheless, it may not be aware of what this data represents (for example
the values could be temperatures), thus being unable to use the data within the correct
context.
- Semantic interoperability: This one ensures that there is a common meaning and
understanding of the data exchanged. Specifically, semantic interoperability ensures
that computer systems can exchange data unambiguously, sharing the meaning of the
data. It is also a basis for enabling efficient computable machine logic (e.g., machine
learning algorithms), while driving knowledge extraction and knowledge discovery.
Thus, the system becomes capable of using this information in the proper context.

17
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

5.5 Web Services

Web services are applications or systems that enable communication between different devices
over the Internet. These services facilitate interaction between heterogeneous software systems,
allowing data and functionalities to be shared between different platforms and programming
languages.

These services use a set of standard web-based protocols to enable interoperability between
applications and systems. Web services typically use standards such as HTTP, XML, SOAP, REST and
JSON to facilitate communication and data exchange between different applications. There are
several different forms of web services described below:

- SOAP (Simple Object Access Protocol): Uses XML for information exchange and defines a rigid
structure for communication between applications. SOAP allows processes running on a client from
heterogeneous operating systems (such as Linux or Windows) to access a server through calls to
web services and receive responses regardless of language and platforms.

- REST (Representational State Transfer): Uses HTTP methods (GET, POST, PUT, DELETE) to access
and manipulate resources in a system. It is based on principles such as identifying resources through
URLs and manipulating these resources through HTTP requests. REST allows independence
between different platforms (Unix, Windows, Mac, …), as well as independence of programming
language (C++ can talk to Java, etc.), is standards-based (as it runs over HTTP) and can be easily used
in the presence of firewalls.

5.6 Publishing-subscription and messaging technologies

Publish-subscribe and messaging technologies are communication paradigms used in distributed


systems to facilitate the transfer of data between different components or systems without being
directly coupled. These models are widely used in distributed software architectures and in the
context of web services and cloud applications. Here is a brief description of both:

Publishing-Subscription:

Concept: In a publish-subscribe system, the components or systems are divided into two main roles:
publishers and subscribers. Publishers issue events or messages (publish) related to certain topics.
Subscribers express interest in certain topics and receive notifications when related events occur.

18
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

- Advantages:
o Decoupling: components do not need to know each other directly. The
publisher does not need to know who the subscribers are, and vice versa.
o Scalability: New components can be added without affecting existing ones.
o Flexibility: Components can communicate asynchronously.

Messaging:

Concept: In a messaging system, components communicate by sending and receiving messages.


Messages can contain data, instructions or events and are transmitted between system
components.

- Models:
o Synchronous: Communication occurs in real time, and the sender waits for
confirmation from the receiver.
o Asynchronous: Communication does not block the sender. It can continue executing
other tasks while waiting for the receiver to process the message.
o Point-to-point: A component sends a message directly to another component.
o Publish-subscribe: Similar to the publish-subscribe concept, but here messages are
broadcast to all interested subscribers.
- Advantages:
o Decoupling: Components can operate independently.
o Scalability: New components can be added without affecting the overall system
communication.
o Reliability: Messages can be stored and reattempted in case of temporary failures.

Both paradigms provide flexibility and scalability in distributed environments, allowing systems to
evolve and expand more efficiently. The choice between them will depend on the specific
requirements of the application and system architecture. Some of the most relevant messaging
protocols are:

➢ Message Queuing Telemetry Transport (MQTT): is a “lightweight” publication-subscription-


based messaging protocol for use on top of the TCP/IP protocol.
➢ Extensible Messaging and Presence Protocol (XMPP): is a messaging-oriented middleware
communications protocol based on XML.
➢ Advanced Message Queuing Protocol (AMQP): is an open standard for the exchange of
messages between applications or organizations.

19
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

5.7 Hardware and Software used in IoT

In this section, we will explore the essential elements of an IoT solution, including the
communication protocols applied in various areas, the sensors and actuators that interact with the
physical environment, as well as the IoT platforms provided by vendors to streamline the
development of these solutions.

5.7.1 Sensors

Sensors are integral components in automating various applications, as they measure and analyse
collected data to detect alterations in physical attributes. Whenever there's a change in a condition
that a sensor is designed to monitor, it generates a measurable response. An IoT sensor device
requires at least three elements:

✓ Sensor
✓ Microcontrollers and associated elements (memories, peripheral, etc.)
✓ IoT gateway for connectivity to send filtered data to other systems

The following figure shows the components of a smart sensor, marked in blue:

Figure 1. Components of a smart sensor

5.7.1.1 Types of sensors

There are different types of sensors which can range from very simple to complex. The classification
of sensors can be based on their specifications, its conversion method, type of material used, its
sensing physical phenomenon, properties that what it measures, and the application field.

20
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

Figure 2 depicts various types of sensors in IoT which are explained below.

Figure 2. Different types of sensors

The most common sensing technologies are listed below, classified according to the types of
physical quantities and technologies used:

• Temperature sensors: The most common technologies used in temperature sensing are
as follows:
a) Thermocouple sensors: These are composed of two dissimilar metals, joined at
one end. A voltage proportional to the temperature at the junction point is
generated at the unbonded ends of the thermocouple, which is where the
temperature is measured.
b) Resistance Temperature Detector (RTD): RTDs are temperature sensing devices
whose resistance changes with temperature.
c) Thermistors: Similar to RTDs, the thermistor is a temperature sensing device
whose resistance changes with temperature. The main difference is the
technology in which they are manufactured (ceramics and polymers), which
makes the resistance variation much larger, less predictable and less standard,
compared to RTDs. The temperature range they cover is clearly lower, although
their cost is cheaper.
d) Semiconductor sensors (integrated circuits): These are based on the increase in
conductivity of semiconductors as a function of temperature.

21
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

• Pressure sensors: They are devices designed to measure the pressure of a fluid (liquid or
gas) or atmospheric pressure in a given environment. We can divide these sensors
according to their topology:
a. Absolute: They measure pressure in relation to absolute vacuum.
b. Relative: They measure pressure in relation to a reference pressure, generally
atmospheric pressure.
c. Differential: They measure the difference in pressure between two points.
• Proximity Sensors: The position of any nearby object can easily be detected with proximity
sensor without any physical contact. By emitting electromagnetic radiation such as
infrared, it finds the presence of an object by simply looking for any variation in the return
signal. There are different types of proximity sensors like Inductive, Capacitive, Ultrasonic,
Photoelectric, Magnetic and etc. targeting different applications. This particular type of
sensor is mostly used in applications demanding security and efficiency.
• Velocity Sensors: It is a sensor that calculates the rate of change in constant position
measurement and position values at known intervals. Velocity sensor may be linear or
angular.
• Humidity Sensors: A humidity sensor measures air temperature as well as moisture and
signals the humidity in the environment.
• Gas sensors: Their purpose is to identify the presence and often the concentration of
certain gases in the environment. It uses specific technologies to detect particular gases,
such as semiconductor, electrochemical or infrared sensors.
Following are some common Gas sensors:
a. Carbon dioxide sensor
b. Carbon monoxide detector
c. Hydrogen sensor

These are the most commonly used sensors in this type of project. However, there are a wide
variety of sensors such as image sensors, level sensors, water sensors, optical sensors and others.

5.7.2 Interfaces between Sensors and Microcontrollers/Devices

Commonly, in order for one of the above sensors to integrate with a network (and subsequently
the internet), it must initially be linked to a microcontroller. This microcontroller will facilitate
communication with a gateway, a local network or directly with the Internet. The reading of the
sensor data from the microcontroller usually takes place using one of the following formats:

o Analogue lines: The most basic sensors provide measurements that are read out to a
microcontroller as an analogue voltage on an ADC input.
o RS232: Many sensors use serial communications (serial line) to communicate their
readings, digitally, to a microcontroller.

22
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

o SPI (Serial Peripheral Interface): A serial protocol that uses 4 signals (MOSI, MISO, CLK, CS)
to communicate peripherals (such as sensor chips) with microcontrollers.
o I2C (Inter IC Communications): A common bus is used for transmitting/receiving data and
a clock is used to read its output values.
o RFID: RFID can range from reading the identification of a device (such as highway or
shopping mall tags) to reading sensor values without any battery or power supply (passive
wireless sensors).

5.7.3 Actuators

An actuator is a mechanical, electrical or hydraulic device that converts a control signal into a
physical motion or action. Actuators are essential components in automated systems and are
responsible for executing decisions made by a controller or control system, transforming electrical
or other information into mechanical motion, change of position or some other form of physical
action. Although we do not use these types of instruments, the main types are shown below:

- Electric actuators: These are devices that have the ability to drive small motors by
converting energy into mechanical torque.
- Hydraulic actuators: These are devices that generate linear or rotary motion through the
use of incompressible fluids, generally hydraulic oil. These actuators harness the pressure
generated by a hydraulic pump to drive a piston or cylinder, thus producing mechanical
motion.
- Pneumatic Actuators: Use compressed air to generate motion. When compressed air is
introduced into the cylinder, it causes a linear or rotary motion.

5.7.4 Communication Protocols

This section discusses the different modes of communication between IoT devices that exchange
information directly with each other, without the involvement of an external intermediary.

Zigbee is a wireless communication protocol designed for low-power, low-power devices in


personal area networks. It is commonly used in IoT and home automation applications. Zigbee
operates in the 2.4 GHz frequency band and enables the formation of mesh networks, which
facilitates communication between devices even if they do not have direct connectivity.

Bluetooth is a short-range wireless communication standard that allows data transfer between
devices. It is widely used in mobile devices, headsets, speakers and other peripherals. Bluetooth
uses short-range radio frequencies to establish direct connections between devices, making it ideal
for personal and home applications.

23
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

Ethernet is a wired communication standard used for local area networks (LAN). It provides a high-
speed connection and is commonly used in business and home environments for data transmission.
In IoT, Ethernet is often used for connectivity of devices that require a more robust and reliable
connection.

Wi-Fi is a wireless communication standard that enables connection to local networks and the
Internet. It is widely used in home and business environments for connectivity of devices such as
smartphones, computers and IoT devices. Wi-Fi provides higher transmission speeds compared to
other wireless protocols and is essential for devices that require constant network access.

24
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

6 Project development
For this part, the project development process will be divided into the following phases:

6.1 Data collection


6.1.1 Configuration and Selection of Components

In this section we will see which are the objects that transform physical magnitudes, related to
environmental properties, into digital variables. This paragraph describes the material used to carry
out this project. Later, in section 9, the price of each of the devices used is discussed.

Arduino Mega

The Arduino Mega 2560 is a microcontroller board based on the ATmega2560. It has 54 digital
input/output pins, 16 analog inputs, a 16 MHz crystal oscillator, a USB connection, a power jack, an
ICSP header, and a reset button. It offers multiple communication options, including UART, SPI, and
I2C. This allows connection to a variety of external devices and sensors, which is one of the main
reasons for its choice.

Figure 3. Arduino Mega 2560 model

Figure 4 shows part of the Arduino Mega code. The code of this board is based on obtaining data
from the sensors and printing them and then sending them to the Node MCU ESP8266. In the Annex
8 of this work, you can see the complete code.

Figure 4. Print of the data sensors code

25
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

Node MCU ESP8266

The NodeMCU Lolin V3 is a development board based on the ESP8266 ESP-12F module, which is a
microcontroller with the special feature of integrated Wi-Fi functionality. This allows the device to
connect to Wi-Fi networks and communicate over the Internet, making it ideal for such projects.
Another advantage of this module is its ability to be programmed using the Arduino development
environment.

Figure 5. Node MCU Lolin V3

Next, the ESP8266 code is discussed, which is in charge of receiving the data, printed by the
Arduino Mega, to send it to the database. Figure 6 shows the libraries used for this code. We also
store the names of the Wi-Fi network, its password, the host and port used in constants. Finally,
the pins selected for the transmission and reception of data between the ESP8266 and Arduino
Mega are pins D7 and D8. To see the exact location, you can find the product datasheet in the
Annex.

Figure 6. Libraries and variables used in ESP8266 code

For this part of the code, which is shown in Figure 7, we set the serial communication to baud
rate. This is used to send data to and from the Arduino board via the USB port to which it is
connected. In the case of arduinoSerial.begin the same function is performed but for the device
that is connected through the RX/TX pins of the Arduino board. On the other hand, lines 20 to 34
represent the start of the ESP8266 Wi-Fi communication with the credentials provided above.

26
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

Finally, we find the loop function, which as its name suggests, runs in loop infinitely. It names the
function readArduino and sendDataToHost, which will be explained in the following’s pictures. In
short, information is read from the Arduino Mega connected to the Arduino serial port and sent
to the host via Wi-Fi.

Figure 7. Wi-Fi initialisation and looping of the ESP8266 code

Figure 8 explains the readArduino function which aims to read data from a device connected to
the serial port. Line 47 of the code checks if data is available to be read. It then reads characters
from the serial port until it encounters a line break ('\n'). The resulting string is stored in the
receivedData variable. Finally this data is printed and the serial port buffer is cleared to make sure
there is no residual data.

Figure 8. Read Arduino function of the ESP8266 code

27
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

Figure 9. Send data to host function of the ESP8266 code

Figure 9 is the code whose function is to send data to a remote server via HTTP. It connects to the
remote server using the address (host) and port (port). It then constructs and sends an HTTP GET
request to the remote server with the provided data. Waits up to 5 seconds to receive a response
from the server. Finally, it reads and displays on the serial port the response from the server and
closes the connection to the remote server.

28
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

DHT11

DHT11 is a temperature and humidity sensor. This sensor uses a thermistor to measure
temperature and a resistive humidity sensor to measure air humidity. These analogue values are
converted internally to digital signals which are sent to the microcontroller.

Figure 10. DHT11 sensor

MQ-2

MQ-2 is a gas and smoke sensor. It detects concentrations of gases such as methane, propane,
butane, carbon monoxide, alcohol, smoke, etc. This sensor contains a heating element and a gas
sensor. When gas or smoke comes in contact with the sensor, the electrical resistance changes,
resulting in a change in voltage or current. This change is used to determine the gas concentration.

Figure 11. MQ-2 sensor

MQ-135

MQ-135 is an air quality sensor that detects harmful gases such as ammonia, hydrogen sulphide,
carbon dioxide and volatile organic compounds. Similar to the MQ-2, the MQ-135 has a sensor that
detects various gases and compounds. The resistance of the sensor varies according to the
concentration of the gases, generating an analogue signal indicating the air quality.

29
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

Figure 12. MQ-135 sensor

KY-037

KY-037 is a sound detection module that detects the intensity of sound in the environment. This
module uses a microphone to detect sound intensity. The variation of sound intensity affects the
resistance of the microphone, generating an analogue signal proportional to the sound level.

Figure 13. KY-037 sensor

BMP180

BMP180 is a pressure and temperature sensor. This model measures atmospheric pressure using a
piezoelectric pressure sensor and temperature using a thermistor. The data is converted into digital
signals that can be read via an I2C connection.

Figure 14. BMP180 sensor

The programming of all these sensors has been done in a single Arduino file, which can be found
in the Annex 8

30
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

6.1.2 Circuit Diagram

Once the selected components have been presented, we will go on to present the wiring that makes
it possible to obtain data from the system. Figure 15 shows the diagram used.

Figure 15. Circuit connection with PSpice

31
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

6.2 Data storage

In this chapter, the focus is on the next stage of our project: data storage. If gathering information
is the first step, this process takes our data further, giving it a secure and accessible place. It explains
how, through XAMPP, the data previously obtained through Arduino will be stored in a database
for further processing.

XAMPP

XAMPP is a free and open-source software package that facilitates the creation of local web server
environments. Its name is an acronym that stands for the tools it integrates: X (for any operating
system), Apache (the web server), MySQL (the database management system), PHP (programming
language) and Perl (another programming language). This set of tools provides a complete and
functional web development environment that can be easily installed and run on local machines.

As mentioned above, this development tool allows you to test your PHP-based web development
on your own computer without the need for internet access. Some of the functions included are:

I. Apache: is a web server that handles client requests and serves web pages. XAMPP uses
Apache as the primary server in its package to manage the delivery of web content.
II. MySQL: is a database management system (DBMS) that organises and retrieves data.
XAMPP integrates MySQL to allow the creation and administration of local databases.
III. PHP: is a programming language designed for web development. PHP, working in
conjunction with Apache, allows the creation of dynamic web applications and the
manipulation of data in the database.
IV. Perl: is a versatile programming language, especially suitable for text processing. Although
not as widely used as Apache, MySQL and PHP, Perl in XAMPP provides additional flexibility
for certain use cases.

6.2.1 Creating a Database

This section discusses the steps taken to create the database to store the data obtained. It should
be noted that the installation and configuration of this programme are not considered necessary
for this guide. It should be noted that all the figures in this section are in Spanish as the installation
of XAMPP is done in this language.

1. Log in to PhpMyAdmin: Start your XAMPP server and open a web browser. Visit
http://localhost/phpmyadmin/ to access the MySQL administration interface
(PhpMyAdmin).
2. Database creation: In the "Create database" section, provide a name for your new database
in the field and click on the "Create" tab.

32
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

Figure 16. Deployment of the create base section

3. Table creation: In the left column of PhpMyAdmin, select the database you just created.
Click on the "New" button to start creating a new table and add the name you want.

Figure 17. Deployment of the create a table


4. Variable assignment: For each column in the table, we enter a name in "Name", select the
appropriate data type (INT, VARCHAR, etc.), and provide any additional settings (length,
auto-increment, etc.). After completing the definition of the database and the table, click
on the "Save" button.

Figure 18. Breakdown of the variables created

For our project, we have added the variables temperature, humidity, gasmq2, gasmq135, sound
and pressure. Each of these variables is assigned a different variable type. Figure 18 shows how
each of them is catalogued.

33
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

6.3 Data visualisation

In this section, we will discuss the implementation and visualisation of data generated by our IoT
system. Data visualisation is essential to understand and analyse the information collected by the
environmental sensors connected to our environment. As an integral part of this project, we have
developed a local website using tools such as Visual Studio Code, HTML, CSS and PHP. This website
has a dual purpose: to provide a solid theoretical background on the components of the
implemented IoT system and to offer an interactive space to visualise the data in real time.

The practical section of the website will allow users to visualise environmental data in real time. We
have implemented an intuitive and user-friendly design that presents relevant information on
temperature, humidity, gas concentration and other parameters measured by our sensors. In
addition, we have incorporated the ability to select dates (filtering data by months of the year) to
explore historical data, providing a more complete view of trends and variations over time.

The selected code editor is Visual Studio Code. VS Code is a creative release platform that you can
use to edit, debug and compile code and finally publish an application. It offers built-in support for
HTML, CSS and JavaScript, which are essential for functional and aesthetic creation.

The following are some of the most important parts of the code on the developed web page. Figure
19 shows the code that is responsible for establishing a connection to a MySQL database.

Figure 19. Database connection file

Here you define the data required for the database connection. $host specifies the location of the
database server, $username and $password are the user credentials, and $dbname is the name of
the database to connect to. On line 10, a new PDO object is created that represents the connection
to the MySQL database. It is given the connection data (host, username, password) as parameters.

34
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

Figure 20. Save data file

Figure 20 shows how data is stored at code level. Line 2 calls the above code to establish the
connection to the database. From line 4 to line 9, the data is fetched from the GET request. The
names in square brackets must match the names used to send this data from the application. Line
11 prepares the SQL query to insert the data into the 'sensor_data' table with the corresponding
values. Finally, PDO is used to prepare a SQL statement. The values of the GET request are bound
to placeholders in the SQL query. In summary, we receive data sent through a GET request, via a
URL that is sent from the ESP8266 Arduino code. This data is then added to the MySQL database.

We now turn to the last file of our website. It should be noted that the parts of the html code in
which the theoretical descriptions, table creations and other settings are created will be left out.
In case you want to see the complete code, you can find it in the Annex.

Figure 21. Date sampler code

35
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

This first part of the file represents the programming of the table in which the values obtained
depending on the selection date are displayed. The first lines of code are dedicated to the creation
of arrays to store the variable data. These arrays will be used to store the data retrieved from the
database. Then, a table is created in which all the data retrieved up to that date will be written. If
the HTTP request is a POST request, the requested date ($desiredDate) is retrieved from the form.
If the request is not a POST request, the current date is retrieved from the server ($currentDate).
Finally, a while loop is used to iterate through the query results. Each result set is stored in the
corresponding arrays and the body part of the table is constructed.

In this fragment of figure 22, the received data is processed and added to the graphs found in the
JavaScript section at the end of the file.

Figure 22. Inserting data into graphs code

On the one hand, PHP data (temperature, humidity, etc.) is taken and stored in JavaScript
variables such as temperatureData, humidityData, etc. This data is then used to create charts
using the Chart.js library. The chart creation code can be found below, where the variables
"temperatureData", "humidityData", etc. are used to set up the respective chart datasets.

36
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

7 Results
7.1 Results of the website interface

The following figures show the final result of the project. For figures 23 to 33 you can see the final
design of the website. Here we can see the theoretical part, in which the sensors used and their
functionality are presented. Finally, in the last part, the graphs obtained with the data from the
sensors are displayed graphically.

Figure 23. Sample of the website

Figure 24. Sample of the website

37
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

Figure 25. Sample of the website

Figure 26. Sample of the website

Figure 27. Sample of the website

38
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

Figure 28. Sample of the website

Figure 29. Sample of the website

Figure 30. Sample of the website

39
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

Figure 31. Sample of the website

Figure 32. Sample of the website

Figure 33. Sample of the website

40
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

Figure 24 shows the date selector to choose a month for data sampling. In turn, the "Show table"
option shows all the values collected in that month. This can be seen in figure 35.

Figure 34. Date selector

Figure 35. Display of data in table

41
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

7.2 Data collection, storage and visualisation results

Now we are going to see how the whole procedure is to obtain, store and visualise the data on our
web page. Figure 36 shows the first step, the printing of the data obtained by the sensors on the
serial port of the Arduino Mega. These data strings are then sent to the ESP8266 MCU Node.

Figure 36. Arduino Mega serial port

Figure 37 shows how the ESP8266 Node MCU receives the data string via serial communication
with the Arduino Mega. Once we obtain the data, we split each data along with its value and then
add it to the URL of our database in order to store and visualise it.

Figure 37. Node MCU ESP8266 serial port

42
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

Finally, in this Figure 38 we can see how the data obtained are stored. It shows the time of the
acquisition and its value.

Figure 38. Database with values obtained

The figures above already show the results of the graphs. The user has to select the desired
month to see the results.

43
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

8 Practical applications
8.1 Practical real-world applications

Implementing an IoT Environmental Monitoring System presents a versatile platform with


numerous practical applications. The collected data can be applied in various real-world scenarios,
providing valuable insights into environmental conditions. Below are examples of practical use
cases and a feasibility study in real-world situations:

Agricultural Monitoring:

- Application: The system can be deployed in agriculture to monitor temperature, humidity,


and soil moisture. Farmers can receive real-time data, enabling them to make informed
decisions about irrigation, planting, and harvesting.
- Feasibility: Improved crop yield and resource utilization, leading to sustainable agricultural
practices.

Urban Air Quality Management:

- Application: IoT sensors can measure air quality parameters such as gas levels and
particulate matter in urban areas. Local authorities can use this data to implement
timely interventions for pollution control.
- Feasibility: Mitigation of air pollution, contributing to public health and sustainable
urban development.

Smart Homes and Energy Efficiency:

- Application: Integrating environmental sensors into smart homes allows for real-time
monitoring of indoor air quality. Automated systems can adjust ventilation and heating
based on the collected data.
- Feasibility: Enhanced energy efficiency and improved indoor comfort for residents.

Wildlife Conservation:

- Application: Deploying sensors in natural habitats helps monitor environmental


parameters relevant to wildlife conservation, such as temperature and humidity. This data
assists researchers in understanding ecosystems and protecting endangered species.
- Feasibility: Facilitating scientific research and conservation efforts for biodiversity
preservation.

44
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

8.2 Feasibility Study

The feasibility of implementing this IoT Environmental Monitoring System in real-world situations
is evident from the success of similar systems in various domains. Key factors contributing to
feasibility include:

Cost-Effectiveness: The use of components such as Arduino provides a cost-effective solution


compared to traditional monitoring systems.

Scalability: The system can be easily scaled to accommodate a wide range of environments and
monitoring requirements.

Data Accuracy: Calibration and precise sensor technology ensure accurate data, making the system
reliable for critical applications.

Integration Capability: The system's compatibility with existing technologies facilitates seamless
integration into diverse industries and applications.

45
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

9 System budget
Table 1 shows the price of all the material used for the realisation of this project.

Material Unit Price

Arduino Mega 1 49,99 €

Node MCU ESP8266 1 9,49 €

Protoboard 2 5,40 €

Cables 40 5,82 €

DHT11 1 5,99 €

MQ-2 1 6,49 €

MQ-135 1 6,99 €

KY-037 1 4,79 €

BMP-180 1 7,79 €

Resistor Kit 1 9,99 €

TOTAL 118,14 €

Table 1. Budget for the project

All programming tools such as Arduino, XAMPP and Visual Studio Code are zero cost and are
therefore not included in the table.

46
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

10 IoT security and privacy


Security in IoT solutions is a key concern for both developers and users. IoT applications must not
only deal with known attacks, but also ensure the continuous security of data transmissions
between devices. Lack of security increases the risk of your personal information leaking while the
data is collected and transmitted to the IoT device. IoT devices are connected with a consumer
network. This network is also connected with other systems. So, if the IoT device contains any
security vulnerabilities, it can be harmful to the consumer’s network.

Search and security tools are being developed to meet these challenges. Depending on the security
approach we want to apply to our project, we can add different solutions or preventions:

- Firewall systems: A firewall system is a protection system that monitors network activities
continuously using a set of predefined rules.
- Intrusion Detection and Prevention Systems: IDPS Intrusion Detection and Prevention
Systems comprise a set of protection mechanisms that aim to detect, record and prevent
potential threats in real time.
- Data Encryption: Implement robust encryption algorithms to ensure the confidentiality of
transmitted and stored data.
- Strong Authentication: Employ strong authentication methods, such as strong passwords
or even biometric mechanisms, to ensure that only authorised users have access to devices
and data.
- Firmware Updates: Establish a secure and efficient process for remotely updating device
firmware, patching potential security vulnerabilities.
- Firewalls and Traffic Filters: Configure firewalls and traffic filters to control the flow of data
between IoT devices and other systems, preventing unauthorised intrusions.
- Continuous Monitoring: Implement continuous monitoring systems to detect and respond
quickly to unusual activity or unauthorised access attempts.
- Protection against Denial of Service (DoS) Attacks: Incorporate measures to prevent or
mitigate DoS attacks that could affect the availability of IoT devices and services.
- Identity and Access Management (IAM): Establish robust IAM policies to control who has
access to which resources and data, thereby reducing the attack surface.
- Physical Security: Consider the physical security of devices, for example by limiting physical
access to devices or placing them in secure locations.
- Education and Awareness: Educate end-users and developers on security best practices
and raise awareness of potential threats and how to mitigate them.

47
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

11 Sustainability Study
The project not only seeks to provide innovative solutions for environmental data collection, but
has also focused on sustainability as a fundamental pillar. Through the following analysis, we
examine how this system contributes to environmental sustainability and addresses some societal
challenges.

For this sustainability study, I have extracted some questions to answer on this topic (Daniel Palomo
Cabrera, 2021). In the following, I will include the questions related to the scope of sustainability
for the self-assessment of my project. In grey, questions answered before going into full
development, in black, questions answered at the end of the project.

11.1 Environmental Field

Have you estimated the environmental impact of the project and have you considered minimising
the impact, e.g. by reusing resources?

By developing a project that combines software with some sensors, the environmental impact is
reduced to the electrical cost of keeping the computer on, as with this, I am able to power my entire
system electrically. Therefore, in order to minimise this impact, the only possible solution is to
reduce the use of data collection to avoid overloading the sensors and to increase their life.

Have you quantified the environmental impact and what measures have you taken?

The impact my project can have translates into hours worked at the computer. However, I have not
quantified the total number of hours in the realisation of this project.

If you were to do the project again, could you do it with fewer resources?

If I were to do the project again, I would not reduce resources. In terms of cutting costs, fewer
sensors could be used. However, this would limit the data information obtained for the user, so it
is not a positive development for the project.

How is the problem you want to address currently solved? How will your solution be
environmentally better than existing solutions?

There are now hundreds of ways to address this issue. The clearest and most widely known example
could be traditional weather stations to more modern sensor-based solutions applied in agriculture.
My proposed solution aims to provide a system that is adaptable to any environment and affordable
at an economic level. The aim is to obtain knowledge of the physical properties that surround us
and to raise awareness of the climate changes that are being experienced around the world.

48
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

Overall, will the project worsen or improve the ecological footprint?

By trying to put people in context about the things around us, it can lead to a change in their
mindset. So, the implementation of these systems would mean an improvement in the ecological
footprint.

11.2 Economic Field

Have you estimated the cost of carrying out the project?

The budget used for the realisation of this project is shown in Table 1, under point 9.

What do you estimate the lifetime cost of the project to be? Can it be reduced?

The cost will be determined by future improvements and maintenance requirements. The cost can
be reduced depending on the scope of the project.

How is the problem you want to address currently solved? How will your solution be economically
better than existing solutions?

The solution I propose is the adaptability of the system in any environment. By using small and
affordable sensors for the user, it becomes an accessible way for many.

11.3 Social Field

What do you think this project will bring to you on a personal level?

The realisation of this project will provide me with knowledge and experience when it comes to
tackling a project on my own. The fact of being able to face and deal with the problems of a job
provides personal and professional growth.

Has the implementation of this project involved significant personal, professional or ethical
reflections on the part of the people involved?

Developing this project has helped me to start projects that really interested me. Being able to
create a website has always been one of my motivations and curiosities for a long time and being
able to combine it with subjects related to my studies has been a great opportunity.

How is the problem you want to address currently solved? How will your solution improve socially
on existing solutions?

At present, this project can be approached in different ways. From the use of different sensors to
the use of actuators for the establishment of alarms (e.g. a fire alarm system).

49
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

Is there a real need for the project?

At the level of social awareness, I think this type of project is necessary. Being able to detect
pollution levels in a preventive way can help to take measures to protect public health. We are
seeing that in some areas of the world, climate change is affecting temperature levels. The insertion
of these projects could try to inform people in order to make a change possible as soon as possible.

50
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

12 Conclusions
Upon completion of this work, I conclude the successful implementation of an Internet of Things
(IoT) based Environmental Monitoring System using widely available hardware platforms such as
Arduino and Node MCU ESP8266.

As I mentioned in the introduction, this project was born out of the motivation and curiosity to
acquire knowledge about sectors such as data processing and web development. The idea of
combining these two fields together with the speciality of my studies seemed to me a motivating
idea. In the same way, doing this kind of project abroad would give me the opportunity to get to
know new ways of working and learning. Throughout these five months of work, there has been a
lot of learning and challenges. First of all, as I was unfamiliar with a subject like this, one of the first
problems I encountered was the fact of narrowing down the topic. While it is true that I had in mind
to implement an IoT system, I had not yet decided what application it would have. However, when
I arrived at my destination university and saw the facilities provided by the campus, I opted for an
environmental monitoring system because I could get a lot out of it. During the realisation of the
project, one of the most important aspects learned was organisation. The fact of initially managing
and implementing the project with a single sensor, in order to avoid tackling the entire
implementation all at once, has been key in locating and resolving the various problems that have
arisen. Thanks to the search for information, I have also been able to learn the importance of how
to treat the data for further processing. In addition, ensuring data security is fundamental for any
type of project as it can cause various problems in the different media in which it is used. In the
same way, I have put my creativity skills to work in the implementation of the website interface.

A highlight of this initiative is its sustainable approach. Consideration has been given to minimising
environmental impact, not only in the collection of crucial environmental data, but also in the
implementation of the project itself. The use of affordable hardware and the optimisation of
wireless communication contribute to an energy-efficient solution. Because of this, it is one of the
reasons why I believe it could compete with the myriad of existing solutions. In terms of practical
applications, this system demonstrates its usefulness in a variety of real-world situations. From
environmental monitoring in industrial environments to air quality assessment in urban areas, the
applications are vast. The feasibility of the system has been tested in different real-world scenarios,
highlighting its robustness and adaptability.

In conclusion, this project represents not only a technological breakthrough in the field of
environmental monitoring, but also a testament to the ability of IoT technology to address
significant challenges. By providing real-time environmental data, this Environmental Monitoring
System is positioned as a valuable tool for informed decision-making and environmental
preservation.

51
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

52
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

13 Bibliography
1. Box Bp, P. O., & Kigali. (n.d.). College of Science and Technology African Center of Excellence in
Internet of Things (ACEIoT) Master of Science in Internet of Things: Wireless Intelligent Sensor
Networking (MSc in IoT:WISeNet) MODULE DESCRIPTIONS.

2. Capgemini Group. (n.d.). iotsensorpov-sensortypes.

3. ESTADO DEL ARTE Y TENDENCIAS DEL IoT e IoE | 1. (n.d.).

4. Felipe Gómez, L. (n.d.). Interoperabilidad en los Sistemas de Información Documental (SID): la


información debe fluir 1.

5. Ferrer, J. S., Seoane, C. G., & Cabrera, D. P. (2021). Diseño e implementación de una aplicación
Android para la búsqueda de aparcamiento.

6. González-Usach, R. ; Y.-V. DC. ; J.-S. M. ; P. S. C. (n.d.). Interoperability in IoT.


http://hdl.handle.net/10251/150250http://hdl.handle.net/10251/150250

7. Internet of Things (IoT). (n.d.).

8. IoT & Applications Digital Notes. (n.d.).

9. Khodadadi, F., & Buyya, R. (2017). Internet of Things: An Overview.


https://www.researchgate.net/publication/315456657

10. Moldón, N. P., Albós, A., Helena, R., & Pous, R. (2019). Security in IoT Ecosystems.

11. Uso de MQTT para el control de dispositivos de IoT 2. (n.d.).

12. Villamil, S., Hernández, C., & Tarazona, G. (2020). An overview of internet of things. Telkomnika
(Telecommunication Computing Electronics and Control), 18(5), 2320–2327.
https://doi.org/10.12928/TELKOMNIKA.v18i5.15911

13. SCAD College of Engineering and Technology, & Institute of Electrical and Electronics Engineers.
(n.d.). Proceedings of the International Conference on Trends in Electronics and Informatics (ICOEI
2019) : 23-25, April 2019.

14. IEEE Communications Society, IEEE Computer Society, IEEE Consumer Electronics Society, &
Institute of Electrical and Electronics Engineers. (n.d.). 2016 IEEE 3rd World Forum on Internet of
Things ((WF-IoT) : 12-14 Dec. 2016.

53
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

15. Internet of Things-IOT: Definition, Characteristics, Architecture, Enabling Technologies,


Application & Future Challenges. Keyur K Patel, Sunil M Patel. 5, s.l. : International Journal of
Engineering Science and Computing, 2016, Vol. 6.

16. Ciberseg. (2021, 8 noviembre). Capas de IoT que debes conocer. Ciberseguridad.
https://ciberseguridad.com/guias/nuevas-tecnologias/capas-iot/

17. Securing the Internet of Things: Challenges, threats and solutions. Panagiotis I. Radoglou
Grammatikis, Panagiotis G. Sarigiannidis, Ioannis D. Moscholios. s.l. : Elsevier, 2019, Internet of
things, Vol. 5.

18. Network Protocols, Schemes, and Mechanisms for Internet of Things (IoT): Features, Open
Challenges, and Trends. Anna Triantafyllou, Panagiotis Sarigiannidis , Thomas D. Lagkas. 2018,
Wireless Communications and Mobile Computing, Vol. 2018.

19. A. Rayes, S. Salam. The Things in IoT: Sensors and Actuators. Internet of Things From Hype to
Reality. 2019.

20. A Survey of Network Virtualization Techniques for Internet of Things Using SDN and NFV. Alam,
Iqbal, et al. 2020, ACM Computing Surveys.

21. Software-defined networking for internet of things: A survey. Bera, Samaresh, Sudip Misra, and
Athanasios V. Vasilakos. 2017, IEEE Internet of Things Journal.

22. A comparative study of LPWAN technologies for large-scale IoT deployment. Mekki, et al. 2019,
ICT Express.

23. A Cloud-Based Infrastructure to Support Manufacturing Resources Composition. Giovanni Di


Orio, Diogo Barata, André Rocha, José Barata. 2015. DoCEIS 2015: Technological Innovation for
Cloud-Based Engineering Systems.

24. Interoperability in Internet of Things: Taxonomies and Open Challenges. Noura, M.,
Atiquzzaman, M., Gaedke, M. 3, 2019, Mobile Networks and Applications, Vol. 24.

25. AZ-Delivery - your expert for microelectronics. (2024, 15 enero). AZ-Delivery. https://www.az-
delivery.de/en

26. Arduino - home. (s. f.). https://www.arduino.cc/

27. Salazar, J., & Silvestre, Y. S. (n.d.). INTERNET DE LAS COSAS. http://www.techpedia.eu

54
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

14 Annex 1: Arduino Mega specifications and pinout

55
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

56
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

57
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

58
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

15 Annex 2: Node MCU ESP8266 specifications and pinout

59
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

16 Annex 3: DHT11 specifications and pinout

60
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

61
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

62
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

17 Annex 4: MQ-2 specifications and pinout

63
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

64
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

18 Annex 5: MQ-135 specifications and pinout

65
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

66
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

19 Annex 6: KY-037 specifications and pinout

67
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

68
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

20 Annex 7: BMP-180 specifications and pinout

69
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

70
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

71
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

72
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

21 Annex 8: Programming code for Arduino Mega sensors

73
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

22 Annex 9: ESP8266 Programming code

74
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

75
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

23 Annex 10: Programming code of the web page

76
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

77
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

78
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

79
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

80
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

81
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

82
IoT Environmental Monitoring System Using Arduino and NODE MCU ESP8266

83

You might also like