Unfiltering the wind sensor

Executive summary

This post is rather long, so here’s an executive summary:

  • The PB200’s wind speed and direction outputs are filtered
  • This means response time of the outputs to changes in the physical world are on the order of tens of seconds
  • We created a “defiltering” filter to address this problem
  • See video here (or below) of it working!

The Problem


The wind speed and direction outputs from the Airmar PB200 sensor is filtered with some kind of moving average filter such that any sudden change in wind speed or direction input results in an output with a lag on the order of a few seconds of time lag.
For example, here is a trial we did of measuring the PB200’s wind direction sensitivity by suddenly rotating the PB200 while facing a fan. The response time of the PB200 is on the order of ten seconds.


The PB200’s wind speed output has similar sensitivity issues:

Obviously, this kind of response is not ideal, since our boat is making decisions about how to trim the sails and rudder on the order of seconds, not tens of seconds. Deviation of measured wind direction from actual wind direction could cause huge miscalculations. Wind speed sensitivity is not as important as wind direction, but could still affect performance.


Here’s a video showing us doing an impulse and step response of wind speed. Ideally we’d use a wind tunnel, but we hacked something together with a fan and a big wooden board

Contacting Airmar…

We called Airmar and their sales rep. informed us that indeed, the output of the wind sensor is filtered “over many many seconds” since that’s what the majority of users (presumably owners of non-robotic boats) demanded.
Evidently, some customer segments  had similar needs as us and wanted a more sensitive wind sensor, so Airmar planned to release a sensor with unfiltered output later this year. The sales rep. told us that they may be able to get us a sample of this sensor early. The sales rep. also promised to ask the engineering department and find the filtering specifications for us, but Airmar never responded to our repeated email requests. Thus, we decided characterize the filter ourselves and create a “unfiltering filter” in software.

The solution


The theory behind unfiltering the PB200 is rather simple#. The PB200 applies a filter h(t) to the input signal (in this case, the actual wind speed or direction). We want to create a filter in software that negates it with impulse response h^(-1)(t)#.
Ideally, the system diagram would look like this:
The output signal from our filter will inevitably have noise or other source-induced error (denoted by s(t) in the diagram above). We want to minimize s(t) when we construct h^(-1)(t)

Finding h(t)

The first step to constructing h^(-1)(t)  is finding the impulse response h(t). As the name suggests, this is as simple as giving the PB200 a sudden, but short, gust of wind for wind speed, and a quick rotation back and forth for wind direction. We used the fan and wooden board technique described above for generating the short and sudden gust#. We smoothed the data a bit to get the following impulse response for wind speed:

It was a bit tricky to collect data for the impulse response of wind direction. We ended up taking the time derivative of the step response to get the following plot:

Calculating h-1(t)

A simple way to calculate h^(-1) (t)  is just to take the inverse Fourier transform of the reciprocal of the frequency response H(ω). To show why this works, we have the condition for h^(-1) (t)   such that
h(t)*h^(-1) (t)=δ(t)
h(t)*h^(-1) (t)*x(t)=x(t)

where * is the convolution operator. Taking the Fourier transform of both sides, we get:

H (ω )⋅H ^(-1) (ω)=1
So the Fourier transform of h^(-1) (t) is just the reciprocal of the Fourier transform of h(t).
However, the problem with this direct approach is that any small noise in H(ω) becomes really big as one takes the reciprocal. So we used a more sophisticated approach that compensated for this effect for small values of H(ω). We used a threshold gamma inverse filter adapted from here.

The result:

Our “unfiltering” filter works quite well. Here’s a video of the wind speed filter working. Pay attention to the laptop screen on the bottom left. The white line shows our defiltered output, while the red fill shows the direct, filtered output from the PB200. You should be able to see how much more responsive the white line is than the red filled line:


We encountered some problems applying this technique to the wind direction data. The main problem was the data wrapping that is inherent with angular measurements (when wind is blowing at 350 degrees, a slight movement can cause the data to jump to 0 degrees). We resolved this by playing around with some angle unwrapping functions. In the end, we used the filter coefficients generated for wind speed for angle. It seemed to work rather well.
The PB200 measures wind speed by pythagorating# x and y-direction speed measurement vectors. It turns out that the individual x and y-direction speed measurements are filtered before being summed. Evidence of this comes from our experiments when the PB200 is at steady state wind speed, any rotation causes the speed to quickly drop down to 0 before slowly coming back to steady state. This is something we can’t really address, so we’ll have to hope that this effect doesn’t affect things too much during competition.

Next steps

We’ve already begun to do some wind tunnel testing to take more accurate measurements of impulse responses and better characterize our and the PB200’s filter. Stayed tuned for more news on that front.


If you have any questions for us, any suggestions, or just want to know what our filter coefficients are, please let us drop us a comment and let us know!

One thought on “Unfiltering the wind sensor

  1. Please don’t delete this comment until you read it carefully. I rewrote this comment so that it is more clear and informative.

    This site just got my attention today. I have some comments on this PB200 entry, but before I do that let me say your site is well done and I will be sure to check it out some more. I am here because some folks over at http://www.panbo.com , the marine electronics blog, provided a link I followed here on the PB200

    I evaluated the PB200 extensively on my sailboat and published two articles on Panbo. In that evaluation I came to a very different conclusion about the sensor, and a different explanation for what your testing reveals.

    In there I wrote ”Any wind measurement, however precise, at the top of a masthead is a measurement of the apparent wind we want to measure plus the pitch and roll motion of the boat (amplified substantially by 50 feet of mast) that we don’t want to measure. The PB200 differentiates itself from past versions and competing mast head sensors by incorporating a 3-axis accelerometer and internal motion correction software able to measure and correct for the motion of the boat bouncing underneath it. The resulting wind angle measurement stayed constant as the boat heeled and rolled underneath the sensor, even when amplified by my 50 foot high mast!” … PANBO Feb 3, 2009

    Let me put this in context to the test in the OLIN SAILBOT video. Imagine you put the PB200 in front of a source of wind, than rotated it manually from zero degrees (north) to 45 degrees (north east) with your hand? With motion correction, the PB200 should report the wind direction as unchanged … 0 degrees (north)

    The ultrasonic wind sensor inside the PB200 will detect that the wind shifted 45 degrees as the wind is coming off a slightly different side of the packaging, but it will correct for that new reading because the accelerometer detects the sensor itself was physically rotated, not the wind source. Due to this very cool PB200 motion correction feature, the PB200 will correctly believe the wind is still blowing from 0 degrees north and will output for some time that no change in wind direction.

    As shown on the OLIN SAILBOT site, this is exactly what happens. The tester keeps the wind source stationary, and rotates the sensor. The PB200 detects both the rotation motion and the wind direction change, sees that they cancel each other out, and for some time reports the wind is still coming from the same compass direction. Which is correct, just because the sensor was rotated doesn’t mean the wind source ever moved.

    What then looks like damping on the video is something else. After a very substantial period of time, the PB200 will give up it’s belief the wind is from 0 degrees and display 45 degrees as the raw ultrasonic angular wind sensor is reporting and as the testers observed. The testers mistook this delay and final reading of 45 degrees as damping, but actually its just the accelerometers determining that the sensor (think attached to sailboat mast) is stable and it should instead believe the wind is actually coming from 45 degrees.

    Now think about this on a sailboat heading 300 degrees north, and the wind is from 0 degrees at a speed of 2 knots. The PB200 is on top of your sailboat. Your sailboat is broadsided by powerboat wave, your boat heals 20 degrees to starboard. 30 or more feet up your mast the sensor is violently moved 3 meters starboard and the PB200 wind sensor measures a puff from 45 degrees that is no puff at all, just the sensor being forced sideways by the wave. A mechanical sensor would have waivered towards the puff, and in 2 knots of wind would likely spin around 3 or 4 times. Not the PB200. It detects the mast motion, does the math, and continues to report wind from 0 degrees.

    The opposite is not true. If you hold your course, there is not power boat, and the wind shifts from 0 degrees to 45 degrees while the PB200 detects no motion, the PB200 will rapidly show you the new direction.

    If you repeat the test in the video, but instead of rotating the sensor, you rotate the big tube producing wind. You will see the PB200 instantly report the wind direction change.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s