Notifications
Clear all

[Solved] Arduino SparkFun Weather Station

2 Posts
1 Users
0 Likes
1,011 Views
(@chucketn)
Member
Joined: 5 years ago
Posts: 25
Topic starter  

My wonderful Daughter gave me the SparkFun weather sensors for Christmas. They went backorder but I received them a couple days ago. I'm still waiting on the weather shield to hook them up.

Anyone here have the SparkFun set? I want to modify the example code for the weather station to report wind direction in Compass headings instead of degrees as it does now. Below is the SparkFun code that returns the degrees. I added the comments with the Compass headings. Is it as simple as replacing the degrees in the cide with the compass headings?

 

int get_wind_direction()
{
unsigned int adc;

adc = analogRead(WDIR); // get the current reading from the sensor

// The following table is ADC readings for the wind direction sensor output, sorted from low to high.
// Each threshold is the midpoint between adjacent headings. The output is degrees for that ADC reading.
// Note that these are not in compass degree order! See Weather Meters datasheet for more information.

if (adc < 380) return (113); //ESE
if (adc < 393) return (68); //ENE
if (adc < 414) return (90); //E
if (adc < 456) return (158); //SSE
if (adc < 508) return (135); //SE
if (adc < 551) return (203); //SSW
if (adc < 615) return (180); //S
if (adc < 680) return (23); //NNE
if (adc < 746) return (45); //NE
if (adc < 801) return (248); //WSW
if (adc < 833) return (225); //SW
if (adc < 878) return (338); //NNE
if (adc < 913) return (0); //N
if (adc < 940) return (293); //WNW
if (adc < 967) return (315); //NW
if (adc < 990) return (270); //W
return (-1); // error, disconnected?
}


   
Quote
(@chucketn)
Member
Joined: 5 years ago
Posts: 25
Topic starter  

Also looking for ideas to protect the Arduino and shield from weather as it has to be outside to sense temp and humidity. Anyone built a weather station? What did you use?

 


   
ReplyQuote