Design of micro-automatic weather station for modern power grid based on STM32

: With the rapid growth of renewable energy resources over the past few years, the analysis and control of modern power systems are becoming more and more complex. Meteorological information has been regarded as the basic data to help operators handle the problems brought by renewable energy. Thus, the concept of micro-automatic weather station was proposed to meet the needs of modern power grid analysis and control. Based on the STM32 controller and meteorological sensors, the hardware and server software of the micro-automatic weather station are designed and developed, which can monitor wind speed, wind direction, light intensity, temperature and humidity of sur-roundings atmosphere. All real-time meteorological data together with geographic information offered by Global Positioning System are sent to the base station via wireless General Packet Radio Service network, the networked data are analysed in the server. The real experiment showed that weather station can run smoothly in the natural environment, providing accurate and real-time meteorological data for users. Consequently, micro-automatic weather station makes it possible for researchers to get a large amount of meteorological information at a low price in a short term.


Introduction
The clean and environmentally friendly renewable energy such as photovoltaic (PV) power generation and wind power generation are playing an increasingly important role in electricity production. However, the randomness and volatility of renewable energy also affect the safety and stability of the power system [1,2] at any time. Furthermore, the impact of natural disasters on the power system [3,4] has gradually been paid attention by researchers. Finally, distributed generation units installed in distribution network [5] also increases the complexity of the power grid. Research about the issues mentioned above mainly depends on the meteorological information. Therefore, obtaining abundant, accurate and real-time meteorological data is of great importance to modern power grid analysis.
Automatic weather stations have been developed for decades [6,7]. The technology of manufacturing traditional automatic weather station is very mature. However, the large volume, high construction cost and long construction period, which are the conspicuous characteristics of the traditional automatic weather station, limits the utilisation of traditional weather station in the electrical field. As a result, the traditional automatic weather station is not suitable for modern power system monitoring and analysis.
The concept of micro-automatic weather station based on the STM32 microcontroller for the modern power system is proposed in this paper, which can monitor the wind speed, wind direction, light intensity, temperature and humidity of surroundings. The Global Positioning System (GPS) module provides time information and geographic information for the weather station. All of the information caught by weather station will be sent to the base station for receiving, decoding, checking, displaying, storing and applying. Applications such as prediction of PV power, forecasting the wind power and analysing the impact of meteorological disasters on power systems have been added to server software as subfunctions. At the same time, several interfaces are reserved for adding new functions in the future. It is worth mentioning that both of the network transmission protocol and the data sampling rate can be modified online by the users. Now we have translated the concept of micro-automatic weather station concept into the actual hardware device. Four sets of weather stations were installed in Jinan, China. In the six months test phase, all the devices ran smoothly with no interruption. By checking the meteorological data stored in the database, the data packet loss rate of General Packet Radio Service (GPRS) wireless communication is lower than 0.1%. In addition, no matter the online applications or offline analysis in the software passed the tests. Therefore, both of the micro-automatic weather station hardware and the server software are mature enough to be put into practical application and provide meteorological information for researchers.

Structure of the system
The micro-automatic weather station is an instrument which can automatically monitor the meteorological information and sent to the server. The whole system is composed of the hardware device (shown in Fig. 1) and the server software.

Hardware device
All of the micro-automatic weather station hardware units are sealed in an aluminium chassis with good waterproof performance to suit the natural environment. It mainly covers power management system, data acquisition system, and information transmission system, which ensures that the weather station can work in the natural conditions without interruption. Fig. 2 shows the structure of hardware device.

Server software system
Getting the accurate and real-time meteorological data is the basic goal of the server software. Firstly, server software system is responsible for receiving, decoding, displaying and checking the data. The exception data will be recorded and reported to users.
After that, on the one hand, the processed weather data will be displayed on the server interface in different forms such as LED numbers or dynamic curves. On the other hand, the meteorological data will also be stored in the database SQLite or Access. Last but not least, the software can do both the online applications and offline applications by using the meteorological data. Steps of data processing are shown in Fig. 3.

Hardware design
3.1 Data acquisition system 3.1.1 STM32 microprocessor: The STM32F103VETb microprocessor is chosen as the core of the micro-automatic weather station, which has rich hardware interfaces to control various types of meteorological sensors. It is convenient to complete the functions of acquiring, processing, displaying and transporting the meteorological data.
The STM32F103VETb microprocessor [8] is based on the 32-bit ARM Cortex-M3 core and is available in the LQFP (Low-profile Quad Flat Package) package with 100 external pins for industrial control. Microprocessor's core operating frequency can up to 72 MHz, it has one 512 KB of flash memory, two 12-bit analogue-to-digital converter (ADC), two 12-bit digital-to-analogue converters, three general-purpose 16-bit timers and an advanced pulse-width modulation timer. This chip also includes abundant communication interfaces: two inter-integrated circuits interface and two serial peripheral interfaces, one universal serial bus fullspeed device interface and one controller area network.
The main functions of the microprocessor can be summarised in four aspects: (a) Control the data acquisition system of external meteorological sensors.
(b) Receiving, decoding, checking and processing the meteorological data packets. (c) Handling the GPS signals to get the synchronous clock and geographic information of the station. (d) Support the information transmission and the power management system.
3.1.2 Temperature measurement: DS18B20 chip [9,10] is chosen to measure the temperature of surroundings. DS18B20 chip is a programmable single-bus digital thermometer manufactured by Dallas Semiconductor.
The sensor's unique single-wire interface requires only one pin to achieve communication, and it can also send a cyclic redundancy check, with a strong anti-jamming error correction capability. The configuration register allows the user to set the temperature measuring accuracy to 9, 10, 11 or 12 bits. DS18B20 supports multi-point networking; it means several DS18B20 chips can be connected in parallel on the only three lines, which is convenient to send data to controllers. The parameters of the configuration register are listed in Table 1.

Humidity measurement:
Micro-automatic weather station uses DHT11 [11,12] to measure humidity information. DHT11 is a calibration with digital signal output temperature and humidity composite sensor, with a single bus serial interface. Because the accuracy of the temperature measured by DHT11 is lower than that of DS18B20, the station discards the temperature information collected by DHT11. The humidity measurement accuracy reaches three decimal places and the effective transmission distance of measured signal can reach 20 m. Therefore, DHT11 chip fully meets the requirements of the humidity monitoring.

Light intensity measurement:
In this design, we select BH1750FVI chip to collect light intensity information, which is a two-wire serial bus interface digital light intensity sensor integrated circuit for two-wire serial bus interface. The module can convert the analogue light intensity to digital variable ranges from 1 to 65,536 by an ADC chip inside. BH1750FVI [13] uses the inter-integrated circuit to communicate with the controller. The structure inside is shown in Fig. 4.

Light intensity measurement:
As for wind speed measurement, we choose the three-cup type wind speed sensor. It can transfer the wind speed information to 0-5 V digital signal, the minimum start wind speed of which is 0.4 m/s. And the wind speed measurement accuracy is about 0.1 m/s. In this design, the direction is divided into 16 directions horizontally, which can be measured by the horizontal wind direction sensor. The minimum starting wind of the device is 0.8 m/s. The shape of the wind direction measurement and the wind speed measurement are shown in Figs. 5 and 6, and the supply voltage is 12 V.

Global Positioning
System: GPS is a comprehensive, allweather, full-time, high-precision satellite navigation system developed by the United States Department of Defense to provide global users with low-cost, high-precision three-dimensional position, speed, and precise timing information.
In the micro-automatic weather station, we use the U-BLOX NEO-6M module to receive GPS satellite signals [14,15], which supports the Radio Technical Commission for Maritime (RTCM) services standard protocol. There are seven data frames in RTCM, they are GPGGA, GPGSA, GPGSV, GPRMC, GPVTG, GPGLL and GPZDA. Taking into account of the micro-automatic weather station's practical working demand, we chose the GPRMC data frame listed in Table 2.

Power management system
Energy management system is the foundation and guarantee of the micro-automatic weather station. Both of the AC power and the DC power can be supported by the system. It mainly covers the management of AC power, rectifier, PV unit, wind turbine, control unit, and lithium battery (Fig. 7).
In AC power supply mode, the weather station is supplied by external 220 V AC power supply. Firstly, the AC power is transformed to 12 V DC power supply by rectifier [16]. Then, DC power supply provides stable power for the entire system. This mode is mainly used in commissioning phase of the equipment.
As the micro-automatic weather station sometimes need to be installed in remote areas such as desert or mountainous areas, where is hard to find the external AC power supply. Therefore, supporting the DC power supply is of great importance to the weather station in some conditions. The DC power supply system contains the PV unit, wind turbine, energy storage devices and the control unit. When the lithium battery [17] is operating in the charging mode, power generated by PV unit and wind turbine will be stored in. While when the battery is operating in the discharge mode, it provides power for the weather station. Parameters of the power management system are listed in Table 3.
Experiment in Fig. 8 shows the weather station can work at least 16 days with no wind and sunlight when the battery is fully charged. In addition, whether in summer or winter, the energy management system can ensure the system run without interruption as shown in Fig. 9.

Information transmission system
Micro-automatic weather station support wired serial communication way, wired network communication way and GPRS wireless     network communication way to transmit meteorological data to the server.
(i) Wired serial communication: Serial communication means the serial port is in accordance with the bit to send and receive data. Although the data transmission speed under serial communication mode is slower than the parallel way to transfer data, the serial port occupied fewer lines. Meanwhile, only two data lines would be used to send and receive data. Convenience is the most conspicuous advantage of the serial communication method. (ii) Wired network communication: As the wired serial communication mode is limited by the high cost of long-distance transmission of the wired connection, and the signal decay when the transmission distance increases. Auxiliary equipment such as the repeater will make the economic benefits of cable transmission mode worse. So the wired serial communication mode limits the transmission distance of the meteorological data. Wired network communication can use the public network with high communication quality. In addition, it will not be limited by the transmission distance. Under this mode, users can modify the transmission protocol (TCP or UDP) and the data sampling rate online. (iii) GPRS wireless network communication: As the weather station needs to be installed in the natural environment, it is inconvenient to use the cable transmission. Taking into account of economic efficiency and transmission stability, GPRS wireless network communication [18] is suitable for the weather station (Fig. 10).
GPRS is a service which GSM mobile phone users own. It is a continuation of GSM and transfers the data in the packet form. Users should pay for the cost calculated in units of the size of transmission content. When the network environment is well, the transmission speed can reach up to 56-114 kbps.

Software design
Micro-automatic weather station's webserver is installed in the base station, the task of which is to receive, decode, check, display, store and apply the data. In our design, the server software can process data from multiple weather stations at the same time, while it also supports the user to modify the system size, data sampling rate, and even the network transmission protocol. Table 4 shows the parameters of the software.

Server software configuration
In server software configuration interface, users can get the working state of both weather stations and web server as shown in Fig. 11.At the same time, users can configure the system's operating parameters. The specific functions are shown as follows: (a) Getting the running status of the server. Such as transmission protocol, server name, interface name, server IP address, subnet mask, broadcast address and server MAC address. (b) Getting the connection information of the micro automatic weather station, such as transmission status, data sampling rate, IP address and port number of the weather station. (c) Configure system operating parameters. Users can modify the target IP address, target port number, data transmission speed and transmission protocol.

Design of real-time user interface
All of the meteorological information including humidity, temperature, wind speed, wind direction, light intensity, coordinated universal time and geographic information received from the weather station displays on the real-time user interface consists of the numerical display part, local time display part, real-time curve display part and real-time wind direction part shown in Fig. 12.

Advanced application of micro-automatic weather station
The meteorological information is the basic data of power system analysis. Due to the small size, low price, and low installation difficulty of the micro-automatic weather station, it makes establishing a number of weather monitoring points in a large area possible. In addition, all the weather stations share one synchronous clock given by GPS signal. On the one hand, real-time applications integrated into the server software use the real-time meteorological information to analysis the operating status of the power system. On the other hand, the meteorological data can be stored in the database for off-line analysis. Some of the advanced applications are listed as follows.

PV power and wind power prediction
Predicting the PV power [19,20] and wind power [21] has become one of the core functions of the server software. Both of the short-term prediction and the long-term prediction can be made online or offline. The forecast results can be output in text form for users.

Impact of meteorological disasters on power systems
Meteorological disaster can give serious impact on transmission lines and load [3,4]. In some cases, it even causes fault of the power system and makes huge economic losses. The server software can accurately record and analyse the meteorological disasters in each region, and then provides users statistical data and analysis results.

Dispatch of active distribution networks
Based on the algorithm mentioned in [22,23], we are currently developing a set of practical software using the real-time meteorological information which can provide a novel, dispersed and dynamic schemes for power system dispatch and control.

Conclusion
This paper introduces the design of micro-automatic weather station. Both of the hardware device and server software have been accomplished. By now, we have installed four sets of micro-automatic weather stations based on STM32 in Jinan, China. During the six months test phase, the hardware devices and the server software run smoothly. The data packet loss rate of GPRS wireless communication is lower than 0.1%. Micro-automatic weather station makes it possible for researchers to get a large amount of meteorological information at a low price in a short term. In addition, the GPRS wireless network communication further reduces the installation difficulty of the weather station. In addition, all of the weather station shares one synchronous clock offered by GPS. This fact will enlighten scholars to dig the practical value of the synchronous meteorological information. Many issues such as analysing and predicting of renewable energy, estimating the impact of meteorological disasters on power systems and dispatching of active distribution networks based on the real-time meteorological information need to be searched deeply and systematically.

Acknowledgments
This work was supported by the project of Global Energy Interconnection -Macro coordination of the Physical and Information Systems of Global Energy Interconnection.