{'fraction_non_alphanumeric': 0.02301429046194749, 'fraction_numerical': 0.01030242605516783, 'mean_word_length': 4.9237204724409445, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Design of Low-power Ultrasonic Anemometer Based on STM32L476

The power consumption of ultrasonic anemometers in engineering application has always been too high, which could limit their application in the long-time field measurement for wind speed. To solve the above problem, an ultrasonic anemometer with low power consumption, which employs the time-difference method to measure wind speed, has been designed in this paper. The ultra-low-power microprocessor STM32L476 is adopted as the core processor and low-power chips are used extensively in peripheral circuits. The whole circuit consists of power circuit, ultrasonic wave transmitter, signal receiver and memory chip. Besides, it can work in both online mode and self-contained mode. Simultaneously, Kalman filter algorithms have been employed to reduce data errors. It has been indicated in many experiments that the anemometer has lower power consumption, as well as higher precision.


Introduction
In recent years, with the development of new ultrasonic transducers and the popularization of highspeed processors, ultrasonic has been extensively applied in measurement technology. Compared with the traditional mechanical anemometer, the ultrasonic anemometer possesses a higher precision and a larger measuring range, and does not suffer from the mechanical wear [1]. Therefore, it has been widely used in engineering applications currently.
However, in some wind speed measurement experiments, carried out in the field, the ultrasonic anemometer can only be powered by the battery, which gives a limitation to its working hours. To meet the requirement of the long-time field experiments, it is of great significance to reduce the power consumption of ultrasonic anemometers. This paper introduces a low-power ultrasonic anemometer with the self-contained working mode. This low-power anemometer can not only output real-time wind speed, but also work in the self-contained working mode, which can realize the sleepmeasurement, storage-sleep work. This newly designed ultrasonic anemometer has a great application value in engineering practice.

Wind speed measurement method
The ultrasonic anemometer designed in this paper uses time difference method to measure wind speed and direction, as shown in figure 1. Two groups of ultrasonic transducers are placed orthogonally, and the distance between two transducers in each group is chosen as the same value [2], with four transducers driven in turn. The wind speed v can be orthogonally decompositioned into v x and v y . L stands for the distance between two transducers in the same group, and c represents the ultrasonic speed in the current environment. For the x direction, the time difference between ultrasonic waves 2 1234567890''"" ( ) And, in the headwind condition, the time difference between ultrasonic waves sent from transducer B and received by transducer A is T BA .
( ) Combine the two above equations and v x can be given as Similarly, the wind speed in y direction v y can also be obtained.
So, the wind speed can be expressed as: Moreover, the wind direction angle α can be calculated with arc tangent equation.

Overall design
With STM32L476 employed as the core processor, the system is mainly composed of power unit, signal control and transmitting circuit, signal receiving and processing circuit, memory chip and communication unit, as shown in figure 2. The power unit supplies power to the circuit. And the processor can control the power supply of the peripheral circuit by controlling the power chip, which can subsequently decide whether the system sleeps. MCU generates two complementary PWM waves to drive transducer to transmit ultrasonic wave, which can be received by the corresponding transducer to generate an electrical signal. After further amplification and envelope detection, the signal can be converted to a square wave by voltage comparator, which can be easily captured by the MCU. Finally MCU calculate the speed of sound based on the time difference between transmitting and receiving. Different instructions can determine two different working modes of the system. The first mode is to continuously output the real-time wind speed online, and the second is the self-contained mode, which adopts sleep-measurement, storage-sleep work cycle.

Circuit design
3.2.1. Microprocessor. Based on ultra-low-power ARM Cortex-M4 processor core, the STM32L476 is a high-speed microprocessor of STMicroelectronics. The current in shutdown mode is only 30 nA, and the current in standby mode is only 300 nA. This system employs the stop2 low-power mode of the processor, and the current is only 1.4 uA while RTC is working. However, other types of microprocessors usually operate at more than 20 uA in the same operating mode. Therefore, choosing STM32L476 as the core processor can reduce power consumption of system greatly.

Power unit.
The system circuit mainly consists of analog circuits and digital circuits. The digital circuit includes microprocessor, memory chip and RS232 chip, and the analog circuit is mainly composed of ultrasonic wave transmitting circuit and signal receiving circuit. The microprocessor needs the long-term stable power-on mode to control other peripherals. In addition, in order to lower power consumption of system, the analog circuit should be shutdown when the system enter sleep mode. Therefore, this system introduces two different power units that power to digital circuits and analog circuits respectively, with 12 V DC input voltage converted into different output voltages. Figure 3, in order to drive four transducers in turn, the system adds a analog switch 74HCT4052D in the signal control part. The microprocessor changes the voltage of the EN pin to control the channel selecting. Also 74HC45 is used here to improve driving ability of the signal, so that the signal can drive transducer to transmit ultrasonic waves more easily.  Figure 3. Channel Selecting.

Signal control and transmitting unit. As shown in
Since transducers connect the ultrasonic transmitting together with receiving circuits, there will be some interference between the transmitted signal and the received signal in the circuit. In order to avoid this interference, two parallel diodes are laid in transmitting circuits to prevent the transmitting signal from disturbing the receiving circuits. Besides, two diodes are incorporated in the receiving circuits to limit voltage so that the circuits will not be damaged by the high voltage of transmitting circuits, as shown in Figure 4 [3].

Signal receiving and detection unit.
Ultrasonic waves decay rapidly while it travels in air. Its amplitude attenuation law can be expressed by following equation.
Where, A 0 is amplitude of the acoustic wave before travelling. α is attenuation factor, which is proportional to the square of frequency; β is attenuation offset coefficient due to wind speed; v is wind speed. and v is positive when v is coincident with the direction of propagation [4]. Due to the attenuation process, the transmitted signal is quite weak after being received by the transducer.
In order to capture the weak signal accurately, filtering, amplification, and detection circuits are usually employed in the receiving circuit, which would result in high power consumption. In order to simplify the circuit and improve the anti-interference ability of the receiving circuit as well as lower power consumption, SA614A is selected to process signals, which has low power consumption, strong anti-interference and can achieve amplification and envelope detection for the input signal. After envelope detection, the frequency of the received signal decreases, but its edge rises/falls slowly, which will induce a large error when the processor capture the signal. In order to improve the capture accuracy and reduce the signal rise/fall time, a voltage comparator is adopted here [5]. Figure  5 and figure 6 show the waveforms before and after the voltage comparator, which are observed by the oscilloscope. As shown in the figure, the signals processed by the voltage comparator have much better edge characteristics. Figure 5. Signals before processing. Figure 6. Signals after processing.

System operation flow
As shown in figure 7 (a), after initialization, the system first selects the working mode by instructions from serial port. In the online output mode, the system continuously calculates the current wind speed and direction, and outputs it via the serial port. If self-contained mode is selected, the system will sleep after measuring and storing a set of wind speeds. When the MCU sleeps, it controls the EN pin of the power chip to power off the external circuit at first, and then the MCU enters STOP2 mode, so that the entire system enters a sleepy state with extremely low power consumption. The system will work again after waking up.

Wind speed measurement
As shown in Figure 7 (b), the microprocessor first determines the transmitting channel and receiving channel. Then it transmits a series of pulses and starts timing. After capturing signal, the processor stops timing and records the time difference. If the time difference exceeds the preset threshold, the process will restart. Then the remaining 3 channels are selected and the time difference will be recorded respectively. After four transmissions and receptions being completed, the wind speed can be calculated using the equation 5. Finally, the Kalman filter algorithms are employed to correct wind speed.

Kalman filter algorithms
The errors of wind speed mainly result from interference of airflow at the test site, occasional fluctuations in sensors, noises from circuit components and other random factors. These errors can be considered as mainly composed of Gaussian white noise. In order to reduce the impact of noise on the accuracy, the system decided to use Kalman filter algorithms to process the data. Because the wind speed is the only output of system, all variables of the classical Kalman filter state equation and prediction equation are one-dimensional. The equations are as follows [6].
(13) By substituting the measured wind speed and the previous wind speed into the above equations, the accurate wind speed present can be calculated.

Power consumption
The author investigated a variety of ultrasonic anemometers that are widely used in engineering application and found that their power is up to 1 W, and most of them cannot work on the selfcontained mode. We measured the current in different working modes when 12 V DC voltage was used here to power our newly designed ultrasonic anemometer. The current in the on-line working mode is 70 mA, and 40 uA in sleeping mode. It can be indicated that this ultrasonic anemometer has obvious advantages in terms of power consumption.

Accuracy test
In order to test the accuracy of the ultrasonic anemometer, the author conducted a test in a small wind tunnel. The temperature of the wind tunnel is 23.72º C and the relative humidity is 52.34％. Due to the 7 1234567890''"" wind tunnel conditions, 5 points of 1 to 20 meters per second were selected to measure wind speed in the experiment. We conducted 20 measurements for the wind speed at each point and obtained average value to compare with the standard wind speed. The results are shown in Table 1, which can prove the high accuracy of this newly designed ultrasonic anemometer.

Summary
Based on the fact that the ultrasonic anemometer on the market generally consumes too much power and can only work in online mode, a low-power ultrasonic anemometer with a self-contained working mode is newly designed in this paper. Two working modes of the anemometer can meet different experimental requirements, and the power consumption is greatly lowered. In addition, the Kalman filter algorithms are introduced to reduce data errors and improve system stability. This newly designed anemometer has been proved to be very useful in engineering applications by power consumption test and accuracy test.