Paddlewheel Speed Sensor + Wind Vane Question

Here is the paddlewheel. Its a vacuform plastic housing with an acylic paddlewheel. The rod is the same carbon fiber that I used for the anemometer. I already have all the sensors working with the arduino so now all I have to do is put the pieces together.

The question I’ve been wrestling with is: How do you average reading from the wind vane? Say you have 5 readings at varying degrees (from 0-360). For example; 10, 5, o, 355, 340. A simple average will be wrong because the readings wrap around a circle… Glen addressed this, but there are special cases that don’t work in his solution. For instance when you have a reading like: 5,5,5,270,270.
Resources:

Advertisements

1 Comment

Filed under import, Uncategorized

One response to “Paddlewheel Speed Sensor + Wind Vane Question

  1. I got this situation in my own project. Here how I do it. You have to keep a double accounting : the existing one (0-360): 5,5,5,270,270 average: 111 and an alternate one (from -180 to +180): 5,5,5,-90,-90 average:-33 In the alternate list, find the min and the max:min = -90, max = 5 Multiply min * max = minmaxminmax = -90 * 5 = -450 If minmax is positive : keep the original average (0 to 360) (not the case here) If minmax is negative : we crossed either north or south Calculate delta = max – min = 5 – (-90) = 95 If delta < 180 : we crossed north : take the average of -180to+180 and transform it to 0-360Here we keep -33 which becomes 327 in 0-360 If delta > 180 : we crosses south: keep the original average (0-360) (not the case here).