• No se han encontrado resultados

Design and validation of an IoT platform with adaptive data logging for remote real time monitoring of rapid changing

N/A
N/A
Protected

Academic year: 2022

Share "Design and validation of an IoT platform with adaptive data logging for remote real time monitoring of rapid changing"

Copied!
80
0
0

Texto completo

(1)

Campus Monterrey

School of Engineering and Sciences

Design and validation of an IoT platform with adaptive data logging for remote real time monitoring of rapid changing

variables in indoors and outdoors environments

A thesis presented by

Jos´e Yael L´ opez Hern´ andez

Submitted to the

School of Engineering and Sciences

in partial fulfillment of the requirements for the degree of

Master of Science In

Engineering

Monterrey Nuevo Le´ on, May 14, 2020

(2)

Dedication

Thanks to my grandparents, parents and brother for supporting and accompa- nying me during this dream of pursuing a masters degree at the Tecnol´ogico de Monterrey. I thank you for your patience, advice, trust, tolerance, and love. All of you are my main motivation to grow both academically and professionally. Your constant dedication and demand towards me have resulted in many academic, social, and professional achievements, being this thesis project just one of them.

I want to thank Delee Corp and all its collaborators, especially Ing. Alejan- dro Abarca, Dr. Miguel Esparza, and Dr. Carlos Aguilar for their participation, willingness, contributions, trust, and guidance during the beginning of the thesis project.

I thank my fellow masters, with whom I hope I forged long lasting friendships, for always being there to help and advise me, and for sharing many memories and learnings throughout the master’s program.

All of your constant inspiration, help, and demand resulted in this work as well as all the experiences lived during this process. I dedicate this thesis to all of you and hope the results and the final work of this project are cause of pride for you as it is for since you were part of it.

(3)

Acknowledgements

I want to thank all those who were present and made possible the development of this thesis.

I am grateful to Dele Corp for providing facilities, economic and human capital, as well as being willing to create a collaboration between industry and the university for the development of the thesis.

I thank Tecnol´ogico de Monterrey for being an institution willing to bid for research and development of Mexican technology by offering the scholarship that allowed me the enrollment in the master’s program by covering the registration fees at this institution.

I thank CONACyT for having supported me with a monthly maintenance relieve during the master’s program. I also thank them for having awarded me the mobility scholarship that allowed an international stay in China to give even more value to the work done.

I want to thank the staff at the OTT office, particularly Guadalupe Quiroz and Enrique Badillo for having helped me meet the requirements to start the interna- tional stay in China, as well as being in constant communication with the Chinese counterpart for the acquiring of many required documents.

I am grateful to the HUB Tec-China that made the stay in China more pleasant by allowing me the use of its facilities and for offer constant support, and guidance to better understand the customs, culture, and history of that nation. I also thank them for having been a connection office with the industry, which allowed me to carry out visits, interviews, and other activities involving some Chinese companies.

(4)

Design and validation of an IoT platform with adaptive data logging for remote real time monitoring of rapid changing variables in

indoors and outdoors environments

by

Jos´ e Yael L´ opez Hern´ andez Abstract

This thesis addresses the impact of Internet of Things (IoT) development as well as its growing importance in the industry of big economies like China, and shows the development of an IoT platform for real time data acquisition and display on a web page. From the beginning of this decade, the Chinese government have been focusing on the development of new technologies like IoT devices and services by investing in fast growing cities through the implementation of the so called ”Science Cities”. A research carried out in China, that had as scope the use of IoT technologies, resulted in the knowledge that there is a need of the development of IoT devices to fulfill the industry requirements, thus a prototype for remote data monitoring using a micro- controller capable to connect to Wi-Fi networks is proposed. The system prototype that was developed is based on a client-server architecture following a Device-To- Gateway communication model using on-the-shelf components for the measurement of humidity and temperature as well as acquiring Global Position System (GPS) information. For this system a web page interface was designed to display the col- lected readings. The maintenance, accuracy and consistency of data, referring to the data integrity, was obtained in every test performed using the system prototype.

This prototype was tested in static indoor environments, where the devices did not change their location during the test, and dynamic outdoor environments, where the devices were shifting locations during the test. The obtaining findings of the prototype performance show a 94.76% of data integrity on the indoors static test and 76.76% using the web page in the same conditions. On the other hand, the out- door dynamic test achieve a maximum of 44.66% of data integrity, which dropped to 17.24% by using the web page. It is observed how the use of the web page results in a decrease of the data integrity mostly because of the network compatibility between the Wi-Fi device and frequency bands that the network vendor uses to connect to the internet. A test performed using an adaptive method, where the temperature was constantly being modified, resulted in an increase in the efficiency of how the data is saved in the storage device achieving a data reduction of 74% and a final Comma-Separated Values (CSV) file size decrease of 75%. The data acquired is then used for further processing by calculating the position based on the GPS latitude and longitude, the velocity using an approach with backwards differences and accel- eration using an approach with centered differences. The experimental results show that the IoT system prototype can be used for the measurements of environmental variables on indoor and outdoor applications.

(5)

2.1 IoT Layers Architecture . . . 4

2.2 Device-To-Device Communication Diagram . . . 5

2.3 Device-To-Cloud Communication Diagram . . . 5

2.4 Device-To-Gateway Communication Diagram . . . 6

2.5 Back-End Data-Sharing Communication Diagram . . . 7

2.6 Shaoxing city - Ke Qiao Science and Technology Park main entrance. 8 2.7 Zhejiang Province . . . 9

2.8 Company size (number of employees) of the researched companies. . . 11

2.9 Related industries of the researched companies. . . 12

2.10 Years of foundation of the researched companies. . . 15

2.11 AAR (annual average revenue) of researched companies. . . 16

2.12 Relation between the Establishment Year and the Company Size . . . 16

2.13 Industry and company size relation. . . 17

3.1 Functional Prototype (Both devices in one protoboard) . . . 22

3.2 Communication Diagram . . . 23

3.3 Client device . . . 23

3.4 a) NodeMCU Components, b) NodeMCU Pin-Out . . . 24

3.5 DHT11 Module. . . 24

3.6 GPS Module - NEO6MV2. . . 25

3.7 Client device Connections . . . 26

3.8 Client electric schematic . . . 26

3.9 Example of data acquired by the Client device and URL generated. . 27

3.10 Client device Firmware Diagram . . . 28

3.11 Server device . . . 29

3.12 Micro-SD Card Adapter module . . . 29

3.13 Server device Connections . . . 30

3.14 Server electric schematic . . . 30

3.15 Server Firmware Diagram . . . 32

3.16 Prototype Web Page . . . 33

3.17 Google Maps integration on Web Page . . . 34

3.18 LeafLet integration on Web Page . . . 34

3.19 LeafLet Map . . . 34

3.20 Web Page Main Sections . . . 35

4.1 Web page display during the fifth test . . . 38

4.2 Field test 4 outdoor route . . . 40

4.3 Test 6 route . . . 40

4.4 Example displays from Web page for Test 6 . . . 41

(6)

5.1 a) Percentage of relative humidity , b) Temperature in Celsius degrees 44

5.2 Temperature from Adaptive Method . . . 46

5.3 Matlab Haversine formula Scrip . . . 47

5.4 a) Route selected points, b) Google Distance Calculation . . . 48

5.5 Velocity Plot . . . 49

5.6 Acceleration Plot . . . 50

(7)

2.1 IoT Communication models advantages and disadvantages . . . 7

2.2 Identified internet industry related companies. . . 14

2.3 Commonly used development boards in IoT projects. . . 20

3.1 NodeMCU characteristics. . . 24

3.2 Temperature/Humidity sensor characteristics. . . 24

3.3 NEO6MV2 module characteristics. . . 25

3.4 Client Firmware Libraries . . . 28

3.5 Micro-SD Card Adapter module characteristics . . . 30

3.6 Server Firmware Libraries . . . 31

4.1 Tests categories . . . 37

5.1 Data integrity obtained in Indoor and Outdoor tests. . . 44

(8)

Page

Abstract vi

List of Figures viii

List of Tables ix

1 Introduction 1

2 Theoretical Framework 3

2.1 Internet of Things IoT . . . 3

2.1.1 Communication Models . . . 4

2.2 IoT development in emerging Chinese Cities . . . 8

2.2.1 Hangzhou . . . 9

2.3 IoT Development in Mexico . . . 18

2.4 IoT Microcontrollers . . . 19

2.4.1 NodeMCU . . . 20

3 System Prototype 22 3.1 Client . . . 23

3.1.1 Components/Hardware . . . 23

3.1.2 Functionality . . . 26

3.1.3 Client Back-End . . . 27

3.2 Server . . . 29

3.2.1 Components/Hardware . . . 29

3.2.2 Functionality . . . 31

3.2.3 Server Back-End . . . 31

3.3 Web Page . . . 33

3.3.1 Back-End . . . 33

3.3.2 Front-End . . . 35

4 Prototype Testing 36 4.1 Client and Server devices tests . . . 36

4.1.1 Indoors Static Environments . . . 37

4.1.2 Outdoor Dynamic Environments . . . 38

5 Discussions and Results 42 5.1 Tests results discussion . . . 42

5.1.1 Indoors Tests . . . 42

(9)

5.1.2 Outdoor Tests . . . 42 5.2 Using an adaptive method . . . 44 5.3 Getting distance from GPS coordinates . . . 46

6 Conclusions 51

A Acronyms 54

B HTML5 CODE 55

C Client CODE 58

D Server CODE 60

References 70

CV 71

(10)

Introduction

Remote monitoring is a useful tool in industries that require constant tracking of their products or services as they are transported. It allows companies to assure to their customers that the product/service they are offering will arrive to them at the best conditions [1].

Systems that provide such capacities are commonly expensive or are far more advance for the actual requirements because they don’t only consist of hardware, but also software, mobile applications, web page, and, among other things, storage services [2]. Therefore, a low cost and reliable platform is needed to fill the gap of low-complexity data acquisition requirements. This thesis is focused on the design and development of a prototype IoT platform for real time monitoring capable of presenting remotely measured data to the user on a web page.

Chapter 2 presents some related concepts like IoT, web services and communi- cation models, among others, that must be addressed in order to understand the basic functionality of the prototype. One of this communication models is selected to be implemented in the prototype following the IoT general architecture that is also explained.

This Chapter 2 also includes a research carried out in the city of Hangzhou in the province of Zhejiang in China. The research had as scope the use of internet technologies by the companies established in the area. As many industries are focusing on the digitization of their services, it is important to understand the part governments and cities have in this process. It is explained why Hangzhou was chosen as the research city, and how the internet technologies have had an impact on the Chinese government policies to pursue greater development [3]. Analysis graphs are used to present the recovered data and ease the visualization of it.

A comparison between some selected microcontrollers is done at Chapter 2 in order to identify the one that best meets the requirements of the system prototype that is being proposed. A summary of previous works using the identified micro- controller is also carried out to see how this device has been used in other related projects. These application examples are analyzed to identify the advantages and challenges this device has, as well as its limitations.

Chapter 3 details an explanation of the system prototype components. This ex- planation shows the hardware that is used in the prototype as well as the connection schematics. The functionality of the prototype is meticulously explained showing examples of the data acquired and how it is transmitted. An overview of the com- munication protocols used is presented alongside the implementation of them in the firmware. As for the Front-end, the design process of a web page is shown as well as the main section it contains.

Chapter 4 presents the tests that were performed. These test are divided into indoor static tests, where the devices were located at a specific location during the

(11)

tests, and outdoor dynamic tests, where the devices were shifting locations during the tests. The web page is also used in some of these tests to analyze its impact on the overall system functionality. For the outdoor dynamic test, a selected trajectory is followed with the system acquiring the measurements form the sensor and the readings from the GPS.

The results are analyzed and discussed in Chapter 5 by identifying the main obstacles and issues presented. The acquired latitude and longitude are used to calculate the position using the Haversine formula, the velocity using an approach with backwards differences and the acceleration using an approach with centered differences. An adaptive method is included to increase the system efficiency when saving the data on the storage device.

Finally, Chapter 6 presents the conclusions of the work summarizing the results and discussions addressing the challenges that appeared. Possible changes for further development are mentioned for future complementary works based on the presented thesis.

It is worth mentioning that this work assumes the rapid changing variables as variables that can change within minutes at least a %10 of their actual value. Those variables are present in the environment of interest.

(12)

Theoretical Framework

In this chapter, brief descriptions of basic concepts related with this project are made. Literature review as well as State-of-the-art of the IoT technologies are explained in detail. In addition, the concepts of IoT, Wireless technology, cloud services, IoT architectures, communication models and some protocols are explained in order to understand the complexity of the platform. A research is also presented in this chapter, having as main scope the use of IoT services and technologies in China due to their fast growth in this country. Finally, a comparison between microcontrollers is done to identify the one that best meets the requirements of the system prototype is presented as well as a summary of previous works using the selected microcontroller in other related projects.

Nowadays is more and more common to use the services provided by the internet that include the storage and computing of data in the so called “Cloud”, which has allowed to do analysis in real time, and display or access to information from different locations in the world. The IoT holds a great picture for social and economic benefits to emerging and developing economies such as China, which is one of the countries that has invested in the development of new technological zones in different cities [4]. This development includes areas like sustainable agriculture, water quality, domotics, healthcare, wearables, industrialization, and environmental management, among many others. As such, the IoT holds promise as being tool for achieving the United Nations Sustainable Development Goals [5].

2.1 Internet of Things IoT

The term IoT, was first used in 1999 by the British technology pioneer Kevin Ash- ton to describe the system in which objects in the physical world are linked to a larger network and function independently through the internet using sensors [5].

In a more comprehensive way, it refers to scenarios where network connectivity and computing capability extend to objects, sensors and everyday items that are not considered computers; allowing these devices to generate, exchange and consume data with minimal human intervention. The increasing trend of objects linked to the internet has created a demand in engineers and scientists in an important magni- tude in order to be consistently innovative and has affected the global community in a dramatic way. The main vision of IoT is to be a tool in a revolutionary, fully inter- connected “smart world”, with relationships between objects and their environment, and objects and people becoming more closely connected [6].

(13)

Figure 2.1: IoT Layers Architecture

Speaking about the architecture of the IoT technologies, these can be divided into three main layers, which are Perception, Network and Application shown in figure 2.1. Perception layer can be considered the lowest layer, and its main function is to acquire data from the environment and with this then identify the physical world.

This first layer can include different types of hardware such as a sensors network, Radio Frequency Identification (RFID), home network, control gate away, among others. The middle layer is the Network layer where processes as initial analysis of data, broadcasting of data, and polymerization are included. This central layer can also be considered the Central Nervous System that manages the services of the IoT technologies because it connects the Perception layer with the Application layer. This second layer use 2G, 3G, Wi-Fi, Satellite Access, Code Division Multiple Access (CDMA), Global System for Mobile Communications (GSM), Integrated IP core Network, etc. to transmit the information. The Application layer is the top layer and this layer use cloud computing, cloud storage and cloud analysis to integrate and monitoring the data [6, 7].

2.1.1 Communication Models

From an operational perspective, it is useful to think about how IoT devices connect and communicate in terms of their technical communication models. The four more widely used IoT’s models are Device-To-Device Communication, Device-To-Cloud Communication, Device-To-Gateway Communication and Back-End Data-Sharing Communication.

• Device-To-Device Communication

The Device-To-Device communication model represents two or more devices that are connected directly and have communication between them without the need of an intermediary application server[5]. These devices can have communication through many types of different networks like the internet.

Protocols like Bluetooth, Z-Wave, ZigBee are commonly used to establish di- rect device-to-device communication. This model allows devices to adhere to a communication protocol to communicate and exchange messages to achieve their function. A model example can be seen in figure 2.2 [6, 5].

(14)

Figure 2.2: Device-To-Device Communication Diagram

• Device-To-Cloud Communication

The Device-To-Cloud communication model refers to the direct connection between the IoT device and an internet cloud service such as Alibaba Cloud, Tencent Cloud, Google Drive, One Drive or any application service provider to store and exchange data and control transmission traffic. This model mostly takes advantage of existing communications protocols like commonly used wired Ethernet or Wi-Fi connections to establish a connection between the device and the Internet Protocol (IP) network, which at the end connects to the cloud service [5]. Many Hardware has been developed to allow differ- ent devices without the ability to connect to the internet to gain access the cloud through external modules, such as the NodeMCU [8]. In many cases, the Device-To-Cloud communication model adds value to the end user by ex- tending the capabilities of the device beyond its original features. One detail about this model is that interoperability challenges can appear when attempt- ing to integrate devices from different manufacturers because frequently the device and cloud service are from the same vendor [9]. Figure 2.3 illustrates an example of this communication model.

Figure 2.3: Device-To-Cloud Communication Diagram

(15)

• Device-To-Gateway

In the Device-To-Gateway model there is an application software operating on a local gateway device, typically known as Application Layer Gateway (ALG), that works as an intermediate between the IoT device and the cloud service providing security and other functionalities like data translation. In fewer words, the IoT device connects through the ALG as a conduct to reach the cloud [5]. Another way to see the Device-To-Gateway model is with the de- velopment of “hub devices” [10], which are devices that are used as a local gateway between individual IoT devices and the cloud service, but they can also get rid of the interoperability gap between devices from diferent manu- facturers [5]. Figure 2.4 illustrates an example of this communication model.

Figure 2.4: Device-To-Gateway Communication Diagram

• Back-End Data-Sharing Model

The Back-End Data-Sharing communication model is based on an architecture that allows the users to send or access data from a cloud service in collaboration with data from other sources [5]. This communication model allows the user to upload, share and grant access of data to other users or third parties. This model can be seen as an extension of the Device-to-Cloud communication model, which can lead to data clusters where IoT devices only upload data to one application service provider [6]. This model architecture allows the user to change the location of the data when switching between IoT services, bringing down traditional data cluster barriers. The back-end data-sharing model suggests cloud Application programming interface (API), which are needed to achieve interoperability of smart device data hosted in the cloud [5].

Figure 2.5 shows an example of this model.

(16)

Figure 2.5: Back-End Data-Sharing Communication Diagram

The four basic communication models demonstrate the underlying design strate- gies used to allow IoT devices to communicate and also help to illustrate the ability of networked devices to add value to end users [5]. While the concept of combining computers, sensors, and networks to monitor and control devices has been around for decades, the recent confluence of key technologies and market trends is emerg- ing in a new reality for the IoT technologies [6]. Internet of Things new products and services can be designed to take advantage of data streams that didn’t exist before acting as a catalyst for further innovation and also bring new opportunities for established industries where many represents a new source of welfare and effi- ciency for producers and consumers [11, 5]. The table 2.1 shows in a resume way the advantages and disadvantages of these communication models.

Table 2.1: IoT Communication models advantages and disadvantages

(17)

In addition, it is important to have in mind and mention that there are many standards, protocols, methods and rules made to minimize possible risks to the infor- mation or to the infrastructure. Cybersecurity has been increasing its importance in the last years due to the big and important quantity of information managed in inter- net. According to [12], cybersecurity is the organization and collection of resources, processes, and structures used to protect cyberspace and cyberspace-enabled sys- tems from occurrences that do not respect the property rights of others.

Fredrick Chang (2012), former Director of Research at the National Security Agency in the United States declared that cybersecurity is fundamental, and hu- mans must defend machines that are attacked by other humans using machines and knowledge of computer science, electrical engineering and mathematics.

2.2 IoT development in emerging Chinese Cities

As previously mentioned, a scope of companies was made in different cities in the Zhejiang province of China. The number of IoT connections in China has grown in an exponential way over the last 5 years [13]. Despite this significant growth, how- ever, the IoT market is still relatively immature worldwide. Solutions are commonly built on an ad-hoc basis, and there is a lack of tried-and-tested components, archi- tectures and off-the-shelf solutions. In the city of Hangzhou, the government have invested in different technological parks for the development of new technologies like IoT services [1]. Some of these centers are the Fuyang Economic and Technologi- cal Development Zone, Ke Qiao Science and Technology Park, Hangzhou Chengxi Technology Innovation Industry Cluster, Hangzhou National High-Tech Zone and Internet Town among others. The main entrance of the Ke Qiao Science and Tech- nology Park can be seen in the Figure 2.6, in one of the multiple visits to the parks that were made in this scoping.

Figure 2.6: Shaoxing city - Ke Qiao Science and Technology Park main entrance.

Smart city development is viewed by central Chinese authorities as an effective means toward utilizing Information and Communication sciences and technologies areas such as Internet of Things, cloud computing, big data, and spatial geographic information, for improving urban planning and management [3].

(18)

Hangzhou is considered as the capital of e-commerce in China and it is also called as “China’s Silicon Valley”. International e-commerce refers to international business transactions and deals between different countries through an e-commerce platform according to the Institute of Forward-Looking Industry’s definition. E- commerce is expanding rapidly in China in the last few years, where it is expected to continue at this rate of growth in a near future. In 2013, more than $11 billion US dollars were spent on overseas e-commerce transactions [14].

The objective of the research was to see how companies in Hangzhou, which is one of the cities with more technological growth in China, are using the IoT technologies regarding cloud services, specialized hardware, communication software and data communication. Some technological parks like Dream Town aims to become a new norm of Internet incubation for smart development throughout China. Based on the data acquire it appears that many of the surveyed smart projects reflect new ideas in the Internet of Things sector for the Chinese environment, but it does not necessarily signify advanced technological artifacts in the broader sense [3].

Figure 2.7: Zhejiang Province

2.2.1 Hangzhou

The city of Hangzhou is the birthplace of Alibaba Group, which is the biggest e- commerce platform in China. Alibaba has change the way of how business interact with the consumers, providing a payment platform as well as identification codes for every place, also applications as Alipay or WeChat allow the users to pay practically everything in the city using the phone, leaving aside the need to carry cash or identifications. All this is possible thanks to the use of the internet and a well- organized network. Hangzhou high technological development zone accommodates knowledge and technology industries such as pharmaceutical, chemical, machinery and electronics, textiles, as well as export processing industries [4].

(19)

A recent smart project in the Internet area called Dream Town Internet village in the city of Hangzhou is being developed in order to promote innovation-driven urbanization. It gives spaces of high-technology innovation at international level such as Silicon Valley in California.

The Dream Town incubation space is one of the 3 platforms of one of the most important projects in the city in the last years: the Hangzhou Future Sci-Tech City project (FSTC), which is a scientific and technological innovation zone located in the west area of Hangzhou that was initiated in 2010 by the Chinese Central Organization Department and State-owned Assets Supervision & Administration Commission of the State Council. The two main challenges that has encountered this project is the market promotion of produced innovation and the integration of economic, social, and environmental considerations.

It is pretended that exists research and development in the areas of Internet of Things, cloud computing, big data, and spatial geographic information and that eligible smart applications should fall in the areas of e-business, software design, information services, integrated circuits, network security, and animation design.

Also, it was expected over the period 2018 to involve 200 startup projects, set up by 10,000 graduates, which would attract more than 300 Venture Capital (VC) funds and over $45 billion of investment.

The project has a big influence by Alibaba as a role model for startups. It offers onsite technical resources for free and online platform serves. Also, it has a big influence in the area of capacity building, where many founding members or employees of Dream Town were once working for Alibaba Group. In addition, Alibaba is considered as a potential attractor of VC funding in FSTC, an aspect which could increase financing prospects for the startups [15].

In the scope realized in Hangzhou, the information of the industries was taken from different Chinese companies databases and corroborated in their web pages.

Although most of the companies seen in this scoping have an information site (97), there were a few that did not count with one (3).

An aspect under consideration is the size of the company. The Figure 2.8 indi- cates the range of the number of employees working in such companies. The range of 51 to 100 workers is the most common by far, corresponding to 43% of the scoped companies. Behind that range, the following is the one from 201 to 500 employees, and then the one from 11 to 50 employees. Thereby, the sum of the first three groups covers 79% of the pie chart. It can be noted that most of the analyzed companies are small and medium size companies according to the Organization for Economic Co-operation and Development (OECD), which states that enterprises can be clas- sified as small or medium sized if they have less than 250 employees and large if they have more.

Although Hangzhou is not one of the most populated cities in China, it has a big population compared with big famous cities around the world. Its population is around 10 million people. If companies with 500 or less employees are analyzed, it can be noted that it is near of 84% of the scoped companies. This means that 84% of the scoped companies have a population of less than 0.005% of the entire population of Hangzhou per company. Meanwhile the another 16% of the companies, which are categorized as large companies, have 0.05% or less of the Hangzhou population each one. It can be said that exists a lot of opportunities in the IoT technological area because of the enormous demand that a big population requires. It is necessary to

(20)

do market studies to analyze the behavior of the technological and engineering area economies, observe the available offers in the market and make conclusions about how the solutions and products can satisfy the clients needs in a better way than the rest of the companies.

Figure 2.8: Company size (number of employees) of the researched companies.

It is important to distinguish the industry type and the area they are focused in.

A clustered bar chart of Hangzhou companies was made in the Figure 2.9 to make a comparison between the types of industries. As it can be seen, the most common industry types were related with Mechanical/Industrial Engineering, followed by Electric/Electronic Manufacturing and then International Trade and Development.

Also, Machinery and Mining/Metals obtained high number of related industries.

It is interesting to notice that the type “International Trade and Development”

had high number of companies related as Hangzhou is considered the capital of e- commerce in China. Also, the mechanical and electrical engineering areas around a lot because they are very important in manufacturing, which is the basis of national economies in many countries, being important to the industry for the development of the national richness.

IoT new technologies began to adapt to this kind of sectors to improve both the products and the processes. It is considerable to think about the technological transition time in IoT developments since it is a relatively new technology.

(21)

Figure 2.9: Related industries of the researched companies.

(22)

It is important to analyze the most outstanding companies related to IoT seen in this scoping to identify ideas of applications and products in the market. The companies are the following: Tuya Smart, Broadlink Intelligent Technology Co.

Ltd, Rokid Corporation Ltd, LifeSmart, Alibaba Cloud, Hangzhou Hongsu IoT Development Co. Ltd, and Hangzhou Aixiangji Technology Co. Ltd.

Tuya Smart company is focused in IoT solutions and household applications such as air conditioning and heating, water purifier, and smart fan among many others.

They used a cloud platform which can be connected to a customized app via ZigBee, Wi-Fi, Bluetooth or General Packet Radio Service (GPRS) Embedded Modules for any device.

The companies related with domotics are Broadlink, Hongsu IoT Development and LifeSmart. Broadlink is one of China’s smart home provider leaders by focusing on universal remotes, speakers, light switches, and air quality sensors, among other solutions. On the other hand, Hongsu IoT Development is a company focused on the development of intelligent trash bins and trash compactors. Finally, LifeSmart is one of the international market leaders on domotics solutions that design and innovate with very sophisticated products such as smart light switches, smart fan coils, gateways, doors and cameras.

Rokid Corporation Ltd. is a company dedicated to AI (artificial intelligence), robotics and manufacturing in wearable devices. The main objective of the com- pany is to provide a smart assistant capable of improving the quality of daily life activities through voice recognition and non-verbal interactions. Another interesting company is Aixiangji. They provide technological solutions for current manufactur- ers to build smart products within short time and have deployed cloud services. And finally Alibaba Cloud from Alibaba Group, which is one of the 20 biggest companies in China, and as it was said before, it develops highly scalable cloud computing and data management services providing large and small businesses, financial institu- tions, governments and other organizations with flexible, cost-effective solutions to meet their networking and information needs.

All these companies were seen in the scope and their applications and technolo- gies can be observed table 2.2. The most important IoT related companies were described and it is expected in a very near future that more IoT companies arise with the help of the government and the budget dedicated to these projects. It is worth mentioning that Alibaba Group has a big influence and it is giving technical and economic support to new technological parks in order to have an important technological and monetary growth in the city.

(23)

Companies Applications Technologies

Tuya Smart

Air conditioning and heating, heater, water purifier, smart

fan.

Wi-Fi, Bluetooth, ZigBee, GPRS.

BroadLink Intelligent Technology

Universal remotes, light switches, air quality sensors,

speakers.

Wi-Fi.

LifeSmart

Smart light switches, smart fan coils, smart motors, gateways, doors, cameras.

Wi-Fi.

Hongsu IoT Development

Trash bins, trash compactors,

vacuum cleaner. Unspecified.

Rokid Corporation

Wearables, artificial intelligence, robotics, virtual

reality, smart assistants.

Bluetooth.

Aixiangji Technology

Consultancy, technical

solutions. Cloud services.

Table 2.2: Identified internet industry related companies.

All those companies are related to the domotics area. They provide automated solutions for the day to day activities that are usually done by the user in a repetitive way. Some of those include the monitoring of rapid changing variables like temper- ature inside the house or only on a selected room, the amount of light that comes from the exterior to the interior of the house by pulling down or up the curtains, the temperature or the amount of water when taking a shower and the speed of a ceiling fan depending on the air flow it produces. Another company involved in the use on the internet is Centaur Technologies Co. Ltd., located in the city of Shaoxing in the south of Hangzhou. Centaurs Technologies specialized in the development of an operative system with AI capable of having a conversation about a specific topic with the user. This company is working with the textile industry, which is Shaoxing biggest industry, in order to provide solutions to their requirements. The company mentioned in an interview that they are interested in the integration of their technology with hardware to be able to acquire and measure data from process of the textile industry. They mentioned that a common issue is the change in the velocity of the rollers of certain type of machine they use to move the fabrics. It can be considered a rapid changing variable because the velocity of the roller changes in a matter of minutes and varies between some range. In this situation the implemen- tation of an IoT device can alert the operator when the speed of the roller decrease or varies so it can be fixed or take some predefined tasks to solve the issue.

In the 20th century, China has had an important growth in technological areas, and it is reflected not only in their technological advances but in the creation of new business related with investigation and development in science and engineering.

(24)

It is for that reason that China has become a potential country where has taken advantage in international trades, as was shown in Figure 2.9. A clustered bar chart is displayed in Figure 2.10, where ranges of the foundation years of the scoped companies are presented. It can be noticed that in the last years, the creation of this kind of companies has had an exponential growth. The ranges 2000-2003 and 2008-2011 has the maximum values with 20 companies each one, followed by the range 2004-2007 with 15.

As it was said before, the term IoT was first used in 1999 by Kevin Ashton [5]

where began the development of IoT technologies which coincides in this case with the shown graph in this scoping. The trend line shows us graphically the magnitude growth, which it is expected to increase more along next years. As having a stable technological company take many years, it’s for that reason that the values of the last ranges of the chart are less than the ones around 2000 and 2011. Even so, it is expected to increase as most of them consolidate in a good way.

Figure 2.10: Years of foundation of the researched companies.

The Figure 2.11 shows the annual average revenue in US Dollars of the companies seen in this scoping. As it can be seen in the graph chart, most of the companies have an annual revenue around 1 and 2.5 million dollars, followed by the companies that earns around 2.5 and 5 million dollars. The companies with annual revenue around 1 and 10 million dollars per year occupies the third part of the total amount of reviewed companies. 32 cases with no data were omitted in the graph for visual purposes.

These ranges were chosen in comparison with LinkedIn ranges for standardization purposes.

(25)

Figure 2.11: AAR (annual average revenue) of researched companies.

The Figure 2.12 shows a correlation between the establishment year and the company size. It can be seen that the broad majority of companies, regardless of the establishment year, are in the range of size 11-50 (3), 51-200 (4) and 201-500 (5) number of employees as previously shown in Figure 2.8. The biggest company reviewed is Alibaba Cloud, which was established in 2009, is the out-layer that can be seen in the upper right corner of the Figure 2.12.

Figure 2.12: Relation between the Establishment Year and the Company Size

Each of the companies in the scope was related to a certain type of industry, but some were not clear enough to be placed in just one industry. Therefore, the three main industries were selected for each company. The Figure 2.13 shows the companies size depending on the industry they were located. There are three dif- ferent types of data displayed, which are the type of industry one, two and three.

(26)

The vertical axis is the industry ID that can be seen on the right side. The right side shows the most common industries selected in the scope as previously shown in Figure 2.9.

Figure 2.13: Industry and company size relation.

One of the companies that were interviewed was GENEMAT COMPOSITES., LTD., in which the contact was the regional director. Genemat Composites is a branch of Hangzhou Jinmeng Road Establishment Co., LTD. Genemat was estab- lished in 2001 as a high-tech enterprise specializing in the design, R&D and pro- duction of sheet molding compound (SMC) composite materials and products. It has advanced manufacturing technology, in accordance with the EN124, EN1433 EU standards, AASHTO American standards, CTE 77 American standards and AS3996 Australian standards. Genemat provides solutions to sectors such as infrastructure and telecommunications. The company is not now related to the use of IoT technolo- gies, but it is looking to develop a project that allow them to acquire data for one

(27)

of their products to be able to analyze it. They are looking for a solution provider that can deliver a system that integrates hardware and software to implement in their products.

The city of Hangzhou has many industrial parks as well as incubator to allow entrepreneurs to be able to start their companies. One of these centers is Dream Town, which is a town transformed from 12 granaries to an incubator center of markets.

2.3 IoT Development in Mexico

IoT technologies in Mexico had been having a slow development in the industry and the society in general. This can be due to the collective Mexican culture that does not change its way of thinking or doing things, the connectivity issues in the country and the limited capacity for storage, analysis, administration and security of big amount of data generated by the interconnected devices [16]. Other social factors that keep away the interest for the development of IoT technologies are the economic environment of the Mexican families, the lack of adoption of technological developments in homes and even the lack of trained personnel in the area [17].

Nowadays there are around 8.9 million IoT connections in Mexico, which place the country in the 18 place from a sample of 24 countries of the OCDE [18]. In another perspective, there are 6.8 IoT devices per 100 habitants, which leaves Mexico at the last place from 28 selected countries from the OCDE [18]. This is evidence that Mexico is still new in the implementation and development of IoT technologies, and also that there is a big opportunity for the implementation of government programs like the ones from China, academic involvement with the industry and international collaboration for IoT communication projects.

Although the IoT technologies are not so popular in Mexico, the advantages and benefits of the IoT technologies are well known. Some of the identified areas that can benefit from this technology are the following:

• Reduce the time of commercialization of services and products and have more precise answers for the clients by having access to the client data like their necessities and issues [17].

• Faster capture of data about processes and products for the development of the market necessities.

• Look into the business including the tracking of the supply chain, which will reduce the cost of doing business in distant locations [16].

• Take instant decisions about prices, logistic, sales and support [19].

IoT technologies offer many more examples apart from the ones already mentioned because this technology can be applied to anything able to provide acquirable signals or measurable data. A potential application area for the purposed device in this thesis is the supply chain. When introducing the IoT technologies to the vehicles used in the supply chain, the following tasks can be performed:

• Optimization of routes and delivery times.

(28)

• Identify and alert from sudden braking or sharp turns while driving.

• Alert speeding or lose time on the road.

• Monitoring in real time of the geolocation of the vehicles

• Monitoring of the status of the transported goods

• Have more control on the vehicle maintenance

• Knowing drivers driving habits

IoT applications can extend across practically every industry and business no matter the size. Applications goes from connecting medical coolers for the transportation of organs and vaccines between hospitals, to smart textiles that can detect changes in temperature or even pallets that are capable of sending information regarding cargo, location and weather [19].

2.4 IoT Microcontrollers

Considering the shortage of development of IoT devices to fulfill the industry require- ments, a prototype for remote data monitoring is proposed using a microcontroller capable to connect to Wi-Fi networks. There is a big variety of Microcontroller Units (MCU)’s in the market, but they come as single chips, and to be able to use them certain peripheral components must be included. Therefore, a more com- plex design is needed to access the functionalities of those MCU’s. Fortunately, the manufacturers commonly provide development boards that include the minimum peripheral components so every aspect of the MCU can be tested. Thus, a devel- opment board is going to be selected to build the purposed prototype since it helps to accelerate the prototype development cycle (design, validation). Commonly used development boards were revised to select the one that fulfills the prototype commu- nication requirements, which are Wi-Fi connectivity, sufficient I/O ports and sensor communication protocols. In a more general way, aspects that must be taken into account in a design are the umber I/O ports, communication protocols available, size, Wi-Fi functionality, coding firmware being open-source, supply voltage, and, among other aspects, being low cost and easy to obtain. The revised development boards characteristics are shown in the table 2.3.

(29)

Model Characteristics Price

Arduino UNO

MCU-ATmega328P, Operating voltage-5V, Digital I/O pins-14, base area 68.6×53.4 mm, available communication protocols UART, I2C and SPI, Wi-Fi

functionality available by using external module.

Uses the open-source Arduino IDE

$23

Raspberry Pi

MCU-ARM Cortex A53, Operating voltage-5V, Digital I/O pins-17, base area 85.6×56.5 mm, available communication protocols UART, I2C and

SPI, Wi-Fi functionality included. Uses the open-source Raspbian

$35

NodeMCU

MCU-Tensilica 32-bit RISC CPU Xtensa LX106, Operating voltage-3.3V, Digital I/O pins-16, base area 49×24.5 mm, available communication protocols

UART, I2C and SPI, Wi-Fi functionality included.

Uses the open-source Arduino IDE

$8.39

Table 2.3: Commonly used development boards in IoT projects.

The purpose of the development of the prototype is to produce a compact, useful, and low-cost device capable of Wi-Fi communication. Therefore, the NodeMCU stands as the more valuable choice at being the one with the lowest price, enough GPIOs, and Wi-Fi connectivity included.

2.4.1 NodeMCU

NodeMCU is a commercial and very common microcontroller used in wireless and Internet of Things applications. Known as a low-cost wireless communication plat- form that runs on the ESP8266 Wi-Fi SoC from Espressif Systems firmware. It is an open-source, well documented, simple, and compact microcontroller that can be controlled remotely at any connected location at any time. ESP8266 has a wide area of applications such as domotics, tracking devises, smart plugs and lights, security systems, industrial wireless control, smart sensor, smart cities, wearable electronics, Wi-Fi devices, among many others [20]. Documented and shared experiments are presented below.

Khan used the NodeMCU as portable biometric attendance system with wireless communication to a web server to store information in a database [21]. The captured data of students is stored when a finger is registered, and his/her attendance is counted automatically.

Domotics is one of the areas that uses most of the IoT devices. They are used for efficient control and optimization performance avoiding unnecessary wastage of power and resources by turning on/off lights, regulating its intensity, and controlling fans and water pumps speed [8, 22, 23].

Abdulahad design a system to measure and control air quality, temperature, and humidity in food stores at remote locations through web servers. Two actions were taken; air cooler was turned on to cool foods when some variables reached certain values, and air puller was activated to pull the contamination out of the locations [24].

The health area is a good opportunity to do improvements in IoT technology as

(30)

well. Chooruang designed a heart rate monitoring system using the ESP8266 Wi-Fi module where detection of the heart rate of a patient were made in real time getting a low percentage error around 2% and 6% [25].

Singh created a low-cost intuitive method for real time measurement of blood pressure. The prediction algorithm can use the acquired data to automatically re- lease a medical dosage invasively in cases of emergency. Also, blood pressure readings are sent immediately to emergency contacts if data is out of certain tolerance [2].

Many other investigations and developments have been made in the IoT area.

Futuristic concepts such as voice-controlled autonomous vehicles are being designed and tested for its use in a broad area of applications [26]. As it can be seen, the Internet of Things promise a limitless development of applications in any area or environment with the correct sensors, actuators, and displays.

(31)

System Prototype

The system prototype that was designed (figure 3.1) consists of two separate parts with wireless communication composed by different modules. Each module was selected to provide certain functionality to the prototype to fulfill the proposed system requirements.

Figure 3.1: Functional Prototype (Both devices in one protoboard)

The prototype is meant to acquire environmental data, in this case temperature and humidity, and also the geographical information like latitude and longitude read- ings from a GPS. The system was built with a Client-Server architecture following a Device-To-Gateway Communication model. Figure 3.2 shows the communication diagram.

The device that acts as the Client is the one that acquires the environmental and GPS data. This data is acquired by a microcontroller that acts like a gateway so the data can be processed and then be sent to the Server device through Hypertext Transfer Protocol (HTTP) commands. Then the Server device gathers the data from the Client device and process it so it can be displayed on a web page. The Server device also has the function to store the data for historic review and further analysis.

(32)

Figure 3.2: Communication Diagram

3.1 Client

Figure 3.3: Client device

3.1.1 Components/Hardware

For the Client a NodeMCU microcontroller board (figure 3.4) was used. NodeMCU is a low-cost open source IoT platform. It includes a firmware that runs on the ESP8266 Wi-Fi System on Chip (SoC) from Espressif Systems, and hardware which was based on the ESP-12 module [27]. It features an advanced API for hardware I/O, which can reduce the work for configuring and manipulating hardware. This microcontroller can be programed using the open source Integrated Development Environment (IDE) from Arduino, which simplify its use.

(33)

(a)

(b)

Figure 3.4: a) NodeMCU Components, b) NodeMCU Pin-Out

WiFi Module ESP8266

Power Supply 5V DC via micro USB

On board buttons Reset and Flash

GPIO 13

Analog Ports 1

Voltage supplied by board 3.3V DC

Table 3.1: NodeMCU characteristics.

For the Temperature/Humidity module a DHT11 sensor (figure 3.5) was used.

This are off-the-shelf components that are low cost and are widely used in a diverse type of projects.

Figure 3.5: DHT11 Module.

The sensor has the following characteristics:

Model DHT11

Power Supply 3 - 5.5V DC

Output Signal Digital signal via single-bus Measuring range Humidity 20 -90 % Temperature

0- 50 C

Resolution Humidity 1% RH Temperature

0.1C

Sensing Period Average: 2s

Dimensions Size 12×15.5×5.5 mm

Table 3.2: Temperature/Humidity sensor characteristics.

(34)

The GPS module is the NEO6MV2. The NEO-6 module series is a family of stand-alone GPS receivers featuring the high performance u-blox 6 positioning en- gine. These flexible and cost effective receivers offer numerous connectivity options in a miniature package. Their compact architecture and power and memory options make NEO-6 modules ideal for battery operated mobile devices with very strict cost and space constraints [28]. This module can also provide the date and time in the Coordinated Universal Time (UTC) time zone.

Figure 3.6: GPS Module - NEO6MV2.

The GPS has the following characteristics:

Model NEO6MV2

Power Supply 2.7 - 3.6V DC

Supply Current 67 mA

Antenna Gain 50 dB

Antenna Type Passive and Active antenna

Interface Universal Asynchronous

Receiver/Transmitter (UART)

Tracking & Navigation -160 dBm

Dimensions 16×12.2×2.4 mm

Table 3.3: NEO6MV2 module characteristics.

The latitude and longitude are a coordinate system that gives the position or location of any place on Earth’s surface. The latitude is the measurement on the globe of a location north or south of the Equator, while the longitude is the measure- ment of a location east or west of the prime meridian at Greenwich, the specially designated imaginary north-south line that passes through both geographic poles and Greenwich, London [29]. Both measurements are done in degrees, the latitude from -90 to 90, and the longitude from -180 to 180 [28].

These components are connected to the NodeMCU microcontroler board like in the figure 3.7. The electric schematic is shown in figure 3.8.

(35)

Figure 3.7: Client device Connections

Figure 3.8: Client electric schematic

3.1.2 Functionality

The Client device consists of a Temperature/Humidity module as well as a GPS module to obtain the location where the prototype is being set or if it is moving.

The basic functionality of the Client device is that it connects to the internet and once it has a response of the server it starts the acquisition of the data from the sensor and the GPS. The time zone is adjusted to the time zone of interest and the rest of the data is arranged and fit into a URL in order to be sent. Then, through an internal manipulation, it sends to the designated Server device the URL by HTTP

(36)

commands. Every time the Client device finishes sending a batch of data it asks again if the Server device is available for the next transmission.

Figure 3.9: Example of data acquired by the Client device and URL generated.

The figure 3.9 shows an example of the data arranged in the URL. The Client device recovers the values of the temperature in Celsius and the relative humidity from the DHT11 sensor. From the GPS it shows the satellite it is connected, the date and time in UTC, and finally the latitude and longitude. At the ID parameter, the number of device is shown. This is because other devices can access the server, so the ID is useful to see which device is connected. It is worth mentioning that the ID is designated manually and the number is arbitrary. The URL follows HTTP architecture so it can be send, received, and understand by the receptor.

HTTP is the underlying protocol used by the World Wide Web (WWW) and defines how messages are formatted and transmitted, and what actions Web servers and browsers should take in response to various commands. The petitions are at- tended by the command GET on the firmware. This command reads the informa- tion we want to send to the server after the ”?” character followed by the name of the parameter followed by the ”=” character followed by the value, something like

”NAME=VALUE”. The different parameters are separated by the & character [30].

The blank spaces should be substituted by the ”+” character. As for the URL that is generated, for example, the parameter longitude is between latitude and day, so it must be placed in the URL as ”...&Lon=-100.154175&...”.

In order for the Client device to connect to the Server device, the IP of the Server device must be known and must be included in the firmware of both devices.

As previously mentioned, when initialized, the Client device begins to connect to a specific Server device based on the IP provided. Once the connection to the Server device is established the data packages start being sent. The Server device IP is designated on its firmware, this IP depends on the availability provided by the router that is being used.

3.1.3 Client Back-End

The firmware of the Client device was programmed on the open source Arduino IDE. The Arduino IDE comes with a library called Wiring, which is capable of programming in C and C++ languages [31]. This allows the ease of programming input/output operations. The components used to build the Client device have a library developed on the Arduino environment so they can be programmed by using pre-design functions to access to their functionality. This allows to have a fastest and more understandable code. A library can be defined as a collection of pre-compiled routines that a program can use. Libraries are particularly useful for storing frequently used routines because we do not need to explicitly link them to every program that uses them [31]. Libraries allow us to program in a more upper way without the need of using the basic routines from the data sheet of the devices.

The libraries used in the Client device are the ones in the table 3.4.

(37)

Library Description

ESP8266WiFi.h Used for the ESP5266 WiFi module

SoftwareSerial.h Used to allow UART communication

TinyGPS.h Used fro the GPS module

DHT.h Used for the DHT11 sensor

Table 3.4: Client Firmware Libraries

Figure 3.10: Client device Firmware Diagram

The Client device firmware follows the flow presented in the figure 3.10. It starts by declaring the used variables like the SSID and password of the Wi-Fi network. Then it passes to the setup initializing the serial communication, the GPS, the DHT11 sensor and the Wi-Fi communication. After the components have being successfully initialized it goes to the main routine in which the reading of the components are being made. In this routine, after the readings is being stored in the designated variables, the URL that is going to be send to the Server device begins to form, and after completion it is send to the Server device on the IP address that was provided. Then the program waits for the Server device to be ready to receive another batch of data. During the main routine two external functions are called, one is to give the GPS enough time to acquire all the data and the other is to accommodate the date data from the GPS in a more understandable presentation since it comes by a bunch of numbers placed together.

(38)

3.2 Server

Figure 3.11: Server device

The Server device (figure 3.11) consist of a NodeMCU microcontroller board and a Micro-SD Card module. The Micro-SD Card module is used to allow the NodeMCU microcontroller board to communicate with the memory card and write or read the information on it.

3.2.1 Components/Hardware

The NodeMCU was previously mentioned on the Client device hardware. The Server device use the same microcontroller.

The Micro-SD card module has the following characteristics:

Figure 3.12: Micro-SD Card Adapter module

(39)

Model Micro-SD Card Adapter

Power Supply 3.3 - 6V DC

Supply Current 0.2 - 200 mA

Support Card Type Micro SD card (<= 2G), Micro SDHC cards (<= 32G)

Antenna Type Passive and Active antenna

Interface Serial Peripheral Interface (SPI)

Dimensions 42×24×12 mm

Table 3.5: Micro-SD Card Adapter module characteristics

These components are connected to the NodeMCU microcontroler board as in the figure 3.13. The electric schematic is shown in figure 3.14.

Figure 3.13: Server device Connections

Figure 3.14: Server electric schematic

(40)

3.2.2 Functionality

The function of the Server device is to acquire the data sent by the Client device through HTTP commands so it can process it and have the information ready when called by a web page. The values are stored in a Micro-SD card so they can be analyzed and have further processing. The Server device is accessed by a web browser through the designated IP.

3.2.3 Server Back-End

As previously mentioned the components, such as the Micro-SD card module, have a developed library for the Arduino environment. The libraries used by the Server are the ones in the table 3.6.

Library Description

ESP8266WiFi.h Used for the ESP5266 WiFi module ESP8266WebServer.h Used to allow the NodeMCU as a web server

SD.h Used for the Micro-SD card module Table 3.6: Server Firmware Libraries

The server firmware follows the flow presented in the figure 3.15. It starts by declaring the used variables like the SSID, password, IP address, IP gateway, IP mask, global variables, among others. Then it passes to the setup configuring and initializing the Wi-Fi with the designated IP address, initializing the micro-SD card module and it starts listening to request from clients. One of the functions that are called is handleURL, which is responsible to get the URL generated by the client and place the data in the designated variables. The storage of information in the Micro- SD card is done with this function. The Hypertext Markup Language (HTML) code for the web page is also contained in this function and assigned to the variable htmlPage, which is later sent by the server when a browser requests it. The main routine is only waiting for a client to connect, and once a client connects the entire program starts over.

The SD library allows to read and write data in a SD or Micro-SD board included in a shield or specific module. The SD cards are very useful for storing files like audio, video, images or, like in this case, text obtained by different sensors. This cards offer a record system much greater than the EEPROM memory. The SD library can use SDSC or SDHC type cards, and it is based in the Sdfatlib library, which can work with FAT16 and FAT32 file systems [32]. The communication between the card and the microcontroller is by SPI through pins CSK, MOSI, MISO and the activation pin CS which in this case have been set as the GPIO15.

The Server device gets the URL sent by the Client device and then it reads the parameters and store the values on variables declared in the firmware. The values are stored in the Micro-SD card in CSV format. The CSV is a type of data format in which each piece of data is separated by a comma. This is a popular format for transferring data from one application to another, because most database systems are able to import and export comma-delimited data. The data is stored in the following order:

(41)

ID , DATE, TIME, TEMPERATURE, HUMIDITY, LATITUDE, LONGITUDE 1 , 2 4 / 3 / 2 0 2 0 , 1 9 : 4 6 : 1 8 , 4 0 . 4 0 , 3 6 . 0 0 , 2 5 . 6 9 9 1 2 0 , −100.154167 1 , 2 4 / 3 / 2 0 2 0 , 1 9 : 4 6 : 1 9 , 4 0 . 4 0 , 3 6 . 0 0 , 2 5 . 6 9 9 1 2 1 , −100.154175 1 , 2 4 / 3 / 2 0 2 0 , 1 9 : 4 6 : 2 0 , 4 0 . 5 0 , 3 5 . 0 0 , 2 5 . 6 9 9 1 2 5 , −100.154175 1 , 2 4 / 3 / 2 0 2 0 , 1 9 : 4 6 : 2 1 , 4 0 . 5 0 , 3 5 . 0 0 , 2 5 . 6 9 9 1 3 1 , −100.154182 1 , 2 4 / 3 / 2 0 2 0 , 1 9 : 4 6 : 2 2 , 4 0 . 5 0 , 3 5 . 0 0 , 2 5 . 6 9 9 1 4 1 , −100.154190 1 , 2 4 / 3 / 2 0 2 0 , 1 9 : 4 6 : 2 3 , 4 0 . 6 0 , 3 4 . 0 0 , 2 5 . 6 9 9 1 4 6 , −100.154198 1 , 2 4 / 3 / 2 0 2 0 , 1 9 : 4 6 : 2 7 , 4 0 . 6 0 , 3 4 . 0 0 , 2 5 . 6 9 9 1 4 4 , −100.154190 1 , 2 4 / 3 / 2 0 2 0 , 1 9 : 4 6 : 2 8 , 4 0 . 6 0 , 3 6 . 0 0 , 2 5 . 6 9 9 1 3 5 , −100.154182 1 , 2 4 / 3 / 2 0 2 0 , 1 9 : 4 6 : 3 0 , 4 0 . 6 0 , 3 6 . 0 0 , 2 5 . 6 9 9 1 3 7 , −100.154182 1 , 2 4 / 3 / 2 0 2 0 , 1 9 : 4 6 : 3 1 , 4 0 . 7 0 , 3 4 . 0 0 , 2 5 . 6 9 9 1 3 7 , −100.154175 The data is stored in the Micro-SD card every second.

Figure 3.15: Server Firmware Diagram

As previously mentioned, to allow the communication between the Client and the Server, the server IP must be known. The number ”192.168.0.94” is being designated as the server IP address for the Wi-Fi network were the indoor tests were performed.

This IP address is assigned to the server device by a configuration on the firmware

(42)

using the ESP8266 libraries. It is meant to work only in a local Wi-Fi network. This means that the server can’t be accessed from outside the network. This is being done because the information provided by the system prototype is confidential and can only been seen by authorized users. The access to the server through internet can be possible using a VPN or by implementing a public IP address.

3.3 Web Page

A web page (figure 3.16) was included in the mobile server so the data could be seen.

Figure 3.16: Prototype Web Page

3.3.1 Back-End

A web page was designed using HTML, CSS and JavaScript. HTML is used for the construction of web pages and applications that combines mobile devices, cloud computing and work associated with the net. The HTML5 provides three charac- teristics: structure, style and functionality. The HTML provides the structure, CSS provides the style and how that structure is presented, and JavaScript provides the functionality [33]. The web page HTML5 code is included in the Appendix B.

As for the map that is included in the web page, an API from Google was used.

To be able to use the Google Maps API an account on Google Cloud have to be made. Once the account is done, among the Google many APIs and services, the one needed to be able to include a Google Maps map in the HTML5 code is the API of Maps JavaScript. It is worth mentioning that the use of this APIs has a cost depending on the number of request and cite visits. When requesting an API from Google, a kEY is generated. This KEY allows us to use the API services in HTML5 through JavaScript. Figure 3.17 shows the JavaScript code to integrate the Google Maps API within the web page. To be able to place the current location of the Client device, the latitude and longitude are used as variables for the API. A marker is also included to visualize better the location of the Client device.

(43)

Figure 3.17: Google Maps integration on Web Page

The Google Maps API was chosen because it is the one more commonly used in Mexico. Google services includes many other functions that can be implemented for further development and increase of functionality of the Web Page. One inconve- nience is that Google services cost and are not available worldwide. For example, in China Google Maps doesn’t work due to government regulations, so by using Google services the prototype wouldn’t be functional in mainland China.

There are several other maps API providers that can work in mainland China.

One of them is Bing by Microsoft. Bing is commonly used in China as a web browser, so an API from Bing would be a good implementation for the prototype to work, but like Google, the use of Bing services cost. Other API maps without cost and able to work in China are provided by Modest Maps, Poly Maps and LeafLet.

The previous mentioned open source API providers have good quality maps but with fewer functionality in comparison with Google or Bing. Still, they probe to be adequate for the purpose of this thesis. LeafLet was implemented to see how different the Web Page would look like by including the JavaScript code in figure 3.18, having as a result the maps shown in figure 3.19. LeafLet API uses different map designs, and these can be chosen by indicating in the JavaScript code which map provider is going to be used. In this case the map provider is Mapbox, that’s why its URL is included in the 3.18 code. As well as Google, a KEY was needed, but in this case that KEY was provided by Mapbox without any restriction or cost.

Figure 3.18: LeafLet integration on Web Page

Figure 3.19: LeafLet Map

This Thesis does not suggest any maps API above the others, it is just empha- sized that there are many options and each one of them have certain functionalities.

(44)

The API should be selected depending on the locations where the device is going to be used and the desired functionality on the Web Page.

3.3.2 Front-End

The purpose of the web page is to display the acquire data from the client to the user. The page is being automatically refreshed every 30 seconds so it can display the newest data. The page is composed by the following main sections:

Figure 3.20: Web Page Main Sections

1. This section includes the readings of temperature and humidity from the DHT sensor and the latitude and longitude provided by the GPS.

2. In this section there can be seen the historic plots that shows the latest values up to 100 readings. The values that are displayed are the temperature and the humidity. The horizontal axis is the time were the data was acquired and the vertical axis is the value of the data. The maximum and minimum of the vertical axis are adjusted depending on the 100 data points that are plotted each time the page refresh.

3. The date and time from the GPS are placed here.

4. This is where the API for the map is display, it shows the location provided by the latitude and longitude under Geographical Coordinates in section 1.

5. This section includes a menu bar that is meant for further development. The present version is mainly decorative.

Every time the web page is refreshed it connects to the server to update the val- ues. The HTML5 code is included in the server firmware were also some processing is done to accommodate the data in the corresponding location of the web page, choose the data point to be plotted, set the minimum and maximum values of the vertical axis for the plots and set the location to the map with the longitude and latitude.

Referencias

Documento similar

This doctoral thesis aims to clarify the effect of habitual coffee consumption on the development of functional limitations, frailty and disability, as well as its effect on the

This Bachelor Thesis describes the design and implementation of Clockwork, a modular platform for the development of videogames, that consists of a microengine, a package manager, a

Therefore, these aspects would confirm that improvements possibly would arise from gains in impulse at swim start obtained specifically on lower limbs with the experimental

The assessment of the value of the filtration process was assayed for the nanoformulation and, although the results showed no significant changes in the particle size when using

This paper aims to present Airbnb as an example of the sharing economy and analyze how its growth has been affecting the hotel industry and the rental housing market.. In order

A variety of advanced technologies such as intelligent robots, communication systems (e.g., 5G), and the Internet of Things (IoT) are expected to enhance the fourth

In the present work, the development of an electronic platform for remote real-time monitoring of long-term cold chain transport operations is detailed where a comparative analysis

Due to the importance of promoting the development of satisfac- tory sex life in breast cancer survivors, as well as the evidence on the positive impact of surgical interventions