The project aims at designing a low-cost full digital highly accurate ultrasonic anemometer based on the i.MX RT crossover MCU from NXP. Anemometers are devices used to measure the wind velocity and direction. There are many different types of anemometers, mechanical, ultrasonic and even thermal anemometers. Mechanical anemometers such as cup and vane anemometers have been used worldwide for many years. They measure the wind velocity based on the mechanical motion due to the wind. Cup type anemometers determine wind speed by counting the cup bed rotation in a certain time. Mechanical wind sensors perform well in good weather conditions, nevertheless they are not suitable for deployment in bad weather conditions. Even though they provide reasonable accuracy, in order to get a highly accurate measurement, ultrasonic sound waves can be used. Ultrasonic anemometers have broader wind speed range when compared to mechanical anemometers. Also, they do not have the drawbacks of mechanical anemometers such as wear and tear.
In this project we take emphasis in the low-cost, imagine an array of anemometers dispersed over a crop field connected through a communication mesh for the precise control of UAV form spraying agrochemicals. In such an application, the cost of commercial ultrasonic anemometers, in the order of thousands of dollars, is a very important disadvantage. Think that a typical crop field in Argentina, Australia, Canada of USA is around 500 acres and that is a huge area to cover.
The aim of this project is a proof of concept that advance math can be solved in real time for obtaining accurate result of both wind speed and direction. Other successful DIY projects around anemometers have been taken into account (such as Hardy Lau and Carl47). Nevertheless, the project code is more of an open workbench for users to install and develop their own ideas to prove the concept right. In the next section we explain the basic working principle of the ultrasonic anemometer and a brief discussion of the the measurement method already implemented.
How it worksThe working principle of the sonic anemometer is to use the ultrasonic time difference method to measure the wind speed. Because of the speed at which sound travels in the air, it superimposes the velocity at which it flows up the wind. If the direction of the ultrasonic wave is the same as that of the wind, its speed will be accelerated; otherwise, if the direction of the ultrasonic wave is opposite to that of the wind, its speed will be slowed down. Therefore, under the fixed detection conditions, the speed of ultrasonic propagation in the air can correspond to the wind speed function. Accurate wind speed and direction can be obtained by calculation, i.e. using two axis arrangement.
The details
An ultrasonic wave is generated by an ultrasonic source and is sent to an ultrasonic receiver. Since the speed of sound is quite high ((s_s = 343 m.s-1) , propagation time will be quite short. The most basic methods for wind speed and direction are time of flight method and phase shift method.
Time of flight method uses the time difference between the source (which is the transmitter) and the receiver to measure wind speed. In the phase shift method, the transmitter sends a continuous signal and the receiver measures the phase shift continuously to compute the wind speed.
- Time of Flight (ToF)
Measurement based on ToF is done by sending an ultrasonic pulse from emitter to receiver and measuring its flight time. The following figure shows a two-dimensional anemometer with two transmitters and two receivers.
The transmissions are aligned with the X and Y axis. When wind blows there will be interference with the sound waves transmitted through the air. If the direction of the wind and the direction of the sound are the same, the sound waves will travel faster. If the direction of the sound is opposite to that of the wind, the sound wave will travel slower. Speed of sound is constant in static air, so the wind speed can be determined based on the change in sound propagation speed. In the figure, the X component of wind speed, Swx, is along the direction of transmission (additive wind) whereas the Y component of wind speed, Swy, is against the direction of transmission (subtractive wind). Equations (1) and (2) represent the measurement of the time of flight due to additive and subtractive wind and can be calculated as:
ToF_x = d / (Ss + Swx)..............................(1)
ToF_y = d / (Ss - Swx)...............................(2)
where Swx and Swy are the X and Y components of the speed of wind which can be positive or negative depending on the wind direction, Ss is the sound velocity and d is the distance from the transmitter to the receiver. The speed with which signal propagates will be the sum of the speed of sound and the speed of wind.
This method drives the ultrasonic sensor using intermittent pulses and it needs to wait for some time for the first pulse to reach the receiver. Therefore, it is relatively time consuming. Ultrasonic sensors based on time of flight give a 0.5 to 2.0 sec time resolution. And of course, sensors with a better time resolution are more expensive.
Take for example, the following picture:
In the example picture above the ToF can be measured from the beginning of the sent pulse (not in the picture) till the yellow dot. Now, it may seem simple acquiring the yellow dot, but as yo can see in the oscilloscope picture in the following sections, this waveform is immersed in noise. Due to this, an important calculation method to recover the yellow dot y to count the zero crossings of the signals that starts at the yellow dot. If you count the crossings, the green dots in the picture, you are able to recover the signal. As the frequency is known, only the initial phase remains to be found. This is the calculation chosen for the ToF in the present project so far.
- Phase shift method
In order to get a higher time resolution than ToF, the phase shift method can be used. In this method, the phase shift of the emitted ultrasound signal is measured at the receiver. Wind velocity can be computed with this phase shift. An advantage is that measurements can now be continuous, we can have a direct and continuous speed measurement, which is very important for some applications. Phase shift is directly proportional to the wind speed. By sending a continuous wave, the propagation time can be determined by measuring the phase difference between the signal transmitted and the signal received. Moreover, by sending a continuous pulse, this method is able to overcome the problem due to the vibration of the sensor. The equation (3) is for the wave received at the receiver, Wr, when a wave We is emitted from the emitter and has a waveform as cos ( 2*pi*f*t ). In that case, the received waveform has the form:
Wr ~= cos ( 2*pi*f*t + k*d )..................(3)
where f is the ultrasound frequency and k is the wave vector when no wind is going across the path. There are related by the dispersion relation:
f = Ss * k................................................(4)
where Ss is the speed of sound. As seen on (3), d represents the distance between the transmitter and the receiver, which is know.
Now, when wind transverse the path of the emitter and receiver, there will be a phase shift:
Wr ~= cos ( w*t + ( k + delta_k )*d )..................(5)
and:
delta_k = f * ( Sw / (Ss + Sw )*Ss )..........(6)
where Sw represents the wind velocity.
This method has the characteristic of requiring the using of a waveform as excitation, not a simple pulse as with the ToF method.
The HardwareThe generation of ultrasonic waves is similar to the generation of an audible sound wave using speakers. Nonetheless, a typical speaker does not has the mechanical bandwidth to follow waves at ultrasonic velocities. For that reason, most practical ultrasound sources are based on the piezoelectric principle of trans-conduction. Piezoelectric sources have the advantage of simple construction and operation, which makes them suitable for a variety of applications. Since the ultrasonic waves are high-frequency waves, the sensitivity of a device to detect high-frequency waves plays an important role in ultrasonic wave detection. Thus, in this project we use the piezoelectric effect can be used to detect as well as generate ultrasonic waves. Piezoelectric sources have the advantage of simple construction and operation, which makes them suitable for a variety of applications.
If the phase shift method is selected a DAC is required to synthesize the waveform sent to the transmitter and its output must also be amplified since it has to excite a piezoelectric transducer with, in the case of an outdoor transducer, almost 200V. We have selected the UTR-1440K-TT-R as the outdoor transducer from PUI Audio and added the datasheet to this publication as well as the manufacturer suggested Dual Mode Drive Circuit.
The CodeThe code itself is built around the i.MX RT1010 Evaluation Kit from NXP. We have chosen the MIMXRT1010-EVK since it's low cost and very powerful Cortex processor running at 500MHz. Why such a processor is need ? Because of the heavy math involved in detecting the received signal, since we know when we set the initial pulse but we have to measure returning signal and eliminate any other unwanted signals (such echos) using digital filter. The use of digital filter is time consuming and we want to do this as fast of possible. The other very important feature the i.MX RT1010 has it the ADC, which can sample up to 1Mhz, this is specifically useful for
Let's understand the problem by watching the following scope signal. In Channel 2 (the light blue trace) is the pulse we sent to the transducer and In Channel 1 (the yellow trace) is the signal that we received from the transducer. As can be seen in the picture Ch.1 is quite noisy but the ADC has two acquire the signal and determine when this 40kHz lobe appears. It seems simple, but unluckily every transducer has different resonant frequency and although it is around 40KHz, a single transducer device has a frequency variation of +/-700Hz. Moreover, this resonant frequency varies with the device aging and weather conditions.
As can also be seen in the picture, the signal from the transducer is really low, we are talking 35mV peak, that is roughly 70mV p-p. Then we have to provide an offset and amplification to achieve, at least, 0 to 3V. As seen on the MIMXRT1010-EVK schematics provided by NXP the ADC voltage reference pin was attached directly to the main 3V3 power; this is not a good design practice since all the noise from the power of a digital microprocessor goes directly to the ADC reference, but we will have to work with this caveat for the time being. In the schematic we have placed a external voltage reference, the lm4020. J26 is a header we can use since 5 ADC channel are available are our disposal.
The idea is to amplify and filter the incoming signal, in order to eliminate unwanted noise and have a limited bandwidth. We must provide an amplification of this signal around 40 times, for that we use a the TLV2372IDR from TI since has a very low power consumption and rail-to-rail output. It is worth noting that the schematics shown must be repeated 4 times in order to have full wind speed and wind direction. When one transducer transmit in an axis the other transducer receives, that is the reason why a transformer is placed, in order to provide pulse amplification (from the 12v to the 140Vp-p needed by the transducer) an isolation from the pulse driver stage.
PrototypeWe recommend placing the transducers in a fixed setup with a known distance, like the one you see in the following picture.
This setup allows easy angle positioning from both receiver and emitter and d=300mm in the complete path. With this setup we accomplish our first measurement as seen in the oscillograms of the previous sections.
Yes as you can see, the placement of the transducers is critical. Moreover, the waterproof transducer must be placed outdoor and have to withstand heavy weather. In order to do this we are currently designing a pod where the 4 transducer can be placed.
Here you can see a more beautiful rendering of the future prototype, just because it's beautiful!
The pod allocates four transducer in two axis and provides a reflective surface with a fixed time of flight. In this case the ToF is around 30cm which is a compromise between accuracy of the measured wind and length of the received pulse.
ConclusionAs stated early, this is a work in progress and aims at progressing in the understanding on how different detection algorithm works and different calculation schemes operate. So far we have introduced the ToF code and obtained interesting results width and error in the range of 140us which translates to 0.8m/s.
Future WorkWe are also trying to implement a third detection method that uses the Doppler effect. We also want to test the device profoundly out of the lab, but for that, the housing must be fabricated and tested.
Comments