A Low-Cost System for Measuring Wind Speed and Direction Using Thermopile Array and Artiﬁcial Neural Network

Featured Application: The proposed system can be used as a low-cost alternative to anemometers and wind vane for applications in residential hybrid renewable energy systems. Abstract: Recent developments in wind speed sensors have mainly focused on reducing the size and moving parts to increase reliability and stability. In this study, the development of a low-cost wind speed and direction measurement system is presented. A heat sink mounted on a self-regulating heater is used as means to interact with the wind changes and a thermopile array mounted atop of the heat sink is used to collect temperature data. The temperature data collected from the thermopile array are used to estimate corresponding wind speed and direction data using an artiﬁcial neural network. The multilayer artiﬁcial neural network is trained using 96 h data and tested on 72 h data collected in an outdoor setting. The performance of the proposed model is compared with linear regression and support vector machine. The test results verify that the proposed system can estimate wind speed and direction measurements with a high accuracy at different sampling intervals, and the artiﬁcial neural network can provide signiﬁcantly a higher coefﬁcient of determination than two other methods.


Introduction
The popularity and necessity of renewable energy is creating the demand for residential hybrid renewable energy systems (HRES). Renewable energy is not only essential for reducing pollution but also in order to satisfy the ever-increasing demand for energy. To efficiently manage energy generated HRESs, real-time monitoring of wind speed is required by many renewable energy related systems. Wind speed is crucial for computing/estimating wind power output [1,2], as well as solar power output [3,4]. Commercial wind speed sensors are mainly of three types: (a) rotary/cup anemometer, (b) hot-wire anemometer and (c) ultrasonic anemometers. Although, each of these types has different working principles, their market prices are notably high for residential usage applications. Wind speed data are broadly used for wind energy potential analysis, as presented in [5][6][7]. Similarly, wind speed data are also used for optimal sizing of renewable energy systems [8][9][10][11], energy management systems relying on weather forecasts [12][13][14][15].
The wind speed and wind direction data are invaluable for renewable energy potential analysis and renewable energy generation applications. However, many challenges regarding current technologies for measuring the wind speed and wind direction include:

•
Rotating parts in cup anemometers and wind vanes are prone to degradation and faults over time and result in inaccurate readings. • Many applications are constrained by size, and a wind flow trajectory may not be suitable for rotating anemometers.

•
In order to encourage the use of such sensors in residential setups, the cost of a system should be affordable.
• Costs of wind speed and direction measurement systems are highly influenced by the components used for sensing the wind attributes. Therefore, technology that is more sophisticated may provide a higher accuracy but may lead to significantly higher system costs.
Several studies on the development of anemometers rely on expensive and complex manufacturing processes. However, such systems are not accessible to general/residential users due to the initial capital restrictions. In this study, we developed a low-cost highaccuracy wind speed and direction sensing system using a thermopile array, a positive temperature coefficient (PTC) heating element and a heat sink. The heat sink is used as a heat exchange between the PTC heater and the environment, i.e., wind behavior. An independent temperature sensor is used for collecting the ambient temperature data as changes in ambient temperature influence sensing accuracy of thermal anemometers [16,17]. The major contributions of this study are:

•
This study reports on the development of a low-cost wind speed and direction sensing system using easily available and low-cost components, including a thermopile array, a PTC heater, a heat sink, and an ambient temperature sensor.

•
The proposed device does not have any rotating or moving parts, hence, it requires less maintenance and can transfer measurement data wirelessly without a need for wires.

•
The use of an artificial neural network (ANN) to estimate the wind speed and direction from the thermal distribution using data collected from the thermopile array and ambient temperature sensor with a high coefficient of determination (R 2 score) at different sampling intervals.
In order to evaluate the accuracy of our system, we compared the wind speed and direction estimated with respect to a cup anemometer and a wind vane, respectively. We use support vector machine (SVM) [18] and linear regression (LR) [19] with least squares to compare the estimation accuracy of wind speed and direction using the thermopile data against an ANN method. Selection of SVM and LR methods for comparison is based on their applicability and popularity for use in signal processing, regression and prediction tasks, as discussed in Section 2. In addition to the contributions stated above, the proposed systems also collects thermopile and ambient temperature data which are transferred to a computing device wirelessly at an interval of 2 s.

•
An artificial neural network (ANN) is trained on the thermopile array, and ambient temperature sensor data can provide a significantly higher R 2 score for wind speed and direction estimation than the SVM and LR methods.

•
For the evaluation of system, 96 h of data are used for training the ANN model and 72 h of data are used for the testing the model performance.
This paper is structured as follows: in Section 2, a brief discussion of related work and research is presented. Section 3 introduces the mechanical design and working principle of the proposed system. In Section 4 the collected dataset, regression results and comparison between different regression methods are discussed. Section 5 draws the conclusion for the presented study and discusses limitations and future directions.

Related Works
Over the years, there have been many developments in wind speed and direction sensing and making devices without rotating parts using ultrasonic or thermal technology has been the primary focus. In [20], a three-dimensional (3D) ultrasonic anemometer was developed based on the geometric placement of sensors. Based on the results, the system could estimate relatively higher wind speeds with good accuracy. Using microelectromechanical systems (MEMS), the authors of [21] developed a low power ultrasonic anemometer using adaptive phase tracking. Additionally, in [22] a 3D ultrasonic anemometer is discussed using an ultrasonic sensor array that can provide accurate wind speed and direction measurements. Unlike ultrasonic sensors, thermal anemometers are based on the principle of heat exchange through interaction of a heated element with wind. Hot-wire anemometers [23][24][25] are popular thermal-type wind speed sensors that require minimal installation space and are portable for mobile operations. However, hot-wire anemometers can only measure wind/flow speed. In [26], a thermoelectric-type anemometer is developed that can measure wind speed with a high accuracy while keeping the power consumption ultra-low. Thermal anemometers have great potential as they can miniaturized, and due to their solid-state sensing capabilities, they require minimal maintenance. In [27], a solid-state anemometer is developed using thermal flow sensors that can, not only estimate the wind speed, but also the direction. Several research efforts on micro-machined two-dimensional thermal wind sensors can be found in [28], which focus on making solidstate anemometers smaller, more energy efficient and less sensitive to other environmental factors. Some major recent contributions to the wind speed sensing systems include the work in [29] which develops a piezoelectric wind speed sensor by establishing a mathematical relationship between wind velocity and a piezoelectric film's vibration frequency. A portable anemometer with spherical structure proposed in [30], which uses the differential pressure measurement across two non-intersecting tunnels to estimate fixed-point wind velocity and direction with a high degree of accuracy. In another development, a wearable anemometer is presented by the authors of [31], where wind velocity and direction are estimated through a thermal flow sensor, triaxial accelerometer and triaxial magnetometer. Reference [32] discusses the development of a miniature thermal wind sensor based on constant power control and the temperature distribution principle.
Accurate wind speed measurements are important for reliable wind speed predictions and accurate wind energy assessment. Reference [33] introduces a method for offshore wind speed assessment using global wind speed datasets and in situ measurements. Most of the research on wind speed prediction on a short-term horizon relies on historical wind speed data. In [34], a short-term wind speed prediction model is proposed using variational mode decomposition (VMD) and a genetic algorithm ANN. The proposed model in [34] achieved a higher accuracy than other models in comparison. In [35], a hybrid evolutionary model was used to improve the accuracy of a long-term short-term memory neural network (LSTM) for short-term wind speed forecasting. In [36], a wind speed prediction method is introduced using ANN and wind speed measurements collected from multiple local sites. A stochastic optimization assisted ANN is used for short-term wind speed prediction in [37]. Apart from ANN, many other machine learning models have also been used for wind speed forecasting. In [38], a hybrid mode decomposition was used with an extreme learning machine in order to develop an outlier robust wind speed forecasting model. Reference [39] proposes a direct multistep wind speed prediction model by combining a self-adaptive data processing method with fuzzy entropy and a LSTM neural network. Reference [40] proposes a preprocessing-free model for multi-step wind speed forecasting using residual causal convolutional network, non-linear attention and sliding window technique. Support vector machines are also used for wind speed prediction tasks [41,42].
Apart from wind speed prediction tasks, machine learning models are used for several generic prediction, calibration and signal processing tasks. In [43], SVM regression is used to transfer the calibration between electronic noses for air pollution detection. SVM was also used in [44] for the calibration of a six-component force/torque transducer. In [45], a hot-wire anemometer calibration method is presented using Gaussian process regression and uncertainty awareness. Many studies rely on ANN models for signal processing, such as the methodologies proposed in [46,47]. ANN model performance is often compared against SVM [40,[48][49][50][51][52][53], since SVM is generally used for similar applications to ANN and, in some cases, provides superior accuracy and has more deterministic results as opposed to the stochastic nature of ANN. Another relatively simple method for multivariate analysis and regression is LR [54][55][56][57][58], which also popular due to its simplicity, interpretability and minimal computing requirements.

Design of Device
The working principle of the proposed sensing device can be seen in Figure 1a. A PTC heater is used to generate heat at a constant temperature. Since PTC heating devices are self-regulating [59,60] and can maintain a constant temperature without a dedicated close-loop control. An aluminum heat sink is mounted on the PTC heater to act as a heat exchanger. The maximum temperature of the PTC heater was set at 60 • C using a 5-V direct current supply. In this study, a thermopile array [61] with an 8 × 8 grid arrangement was used to collect the temperature data. The thermopile array was mounted 45 mm above the heat sink, so that the field of view could completely cover the heat sink area. The thermopile array had 64 thermopile sensors and a symmetric arrangement of the thermopile array allowed the temperature data to be collected from the heat sink surface as uniformly distributed grids (8 × 8). An ESP32 module [62] was used to collect the temperature data from thermopile array through an I 2 C interface. The collected data were then wirelessly transferred to a notebook PC via Wi-Fi. In Figure 1b, an assembled version of the proposed sensing device is shown. The PTC heater and heat sink are mounted at the bottom of the device frame, while the thermopile array and ESP32 are mounted at the top part of the frame. The device frame is supported by three cylindrical structures to keep the interference of the wind interacting with the heat sink to a minimum. In Figure 1c, a picture of the 3D printed version of the proposed device is shown, which is used for the measurements and experiments in this study.  The experimental measurement data on temperature change on the surface of the heat sink are due to wind flow. In Figure 2, some measurements collected by the thermopile array are shown in form of a heat map. Each square block on the heat map represents temperature measurements by one thermopile in the thermopile array. The color bar to the right of each heat map shows the color that corresponds to the measured temperature. In total, 64 blocks of temperature data were measured by the 8 × 8 thermopile array. Visually, at low wind speeds, the center area of the heat sink is hotter than the exterior. However, as wind speed increases, the temperature at the center starts decreasing. In addition, at higher wind speeds, the temperature is more dispersed in the opposite direction to the wind. Wind direction has a significant effect on the temperature distribution on the surface of the heat sink. The direction of higher temperature zones follows the direction of the wind. However, at lower wind speeds, the temperature at the center of the heat increases up to 60 • C, making the wind direction effect negligible.

System Architecture
The proposed wind speed and direction sensing system consist of two-stage data processing techniques. As shown in Figure 3a the thermophile and ambient temperature data are collected by the device and then transferred wirelessly to a personal computer (PC). The transferred data are then used by two ANN models for estimating wind speed and wind direction, simultaneously. The ANN models are generally used for regression, prediction and calibration tasks, as mentioned in Section 2. The major benefit of the ANN model is its ability to model non-linear and highly stochastic mathematical relationships between multiple variables. The ANN models used in this study are trained against the observed wind speed and directions that are measured by a cup anemometer and wind vane. Due to the universal approximation properties of ANN [63], it is preferred over linear regression and other machine learning models for calibration and regression tasks [55,[64][65][66][67]. In this study, we used two identical ANN models with four hidden layers. The number of neurons in each layer were 64, 32, 16 and 8 neurons respectively, these hyper-parameters were obtained using a halving grid-search [68]. The sigmoid function is applied as the activation function for each layer, except the output layer, which has a linear activation. The Adam [69] optimizer was used for optimizing the ANN. The input data are normalized using minimum and maximum value of the training dataset. For comparison, support vector regression [18] and LR using least squares are used. The maximum number of iterations for the ANN model was set to 10,000 epochs, while for the SVM regression model the stopping tolerance was set to 10 −5 and the squared l2 penalty was set to 0.1. All three models were programmed using the 'Scikit-learn' [70] library in the 'Python' programming environment. The data collection and transfer routine for ESP32 were written in 'C++' programming language. The data collection and transfer rate for the thermophile array were set to a 2-s interval. The down sampling of the collected data was performed using the PC before estimating the wind speed and direction. In Figure 3b, a potential application scheme is shown, where the proposed device can be used for the wind speed and direction measurements by an energy management system for solar panels and wind turbines. Alternatively, it can also be used for potential wind energy assessments for a given residential building or community area.

Experimental Setup and Dataset
The proposed system is tested in an outdoor setup. The training and testing data were collected from Tainan City, Taiwan, from a residential building rooftop, as shown in Figure 4a,b. A total of 168 h (1 week) of data were collected through the thermopile array, ambient temperature sensor, cup anemometer and wind vane. The total height of the sensors from the ground was 30 m and a vertical pole was used as the fixture for the sensors. Figure 4c shows the top view of the proposed device and experimental setup. In this setup, thermopile array data are collected simultaneously with the cup anemometer and wind vane at 2-s intervals to establish a one-to-one sampling correspondence between the proposed device measurements and the observed/actual wind speed with direction. In Figure 5, the thermopile array (64 channels), ambient temperature, wind speed and wind direction collected at 2 s intervals are shown. From the plots, it can be observed that the wind speed and wind direction data show a highly stochastic nature. However, the change in trends of wind speed corresponds to the change in the trends of the thermopile array data. This represents the relationship between these two variables. Wind direction does not show an obvious relationship. The vertical line (black colored) separating the plots shows the separation of datasets used for training and testing. The data on the left side of the vertical line are the 96-h dataset used for training the regression models, including ANN, SVM and LR, while the data on the right side are the 72-h data that are used for testing.

Estimation Results
In order to validate the accuracy and applicability of our proposed system, different sampling rates were used for training and testing the regression models. In this study, six sampling intervals were considered, 10 s, 20 s, 1 min, 2 min, 5 min and 10 min. The dataset is down sampled from 2 s intervals to the corresponding sampling interval by averaging the values. Each regression model is separately trained and tested for different sampling intervals. In Table 1, the error metrics for ANN, SVM and LR regression models are reported. The coefficient of determination (R 2 ) [71,72] and root mean squared error (RMSE) and mean absolute error (MAE) [40] are reported in order to evaluate the wind speed and direction estimation performance. The wind speed estimation performance of the ANN model surpassed those of the SVM and LR models. Consistently, for each sampling interval the ANN model could estimate the wind speed with a high accuracy. Especially for sampling intervals above 1 min, the wind speed ANN model's R 2 score was higher than 0.95 and reached a maximum of 0.99 for the 10 min sampling interval. The RMSE and MAE errors of the ANN model were also below 1 m/s and the best performances were achieved for the 10-min sampling interval, at 0.279 and 0.207, respectively. The SVM and LR models for wind speed estimation showed similar performances throughout the different sampling rates. Therefore, in the case of a tradeoff between accuracy and computing resources, the LR model can be preferable for on-device estimation of wind speeds. For wind direction estimation, the ANN model showed an R 2 score above 0.83 for each sampling interval, reaching a maximum of 0.941 for the 10-min interval. However, the SVM regression model for wind direction performed poorly, but the LR model could provide reasonable estimations at 5-min and 10-min sampling intervals. The observed vs. estimated/predicted wind speeds at the 10-s sampling interval are presented for ANN in Figure 6a, SVM in Figure 6b and LR in Figure 6c. From the plot, it can be seen that the ANN model is able to model the stochastic trends of wind speed using the thermopile array and ambient temperature data. The SVM and LR models can also reach a reasonable accuracy for wind speed estimation. However, for highly stochastic changes, especially at higher wind speeds, the ANN model performance was superior to those of SVM and LR. For wind direction estimation, the ANN model could capture most of the stochastic changes in trends, as shown in Figure 7a. However, the wind direction estimation accuracy was relatively lower than the wind speed estimation. The SVM model for wind direction could only model the average changes in trends, therefore the overall accuracy was poor, as shown in Figure 7b. The LR model was able to predict/estimate the wind direction better than the SVM model, however, it fell behind the ANN model's performance, as shown in Figure 7c. The comparison plots for the ANN models for wind speed and direction at sampling intervals of 20 s, 1 min, 2 min, 5 min and 10 min are provided in Appendix A, Figures A1-A10.

Conclusions
In this study, the development of a low-cost system for wind speed and direction measurement is reported. The sensing device is designed based on temperature distribution trends using a thermopile array, ambient temperature sensor, PTC heater and heat sink. Two ANN models are trained on the thermopile array and ambient temperature data for estimating wind speed and direction. The performance of the proposed system and the ANN model are tested for different sampling intervals and are found to be superior to SVM and LR regression models for estimating wind speed and direction. We can summarize the findings, using our experimental, results as follows:

•
Our proposed system could achieve an R 2 score of up to 0.99 and 0.941 for wind speed and direction estimation using the ANN regression model, respectively, at a 10-min sampling interval with MAE being 0.07 m/s and 13.657 • , respectively.

•
The R 2 score, RMSE and MAE of the proposed system at sampling intervals of 5 min, 2 min, 1 min and 20 s were well under acceptable limits.

•
The ANN method outperformed SVM regression by 2.2% in terms of R 2 score, 44.7% in RMSE, and 44.5% in MAE for wind speed estimation at a 10-min interval.

•
The ANN method outperformed LR by 9% in terms of R 2 score, 28.7% in RMSE and 24% in MAE for wind direction estimation at a 10-min interval.
Therefore, it can be concluded that our low-cost solution for wind speed and direction sensing can be used for residential and other applications without sacrificing accuracy. The proposed device can be installed in a small space and has no rotating parts, which increases the reliability and decreases the maintenance requirements.
The limitations of this study include: • The relatively lower accuracy for wind direction estimation at smaller sampling intervals, which is suspected to be due to the lower spatial resolution of the thermopile array and the design of the heat sink that restricts the airflow from some directions.

•
The wind speed and direction accuracy decrease with a shorter sampling rate because the changes in thermal distribution are not recorded as quickly as the changes in wind attributes.
The proposed system can be potentially used as an outdoor wind sensor and can also be used as a compact and portable flow sensor for indoor and tunnel settings. Other use cases for the proposed device includes, heating, ventilation and air conditioning systems in large commercial buildings and underground tunnels.
As future directions, the design of heat sinks and its fins will be studied and improved. In addition, a higher resolution thermopile array with resolutions greater than 8 × 8 grid will be considered with faster sampling rates for collecting temperature distribution data. Other environmental factors, such as humidity and atmospheric pressure, will also be considered for estimation modeling. The application potential of this device for monitoring the air flow in ventilation, air conditioning vents and underground tunnels will be explored.