26-02-2015, 21:43
The Fine Offset Wind Direction sensor tends to jump around at random (I have seen mine turn a full 360 degrees on more than one occasion). I have thought about various forms of mechanical dampening such as an aluminium plate and a strong magnet. I have also tried oil on the bearing and an enlarged fin but that has had little impact.
My set up is a standard Fine Offset model 3081 plus an Arduino receiver picking up the transmissions from the Fine Offset rooftop sensors (around once every 40-48 seconds or so).
I then tried an arithmetic dampening of the form
x = (xold*(d-1) + m)/d where
x is the smoothed value,
xold is the previously calculated smoothed value
m is the current measurement
d is the dampening facor (I initially used d=8)
The smoothing is applied to the North and East (i.e. x and y) component of each wind vector sample (strength and direction), then the smoothed N and E components are reconstituted as an average strength and direction. This has worked very well, but unfortunately, each measurement has only a one eighth impact every 40 seconds. Ideally this would be implemented in Weatherduino to use the sample every 5 seconds or even more frequently.
Snippets of my Arduino code to do this averaging are:
The output from this code is a smoothed wind speed (knots) and direction (degrees).
Would it be feasible to add this into Weatherduino Pro?
My set up is a standard Fine Offset model 3081 plus an Arduino receiver picking up the transmissions from the Fine Offset rooftop sensors (around once every 40-48 seconds or so).
I then tried an arithmetic dampening of the form
x = (xold*(d-1) + m)/d where
x is the smoothed value,
xold is the previously calculated smoothed value
m is the current measurement
d is the dampening facor (I initially used d=8)
The smoothing is applied to the North and East (i.e. x and y) component of each wind vector sample (strength and direction), then the smoothed N and E components are reconstituted as an average strength and direction. This has worked very well, but unfortunately, each measurement has only a one eighth impact every 40 seconds. Ideally this would be implemented in Weatherduino to use the sample every 5 seconds or even more frequently.
Snippets of my Arduino code to do this averaging are:
Code:
...
byte packet_size = 9, packet_ID = 10, state = 0, wind_dirn_index = 0, dampening = 8;
float sindir[] = {0.0, 0.256, 0.474, 0.619, 0.670, 0.619, 0.474, 0.256, 0.0, -0.256, -0.474, -0.619, -0.670, -0.619, -0.474, -0.256}; Sin of each of the 16 wind directions
float cosdir[] = {0.670, 0.619, 0.474, 0.256, 0.0, -0.256, -0.474, -0.619, -0.670, -0.619, -0.474, -0.256, 0.0, 0.256, 0.474, 0.619}; Cos of each of the 16 wind directions
float radiation, wind_E_vector = 0.0, wind_N_vector = 0.0, wind_avg, wind_dirn_avg;
...
void loop()
{
...
Serial.print(" "); //Publish ascii data
wind_dirn_index = packet[8] & 0x0f; //Extract wind direction index
wind_E_vector = (wind_E_vector * (dampening - 1) + get_avg_wind() * sindir[wind_dirn_index]) / dampening; //Smooth x-component
wind_N_vector = (wind_N_vector * (dampening - 1) + get_avg_wind() * cosdir[wind_dirn_index]) / dampening; //Smooth y-component
wind_avg = sqrt(wind_E_vector*wind_E_vector + wind_N_vector*wind_N_vector); //Wind average strength
wind_dirn_avg = atan2(wind_E_vector, wind_N_vector)*180/3.1416; //Wind averade direction
if(wind_dirn_avg < 0) wind_dirn_avg = wind_dirn_avg + 360; //Convert (-180 to 180) to (0 to 360)
Serial.print(wind_avg, 1); //Average wind speed (knots)
Serial.print(" ");
Serial.print((0.67 * get_gust_wind()), 1); //Wind gust (knots)
...The output from this code is a smoothed wind speed (knots) and direction (degrees).
Would it be feasible to add this into Weatherduino Pro?



