background image

Weather Station Wirelessly Connected to Wunderground

CONTRIBUTORS: 

 NATE

 FAVORITE

19

Wimp Weather

The Wimp is a personal weather station that uses the weather shield along with an Electric Imp to push live weather data up to Wunderground. You can help increase
the accuracy and prediction of weather by adding a weather meter to your house! But why buy an off-the-shelf system when you can build you own? For around
$250 you can build a cutting edge open source station that you have complete control over! All you need is a pile of parts and access to a Wifi network.

Live weather in downtown Boulder

Wunderground makes it really easy to setup your own weather station. You fill out a form, pick a username and password, then get a station ID. Using this ID and
password, we can push weather data with a simple HTTP POST command:

http://rtupdate.wunderground.com/weatherstation/updateweatherstation.php?ID=KCOBOULD115&PASSWORD=SparkFun&dateutc=2014-07-02+03%3A32%3A42&windd
ir=270&windspeedmph=7.0humidity=45.4&tempf=43.1&baromin=29.4161&realtime=1&rtfreq=10&action=updateraw 

Copy and paste the above code into a browser, and press return. You should see 

success

Note:

 You may have to modify the 2014-07-01 to today’s date. You can

then view the weather station data you just posted here. Congrats! You’ve just published your first weather data to the Internet of Things.

The above link shows how to push temperature data to the web, but you can also post a large number of other weather metrics. This example will show you how to
report the following bits of weather:

Temperature
Humidity
Light level
Rain fall
Instantaneous Wind speed + direction
Gusting speed + direction for the last 2 minutes
Gusting speed + direction for the last 60 minutes

Содержание Wimp

Страница 1: ...d we can push weather data with a simple HTTP POST command http rtupdate wunderground com weatherstation updateweatherstation php ID KCOBOULD115 PASSWORD SparkFun dateutc 2014 07 02 03 3A32 3A42 windd...

Страница 2: ...hardware device both to other devi Solar Cell Large 2 5W PRT 07840 Packaged solar cell with barrel plug termination This is a custom cell produced for SFE not a small toy surplus item This unit is rat...

Страница 3: ...r of weather metrics but doesn t have the capabilities to wirelessly report them Electric Imp You will need to modify the Electric Imp shield in three ways Clear the card detect Jumper Clear and move...

Страница 4: ...fully charged to 3 2V when very dead This is acceptable because the RedBoard can operate from 5V down to about 3V and both the Electric Imp and the Weather Shield have on board 3 3V regulators The Red...

Страница 5: ...tronics to fail My wife had the excellent idea of wrapping the non sensor bits in cellophane Two of the layers are wrapped and the top shield the weather shield is left exposed so that the air can fre...

Страница 6: ...up to my home network Note This example assumes you are using the latest version of the Arduino IDE on your desktop If this is your first time using Arduino please review our tutorial on installing t...

Страница 7: ...ensor HTU21D myHumidity Create an instance of the humidity sensor Hardware pin definitions digital I O pins const byte WSPEED 3 const byte RAIN 2 const byte STAT1 7 ifdef ENABLE_LIGHTNING const byte L...

Страница 8: ...essure float dewptf dewpoint F It s hard to calculate dewpoint locally do this in the agent These are not wunderground values they are just for us float batt_lvl 11 8 float light_lvl 0 72 volatiles ar...

Страница 9: ...ery second for 120 second to get 2 minute average windspeedmph get_wind_speed winddir get_wind_direction windspdavg seconds_2m int windspeedmph winddiravg seconds_2m winddir if seconds_2m 10 0 display...

Страница 10: ...dog If we go for more than 24 hours without a midnight reset then force a reset 24 hours 60 mins hr 1 440 minutes 10 extra minutes We hope that Imp is doing it if minutesSinceLastReset 1440 10 midnigh...

Страница 11: ...p stackoverflow com questions 1813483 averaging angles again long sum winddiravg 0 int D winddiravg 0 for int i 1 i WIND_DIR_AVG_SIZE i int delta winddiravg i D if delta 180 D delta 360 else if delta...

Страница 12: ...V rawVoltage operatingVoltage Convert the 0 to 1023 int to actual voltage on BATT pin rawVoltage 4 90 3 9k 1k 1k multiply BATT voltage by the voltage divider to get actual system voltage return rawVol...

Страница 13: ...l Serial print batt_lvl 2 Serial print light_lvl Serial print light_lvl 2 ifdef LIGHTNING_ENABLED Serial print lightning_distance Serial print lightning_distance endif Serial print Serial println Test...

Страница 14: ...etClockDivider SPI_CLOCK_DIV16 Uno 16MHz 16 1MHz SPI setBitOrder MSBFIRST and chip is MSB first lightning_init Setup the values for the sensor Serial println Lightning sensor online void lightning_ini...

Страница 15: ...Load the code onto your RedBoard or Arduino of choice Open a terminal window at 9600bps You should see new weather data upon power up and every time you send the character...

Страница 16: ...al local_hour_offset 7 Mountain time is 7 hours off GMT const MAX_PROGRAM_SIZE 0x20000 const ARDUINO_BLOB_SIZE 128 program null html HTML BODY form method POST enctype multipart form data Program the...

Страница 17: ...n hextoint line slice 0 2 local addr hextoint line slice 2 6 local type hextoint line slice 6 8 Ignore all record types except 00 which is a data record Look out for 02 records which set the high orde...

Страница 18: ...json null try json http jsondecode req body catch e server log JSON decoding failed for req body return res send 400 Invalid JSON data local log foreach k v in json if typeof v array typeof v table fo...

Страница 19: ...currentHumidity mysplit humidity if currentHumidity 1 tointeger 99 humidity humidity 99 if currentHumidity 1 tointeger 0 humidity humidity 0 Turn Pascal pressure into baromin Inches Mercury at Altimet...

Страница 20: ...Time bigString winddir bigString windspeedmph bigString windgustmph bigString windgustdir bigString windspdmph_avg2m bigString winddir_avg2m bigString windgustmph_10m bigString windgustdir_10m bigStri...

Страница 21: ...ingbox com pushingbox devid vB0A3446EBB4828F stringToSend stringToSend batt stringToSend stringToSend light server log string to send stringToSend Debugging Push to internet local request http post st...

Страница 22: ...means the previous Sunday must be before the 1st if month 11 if previousSunday 0 dst true if dst true hour If we re in DST add an extra hour Convert UTC hours to local current time using local_hour i...

Страница 23: ...ber 3 break case 12 month_lookup 5 December 5 break default month_lookup 0 Error return 1 offset centuries_table year_digits year_fractional month_lookup day offset 6 11 2 3 9 31 offset 7 31 7 3 Wedne...

Страница 24: ...TIVITY configure DIGITAL_OUT ACTIVITY write 1 Pin 8 is the orange LED LINK hardware pin8 LINK configure DIGITAL_OUT LINK write 1 Sequence number __seq 0x28 STK500 constants list from AVRDUDE const MES...

Страница 25: ...sRead 0 LINK write 0 Turn LED on do local ch read if ch 1 write ch b charsRead if charsRead len break while ms started timeout LINK write 1 Turn LED off Clean up any extra bytes while SERIAL read 1 if...

Страница 26: ...invalid 0 0x03 assert signature len 3 signature 0 0x1E signature 1 0x95 signature 2 0x0F function program_duino address16 data local addr8_hi address16 8 0xFF local addr8_lo address16 0xFF local data...

Страница 27: ...and other daily variables agent on sendMidnightReset function ignore server log Device midnight reset SERIAL write Special midnight command Send a character to the Arduino to gather the latest data P...

Страница 28: ...do the low level string manipulation on the device but leave the heavy lifting to the agent You ll need to replace STATION_ID and STATION_PASSWORD with your own ID and password Note Because we are pa...

Страница 29: ...of extra mechanical bits to withstand mother nature Base The weather station was installed on an old camera tripod A hacksaw quickly removed the head of the tripod where the camera attaches The weath...

Страница 30: ...h a few wing nuts on the second block Once installed the eye bolt and screw were very solidly attached to the cinder block Wire Rope One threaded screw with inverted wing nut on the left and one eye b...

Страница 31: ...it of Googling I discovered these things called turnbuckles Wow they work You probably fall into one of two categories Either you know exactly what wire rope is and you think I m crazy or you re like...

Страница 32: ...le danger as possible You may think you ll only have to do maintenance on the weather station once a year If you re building your own plan to be in the station once a week in the beginning and once a...

Страница 33: ...ead more about the Electric Imp Pushing data to data sparkfun com Hacking MindWave Mobile Making Simon Says Wireless Checkout these other great sensor tutorials as well ML8511 UV Sensor Hookup Guide T...

Отзывы: