fatin nur faqihah binti adnan bachelor of computer …

67
WEATHER STATION USING IOT FATIN NUR FAQIHAH BINTI ADNAN BACHELOR OF COMPUTER SCIENCE (SOFTWARE DEVELOPMENT) WITH HONOURS UNIVERSITI SULTAN ZAINAL ABIDIN 2019

Upload: others

Post on 16-Mar-2022

3 views

Category:

Documents


0 download

TRANSCRIPT

WEATHER STATION USING IOT

FATIN NUR FAQIHAH BINTI ADNAN

BACHELOR OF COMPUTER SCIENCE

(SOFTWARE DEVELOPMENT) WITH

HONOURS

UNIVERSITI SULTAN ZAINAL ABIDIN

2019

WEATHER STATION USING IOT

FATIN NUR FAQIHAH BINTI ADNAN

BACHELOR OF COMPUTER SCIENCE

(SOFTWARE DEVELOPMENT) WITH HONOURS

FACULTY OF INFORMATICS & COMPUTING

UNIVERSITI SULTAN ZAINAL ABIDIN

2019

i

DECLARATION

I hereby declare that this report is based on my original work except for quotations and

citations, which have been duly acknowledged. I also declare that it has not been

previously or concurrently submitted for any other degree at Universiti Sultan Zainal

Abidin or other institutions.

____________________________________

Name : Fatin Nur Faqihah Binti Adnan

Date : ………………………………..

ii

CONFIRMATION

This project report title Weather Station Using Internet of Things (IoT) was prepared and

submitted by Fatin Nur Faqihah Binti Adnan and has been found satisfactory in terms of

scope, quality and presentation as a part of fulfillment of the requirement for the Bachelor

of Computer Science (Software Development) with Honours in University Sultan Zainal

Abidin.

____________________________________

Name : Prof. Madya Dr. Engku Fadzli Hasan

Bin Syed Abdullah

Date : …………………………..

iii

DEDICATION

I would like to express my deepest appreciation to all who provided me the possibility to

complete this report. A special gratitude goes to my supervisor, Prof. Madya Dr. Engku

Fadzli Hasan Bin Syed Abdullah for guiding me in the development of this project. My

warmest gratitude for my Final Year Project panels for aiding my system and giving the

feedback and valuable guidance.I take this opportunity to thank my parents and my family

for giving moral support and encouragement. Special thanks to all lectures under Faculty

of Informatics and Computing for their attentions, guidance and advice in developing this

project. I, sincere thanks to my fellow friends for their help in finishing this project.

iv

ABSTRACT

This project was developed because to help user access data about weather anywhere in

real-time. There is a difference between real-time weather station and weather forecast. The

weather forecast is to predict the weather according for a given location and time. Weather

forecasts are made by collecting quantitative data on the current state of the atmosphere in

a particular place. Meanwhile, real-time weather station is a device that collects data related

to the weather and environment using many different sensors. Weather station is a facility

that can use for measuring atmospheric conditions like temperature, humidity and air

pressure to provide information for weather forecasts and to study the weather and climate.

Due to the fact that without weather station, user can’t be alerted of the strong winds, heat

waves or any other weather-related emergency. This means that we need weather station to

make forecasts and collects data related to the weather. To overcome the problems faced,

there are techniques that can be implemented to assist this project. This project will use

Internet of Things with sensors to build weather station. The weather station can help

provide data for forecasts. Once a weather station is connected, user can view the history

of information as well.

v

ABSTRAK

Projek ini dibangunkan untuk membantu pengguna mengakses data mengenai cuaca di

mana-mana sahaja dalam waktu semasa. Terdapat perbezaan antara stesen cuaca masa

nyata dengan ramalan cuaca. Ramalan cuaca adalah untuk meramalkan cuaca mengikut

lokasi dan masa yang diberikan. sementara itu, stesen cuaca masa nyata merupakan peranti

yang mengumpul data yang berkaitan dengan cuaca dan alam sekitar dengan menggunakan

sensor yang berbeza. Stesen cuaca adalah kemudahan yang boleh digunakan untuk

mengukur keadaan atmosfera seperti suhu, kelembapan dan tekanan untuk memberikan

maklumat untuk ramalan cuaca dan untuk mengkaji cuaca dan iklim. Ada fakta mengatakan

bahawa tanpa stesen cuaca, pengguna tidak mendapat maklumat mengenai angin kencang,

gelombang panas atau sebarang kecemasan berkaitan cuaca. Ini bermakna kita memerlukan

stesen cuaca untuk membuat ramalan dan mengumpul data yang berkaitan dengan cuaca.

Untuk mengatasi masalah yang dihadapi, terdapat teknik yang dapat dilaksanakan untuk

membantu projek ini. Projek ini akan menggunakan Internet of Things dengan sensor untuk

membina stesen cuaca. Stesen cuaca dapat membantu menyediakan data untuk ramalan.

Apabila stesen cuaca itu berjaya disambung, pengguna boleh mengakses data semasa dan

juga data-data yang lepas.

vi

CONTENTS

DECLARATION I

CONFIRMATION II

DEDICATION III

ABSTRACT IV

ABSTRAK V

CONTENTS VI

LIST OF TABLES IX

LIST OF FIGURES X

CHAPTER 1 1

INTRODUCTION 1

1.1 Introduction 1

1.2 Problem Statement 3

1.3 Objective 3

1.4 Scope 4

1.4.1 User Scope 4

1.4.2 System Scope 4

1.5 Limitation of Works 4

1.6 Expected Result 5

CHAPTER 2 6

LITERATURE REVIEW 6

vii

2.1 Introduction 6

2.2 Related Research Technique and Tools 7

CHAPTER 3 12

METHODOLOGY 12

3.1 Introduction 12

3.2 Rapid Application Development (RAD) 13

3.2.1 Phase 1: Analysis & Quick Design 14

3.2.2 Phase 2: Prototype Cycle 15

3.2.3 Phase 3: Testing 15

3.2.4 Phase 4: Deployment 16

3.3 Requirement Analysis 17

3.3.1 Hardware Requirement 17

3.3.2 Software Requirement 18

3.4 System Design 19

3.4.1 Framework 20

3.4.2 Process Model 21

3.4.3 Entity Relationship Diagram (ERD) 23

3.4.4 Schematic 24

3.5 Data Dictionary 25

CHAPTER 4 26

IMPLEMENT AND RESULT 26

4.1 Introduction 26

4.2 Interface Design 26

4.2.1 Weather Station 27

4.2.2 User 36

4.3 Flow Chart 38

4.3.1 Flow Chart for Weather Station 38

4.3.2 Flow Chart for User 39

CHAPTER 5 40

viii

CONCLUSION 40

5.1 Introduction 40

5.2 Project Contribution 40

5.3 Project Constraints and Limitation 41

5.4 Future Works 41

5.5 Conclusion 41

REFERENCES 42

APPENDIX 43

ix

LIST OF TABLES

TABLE TITTLE PAGE

3.1 Hardware Requirement 17

3.2 Software Requirement 18

x

LIST OF FIGURES

FIGURE TITTLE PAGE

3.1 Rapid Application Development 14

3.2 Framework of the project 20

3.3 Context Diagram of the System 21

3.4 Data Flow Diagram of the System 22

3.5 Entity Relationship Diagram of the System 23

3.6 Schematic of the System 24

3.7 Weather 25

4.1 Sensor Installation 27

4.2 Sensor Safety 28

4.3 Installation for Sensors and Controller 29

4.4 Installation Area for Sensors 30

4.5 Installation Area for Controller 31

4.6 All of Connection 32

4.7 Connection of Solar Panel 33

4.8 Overall Installation 34

4.9 Installation Area for Weather Station 35

4.10 Menu Interface 36

4.11 Station 1 37

4.12 Station 2 37

4.13 Flow Chart for Weather Station 38

4.14 Flow Chart for User 39

xi

LIST OF ABBREVIATIONS / TERMS/ SYMBOLS

CD Context Diagram

DFD Data Flow Diagram

ERD Entity Relationship Diagram

RAD Rapid Application Development

IoT Internet of Things

DBMS MySQL Database Management System

RDBMS Relational Database Management Systems

1

CHAPTER 1

INTRODUCTION

1.1 Introduction

A weather station is a device that collects data related to the weather and

environment using many different sensors. Weather station is also a facility that can use for

measuring atmospheric conditions to provide information for weather forecasts and to study

the weather and climate. The measurements taken include temperature, atmospheric

pressure, humidity, wind speed, wind direction, and precipitation amounts. Weather

stations are also called weather centers, personal weather stations, professional weather

stations, home weather station and weather forecaster.

There are a difference between real-time weather station and weather forecast. The

weather forecast is to predict the weather according for a given location and time. Weather

2

forecasts are generated by collecting as much data as possible on current atmospheric

conditions and using insights into atmospheric processes to determine how the weather will

change in the future. Meanwhile, real-time weather station is a device that collects data

related to the weather and environment using many different sensors and get accurate

weather readings in real time.

Therefore, Weather Station using Internet of Thing is proposed to help user access

data about weather anywhere in real-time. User can collect the measurements by the sensors

at any time. It can even be viewed on smartphone or tablet. This means that whenever user

want to know what the temperature is, user can have access to information in real time.

3

1.2 Problem Statement

Human activity is influenced by weather conditions, monitoring of weather

conditions can help in controlling the activity. It is important to monitor and study the

pattern of weather at surrounding. Limited way for user to know about weather such as

temperature, humidity and wind speed. Without weather station, user can’t be alerted of the

strong winds, heat waves or any other weather-related emergency.

Furthermore, difficulty in making weather forecasts without data. When user use

weather station, user can view the history of information as well. User can figure out the

trends in the measurements. This will allow user to analyze the trends in a more effective

way.

1.3 Objective

• To design a real-time weather station that can help user to access data anywhere in

real-time.

• To develop weather station using Internet of Things.

• To test the capabilities and effectiveness of the Weather Station and generate the

data to the user.

4

1.4 Scope

The scope is important to set a boundary on what the area will cover in the

project. Thus Weather Station using Internet of Things is focused on getting data about

weather like temperature, humidity, and pressure.

1.4.1 User Scope

Can view the data of temperature, humidity and air pressure.

1.4.2 System Scope

Collects data of temperature, humidity and air pressure from whether

station.

Save the real time data and sent the data to local server.

Weather Station will be sent the data to the database every 5 minutes.

1.5 Limitation of Works

This Weather Station project only involves user to view the data of weather such as

temperature, humidity and air pressure. In this project, DHT11 and BMP180 sensors will

be used to build weather station. Last, weather station also require an internet connection

to send data to users. Once a weather station is connected, then user can view the history

of information as well.

5

1.6 Expected Result

The expected result of this project is user can access data temperature, humidity

and air pressure anywhere in real-time. To get data readings from weather stations,

users need to use a telegram. In this project, the chatbot system is used to inform the

users about the weather. This means that whenever user want to know what the

temperature is, user can have access the information in real time using telegram. Next,

real-time alerts which allow the user to plan the day accordingly. Having insights into

these alerts can help avoid emergency situations. The weather station can help provide

data for forecasts. Once a weather station is connected, user can view the history of

information as well. This project can figure out the trends in the measurements. This

will allow user to analyze the trends in a more effective way.

6

CHAPTER 2

LITERATURE REVIEW

2.1 Introduction

Internet of Things, IoT

The Internet of Things, refers to all of physical devices around the world that are

connected to the internet, collecting and sharing data. In other words, this is the concept of

basically connecting any device to the Internet with an on and off switch. This enhances

the level of digital intelligence to devices, allowing them to communicate real-time data

without involving humans, effectively merging the digital and physical worlds. This

includes everything from cellphones, coffee makers, washing machines, headphones,

lamps, wearable devices and anything else.

7

A complete IoT system integrates four distinct components. The first component

is sensors or devices. Sensors help in collecting very minute data from the surrounding

environment. Then, next component is connectivity. The collected data is sent to a cloud

infrastructure but it needs a medium for transport such as cellular networks, satellite

networks, Wi-Fi, Bluetooth. Data processing is the next component of IoT. In data

processing, the software performs processing on the acquired data. Last component is user

interface. The information made available to the end-user in some way. This can achieve

by triggering alarms on their phones or notifying through texts or emails.

2.2 Related Research Technique and Tools

A review of the research paper has been conducted to study on how others

embedded the internet of things into their application. As a result, a few research paper

have been reviewed.

The first article is Wireless weather monitor using internet of things. The research

stated weather monitoring is an application of science and technology. In this proposed

system is all components are low cost and the circuit has less complexity. The authors

developed a reliable, efficient, and cost-effective system which enables user to

continuously monitor their surrounding environment parameters like temperature and

humidity. This system can be utilized at any place in the world at low cost. The result of

8

this research is the weather monitoring system using IoT provides a low power and cost-

effective solution for establishing a weather station is success and the system is tested in an

indoor environment and the weather conditions (humidity, temperature, and pressure were

updated successfully) using the sensors.

The second article is weather monitoring using wireless sensor networks based on

IOT. In this article, the research about monitoring the weather conditions at a specific place

and make the data visible anyplace on the world. The technology behind this is Internet of

Things (IoT). The framework manages monitoring and controlling the natural conditions

like temperature, relative humidity, light force and CO2 level with sensors and sends the

data to the website page. The examination and execution of a framework for monitoring

the natural parameters is expert. The framework gives a low power answer for setting up a

weather station.

The third article is IoT based data logger system for weather monitoring using

wireless sensor networks. The study about weather monitoring using wireless sensor

networks. For establishing a connection between the sensor network and internet, we used

a Wi-Fi module as an additional communication interface controlled by the

9

microcontroller. The author used ESP8266 Wi-Fi module which is having TCP/IP protocol

stack integrated on chip. So that it can provide any microcontroller to get connected with

Wi-Fi network. The research and implementation of a system using IoT scenario is

accomplished. The system is tested in an indoor environment and it is successfully updated

the weather conditions from sensor data. It is also a less expensive solution due to usage of

low power wireless sensors and SoC contained Wi-Fi module.

Next, a smart gadget to analyse the weather changes using SensorHat sensor and

Internet of Things(IoT). The main objective is to develop project which monitors the

weather with temperature, pressure and humidity values. To build weather dashboard, using

Raspberry pi, SenseHat and wifi usb nano adapter which captures the weather inside and

outside of house over time and sends the data to ThingSpeak. Its importance is that it

provides a reliable and practical tool to measure the parameters with a very simple device.

The core component of the system which is newly available in market, SenseHat which is

an Add-on-Board is utilized. In the present work this sensor values obtained are updated

continuously from the point of observation to the point of monitoring using ThingSpeak

IoT web services.

A wireless sensor network for weather and disaster alarm systems. This article is

the system that can be used to prevent enormous damage from natural disasters. In this

10

system, a wireless sensor network based on Zigbee/IEEE802.15.4 standard is utilized as a

weather station network. This proposed system takes advantage of wireless sensor networks

which can send signals over far distances by using a mesh topology, this transfers the data

and also consumes low power. Therefore, this system can be installed in locations that are

difficult to hardwire or have no access to electricity. The developed system is very flexible

and accurate. The developed system has core competency including, display weather

information, alert when weather conditions match using decision tree technique and keep

weather information statistics.

Then, for the next article is Design of Telegram Bots for Campus Information

Sharing. Latest additional feature in Telegram is Chat bots. User can interact with bots by

sending commands and they will reply with exactly what user needs as chatting with a

knowledgeable friend. Telegram bot is able to gather all the information stored in the

database and deliver such information to the users as requested. Bot can respond to requests

in less than 0.5 seconds. The communication method used is WebHooks. Basically,

Webhooks method is easier to be developed, HTTP based request and fast when responding

to a request.

NodeMCU(ESP8266) Control Home Automation using Google Assistant. In this

article, this project aim to implement a voice controlled home automation system using a

WI-FI and IOT, which is being remotely controlled and monitored by any smartphone. The

microcontroller utilized is NodeMCU and the communication between the microcontroller

11

and the application is established via Wi-Fi. The advantages of project using NodeMCU is

can control contraptions from anywhere using mobile phones to control smart home.

Last but not least is measurement of temperature and humidity by using Arduino

tool and DHT11. In this article is about to measure temperature and humidity by using

Arduino tool and DHT11, which will be beneficial for balancing the environment to

increase the productivity. DHT11 sensor is a combined module for sensing humidity and

temperature which gives a digital output signal. This system can provide a convenient

method for effective monitoring of temperature and humidity in real time.

12

CHAPTER 3

METHODOLOGY

3.1 Introduction

The methodology is the set of the complete guideline that includes the models of

tools to carry out activities in the software development life cycle (SDLC). This chapter

focuses on methodology used in this project development. It is important to choose a perfect

methodology in developing a system because it will concentrate to a better development

and management. In this project, methodology that has been chosen is Rapid Application

Development (RAD). Rapid Application Development has been implemented during the

development process of Weather Station using Internet Of Things ( IoT).

13

3.2 Rapid Application Development (RAD)

The term Rapid Application Development or RAD is taken to relate to projects

based around tight timescales, which use prototyping and combine high-level development

tools and techniques. In software development, rapid application development (RAD) is a

concept which emphasizes working on software and being more adaptive than other

development methods. Rapid application development RAD is an agile project

management strategy popular in software development. Unlike waterfall development life

cycles, where testing is done at the end of the project, iterative life cycles specify testing at

multiple points during development. RAD has been proven to be a valuable software

strategy.

There are four main phases involved in the rapid application development (RAD)

which is analysis and quick design phase, prototype cycles phase, testing phase and

deployment phase.

14

RAD follow four main phases:

Figure 3.1 Rapid Application Development

3.2.1 Phase 1: Analysis & Quick Design

The first phase of the RAD is to understand the requirements of the system

(analysis and quick design). It requires a high level or knowledgeable end-users to

determine what the functions of the system should be. This should be a structured

discussion of the business problems that need to be solved. This phase of the

process includes deciding what programming languages and database need to be

used.

PHP scripts and the MySQL database are used as the development tools to

develop a prototype. It has evolved to include command-line interface capability

and can be used in standalone graphical applications. In this phase, the software’s

15

overall structure is defined. It is important to understand the requirements of the

system before proceeding to prototype development.

3.2.2 Phase 2: Prototype Cycle

The second phase is a repetition of the prototype development phase such

as development, demonstrate and design. It includes creating a physical design for

the database and mainly focusses on translation of the design into programming

codes. A code to connect from programming language to MySQL Database

Management System (DBMS) is created.

During this phase, we need to work hard to ensure that the project met every

planning that has been discussed in Analysis & Quick Design Phase. The developer

needed to design a prototype of the project until it meet the expectation and if we

cooperate with customer, we need to fulfill their expectation until the project has

been agree.

3.2.3 Phase 3: Testing

The third phase is testing the prototype to validate the Weather Station

process. When the project is fully developed, project are being tested. The project

is tested by looking at the functions available in the system. Later, the flow

of the system is tested to ensure that interfaces between modules work

(integration testing). Next, the analysis report of the system is compiled. The next

16

process involves enhancement and error correction of the prototype. This stage will

be repeated until the prototypes meet the research objectives.

In this stage, make sure everything work smoothly and at the end result will

satisfied everyone expectations and objectives. Every suggestion, changes and even

new idea still can be used to solve every problem that arise.

3.2.4 Phase 4: Deployment

The last phase is deployment in the actual environment after all project

functionalities and the database design have been validated. During this phase, the

project is released to be used by the user. The users use the system and give their

feedback whether its needs to be improved or there is anything that needs to be

modify. Then the modifications are being made based on the feedback from the user

to make sure the project is completely fulfilling the requirements.

17

3.3 Requirement Analysis

In developing a project, hardware and software play a great role as a standard

requirement which determines the accomplishment of the system. This standard

requirement relates to each other to build a successful system. Below are the sits of software

requirement and hardware requirement which are been used to develop the project.

3.3.1 Hardware Requirement

Table 3.1 Hardware Requirement

Hardware Hardware Function

Laptop Laptop Ienovo

Ultrasonic Sensor Ultrasonic Sensor This hardware will detect

whenever there are any obstacle and hindrance

with the distance that has been set.

Breadboard Breadboard To build and test electronic circuits

without having to do any soldering

NodeMCU NodeMCU An open source IoT platform, it will be

attached to the stick, to give a GPS signal to the

application.

18

3.3.2 Software Requirement

Table 3.2 Software Requirement

Software Function

Microsoft Office Word 2016 i. Tools for writing report, proposal and Gantt

chart.

ii. Tools for preparing the slideshow presentation.

Notepad++ Tools for developing PHP Programming and

MySQL language.

Xampp i. Tools for connecting with MySQL database.

ii. Tools that support PHP Programming.

Google Chrome A platform that been used to display the system

Edraw Max 8 Software to create and design Context Diagram and

Data Flow Diagram

Arduino A software that been used to develop an Internet of

Things (IoT) project.

Fritzing A software that been used to develop schematic of

the project.

19

3.4 System Design

System design is the process of designing the architecture, modules, interfaces, and

data for a system to satisfy specified requirements. System design could be seen as the

application of system theory to product development. In this Weather Station Using Internet

of Things consists of framework, architecture design, schematics and process model.

20

3.4.1 Framework

Figure 3.2 Framework of the project

In this framework, the Weather Station will sent weather’s detail to the

database such as temperature, humidity and pressure data every 5 minutes. Database

will save the weather data and sent the weather data to telegram application. User

will request the weather data through telegram application. Then, telegram will

request the data from database and sent back to the end user.

21

3.4.2 Process Model

In Weather Station using Internet of Things the detail process model consists

of context diagram and data flow diagram. There are explaining as below:

3.4.2.1 Context Diagram (CD)

Figure 3.3 Context Diagram of the System

Figure 3 shows the context diagram for Weather Station using

Internet of Things (IoT) is shown above. There is only one way system

where user can request the weather data from the system.

22

3.4.2.2 Data Flow Diagram (DFD)

Data flow diagram is a two-dimensional diagram that explains how

data processed and transferred into the system. Data flow diagram (DFD)

consists of entities, processed and files to show the flow of the data in the

system.

Figure 3.4 Data Flow Diagram of the System

Based on Figure 4 shown above, there are two processes of the

system, save data and telegram. First process is about, weather station sent

weather’s detail through save data process to weather data store. Second

process is user request data weather through telegram and telegram sent

back the data to the user.

23

3.4.3 Entity Relationship Diagram (ERD)

Figure 3.5 Entity Relationship Diagram of the System

The figure shows the ERD of the proposed for project Weather Station using IoT.

An entity relationship diagram (ERD) illustrates an information system’s entities. ERD

composed of three things such as identifying and defining entity, determine entity

interaction and the cardinality of the relationship.

24

3.4.4 Schematic

Figure 3.6 Schematic of the System

A schematic is defined as a picture that shows something in a simple way, using

symbols. A drawing showing all significant components, parts, or tasks and their

interconnections of a circuit, device, flow, process, or project by means of standard

symbols.

25

3.5 Data Dictionary

Data dictionary is a file or a set of files that contains a database’s metadata. The

data dictionary contains records about other objects in the database, such as data ownership,

data relationship to other objects and other data. The data dictionary is a crucial component

of any relational database. Ironically, because of its importance, it is invisible to most

database users. For more relational database management systems (RDBMS), the database

management system software needs the data dictionary to access the data within a database.

3.5.1 Table weather

Figure 3.7 Weather

26

CHAPTER 4

IMPLEMENT AND RESULT

4.1 Introduction

Implementation and testing is the carrying out, execution, or practice of a plan for

ensuring that the system developed according to user requirements. As such,

implementation is the action that must follow any preliminary thinking in order so that the

operation can function entirely and user-friendly. The process involved in this phase

involved develop of project and also a process of defining how the project can achieve the

objectives before user can used it.

There are a few of the testing to achieve the objective of the system, which is include

unit testing, integration testing, and system testing.

4.2 Interface Design

27

4.2.1 Weather Station

4.2.1.1 Sensor Installation

Figure 4.1 Sensor Installation

Figure 4.1 shows the installation of two sensors for reading for temperature,

humidity and pressure readings.

28

4.2.1.2 Sensor Safety

Figure 4.2 Sensor Safety

Figure 4.2 shows the completed sensor installed in the box to avoid short

circuit. In addition, it facilitates installation when sensors are installed in the box.

29

4.2.1.3 Installation for Sensors and Controllers

Figure 4.3 Installation for Sensors and Controllers

Figure 4.3 shows the placed for installation sensors and controller. To the

left is the sensor installation and to the right is the controller installation.

30

4.2.1.4 Installation Area for Sensors

Figure 4.4 Installation Area for Sensors

Figure 4.4 shows the installation area for sensors. Position both of sensors

are mounted outside the box so that sensors can easily detect the surrounding

weather.

31

4.2.1.5 Installation Area for Controller

Figure 4.5 Installation Area for Controller

Figure 4.5 shows the installation area for controller. There are a positive and

negative wire connection to connect power supply, solar panel and Universal Serial

Bus (USB).

32

4.2.1.6 All of Connection

Figure 4.6 All of Connection

Figure 4.6 shows the connection of sensors, usb and power supply. The data

from sensors will be stored in the database when there is a connection with the

power supply. The sensors also need Wi-Fi connection to stored data in the

database.

33

4.2.1.7 Connection of Solar Panel

Figure 4.7 Connection of Solar Panel

Figure 4.7 shows the connection of solar panel to controller. The solar panel

will provide power to the battery.

34

4.2.1.8 Overall Installation

Figure 4.8 Overall Installation

Figure 4.8 shows the overall installation of weather station. In the top of

pole is solar panel that get power and transfer it to power supply.

35

4.2.1.9 Installation Area for Weather Station

Figure 4.9 Installation Area for Weather Station

Figure 4.9 shows the installation area for weather station in UniSZA.

36

4.2.2 User

4.2.2.1 Menu Interface

Figure 4.10 Menu Interface

Figure 4.10 shows the interface when user use cuacabot. Weather station

has two stations, one at Campus Gong Badak and the other one at Campus Tembila.

User can choose either station1 or station2.

37

4.2.2.2 Station 1

Figure 4.11 Station 1

Figure 4.11 shows the interface when user choose station 1 which is weather

readings for the Campus Tembila

4.2.2.3 Station 2

Figure 4.12 Station 2

Figure 4.12 shows the interface when user choose station 2 which is weather

readings for the Campus Gong Badak.

38

4.3 Flow Chart

4.3.1 Flow Chart for Weather Station

Figure 4.13 Flow Chart for Weather Sation

Start

Get reading from the

sensors every 5

minutes

Connect to WiFi

Connection

successfull

End

Send sensors reading

to the server

True

False

39

4.3.2 Flow Chart for User

Figure 4.14 Flow Chart for User

Start

End

Connect to Wi-Fi

Connection

successful

User enter

input in

telegram

User’s input

successfully

detected

User get

readings of the

sensor from the

server

False

True

True

False

40

CHAPTER 5

CONCLUSION

5.1 Introduction

This chapter discusses about project contribution, project constraint, and its

development, future works that can be taken into consideration.

5.2 Project Contribution

This project is developed to help user to access data anywhere in real-time. User

can collect the measurements by the sensors at any time. This means that whenever user

want to know what the weather is, user can have access to information in real time. Then,

real-time alerts which allow the user to plan the day accordingly. Having insights into these

alerts can help avoid emergency situations.

41

5.3 Project Constraints and Limitation

There are limitations and constraints that occurred throughout the development of

weather station. Among the problems and constraints in the development of this project is

that sensor just provided for temperature, air pressure and humidity readings. Then, this

weather station readings are limited to University Sultan Zainal Abidin areas only.

5.4 Future Works

In the technological future, there are many features that can be improved upon in

this project. Among the suggestions that can be improved are:

Adding more sensors in the project weather station.

The weather station can provide data for forecasts. Once a weather station is

connected, user can view the history of information as well.

5.5 Conclusion

Weather Station Using Internet of Things (IoT) is a project which focus on user can

access data anywhere in real-time. Based on the previous studies and discussion, the

suitable approach is implemented in this system which is Internet of Things (IoT). This

project provide data for forecasts. Once a weather station is connected, user can view the

history of information as well. User can figure out the trends in the measurements.

Hopefully this project can help to overcome the problem in order to make a new production

more efficiently.

42

REFERENCES

[1]Ram, K. S. S., & Gupta, A. N. P. S. (2016). IoT based Data Logger System for weather

monitoring using Wireless sensor networks. International Journal of Engineering Trends

and Technology, 32(2), 71-75.

[2]Chandana, L. S., & Sekhar, A. R. (2018). Weather monitoring using wireless sensor

networks based on IoT. Int. J. Sci. Res. Sci. Technol, 4, 525-531

[3]Nageswararao, J., & Murthy, G. K. (2017). Wireless Weather Monitor Using Internet of

Things. i-Manager's Journal on Embedded Systems, 6(1), 30.

[4]Chapman, L., & Bell, S. J. (2018). High-resolution monitoring of weather impacts on

infrastructure networks using the Internet of Things. Bulletin of the American

Meteorological Society, 99(6), 1147-1154.

[5]Govardhan, G., Hussain, S. J., & Jilani, S. (2016). A smart gadget to analyse the weather

changes using sensehat sensor and Internet of Things (IoT). Indian J. Sci. Technol, 9(35),

1-6.

43

APPENDIX

44

APPENDIX A (GANTT CHART 1)

45

APPENDIX B (GANTT CHART 11)

46

APPENDIX C (CODING ARDUINO)

#include <ESP8266WiFi.h>

#include <WiFiClient.h>

#include <ESP8266WebServer.h>

#include <ESP8266HTTPClient.h>

#include "DHT.h"

#include <Wire.h>

#include <Adafruit_BMP085.h>

#define DHTPIN D3

#define DHTTYPE DHT11

DHT dht(DHTPIN,DHTTYPE);

Adafruit_BMP085 bmp;

const char* ssid = "UniSZA-WiFi"; // Your wifi Name

const char* password = "unisza2016"; // Your wifi Password

const char *host = "172.16.26.144"; // IP, example : 192.168.0.0 , open cmd, then type

ipconfig then look at IPv4 Address.

void setup() {

// put your setup code here, to run once:

delay(1000);

Serial.begin(115200);

dht.begin();

WiFi.mode(WIFI_OFF); //Prevents reconnection issue (taking too long to connect)

delay(1000);

WiFi.mode(WIFI_STA); //This line hides the viewing of ESP as wifi hotspot

47

WiFi.begin(ssid, password); //Connect to your WiFi router

Serial.println("");

Serial.print("Connecting");

//wait for connection

while (WiFi.status() != WL_CONNECTED)

{

delay(250);

Serial.print(".");

}

Serial.println("");

Serial.println("Connected to Network/SSID");

Serial.print("IP address: ");

Serial.println(WiFi.localIP()); //IP address assigned to your ESP

}

void loop() {

// put your main code here, to run repeatedly:

HTTPClient http; //Declare object of class HTTPClient

String tempValueSend, humidityValueSend, pressureValueSend,macaddressSend,

postData;

String macaddress = WiFi.macAddress();

macaddressSend = String(macaddress); //String to interger conversion

float tempvalue = dht.readTemperature();

tempValueSend = String(tempvalue); //String to interger conversion

float humidityvalue = dht.readHumidity();

humidityValueSend = String(humidityvalue); //String to interger conversion

48

float pressurevalue = bmp.readPressure();

pressureValueSend = String(pressurevalue); //String to interger conversion

//Post Data

postData = "humidityvalue=" + humidityValueSend + "&tempvalue=" +

tempValueSend + "&pressurevalue=" + pressureValueSend + "&macaddress=" +

macaddressSend;

http.begin("http://myfik.unisza.edu.my/cloud/046622/BOT/testbot.php");

//Specify request destination

http.addHeader("Content-Type", "application/x-www-form-urlencoded"); //Specify

content-type header

int httpCode = http.POST(postData); //Send the request

String payload = http.getString(); //Get the response payload

Serial.println(httpCode); //Print HTTP return code

Serial.println(payload); //Print request response payload

Serial.println("Mac Address =" + macaddressSend);

Serial.println("Temperature =" + tempValueSend);

Serial.println("Humidity =" + humidityValueSend);

Serial.println("Pressure =" + pressureValueSend);

http.end(); //Close connection

delay(300000); //Here there is 5 minutes delay plus 1 second delay below, so Post Data

at every 5 seconds

}

49

APPENDIX C (CODING TELEGRAM BOT)

1) Coding connect to database and get data from Arduino.

<?php

//Creates new record as per request

//Connect to database

$servername = "localhost"; //example = localhost or 192.168.0.0

$username = "046622"; //example = root

$password = "12345";

$dbname = "046622";

// Create connection

$conn = new mysqli($servername, $username, $password, $dbname);

// Check connection

if ($conn->connect_error) {

die("Database Connection failed: " . $conn->connect_error);

}

//Get current date and time

date_default_timezone_set('Asia/Kuala_Lumpur');

$d = date("Y-m-d");

$t = date("H:i:s");

if(!empty($_POST['tempvalue'])) {

if(!empty($_POST['humidityvalue'])){

if(!empty($_POST['pressurevalue'])){

if(!empty($_POST['macaddress'])) {

$tempvalue= $_POST['tempvalue'];

50

$humidityvalue= $_POST['humidityvalue'];

$pressurevalue= $_POST['pressurevalue'];

$macaddress= $_POST['macaddress'];

$sql = "INSERT INTO weather(address, temperature, humidity, pressure, Date, Time)

VALUES ('".$macaddress."', '".$tempvalue."', '".$humidityvalue."', '".$pressurevalue."',

'".$d."', '".$t."')";

if ($conn->query($sql) === TRUE) {

echo "OK";

} else {

echo "Error: " . $sql . "<br>" . $conn->error;

}

}}}}

?>

51

2) Coding connect to database and get data from Arduino.

<?php

$botToken = "797337214:AAFJPcHskR9gvR_sY7w-Qa_w6Y6F_xsepow";

$website = "https://api.telegram.org/bot".$botToken;

//Grab the info from the webhook, parse it and put it into $message

$content = file_get_contents("php://input");

$update = json_decode($content, TRUE);

$message = $update["message"];

//Make some helpful variables

$chatId = $message["chat"]["id"];

$username = $message["chat"]["username"];

$firstname = $message["chat"]["first_name"];

$chatLastName = $message["chat"]["last_name"];

$text = $message["text"];

$input = strtolower($text);

$tarikh = date("Y-m-d");

if($chatId > 0){ // if bot talking to user

// ##############################################

// ##############################################

// ####### P r i v a t e R o o m #############

// ##############################################

// ##############################################

if(substr($text,0,6) === "hi") {

52

$reply = "hi awak";

} else if(strpos($text,"/start" ) !== false) {

file_get_contents($website."/sendmessage?chat_id=".$chatId."&text=Hi, $firstname

welcome to cuaca bot. This bot help you to find out the weather information in Unisza. ");

file_get_contents($website."/sendmessage?chat_id=".$chatId."&text= tap on /station1 to

get today's weather information at UniSZA TEMBILA");

file_get_contents($website."/sendmessage?chat_id=".$chatId."&text= tap on /station2 to

get today's weather information at UniSZA GONG BADAK");

}

else if(strpos($text,"station1" ) !== FALSE) {

$date=date("Y/m/d");

$time=date("H:i:s");

$sql = "SELECT * FROM weather where address = '80:7D:3A:69:2D:5A' ORDER BY

`no` DESC LIMIT 1 ";

$res = mysqli_query($conn, $sql);

$details = "";

while($row2 = mysqli_fetch_array($res))

{

$temperature= $row2['temperature'];

$humidity= $row2['humidity'];

$pressure= $row2['pressure'];

$Date= $row2['Date'];

$Time = $row2['Time'];

$details = $details." \n\n Temperature: ".$temperature."°C \n Humidity: ".$humidity."%

\n Pressure: ".$pressure." Pa\n\n Date:".$Date."\n Time:".$Time."\n\n";

53

}

$details = urlencode($details);

file_get_contents($website."/sendmessage?chat_id=".$chatId."&text=Hi $firstname this

are the reading for the weather today at UniSZA TEMBILA: ".$details);

}

else if(strpos($text,"station2" ) !== FALSE) {

$date=date("Y/m/d");

$time=date("H:i:s");

$sql = "SELECT * FROM weather where address = '80:7D:3A:67:4F:36' ORDER BY

`no` DESC LIMIT 1 ";

$res = mysqli_query($conn, $sql);

$details = "";

while($row2 = mysqli_fetch_array($res))

{

$temperature= $row2['temperature'];

$humidity= $row2['humidity'];

$pressure= $row2['pressure'];

$Date= $row2['Date'];

$Time = $row2['Time'];

$details = $details." \n\n Temperature: ".$temperature."°C \n Humidity: ".$humidity."%

\n Pressure: ".$pressure." Pa\n\n Date:".$Date."\n Time:".$Time."\n\n";

}

54

$details = urlencode($details);

file_get_contents($website."/sendmessage?chat_id=".$chatId."&text=Hi $firstname this

are the reading for the weather today at UniSZA GONG BADAK: ".$details);

} else {

$reply = "sorry, I can't understand the command \xF0\x9F\x98\xA5 ";

$reply = "You can tap on /station1to get today's weather information at UniSZA

TEMBILA ";

$reply = "You can tap on /station2 to get today's weather information at UniSZA

GONG BADAK";

file_get_contents($website."/sendmessage?chat_id=".$chatId."&text= sorry, I can't

understand the command \xF0\x9F\x98\xA5 ");

file_get_contents($website."/sendmessage?chat_id=".$chatId."&text= tap on

/station1 to get today's weather information at UniSZA TEMBILA");

file_get_contents($website."/sendmessage?chat_id=".$chatId."&text= tap

on /station2 to get today's weather information at UniSZA GONG BADAK");

}

} else {// end of if bot chat to user

// ##############################################

// ##############################################

// ########## C h a t R o o m ################

// ##############################################

// ##############################################

}

?>