DEVELOPMENT OF AN AUTOMATED SYSTEM FOR WEATHER DATA COLLECTION AND FORECASTING CLIMATE EVENTS BY MEANS OF RADIO FREQUENCY

The weather forecasting method is based on the analysis of data collected to support decisionmaking. This paper describes the development of a weather station (prototype) to assist in monitoring plantations and forecasting extreme weather events. The strategy adopted is to use a set of stations connected via radiofrequency forming a communications network to better understand and anticipate such events. The weather forecasting method is based on analysis of data collected to support decision making. The laboratory tests were successful, but field tests had several difficulties and unforeseen events that will be described at the end of this paper.


INTRODUCTION
Monitoring the atmospheric condition is of interest to all areas, whether for the population, industries or trade. However, monitoring the weather is very important for farmers, especially the small farmers, since an unexpected rain or drought can cause the total loss of the plantation (FIELD et al., 2012).
In addition to directly interfering in the crop production, with periods of drought and rain, the weather also has na indirect influence, promoting an environment for the proliferation of a certain pest in the plantation due to a sudden climatic change (MENDELSOHN et al., 2004).
Thus, it is important for farmers to constantly monitor the climatic conditions, even by taking some of their time and often causing them to spend on pesticides at inopportune or late times as it may result in a certain harm on the harvest and, consequently, less profit or even losses.
As technology is always evolving, tending to make life of the farmers easier, a weather forecast is easily found, either on TV or via the Internet. However, many of them do not concern the microclimate of a city or region, and may not cover the area of such farmers. A possible solution is a small weather station, installed close to the property or even on the farmer's field. This station collects the weather data of the microclimate in the vicinity of the crop, indicating the results and forecasts obtained. This would help farmers to monitor their planting and establish the best management decision, appropriate to each situation Combined with this system, a program is added to interpret the data, providing more accurate weather forecasts and, adapted to the needs of each farmer, it provides data regarding alerts s and recommendations for the use of pesticides, artificial irrigation, among other preventions and necessary care to a crop. With prior notice, the farmer can apply phytosanitary products in the first period of pest attack, minimizing losses as much as possible, either by preventing the pest, drought, or in moderating the use of agrochemicals, using them only when there is a greater need.
The objective of the paper is to present the development of a complete platform for the acquisition and transmission of weather data, producing hardware and software tools for the provision of alerts and meteorological information in a contextualized and automated way to prevent disasters caused by extreme events

MATERIAL AND METHODS
The occurrence of extreme events has been increasing due to climate changes, mainly related to the rise in the global temperature. Further projections released by the Intergovernmental Panel on Climate Change (IPCC) show that these events considered extreme will be more and more common and intense (FIELD et al., 2012). The increase in the human vulnerability to these events due to the global population growth and the consequent increase in the occupation of risk areas also leads to a greater occurrence of natural disasters. Natural disasters cause not only great losses of human lives and properties worldwide, but they also impact natural ecosystems, farming, coastal areas, water resources, cities and public health. These extreme weather events are responsible for financial losses, deaths and injuries (FIELD et al., 2012).
Despite its small territory in comparison to other states of Federation, Santa Catarina is one of the states with records of several extreme events (example of hurricane Catarina and the recent meteorological tsunamis on the southern coast of Santa Catarina (PBMC, 2016).
Weather monitoring through stations is of great importance in the understanding of atmospheric phenomena and their influences in several sectors, considering that the most perceptive of the problems are the high impact climatic events resulting from long-term climate changes.
An automatic weather station is defined as a station whose observations are made and transmitted automatically (INMET, 2011). Meteorological observation is carried out using specific tools. In the acquisition model for high impact climatic events, a set of stations must operate in cooperation and quickly in order to predict their formation and indicate possible behaviors. Mendelsohn et al. (2004) point out that weather stations, mainly in Brazil, are more efficient when compared to meteorological satellites due to the more accurate collection of data such as precipitation, indispensable for farming planning. According to Inema (2011), the implementation of weather stations in much of the country, arose from the need for institutions and companies in the climate analysis and modeling.
The use of weather stations with conventional communication systems can lead to delays and dependence on third-parties, making the monitoring process slower and more expensive, and the detection and monitoring of severe weather events requires fast processing and with no interruptions of sensors. Moreover, the best knowledge of climate change depends on the dispersion in the space of the stations, something that is hampered, in extreme conditions, with the transmission technologies available in the market, usually satellite and / or cellular (MENDELSOHN et al., 2004).
A critical point of data acquisition is in communication, which uses satellite at a high cost per station and another decision-making process based on the models and the information generated. Data cannot be transmitted in real time, being compiled and sent at intervals of one to three hours. Mendelsohn et al. (2004) point out that despite making accurate measurements, weather stations are still expensive for extensive application, mainly preventing the monitoring in the agricultural environment The need for collection and transmission of data is demonstrated by a project using data from the National Oceanic and Atmospheric Administration (NOAA) that by using real-time data collection systems, the number of stations to cover the same area is minimized (HERRING et al., 2015). This information about data collection points to the absence of accessible systems and operation in real time, which allow the issuance of reports of sudden changes in the climate, as well as data collection at regular intervals for further analysis by an intelligent and autonomous system.
To determine the origins of the impacts on water reserves, it is necessary to analyze a large amount of data in order to characterize anthropogenic actions and climatic anomalies (OTTO et al., 2014). The lack of stations results in more inaccurate analyses, due to the low resolution of the data for each region. According to Herring et al. (2015), the determination of the causes of droughts are still complex, where several parameters such as lack of rainfall, temperature, evaporation rates and soil moisture must be analyzed.
Climate changes are highlighted in the report by the American Meteorological Society (HERRING et al., 2015); also taking into account the impact of water use and population growth as responsible for the drought in the state of São Paulo (OTTO et al. 2014), thus, the point to be addressed is still the monitoring of water reserves and weather in order to obtain more concise data on the real elements that cause this type of event.
Considering the achievement of the collection of more accurate data for climate monitoring, we sought to develop versatile systems for the acquisition and transmission of meteorological and hydrometeorological data in a contextualized and real-time manner, serving as a mechanism to mitigate extreme climatic events through alerts, tool for communication during this type of event and database in the mesoscale model for further analysis of the impact of climate change, integrating the concepts of radiofrequency and the acquisition of weather data with the objective of a system of data acquisition in time real that functioned independently of electric power and telephony, ensuring the obtaining of information at anytime and anywhere.
Radio-frequency is the only means of communication able to operate in extreme situations. In such cases, the information is transmitted by radio amateurs or public agents (such as civil defense) to emergency centers and decisions are taken based on this information that sometimes may not satisfactorily reflect the dimension of the event. Likewise, Multi-agent Systems (MAS) are systems composed of a set of software agents that interact with the objective of reaching individual or collective goals (DEMAZEAU, 1995) MAS form a subarea of Distributed Artificial Intelligence (DAI) and focus on the study of autonomous agents in a multiagent universe. For MAS, the term autonomous designates the fact that agents have their own existence, regardless of the existence of other agents. Overall, each agent DEVELOPMENT OF AN AUTOMATED SYSTEM FOR WEATHER DATA COLLECTION AND FORECASTING CLIMATE... has a set of behavioral capacities that define their competence, a set of objectives, and the necessary autonomy to use their behavioral capacities in order to achieve their objectives. An agent is a computational entity with an autonomous behavior that allows it to decide its own actions (ALVARES; SICHMAN, 1997). The decision of which action to take is determined by the agent, considering the changes that have taken place in the environment in which it operates and the desire to achieve its objectives The main idea in a multi-agent system is that na intelligent global behavior can be achieved from the individual behavior of agents. In relation to MAS, it is not necessary for each agent to be individually intelligent to achieve intelligent global behavior. The metaphor of intelligence used by Multiagent Systems is the intelligent community, that is, the social behavior that is the basis for the intelligence of the system. The metaphor used by classical Artificial Intelligence (AI) is basically of psychological origin, while the one used by DAI can be of a sociological or ethological nature. A sociological / ethological approach is interesting when it is desired to solve complex problems, which require knowledge of several domains and which may involve physically distributed data.
Thus, a monitoring network distributed geographically, which can have a varied number of entities, whose data can arrive at random, in a dynamic environment and with different actions for each scenario, where decisions need to be taken at all times and with various possibilities, MAS assists the monitoring and decision making, meeting the fundamental requirements to operate in this dynamic environment.
The system is used for the acquisition of meteorological data by sending alerts in real time, without the need for any type of communication with the internet or the electrical network. Several market segments can benefit from the system, the most important of which is public security, which need accurate information for better prevention and relocation of personnel and the agricultural sector due to the lack of weather coverage in much of the country and the state, hindering crop and planting planning.
The main reason for the lack of prevention is the absence of distributed, interconnected, intelligent and efficient climate monitoring and communication systems in extreme situations, therefore, the contribution of this paper is to present a proposal for a microclimate monitoring network with weather stations interconnected via radio frequencies that they collect, making them available to assist in decision making in order to inform, alert and minimize financial or human losses.
One of the differentials is the assurance of the data transmission service even in situations where the electricity and telephone network are inoperative, in these situations the amateur radio is the only efficient and effective communication mechanism, that is, when everything else fails, the radio is still operational. Another differential will be a system based on agents, autonomous software entities capable of making decisions, which based on the collected information will be able to inform about likely extreme events in formation or occurring and to foresee their trajectory and impacts. The constitution of this network of equipment and software will support studies to improve the understanding of the physical phenomena involved, increasing the ability to forecast extreme events and to promote prevention and adaptation actions so that these events do not become natural disasters Figure 1 shows the constituent elements, represented by numbers of the weather station developed for the project, where the sensors in it collect the data, later treated and used for interpretation, considering each parameter to draw a conclusion about what is happening in the time of the specific location.

DEVELOPMENT OF THE WEATHER STATION
For the adequate functioning of the station, it was used some sensors, which obtain values based on wind speed and direction, temperature, air relative humidity, rainfall, atmospheric pressure, solar irradiation index and battery voltage.
The anemometer ("1") is one of the instruments used for this weather station. It is used to measure the speed and direction of the wind and it is located at the top of the station, for a better data collection The temperature and humidity sensor ("2") measure the temperature and air humidity.
The rain gauge ("3") is a type of sensor which measures local precipitation. It has a nozzle to collect rainwater to obtain the necessary data. It is placed at the top of the station, below the anemometer.
The atmospheric pressure sensor ("4") measures the local atmospheric pressure.
The pyranometer ("5") measures solar radiation The energy required for the operation of the weather station is obtained from solar energy, so a photovoltaic plate ("6") was used.
The plate for communication between the station and the gateway, where the data are interpreted, is identified as number "7" in Figure 1.
Regarding the sensors, it has to be considered the issue of the unit of measurement for each one of them which are listed below • The temperature is measured in degrees Celsius (° C); • Relative humidity is measured in percentage (%); • Atmospheric pressure is measured in hectopascal (hPa); • Irradiation is measured in watts per square meter (W.m-²); • The wind direction is measured in degrees (°); • Wind speed is measured in kilometers per hour (km.h-1); • Rainfall is measured in millimeters (mm); and • The battery voltage is measured in volts (V) DEVELOPMENT OF AN AUTOMATED SYSTEM FOR WEATHER DATA COLLECTION AND FORECASTING CLIMATE...

Figure 1. Weather station developed for the project
The readings of the sensors are displayed based on the use of a graphical interface of the Node-RED framework (Section 3.2), demonstrating each value, which presents the necessary corrections, on a website.

NODE-RED
The Node-RED platform was used to integrate, interpret and display data from the station. Node-RED is a programming tool for wiring hardware devices, Application Programming Interface (APIs) and online services. It provides an editor based on Java code in the browser that makes it easy to wire streams using the wide range of nodes in the palette that can be deployed to its runtime in a single-click This tool features a programming based on nodes, or modules, which makes it simpler to program, but without losing functionality. Because it is an Open Source platform (open source), it can be used by anyone for free.
As shown in figure 2, on the left side, there are the options of nodes to be placed, either the patterns or those created / imported, each with a different function or configuration. In the center of the image there is the code made by the nodes, each with their respective wirings (left side entrance and right-side exit).
In addition to the advantage of being free of costs, it allows developers to make their custom modules available for use, with a vast library with several functionalities, and its implementation is done easily and instantly RAMOS, C. C. O. et al.

GATEWAY
The station could communicate with the Node-Red through a device denominated "gateway". This device makes the connection for the transmission of information from the sensors. In relation to the communication of the station with the gateway, data are transmitted by means of radio-frequency waves, where in the same gateway, several stations can be wired considering its range of 18 km of radius for the connection to the stations. Regarding the communication between the gateway and Node-RED, this is done over the internet, via WI-FI, and information can be sent from the many stations connected to the gateway, if the machine using Node-Red supports it.
The gateway can be the station itself shown in figure 1, as one of the future goals of the project will be the creation of a collection of stations for a combined monitoring, using an approach based on a MESH-type network, where the stations exchange information via radio-frequency. Thus, the project was based on a network architecture where each station is represented by a node and all nodes communicate with a ROOT station (which transmits to the internet), which in turn is responsible for sending information to the internet via a WI-FI or GSM data network.
The node measures the values of the sensors connected to the microcontroller at the station. The microcontroller then converts each signal into data, and these data are transmitted to other controllers until they reach the ROOT station, which then transmits that signal to the Node-RED where the data is stored and can be viewed from any environment with internet.
For a convenient installation of the sensors, the entire system of the stations used was of the wireless type, which allows its installation in an open field with only access to a ROOT station for internet connection and data storage in the cloud that can be easily placed in any room of a residence. Apart from the gateway (ROOT), the complete system runs on batteries that provide good autonomy for microcontrollers and do not require constant changes.
For the transmission of information on the weather, the Mesh network is used, where the nodes read the sensors and transmit the information to the node directly above it, and so on until reaching the ROOT (gateway), all by means of radio frequency. After reaching the Root, the information will be transmitted over the internet network to a server in the cloud that will store this data and from that point the user will be able to access it.
The developed network has a structure similar to the topology of a tree, where the ROOT has up to 5 branches and each branch has another 5, and so on until the fifth level. Each node sends information to its superior until reaching the ROOT, however if a node disconnects, all of those below it will also be cut off from the network. The generated system has a program to circumvent the loss of a node in the network, in case one node is disconnected, the other nodes will rearrange themselves in the system so that all of them remains connected (figure 3). The stations communicate with the gateway via radio frequency and the gateway communicates with the Node-RED framework via WI-FI (figure 4).

NODE-RED-STATION WIRING
The Node-RED that is used for the station is currently running on a machine within the cloud server services Amazon Elastic Compute. This service was chosen because it offers a freeof-charge server that can remain continuously connected, and in this way, both the station data and the programming by Node-RED, can be accessed from any machine, as long as there is an internet connection.
The programming was done as follows: the data arrives at the machine that is running Node-RED via gateway (that is, Node-RED is connected to the gateway); within Node-RED programming, all the information arrives together and in one line, so that information is broken and separated into lines, and again it is broken and separated in JavaScript Object Notation (JsON), which basically breaks the information received in separate classes for each type of information. For example: the first step breaks the information into lines and the information arrives as follows [temperature: 25; pressure: 0.98; humidity: 50].
The second step transforms the entire text into separate information. As before, the information was only "[data.station]", then it is "[station.data. temperature.]", and the same for each type of data received.
This allows the exchange of information to be done in a faster and more fluid way, and also allows each information to be treated differently, as for the display of the current data of the station in the Node-RED UI. Currently, programming only separates the data individually and displays it in real time, in addition to assembling a graph of the data versus time, presenting only a few simple operations with the data, for the conversion and for the real-time display.
The graphical interface of the electronic address that offers the information already treated is represented in figure 5.

SYSTEM OPERATION
The result for the functioning of the entire developed system worked very well in the laboratory, proving to be a solid and efficient system, considering that the collected data seemed to be correct.
For the experiments carried out in the field, the developed weather station was installed in a community of farmers so that it could assist in the best decisions for their plantations. The gateway was installed in a barn, that is, in a covered area so as not to be exposed in the environment and with internet available. For this experiment, the gateway was developed separately, that is, it was not a station, since there was only one station to be tested.
Therefore, 89360 samples of the station were collected every 1 minute, each sample has the information described in Section 3.1, during the month of January 2019. The data provided by the station were the following: temperature, atmospheric pressure, relative humidity, radiation, RAMOS, C. C. O. et al. Figure 5. Graphical interface for presenting data collected by the weather station wind direction, wind speed and rainfall.
As there was much more information about periods without rain than periods with rain, it was noticed that the data was unbalanced and often incorrect. Difficulties were found in experiments concerned with the prediction of climatic events, therefore, it was found that the data were inconsistent and did not show consistency in relation to the recorded information, which impaired the validation of the collected data, although the system works correctly.
As a result, there was a need to correctly calibrate the sensors of the weather station. The project proved to be complex and many difficulties were found during its execution in the field

DIFICULTIES FOUND IN THE EXPERIMENTS
The several difficulties and unforeseen events during the Project execution in the filed were, as follows: After assembling the station in the field, the gateway had to be changed, as it was not collecting the data correctly; • Fixing the station on the ground was difficult due to the strong winds that knocked it down, thus impairing its operation; • After data collection, the inconsistency of the acquired information was observed; and • When looking for the station to make the adjustments, it was found that the gateway was full of water inside it, which impaired the communication of the data to the electronic address where the data are monitored.

CONCLUSION
• This paper presented the development of a complete platform for the acquisition and transmission of meteorological data, producing hardware and software tools to provide meteorological information in a contextualized and automated way in farming monitoring and in the prevention of disasters caused by extreme events.
• During the tests carried out in the laboratory, the weather station and the automated system for monitoring the collected data worked well and proved to be efficient, but, several difficulties and unforeseen events were found when setting up the station for field tests, whihc hindered the progress of the project (Section 3.6).
• Adjustments have been carried out currently and a new gateway will be developed to test its operation again considering the experiences obtained during the project, enabling the construction of new stations so that they work together and thus assist in the monitoring of plantations and in prevention weather events with the data collected in real time.

ACKNOWLEDGMETNS
Thanks to the farmers who collaborated with the project and the support of the Rectory and the Catarinense Federal Institute (IFC) through the program for granting scholarships and funding to promote Local Productive Arrangements (APL) in the state of Santa Catarina.