Keywords

49.1 Introduction

Meteorological data acquisition equipment must be installed outdoors and in remote locations; that is why, wireless networks (WSN) are used for data transmission [1, 2]. The WSN provide great applicability at low cost with advantages such as flexibility and scalability [3, 4]. Once the communication is established, the microcontrollers must build the data frame for transmission of information by means of internal conditioning of a UART (Universal Asynchronous Receiver Transmitter) [4, 5].

The efficiency in the network depends largely on the topology [6, 7], the nodes must be easy to install; that is, once installed, the only information that must be configured is the address of device being a strategy for optimal performance of WSN [8, 9].

A complete system should provide ease of mobility of equipment through the nodes, that is, allow an exchange of communication node in case of a malfunction [10].

In case the device is close to an Internet access point, IoT cloud server could be used, which can be integrated into the microcontroller and thus manages the station's metrics [11].

To guarantee flexibility, a solar kit for electricity generation can be installed in each of the network nodes so that if the public energy supply network fails, it can be put into operation [12].

49.2 Data Logger System Architecture

The system has three interconnected ATMEGA328 microcontrollers distributed in:

  • Acquisition-Storage

  • Viewing

  • Communication.

The communication between the microcontrollers is through the UART protocol which consists of sending information and receiving data, for which it sends two or more information through the same communication port can be used the separators of chain sections (Fig. 49.1).

Fig. 49.1
figure 1

Reading, writing, and communication structure of weather station

Transmissions consist of STAR-STOP for ASCII codes through serial, as established in teletype operation. The sending of data in a chain allows one or more data to be sent at the same time, each data being separated as a character (“,”), which will be used by the receiving microcontroller to identify and process it.

Each attribute is assigned to a storage box so a variable is created to store the data and also a method to count the stretches entering by serial port.

In this case, we store in a decimal-type variable because some data enter in decimal type or we can convert to integers to store integer.

float datos [] = {0,0,0,0,0,0,0,0,0,0,0}

By specifying the address of record boxes, we can store data in the same variable, and then to call the data when required would be as follows:

Year = data [0] Month = data [1] Day = data [2] Temperature = data [3] Humidity = data [4] Pressure Atm = data [5] Wind speed = data [6] Wind direction = data [7] UV = data [8] Rain gauge = data [9] Electrical Voltage = data [10] Electric current = data [11]

49.3 Network Design

The Open Systems Interconnection (OSI) model is a 7-layer data model designed to organize the various software and hardware protocols involved in the communication network, at the top part of stack.

As a simplified version of OSI model, the TCP/IP model is useful in the layout of today’s end-to-end networks. The TCP/IP stack groups the protocols into four layers: application, transport, Internet, and link. As with the OSI model, the application layer initiates loading and the transport layer assigns ports. The Internet layer handles the routing of Internet (IP) packets while the link layer handles the local area communication (MAC) and physical transmission media (Fig. 49.2).

Fig. 49.2
figure 2

OSI model

Data loggers convert physical parameters into electrical signals that are converted into binary values by analog to digital converters in the microcontroller, converting the ADC values into data frames by the application layer.

The gateway is used to interconnect two different physical layers to collect the information in the database and support them through MySQL (Fig. 49.3).

Fig. 49.3
figure 3

System architecture of weather station

The structure of each weather station incorporates an anemometer, rain gauge, temperature, humidity, barometric pressure, and solar radiation with optional soil moisture sensor for comprehensive monitoring of agriculture and the environment in a single package for simple configuration.

The system’s design provides that stations that do not have a direct line of sight to the transmission connection node can use the other stations as a link point.

The intervals of transmission and storage of information are 10 min, for security has a feedback so that in case of loss of connection to the network of any station this can retry to transmit when you have restored your connection taking data from its backup of a micro SD that is implemented in each station.

The structure of the prototype algorithm is shown in Fig. 49.4. This algorithm controls the properties of the weather station over the TCP/IP network.

Fig. 49.4
figure 4

Structure of the prototype algorithm

49.4 Results

Once the data logger and the communication network have been designed, the next step is the evaluation of software which aims to measure the level of reliability and performance of system.

The weather data of stations are displayed in the web application on a wireless sensor network (WSN) base. All weather parameters collected from the local WSN base stations will be replicated in a centralized database in the cloud, allowing users to access the data in real time from a distributed weather station (Figs. 49.5 and 49.6).

Fig. 49.5
figure 5

MySQL database

Fig. 49.6
figure 6

Webpage

Figure 49.4 shows the dynamic PHP web page that automatically updates after 10 s and shows the last 100 results of database; in case you want more data, you must choose the dates to access the database.

The analysis of root mean square error (RMSE) and the mean bias error (MBE) of results obtained is defined as:

$${\text{RMSE}} = \sqrt {\frac{{\sum {\left( {X_{{{\text{estimated}}}} - X_{{{\text{measured}}}} } \right)^{2} } }}{N}}$$
(49.1)
$${\text{MBE}} = \frac{{\sum \left( {X_{{{\text{estimated}}}} - X_{{{\text{measured}}}} } \right)}}{N}$$
(49.2)

Being:

Xestimated:

weather station Kestrel 5500

Xmeasured:

prototype [13].

We can analyze the statistical results of 1000 measurements of different measured variables, being the deviation practically zero as shown in the scatter plot of Fig. 49.7 demonstrating that most of experimental points are located over the line of fit (Fig. 49.8).

Fig. 49.7
figure 7

Webpage graph view

Fig. 49.8
figure 8

Correlation between Kestrel 5500 and prototype

49.5 Conclusion

This project has the advantage of being scalable since if the device is not in the wireless coverage area or a wireless network cannot be expanded due to various factors, a GSM/GPRS shield can be incorporated to transmit the data directly to the database in the cloud.

The design of a network of integrated wireless weather stations based on the ATMEGA328 microcontroller and wireless communication for communication and transmission of data on temperature, relative humidity, wind speed, and direction and in special cases soil moisture, pH, and resistivity is considered important for the development of future projects in the area of renewable energies as well as in the agricultural area as it has free access to the database stored and managed by MySQL.

The integration of ATMEGA328 microcontrollers with Raspberry is essential for management through a wireless network with TCP/IP communication protocol showing a solution that reduces costs because it is a simple, flexible, and scalable design at the same time can be autonomous in its operation.