CHAPTER 3
SYSTEM IMPLEMENTATION
In this chapter, the hardware and software implementation of IoT based
personal weather monitoring system are described in details including the features of
NodeMCU and applications that come with it.
3.1. Hardware Implementation of IoT Based Personal Weather Monitoring
System
In this section, NodeMCU is utilized to build the measuring and monitoring
system as a main controller. In addition, several sensors are used to monitor the
temperature, humidity and pressure. A relay board is exploited to control appliances.
Sensors are attached to NodeMCU and updating will be done on web server. The
proposed automation system can easily and efficiently control the electrical
appliances via web page and LCD.
In the monitoring section, Internet access is firstly connected in order to
control over internet. After connecting the internet, Blynk application can be control
the hardware components. DHT22 is used to measure temperature and humidity. Data
pin of DHT22 is configured to pin D3 of NodeMCU. If the temperature and humidity
exceed the 30Ċ, this status is showed on the LCD display. At the same time, fan will
on and buzzer for temperature and humidity will turn on. Similarly, the pressure level
can be known automatically by detecting the pressure outside the building using
pressure sensor which is connected to the NodeMCU. Hitachi HD44780 LCD
controller is utilized as LCD driver which uses 4 bits mode. I2C LCD controller has
four connections: Vcc, Gnd, SDA and SCL. With I2C interface LCD module, it only
needs 2 pins to display information. SCL (Serial Clock Line) from I2C LCD is
connected to pin D1 from NodeMCU. SDA (Serial Data Line) from I2C LCD is
connected to pin D2 from NodeMCU. Pressure sensor is also connected to the pin D1
and D2 of the NodeMCU. User can monitor the sensors via LCD. The user can also
monitor the electric appliances through the internet via Blynk application. All of the
sensors can be remotely monitored through Blynk application.
21
3.2. Circuit Diagram of IoT Based Personal Weather Monitoring System
Circuit Diagram of IoT Based Personal Weather Monitoring System is
illustrated in figure 3.1. And the operation of IoT Based Personal Weather Monitoring
System is described above. The following circuit diagram shows all the necessary
connections required to implement the system. The NodeMCU is connected to the
CPU by using data cable. DHT 22 temperature and humidity sensor is placed on the
bread board. The sensor is again connected to the NodeMCU by using connecting
wires which is a serial communication. Then upload the required program in Arduino
software and the temperature and humidity readings are displayed on the serial
monitors which are shown in the experimental results section.
A pressure sensor is a device for pressure measurement of gases or liquids.
Pressure is an expression of the force required to stop a fluid from expanding, and is
usually stated in terms of force per unit area .
Figure 3.1. Circuit Diagram of IoT Based Personal Weather Monitoring System
22
3.3. Software Requirements of This System
In this system, Arduino IDE software, C programming and Fritzing software
are used to designed and upload the program. Firstly, circuit design is illustrated with
Fritzing software. When this outcome result is certainly completely, C programming
language is studied for programming. And then, Arduino IDE is used to program the
Arduion Uno and all of the hardware components. Details of Arduino IDE, C
programming and circuit design software are mentioned below.
3.3.1. Fritzing Software
Fritzing is an open-source hardware initiative that makes electronics
accessible as a creative material for anyone. Fritzing offer a software tool, a
community website and services in the spirit of Processing and Arduino, fostering a
creative ecosystem that allows users to document their prototypes, share them with
others, teach electronics in a classroom, and layout and manufacture professional
PCBs. The software is created in the spirit of the Processing programming language
and the Arduino microcontroller and allows a designer, artist, researcher, or hobbyist
to document their Arduino-based prototype and create a PCB layout for
manufacturing. The associated website helps users share and discuss drafts and
experiences as well as to reduce manufacturing costs.
Figure 3.2. Designing Using Fritzing Software
23
Fritzing empowers the Internet of Things through an ecosystem of easy-to-use
tools and services for creative people. The open-source Fritzing software turns even
non-engineers into producers of interactive electronics. Fritzing can be seen as an
electronic design automation (EDA) tool for non-engineers: the input metaphor is
inspired by the environment of designers (the breadboard-based prototype), while the
output is focused on accessible means of production. As of December 2, 2014,
Fritzing has made a code view option, where one can modify code and upload it
directly to an Arduino device. Component images are distributed under CC-BY-SA,
which will also be the license for any generated breadboard views. In this system, this
software is used to design the overall system.
3.3.2. C Programming Language
C programming is a general-purpose, procedural computer programming
language supporting structured programming, lexical variable scope, and recursion,
with a static type system. By design, C provides constructs that map efficiently to
typical machine instructions. It has found lasting use in applications previously coded
in assembly language. Such applications include operating systems and various
applications software for computer architectures that range from supercomputers to
PLCs and embedded systems. A successor to the programming language B, C was
originally developed at Bell Labs by Dennis Ritchie between 1972 and 1973 to
construct utilities running on Unix. It was applied to re-implementing the kernel of the
Unix operating system. During the 1980s, C gradually gained popularity. It has
become one of the most widely used programming languages, with C compilers from
various vendors available for the majority of existing computer architectures and
operating systems. C has been standardized by the ANSI since 1989 (ANSI C) and by
the International Organization for Standardization (ISO).
C is an imperative procedural language. It was designed to be compiled to
provide low-level access to memory and language constructs that map efficiently to
machine instructions, all with minimal runtime support. Despite its low-level
capabilities, the language was designed to encourage cross-platform programming. A
standards-compliant C program written with portability in mind can be compiled for a
wide variety of computer platforms and operating systems with few changes to its
source code. Many later languages have borrowed syntax/features directly or
indirectly from C language.
24
Figure 3.3. C Programming Language
The main features of C language include low-level access to memory, a simple
set of keywords, and clean style, these features make C language suitable for system
programmings like an operating system or compiler development. Like syntax of
Java, PHP, JavaScript, and many other languages are mainly based on C language.
C++ is nearly a superset of C language (There are few programs that may compile in
C, but not in C++).
3.3.3. Arduino Development “IDE”
The Arduino integrated development environment (IDE) is a cross-platform
application written in Java, and is derived from the IDE for the Processing
programming language and the Wiring projects. It is designed to introduce
programming to artists and other newcomers unfamiliar with software development. It
includes a code editor with features such as syntax highlighting, brace matching, and
automatic indentation, and is also capable of compiling and uploading programs to the
board with a single click. There is typically no need to edit make files or run programs
on a command-line interface. Interface Arduino Uno program is as shown in Figure
3.4.
Figure 3.4. Interface Arduino Uno Program
25
Arduino programs are written in C or C++. The Arduino IDE comes with a
software library called “Wiring” from the original Writing project, which makes many
common input/output. Operations can be much easier. Users only need define two
functions.
To make a runnable cyclic executive program:
▪ Setup ( ): a function run once at the start of a program that can initialize
settings.
▪ Loop ( ): a function called repeatedly until the board powers off.
The control software program is written in ‘Embedded C’. The program has
the capability of sending and receiving the SMS from and to the user mobile via GSM
modem to tell that unauthorized entry/smoke has detected in case of security system
and to control some devices in case of automation system respectively. The program
also provides the display of current status of the system.
3.4. Flow Chart of IoT Based Personal Weather Monitoring System
The procedures steps and program flow chart of personal weather system is
described in figure 3.5.
Figure 3.5. Flow Chart of IoT Based Personal Weather Monitoring System
26
3.5. IoT Platform
The Internet of Things (IoT) has undergone rapid transformation since the
term was first coined in 1999 by Kevin Ashton. Since the variety and the number of
devices connected to the Internet have increased exponentially in recent years, IoT
has become a mainstream technology with a significant potential for advancing the
lifestyle of modern societies. In terms of the technology and engineering aspects of
IoT, there currently exists a clear separation between the hardware and software
platforms, with the majority of vendors focused on the hardware. Few vendors in the
industry currently offer IoT software platforms: for example, out of the top 100 IoT
startups ranked by Matter mark (based on the total funding they received), only about
13 startups provide IoT software platforms.
The aim of this thesis is to make a general survey of the current IoT software
platform landscape based on a detailed analysis. A platform could be a hardware plus
software suite upon which other applications can operate. IoT platforms (more
specifically IoT application platforms) provide a comprehensive set of generic, i.e.
application independent functionalities which can be used to build IoT applications.
When there is only one communication link between devices of one type with another
device of same type then, a system of specific service can be set up. But in case of
communication among devices of multiple types, there is a need of some common
standard application platform which hides heterogeneity of various devices by
providing a common working environment to them.
An IoT application platform is a virtual solution, means it resides over cloud.
Data is the entity that drives business intelligence and every device has something to
talk with other device that is data. By means of cloud connectivity, IoT application
platform translates such devices data into useful information. So it provides user
means to implement business use cases and enables predictive maintenance, pay-per-
use, analytics and real time data management. Thus, IoT application platforms
provide a complete suite for application development to its deployment and
maintenance. IoT platform is a complete suite of services that facilitates services like
development, deployment, maintenance, analytics as well as intelligent decision
making capabilities to an IoT application. Various IoT platforms are now a day
available that can be used for developing an IoT solution but in this system have
covered one popular platform that are widely used for IoT solution building. This IoT
platform is Blynk IoT platform.
27
3.6. Implementation of Personal Weather Station system Using Blynk IoT
Blynk application is used to control and monitor the different appliances such
as fans, lights and so on. The user can read sensor data with the smartphone or PC and
take action using just blynk app. Download the Blynk app and then the user can create
a project dashboard and arrange buttons, sliders, graphs, and other widgets onto the
screen. First step, the new project is created in Blynk application as shown in figure
3.6.
Figure 3.6. Creating a New Project
And then, email and password are signed up in order to start the app as shown
in figure 3.7. All of the sensors data are received. By this way, the user can get the
notifications that occur in the house.
Figure 3.7. Creating a New Account by Using User ID and Password
28
Second step, new project is clicked and entered the Project Name (enter the
Project Name according to the user wish) as “Personal Weather Station”, chosen
device as “NodeMCU“, connection Type as “Wi-Fi” and then clicked “Create” icon
as shown in figure 3.8.
Figure 3.8. Selecting Hardware Device and Creating a Project
After creation the project, App will send the Auth Token code to registered
Email ID. By clicking on the “+” icon which located on top right side of the app,
buttons can be created as shown in figure 3.9.
Figure 3.9. Creating a Button Name
29
And the button name is entered and selected the GPIO pins (example: D0, D1,
D2, D3). As an example, LED is created as a button name and D2 is selected as
illustrated in figure 3.10. Whenever the user presses an icon in the app, then this
information will be send to ESP8266 via Wi-Fi. The ESP8266 analyses the received
commands and turns ON/OFF of the respective device via relay board. In this way,
the user can control and monitor the different appliances via Blynk app.
Figure 3.10. Demonstration of Blynk Application Using LED
3.7. Summary
This chapter explains the overall hardware and software implementation of the
system. The program flowchart of the overall system is also described. Circuit
diagram of system is also described. Test and results of the research will be described
in the next chapter.