Comments: Weather Station Wirelessly Connected to Wunderground


Looking for answers to technical questions?

We welcome your comments and suggestions below. However, if you are looking for solutions to technical questions please see our Technical Assistance page.

  • Member #375744 / about 7 years ago / 3

    Hey has anyone figured out how to use the light sensor on the weather board to get solar radiation per meter squared?

  • MontanaMac / about 8 years ago / 3

    If you are using a Mega or Leonardo, the GPS code as provided with SoftwareSerial RX on pin 5 will not work (see You will have to reroute the shield pins 4 and 5 to other pins which support change interrupts. Or you can do what I did, and simply route the shield's serial pins to hardware serial pins on the Mega, and use Serial1-3 and eliminate the SoftwareSerial altogether.

    Thanks to Ho Yun for alerting me to the SoftwareSerial issue with the Mega.

  • Member #1159498 / about 4 years ago / 2

    Hello. Are there somebody to help me about the code to connect the weather station wireless with electric imp to a IoT platform like ThingSpeak? Thank you very much. I just have bought a full weather station wireless with and imp and now I can use the IoT platform for this station.

    • Member #897830 / about 4 years ago / 1

      Hello, have you found what you were looking for? If so, would you mind sharing? I hooked it up to wunderground so far, but i'd love to get it to ThingSpeak/matlab as well. Thanks in advance Stefan

  • Member #643904 / about 7 years ago / 2

    I'm working on building this, as my first arduino project, and I'm stumped.

    I'm using an arduino uno board, the weathershield, and imp shield. I'm powering these with the USB cable from my computer. The only modification I've done to the imp shield is to cut the Card Detect-A0 trace. I haven't added the other mods for remote programming yet.

    I have the Electric Imp set up, and I can see the red and green lights flashing periodically, at the same time these log messages are generated: 2015-02-04 12:12:12 UTC-5 [Status] Device Booting; 11.76% program storage used 2015-02-04 12:12:13 UTC-5 [Device] Device started, impee_id 2326b4ab5ba5ceee and mac = 0c2a6904f88f 2015-02-04 12:12:13 UTC-5 [Device] Gathering new weather data 2015-02-04 12:12:15 UTC-5 [Device] Serial timeout error initial 2015-02-04 12:12:15 UTC-5 [Device] Nothing to do, going to sleep for 60 seconds 2015-02-04 12:12:15 UTC-5 [Device] sleeping until 1423069994000 2015-02-04 12:12:15 UTC-5 [Status] Device disconnected 2015-02-04 12:13:23 UTC-5 [Status] Device Booting; 11.76% program storage used 2015-02-04 12:13:23 UTC-5 [Device] Device started, impee_id 2326b4ab5ba5ceee and mac = 0c2a6904f88f 2015-02-04 12:13:23 UTC-5 [Device] Gathering new weather data

    The only changes I've done to the squirrel code is my wunderground station ID and password.

    If I start a serial monitor from the Arduino IDE, I see the initial "Wimp Weather Station online!" message, followed by the report line. If I then send a "!" thru the serial monitor, I get another report line.

    It looks to me like the Electric Imp isn't really communicating with the Arduino board. What could I be missing?

    • This is a bold first project. Welcome to the community!

      Sounds like you need to cut and solder the RX/TX trace on the back of the Imp Shield. Please see this tutorial for more info. Once that is done the Imp should be connected to the hardware TX/RX pins on the Arduino and that's how the project sketch is expecting to communicate.

      • Member #643904 / about 7 years ago / 1

        Thanks, Nate! I'll try that.

        One question - in device.nut, the serial port is opened at 115200. In the Arduino, the serial port is opened at 9600. It seems like those should match, or is there something else I'm missing?

        • Where do you see that? Both the device.nut and .ino are running at 9600.

          From device.nut:

          SERIAL.configure(9600, 8, PARITY_NONE, 1, NO_CTSRTS);

          From sketch:


          • Ah, I see what you mean. There are a few spots within device.nut where the port is opened at 115200. These bits of code allows us to talk to the bootloader in certain reset conditions. After reset the Arduino and Imp talk at 9600bps.

            • Member #643904 / about 7 years ago / 2

              Thanks, I see the calls to open at 9600 now.

              With rerouting RX/TX, it fired right up and started feeding data to wunderground!

              Now, on to putting together the LiPo battery with solar panel charger portion of the project.

  • Member #340606 / about 4 years ago / 1

    Any verdict on how the solar shield plus plastic wrap has held up to high winds and freezing/thawing?

    I'm also in Boulder and trying to pull off a similar project, but also tracking solar insolation for a particular orientation. I'm trying to figure out the best option for an enclosure if I'll need a solar shield anyway for temperature/humidity. If I can just fit everything in there with some plastic wrap, that would make this all way simpler.

    • It's held up incredibly well. My weather stations are currently down because of power issues (the glue holding the solar panel to the bent metal gave out after two years, fell off, and battery died). If you can direct power wire, it will help.

  • Target / about 4 years ago / 1

    Just an FYI/Lesson Learned about the Ambient Weather Solar Shield. Drill holes (for the rods that hold the entire shield together) through the top of the shield, and put some lock nuts, or double nuts on top and silicone the holes for waterproofing. The solar shield as it ships has small nuts pressed into the plastic of the top plate, which after getting warm during the day, strong winds will pull these pressed nuts out. Needless to say it's not something you want to discover at 1am on an windy night.

  • Member #593173 / about 4 years ago / 1

    Hi I am struggling a bit with the Agent Code. local sparkfun_publicKey = "dZ4EVmE8yGCRGx5XRX1W"; local sparkfun_privateKey = "privatekey"; What are those codes used for and where can they be generated? Help welcome as i like this great project of a weather station.

  • Member #593173 / about 4 years ago / 1

    Hi I am struggling a bit with the Agent code for registering my station. I assume that the bellow keys are used by Sparkfun and should be replaced local sparkfun_publicKey = "dZ4EVmE8yGCRGx5XRX1W"; local sparkfun_privateKey = "privatekey"; Q: what are those keys and where would they be generated? Kind Regards

  • Member #752554 / about 4 years ago / 1

    I just dug my WIMP project out from the closet to try and revive it. I, too, was having the "Serial timeout error initial" problem. What I discovered is that if I was powering the project from a USB cable into the RedBoard everything worked fine, but if I powered it via the power plug on the RedBoard, I would get the problem you described. Digging a little deeper, it looks like the RedBoard expects to see 7-15V on the power plug, but can work with less on the USB plug. So, if you're powering this with the suggested solar system (as I am trying), it simply will not work properly through the power plug. If you look closer at the pictures in the tutorial, power is being delivered via an added connector on the Weather Shield.

  • Member #897830 / about 4 years ago * / 1

    Hi Nate, Thanks a bunch for this tutorial. I know this is from a few years ago, but i just found it a few weeks ago and gave it a try ... All working very well and reporting what seems to be accurate data to wunderground. (PWS KCAVENIC7, could be down these days because of powering/charging tests).

    I have a question involving the battery, solar panel and sunny buddy though. You said you went for a 6000mA and i purchased the battery you gave a link to.

    ** This is a 3 cells battery, but the sunny buddy seems to be made for single cells. Did you change anything else in the project? Are you still running this 3 items combo as is? **

    As a test, the solar panel + sunny buddy seem to charge the battery when on their own (not hooked up to the station), but before i hook it up ... i'm a bit concerned about unbalanced cells in the mid/long run. Am i overthinking this? Anybody else wants to chime in? Thank you for you're time already, and many thanks in advance for any advice/help. Thanks again for sharing!


  • Member #1182436 / about 5 years ago / 1

    Nate, great tutorial! I noticed that the weather data seems no longer be active from the weather station. Did something happen to it or is it just down temporarily?

    I write product reviews on weather stations and am starting a blog where I'll post "how to" guides (connect to WU, mounting configurations, etc). I'll probably try to find a way to link to this tutorial if that's okay with you? I think my audience would like to see what you've done. Thanks again for sharing!

  • Member #550548 / about 5 years ago / 1

    Anyone have a code to upload to Weather Underground and CWOP weather network?

  • Member #550548 / about 5 years ago / 1

    Does anyone have a method that would allow me to post the data to my own personal website?

  • fourstix / about 5 years ago / 1

    It seems like has been down for about a week. I'm getting either a page with no data, or a Server 502 Bad Gateway everytime I try to access my data stream located here:

    I tried other public streams and all give the same errors, so it doesn't appear to be the weather station itself, but rather

    I realize it's free and in beta, but I was wondering, if there was somewhere I should report this to Sparkfun?

    Is on the way out? And if so, any suggestions which IOT service would be easiest to migrate the weather station to use?

  • Member #1039180 / about 5 years ago / 1

    Hi Nate, Do you have and/or can you add some photos of the electronics in the cellophane wrapping and how they were mounted in the radiation shield?

    Take care, -Bill @TinWhiskerzBlog

  • Member #1039180 / about 5 years ago / 1

    Hi Nate, I believe we met at RedHat Summit this year (I was one of the guys at the BTU Soldering Station and run the 3D printing lab at RH Westford -- along with Chris had the box of printed stuff) I'm currently working on a Microbit + weather bit climate kit and looking at ways to power it as I want to mount it on a high fence pole out in the yard where I don't have power handy and don't want to keep changing AAs. Has your oversized LiPo continued to hold up in the the cold winters? (I live in NH which looks to be a similar winter temp and snowfall to CO) Have you experimented with supercapacitors as an alternative cold weather power storage solution? If so, that would make for another good tutorial for this sort of weather station project. Take care, -Bill

  • Member #1013144 / about 5 years ago / 1

    My 14yo son and I are trying as our first ever electronics project to build the weather station according to your tutorial. we are making progress and having fun. We are stuck on the image showing the electric imp that has the title: "Modified for wireless Arduino bootloading" We've cut the rx/tx traces and IMP responds when we load the test code, but we cannot find where the instructions are for the red and black wires on the imp shield, looks like they are power specific wires but we are lost......

  • Member #583931 / about 5 years ago * / 1

    I've recently noticed that my temperature sensor is reporting tempf=-1766.2 it's been like this for several weeks, should I RMA my board or will cleaning it be sufficient to return it to get it working again?

  • Marthewise / about 5 years ago / 1

    :( This Forum seems to be quiet since 2 years! :)

    Just asking, do you know if it could be possible to do this Weather Station with an Arduino Yun?


  • Member #39228 / about 5 years ago / 1

    Has anyone seen any phantom rain readings while the battery is charging?

    Several times throughout the day today, i was getting indications of precipitation when there was clearly none falling. This seemed to correlate to times when the system was actively charging. It seems to happen whether I'm charging from solar or via USB. Note that I am using an Adafruit solar/lipo charger instead of the Sparkfun Sunny Buddy. Not quite sure what to make of that yet. Will watch for more events tomorrow.

  • Member #436889 / about 5 years ago / 1

    I just wanted to share my experience with my weather station as of late. Sorry for being long winded- I just hope this might help someone else down the road. I am using an electric imp with an Arduino along with the Spark Fun weather station as used in this tutorial, but am using an adafruit temp/humidity sensor instead of what is used in the tutorial. My latest issue was Wunderground not gathering my "dewptf" data but gathering the rest of it. Meaning, all of my data would upload and be reflected in the "current conditions" section except the Dew Point. However, the graphed/table data for my station was showing the correct dew point data, it just wasn't updating in the "current conditions" section at the top. I tried many things to get it working such as moving the variable to different spots of the "bigString" string in my Imp IDE Agent code and even creating a new wunderground account to upload to. Meanwhile, the upload to the Sparkfun database wasn't having any issues. This confused me and I initially wrote it off as a Wunderground issue as my code never changed and one day it just decided to not work correctly. Since my dewptf data wasn't being updated in the "current conditions" section, it was causing my Wunderground app to show incorrect temperatures, as the dewptf variable would show, for example, 73F but the actual outdoor temperature was 40F and it would cause Wunderground to be confused and show the outdoor temperature as 73*F instead, matching the false Dew Point temp. Sometimes the website on a PC would show the uploaded data of the current outside temperature, but then sometimes it would switch to the false number. Baffling. I was about to abandon the Wunderground luxury but then I noticed something. The Agent code used "" function to send the string to Wunderground, but used "http.get" function to send it to Sparkfun. I then changed the "" to "http.get" and alas! My Wunderground station was updating the dewptf data! So, I am not sure why the author of the tutorial and Electric Imp code decided to use the "" function for Wunderground, but it appears Wunderground didn't like it anymore. I am not programming savvy enough to know what the differences are, but I am glad my Wunderground account is now functioning as normal again. Cheers and happy weather monitoring!

    • Interesting. Thanks for letting us know! I've got an updated tutorial coming soon that uses the ESP8266 and the http get method with Wunderground. Not sure why Wunderground changed but glad to hear you've got it fixed!

  • Member #583931 / about 6 years ago / 1

    I just updated the agent code for this project on my github to include posting of my weather data to if you are interested you can find my code at


  • Member #583931 / about 6 years ago * / 1


  • Member #778492 / about 6 years ago / 1

    Hi .. Finally i have finish this great project , but i have an issued that i can not resolve ...

    The problem is in the sensor , when returns the data in KPA , i see tha people normally or should output to the imp 101041 or near this , my gets or 1 or highest values than normal .. example 255825.00 , suddenly drops to near 0 ... and so on ..

    First i have used solar power , now to see if the problem its power supply i used 5V 1.5A from a good power supply direct to the 5v in of the arduino ..

    My config ... Arduino UNO original / IMP / weather shield / Weather meters ...

    I have compiled with arduino ide not with your direct compiler ...

    Maybe it's a problem of the library i am using ?

    Thanks a lot ....!!!

  • Member #371581 / about 6 years ago / 1

    I've got my weather station working nicely using a Photon and BlueSmirf bluetooth module to send data to a serial LCD display. This works fine on 5 V USB power (using the Photon's USB port) so I got a LiPo battery and Sunny Buddy.

    Unfortunately, on battery, it starts up OK but then drops its BT connection after a few seconds. There was a similar comment about this over a year ago but for a different setup.

    I'm using the 6A LiPo battery and it's fully charged. Running on USB power, it appears to be drawing around 120 ma. Running on battery, the "Load" terminal on the Suny Buddy reads 3.9 V but the 5V pin on the Photon is only 2.89 V. Is this a battery issue, a Sunny Buddy issue, or is it just not possible to sink this much current to a Photon and BlueSmirf together? Has anyone gotten this configuration to work?

  • BarrettJ99 / about 6 years ago * / 1

    I've built the weather station on an arduino mega, the imp is installed and connected. I've also added the GPS receiver through the Serial1 port. The problem I'm experiencing is that the imp agent is returning "Error: incorrect frame received ($, %#)" and then prints the string as received. The string is formatted exactly per the sketch, but for some reason it's still returning an error. I know everything else is functioning correctly because when I edit out the receive error detection (below) the imp posts to wunderground as it should.

    if(a[0] != "$" || a[16] != "#")
        server.log(format("Error: incorrect frame received (%s, %s)", a[0], a[16]));
        server.log(format("Received: %s)", dataString));

    I've counted and recounted the string variables and a[0] is indeed $ and a[16] is #.

    With the above error detection functioning, this is the log:

    ==================================================================================== 2016-06-10 13:59:10 UTC-5 [Status] Device connected 2016-06-10 13:59:10 UTC-5 [Device] Device started, impee_id 2349d4aa5ba5ceee and mac = 0c2a6904fbce 2016-06-10 13:59:10 UTC-5 [Device] Gathering new weather data 2016-06-10 13:59:12 UTC-5 [Agent] Error: incorrect frame received ($, #) 2016-06-10 13:59:12 UTC-5 [Agent] Received: $,winddir=270,windspeedmph=0.0,windgustmph=0.9,windgustdir=270,windspdmph_avg2m=0.0,winddir_avg2m=270,windgustmph_10m=0.0,windgustdir_10m=0,humidity=39.6,tempf=82.5,rainin=0.00,dailyrainin=0.53,101053.75,batt_lvl=3.85,light_lvl=0.08,# 2016-06-10 13:59:12 UTC-5 [Status] Device disconnected 2016-06-10 13:59:12 UTC-5 [Device] We heard: $,winddir=270,windspeedmph=0.0,windgustmph=0.9,windgustdir=270,windspdmph_avg2m=0.0,winddir_avg2m=270,windgustmph_10m=0.0,windgustdir_10m=0,humidity=39.6,tempf=82.5,rainin=0.00,dailyrainin=0.53,101053.75,batt_lvl=3.85,light_lvl=0.08,# 2016-06-10 13:59:12 UTC-5 [Device] Arduino read complete 2016-06-10 13:59:12 UTC-5 [Device] Nothing to do, going to sleep for 60 seconds

    2016-06-10 13:59:12 UTC-5 [Device] sleeping until 1465585211000

    When I turn off error detection, I get the following and it posts to wunderground without issues:

    ====================================================================================== 2016-06-10 14:04:29 UTC-5 [Status] Device connected 2016-06-10 14:04:29 UTC-5 [Device] Device started, impee_id 2349d4aa5ba5ceee and mac = 0c2a6904fbce 2016-06-10 14:04:30 UTC-5 [Device] Gathering new weather data 2016-06-10 14:04:30 UTC-5 [Status] Device disconnected 2016-06-10 14:04:30 UTC-5 [Device] We heard: $,winddir=270,windspeedmph=0.0,windgustmph=0.9,windgustdir=270,windspdmph_avg2m=0.0,winddir_avg2m=270,windgustmph_10m=0.0,windgustdir_10m=0,humidity=39.5,tempf=82.2,rainin=0.00,dailyrainin=0.53,101041.00,batt_lvl=3.84,light_lvl=0.06,# 2016-06-10 14:04:30 UTC-5 [Device] Arduino read complete 2016-06-10 14:04:30 UTC-5 [Device] Nothing to do, going to sleep for 60 seconds 2016-06-10 14:04:30 UTC-5 [Device] sleeping until 1465585529000 2016-06-10 14:04:30 UTC-5 [Agent] tempf=82.2 2016-06-10 14:04:30 UTC-5 [Agent] Wunderground response = success 2016-06-10 14:04:30 UTC-5 [Agent] batt_lvl=3.84 light_lvl=0.06

    2016-06-10 14:04:30 UTC-5 [Agent] Update complete!

    It's obviously a problem with the error detection code, but I can't figure it out for the life of me. Perhaps an extra set of eyes will help.

  • Member #789809 / about 6 years ago / 1

    HI! This is a fantastic build and we've had a great time putting it together at City High School in Tucson, AZ. However! We're having an issue! I have two different setups of this, and tried both rain gauges however, they are both reporting rain when we aren't having rain!

    At first I thought it could be the wind moving the gauge, so I removed the rain gauge from my stand, yet it still reported rain! I tried swapping rain gauges with another of the same type, yet still it says rain! Anyone have any tips or insight to this? Thank you for the hard work putting this guide together! It's a great and easy to follow guide!

    • Member #583931 / about 6 years ago / 1

      Did you resolve this issue with your rain gauge? Since I deployed mine my rain continues to increase. We're at 41.6 inches of rain, and it hasn't rained a drop.

  • Member #672777 / about 6 years ago / 1

    How do you deal with the battery in cold weather? The specs for most LiPo cells say that they should not be charged when the battery is below 0 C. The LT3652 on the Sunny Buddy has a pin for hooking up a thermistor for monitoring battery temperature and will cut out charging when the temperature is below 0 C or above 40 C, but that pin does not appear to be brought out on the Sunny Buddy.

    I'm thinking of one of the following: trying to insulate the box well enough that the heat from the electronics will keep it warm enough even during a couple weeks of below 0 C (and if necessary adding a softwqre controlled heating circuit), or putting the battery in a box buried below the frost line (about 12" where I am), or trying to solder some 30 gauge wire to the unconnected pin on the chip and then when I botch it and ruin my Sunny Buddy buying the Adafruit equivalent since they bring out the thermistor connection :-).

    • Member #39228 / about 5 years ago / 1

      I have also been wondering about cold weather charging of the Lipo. I'm in Buffalo, NY and we get some pretty cold winters here. We very often have weeks/months of 0C weather where charging a Lipo would fall outside the recommended operating range. Are there any alternatives for battery power that would be more feasible in cold weather?

    • To be honest I don't monitor cold weather charging but you make a really good point. I've also added an issue to the Sunny Buddy to get the NTC pin broken out on a future revision. Soldering 30AWG is easy once you've had enough coffee ;)

  • Member #778492 / about 6 years ago / 1

    Hi ... I am working on this project ... Everything working ok , the main problem is how i can attached all the system inside a box , to get good temperature , humidity , etc data without affecting the solar sun ...

    What is the bets case for this ?


  • cwbrandsdal / about 6 years ago * / 1

    Hi! Love this project. But I have a hard time getting right readings for the batt level voltage. I use the code provided. I normally use solar and batt. I tested gnd vcc with voltmeter. on batt it reads 3.7v but the code returns about 3.3v. When The voltage is 5v, the code returns 4.27. What am I missing?

    Here is the code:

    float get_battery_level()
      float operatingVoltage = averageAnalogRead(REFERENCE_3V3);
      float rawVoltage = averageAnalogRead(BATT);
      operatingVoltage = 3.30 / operatingVoltage; //The reference voltage is 3.3V
      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

    • Hi! Thanks for checking out the project.

      I would check the voltage on REFERENCE_3V3 to make sure it's a clean 3.3V. (You connected the 3.3V power pin to the analog in pin, right?)

      Next, I would recommend doing a


      to see what the Arduino is sensing on that pin then running through the code-math by hand.

      Finally, you may want to verify that your 3.9k and 1k resistors are indeed close to 3.9k and 1k. If they're off (due to mfg tolerance) I might adjust the ratio math to reflect it.

  • JasonP71 / about 6 years ago / 1

    Has anyone had issue with corrosion on the sensor shield? I created a station for my father on Siesta Key, FL and it has stopped working. When he pulled it down the weather card had a bunch of corrosion on it. I have him sending it back to me as the redboard and other cards I have wrapped in plastic wrap for protection and they are still running. Is there any way to protect the weather sensor card from salt air or a better card to use?

    • Mother nature, and salt air especially, is a powerful thing. You might consider conformal coating the weather shield. Cover the apertures on the humidity and pressure sensors with painter's tape before spraying it and you should be good.

  • fourstix / about 7 years ago / 1

    Over time, my solar panel has developed several white spots in the plastic covering. The look like air bubbles. It seems to still recharge the battery, more or less the same. But lately, after an unprecedented 10 days of rain in the Carolinas, the plastic has blistered and split and looks like there is moisture underneath the plastic coating.

    I just mounted the solar panel facing south off my deck, exposed directly to the sun and the elements. Was this wrong? I had thought solar panels were made to use outdoors, but was there something I should have done to weatherproof it?

    Or did I just get a lemon, and should I order a new one from Sparkfun? It's only been three months outdoors.

  • There was a bug in the 2 minute average wind direction calculation. Thanks for Kevin for pointing it out and helping with a solution. Should be fixed in the codebender sketch. This is just a note for myself and tech support so that we can point at it.

    You can't take the raw average of circular things. The average direction of 355 and 5 degrees is 0, not 180. So here's the new code in case you're wondering:

    //Calc winddir_avg2m, Wind Direction
    //You can't just take the average. Google "mean of circular quantities" for more info
    //We will use the Mitsuta method because it doesn't require trig functions
    //And because it sounds cool.
    //Based on:
    //Based on:
    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 > 180)
            D += delta - 360;
            D += delta;
        sum += D;
    winddir_avg2m = sum / WIND_DIR_AVG_SIZE;
    if(winddir_avg2m >= 360) winddir_avg2m -= 360;
    if(winddir_avg2m < 0) winddir_avg2m += 360;

  • Member #699212 / about 7 years ago / 1

    Hello has anyone had an issue with the agent not sending the midnightrest? My station is not resetting and all of my totals just keep building. If so please help. I am using the code with no changes other that login info and the local hour offset I changed to 5 for eastern time. Thanks.

    • Member #260684 / about 7 years ago * / 1

      I've also been having that problem. Have you been able to figure it out? I am very weak in software, so my next step is to check the circuit, for broken traces/pins etc.

      I've also noticed that Wind Gust only goes up. I only records the peak gusts, and wont drop after the wind slows. Its held that number for days...

      I've also noticed the Sparkfun demo system in Boulder seems to be resetting @noon-30...


      • fourstix / about 7 years ago / 1



        I had the same problem. I noticed the midnight reset was occurring at the wrong hour.

        I traced through the code and noticed that the logic in the agent local time, was not setting the string properly for the noon hour. Noon should be 12:00 PM instead it was setting it to 12:00 AM. 12:00AM is midnight.

        To fix this, I modified calcLocalTime function to set the string to PM whenever the hour is greater than or equal 12.

        local AMPM = "AM";
        if(hour >= 12) //grw - fix noon hour to be PM
            hour -= 12; //Get rid of military time
            AMPM = "PM";
        if(hour == 0) hour = 12; //Midnight/Noon case

        Later on in the checkMidnight routine I updated the code to only send a request at 12:00 AM. Originally it would send the midnight reset at 4 AM and 4PM. (I don't know why.) Here's the update I made. The original code check is in the comment.

        function checkMidnight(ignore) { //Check to see if it's midnight. If it is, send @ to Arduino to reset time based variables

        //Get the local time that this measurement was taken
        local localTime = calcLocalTime(); 
        // server.log("Local time = " + localTime);
        server.log("Local hour = " + format("%c", localTime[0]) + format("%c", localTime[1])  + format("%c", localTime[15]));
        //grw - check for 12%3A00%3A00%20AM string is URL escaped
        // if(localTime[0].tochar() == "0" && localTime[1].tochar() == "4")
        if(localTime[0].tochar() == "1" && localTime[1].tochar() == "2" && localTime[15].tochar() == "A")
          if(midnightReset == false)
                server.log("Sending midnight reset");
                midnightReset = true; //We should only reset once
                device.send("sendMidnightReset", 1);

        This seems to fix the issue for me. I hope this helps!

        • fourstix / about 7 years ago / 1

          I found another issue with the midnight reset. There's a race condition in the device code. If the device goes idle before the agent.on request is made, then the midnight reset is ignored. Because messages are ignored when the device goes into a deep sleep.

          The function imp.wake() will process messages during it's sleep time, so I changed the logic, to add a 60 second wait using imp.wakeup(), then it calls a method to put the device into a deep sleep for 5 minutes using imp.sleepfor(300). (I wanted to sleep more to save the battery life.) 60 seconds is probably a bit long, but it works fine for me now.

           function naptime() {
               server.log("Nothing to do, going to sleep for 5 minutes");
          // Start this party going!

          server.log("Wait 60 seconds then sleep."); imp.wakeup(60.0, naptime);

          • fourstix / about 7 years ago / 1

            I hit the reply button too soon. I forgot to mention that you comment out the imp.onidle function and replace it with the imp.wakeup() function. The wakeup function is a light sleep function that stays connected to the wifi and processes messages from the agent.

            server.log("Wait 60 seconds then sleep.");
            imp.wakeup(60.0, naptime);
            //Power down the imp to low power mode, then wake up after 60 seconds
            //Wunderground has a minimum of 2.5 seconds between Rapidfire reports
            // imp.onidle(function() {
            //  server.log("Nothing to do, going to sleep for 5 minutes");
            //  server.sleepfor(300);

  • Member #353919 / about 7 years ago / 1

    I’m having an issue with serial timeout error using the code from Github with no modifications to the code and I have modified the jumpers on the imp shield.

    It is broadcasting data to Wunderground but periodically encounters the "Serial Timeout error". I believe this is also draining my battery faster than it can charge (extended serial read using more power) as my battery keeps draining over a period of days to a week.

    I have tried replacing the Imp Shield but that didn't make a difference, just produced the same error.

    Has anyone else run in to this & if so what was the solution?

    Any help is greatly appreciated

  • dezldog / about 7 years ago / 1

    I've got my station working, but I get this error:

    [Agent] SparkFun response = 0 measurementTime is not a valid field for this stream

    Could someone point me in the direction to look? Did I do something goofy with my data.sparkfun config? I have the gps connected and I don't see the time reported in the 'we heard' server response.


    • fourstix / about 7 years ago / 1

      I got the same error with my station. It turned out that data.sparkfun lower cases all the fields, so I changed the agent imp code so that the field name was all lower case, measurementtime, rather than measurementTime, and that worked correctly. Here's a link to the data feed for my weather station data stream:

  • ScooterNowak / about 7 years ago / 1

    I've completed a WIMP pretty much exactly like the tutorial except for adding a GPS unit. For some reason I can't get it to run longer than what feels like a full charge of a 6000mAh battery, about 5-6 days. The solar panel is up and facing into the sun most of the day, registering about 9 volts at the peak. I'm guessing the whole system is pulling more power than it's recharging. I even adjusted the sleep time in the Imp Device code to 15 seconds. One question I have is, when the Imp sleeps for 15 seconds is the RedBoard supposed to sleep as well? I can see the green LED and it's on all the time. I've gone through the tutorial so many times and I can't see anything I missed. Other than run duration everything else is stock code and works great. Any suggestions would be great.

    • Member #799539 / about 5 years ago / 1

      I know this is a year later, but I'm new to this project. It's all working fine except the battery drains after a week It sounds like the same issue here. I've also tried a new imp shield in case something was draining there. Same result - battery drains after a week. I've tried a different (but smaller) battery. Same result. I've tried two different solar panels. Same result. Any ideas on where to search appreciated.

      • Hmm, it's hard to say but it may be that the system is not going to sleep properly. If the overall power usage of the system is greater than the charge rate of the solar panel, you will see your battery die over time. I would suggest measuring the current usage across 2-3 minutes. The imp may be getting stuck on some portion of the code and not sleeping. You may get some insight by watching the debug messages within the imp consoles.

        • Member #799539 / about 5 years ago / 1

          Thanks @Nate The current shows 21mA when it's at rest and up to 100-105ma when it uploads data. As I understand it that's ok? I watched it over a few mins and it seemed to just do that same loop. This is at my desk and without the solar panel or measurement devices hooked up. One thought it triggered was around the charging side. I hadn't set the solar buddy potentiometer and so I've checked that guide again and tweaked the potentiometer so it's at 3V. I'll charge the battery to full again and give this a run.

          • That indicates to me that it's at least attempting to sleep (good sign). I created a spreadsheet here to show run time for batteries that may help you (create your own copy to modify cells with your numbers).

  • PhilC857 / about 7 years ago / 1

    I'm sure this is a dumb question, but trying to post to Created the data stream, changed the keys in the Imp code, but can't get the data to go. Seems like I can't get the fields to match between what is sent and what is being received, or at least what Imp telling me. It appears the fields I enter on data.sparkfun keep alphabetizing themselves no matter what I do. Is that the source of the mismatch?

  • Member #654428 / about 7 years ago * / 1

    I finally got my setup mostly mounted to the roof. The temp is recording well but i am still waiting on the RJ12's to come in so i can connect up the rain gauge and wind.

    Also as a suggestion for those that are looking for good ways to mount this i found that a 25' 25 pin serial cable works really well as an extension cable so instead of connecting directly to the redboard i have mine in the red box that is tucked away and a nice grommet on it so it is weather proof. (Holds sunny buddy and battery as well) Then in the ambient weather solar shield only the weather sensor is there. So if it gets wet or dies i only loose the weather board not everything. I 3d printed out a holder for the weather board so it can be easily cable tied to the rod.

  • I just got my weather station up and running and is basically the same one Nathan built with same code (watch for beer in the mail). The only exception is mine is still running off of an AC adapter. I still have to get the LiPO battery, charger, and solar panel. I think that will be a piece of cake though. Just a few tips for other beginners like myself: #1 Get an Electric Imp first and learn how it works, how to program it etc. #2 Then get the imp shield and read the hookup guide on it. Once you have mastered those the rest is a walk in the park. Simply going through the weather station tutorial after you buy all the parts will leave you scratching your head just a bit. A few things weren't adding up for me and once I got #1 and 2 above, everything fell into place and worked like a charm!

  • Member #620298 / about 7 years ago / 1

    Just a head's up for people: I live in the desert about 15 miles outside of Las Vegas. We regularly have high winds with no rain. I've noticed on these days that i trigger rainfall though I'm certain there was none. Turns out in very strong winds, the sensors can wobble enough to cause the rain bucket to trip. For those of you that only get high wind during inclement weather, your rainfall amount may have actually been lower than reported. I'm currently testing putting the rain collector on a separate and much sturdier pole (I used the old camera tripod, but reinforced with heavy wooden dowel and sandstone rock ballast).

  • Member #688386 / about 7 years ago / 1

    I'm considering this project to drive my irrigation controller which lets me pick the weather station that will drive its intellegence. Problem is the controller won't talk to Weather Underground but rather to PWS Weather which seems to be targeted at off the shelf weather stations.

    I'm sure there must be a url like for WUnderground but the PWS Weather documentation points users back to the software that came with their station. So no help. I've been poking around the Internet but can't come-up with anything.

    Has anyone figured this out or have any ideas?


    • dmbgp / about 7 years ago / 1

      I'm looking into the same thing. I don't have anything solid, but I bet the format for sending is somewhere in this project: I'm gonna dig deeper at some point, and if I find a more solid answer I will let you know, but thought I would give you a starting point.


  • Member #662539 / about 7 years ago / 1

    I have finished my weather station, but it doesn't transmit the data on underground and on sparkfun. on the wimp I have clear only the jumper to CD-A0. Have I missed some step?

  • Member #210016 / about 7 years ago * / 1

    I just got my station up today. Works well and very happy with result.

  • Member #612147 / about 7 years ago / 1

    Hi guys!

    I am trying to build up this weather station and so far got all the components except a 6pin-6connector rj 11 . Instead I got the 6 pin, but 4 connectors. I checked the library and it should work. Before soldering it all together I would like to have a second opinion, what do you think? should it be fine?Thanks guys!

    • It's hard to say for certain without knowing the exact part # of the connector you've got. Looking at the Weather Shield layout the inner four pins of the 6-pin RJ11 are used to connect to to Wind/Rain sensors. You should be good but it's hard to say with certainty.

  • JasonP71 / about 7 years ago / 1

    So this was my first major arduino project. One thing that I wasn't in the packages and I haven't found it in the project anywhere (forgive my naivety), was my wind direction was coming from the opposite direction. Turns out according to the Argent site.

    When aligning the wind vane/anemometer, the 'boom' runs in an east/west direction with the anemometer on the west.

    Good to know. Mine is reversed so one more trip on the roof and I'm done.

    Great tutorial. Easy to follow.

    • JasonP71 / about 7 years ago / 1

      Switched everything and the wind direction is still reporting the same. Looks like I have the same issue as Member #628514. I'll call in tomorrow.

  • Member #628514 / about 7 years ago / 1

    This is such a great tutorial! Thank you so much! I've acquired all the same parts and followed the steps and everything seems to work like it suppose to. Except one thing! It is reporting wind direction as 113 ($,winddir=113 and NNE on WU). No matter the actual direction or even if it is plugged in at all. Any advise?

    Thank you!

    • Thanks for the kind words! That's an odd problem. If I had this problem I would write a small program for the Arduino that would read and constantly report the values of the wind direction pin (A0) over the serial port. Then I'd spin the wind vane to be sure the values are changing. Could be a problem with the soldering on the RJ11, the wind vane, and just maybe the Weather Shield PCB. Hard to say but please don't hesitate to ping tech support and reference this comment.

      • Member #628514 / about 7 years ago / 2

        I've measured A0 as I spin and it always outputs zero. I've called the tech, and they're the nicest guys to have on the phone. They'll ship wind vane replacement as they said they're 95% certain that this is the problem.

        • That's a much easier way to do it! (this is why they don't let me work in tech support) Glad to hear you got help. Sorry to hear the vane is misbehaving!

          • Member #628514 / about 7 years ago / 1

            Interesting development. First I've tested the vain replacement. It didn't help. The same winddir=113. I went ahead and purchased new weather shield, soldered headers and new RJ11s. Still winddir=113. I've also tested with redboard as well as Uno.

            Then I removed Imp shield and connected weather shield directly to Arduino. And bam, wind direction started reporting correctly. I reinserted Imp shield, this time on top of weather shield and windir went back to 113. So I'd hate to purchase new imp shield if there is possibility that the problem is in the code. Otherwise I don't know what could be wrong with the Imp. Soldering looks clean. I have jumper wire from P1 to RST like in the tutorial. As well as separated two right connections and joined two left in RX and TX on the back of Imp shield. And then it's your code.

          • Member #660615 / about 7 years ago * / 1

            Hi guys!

            I have the same problem, stuck at 113, however when i load the test sketch for for the weathershield, it reads read vane correctly, so im thinking it is in the code.

            • Please see the updated tutorial. I’m 95% sure your issue is that you need to cut the CD-A0 jumper on the Electric Imp board. Sorry! Please give it a try and let me know if it solves your issue.

      • Member #628514 / about 7 years ago / 1

        No I've tried even new Imp shield and it still does not change wind direction from 113. But whenever I remove the Imp shield it works fine. Could there be a problem with the code? At this point I'm heavily invested and quite frustrated still having issues. Please advise.

        • If you check the schematic there's a card detect (CD) jumper on the bottom of the Imp Shield. Have you cut the trace in that jumper? I'm 95% sure this is your issue and a failure on my part. I'm not sure how I missed this in the build tutorial. Please give it a try and let me know if it solves your issue. Please have a look at the changes I made under the Electric Imp section of the tutorial.

          • Member #628514 / about 7 years ago / 2

            That was it! Thank you! I now have the parts for the second weather station though. Also, I believe there is a small typo in your update where you say "Add jumper from P0 to RST for wireless bootloading". I think it is P1 rather than P0. Once again thank you. Amazing tutorial!

          • Member #583931 / about 6 years ago / 1

            I had the 113 issue as well, I had previously cut the trace but I guess I didn't cut it all the way. I took my install down and cut the CD again, and viola it's recording wind direction properly. Thanks guys.

          • JasonP71 / about 7 years ago / 1

            That resolved my issue too. Thanks great tutorial.

  • Member #595157 / about 7 years ago * / 1

    I have this all setup and running. Data is posting to both WU and Sparkfun. When I cut over to the LiPo solar power everything fires up but I get a Serial timeout error (see below). Any idea why all is well when connected to my laptop usb for power and it runs into this error when I'm on LiPo power? I've also connect straight to a wall outlet usb power source with no troubles. It is only when I switch over to solar that their is an issue with the timeout. All the lights seem to indicate all is well on the device when on the solar.

    Thank you for your help!

    2015-04-11 12:34:41 UTC-6 [Status] Device connected; 11.20% program storage used 2015-04-11 12:34:42 UTC-6 [Device] Device started, impee_id 231f64ab5ba5ceee and mac = 0c2a6904f920 2015-04-11 12:34:42 UTC-6 [Device] Gathering new weather data 2015-04-11 12:34:44 UTC-6 [Device] Serial timeout error initial 2015-04-11 12:34:44 UTC-6 [Device] Nothing to do, going to sleep for 60 seconds 2015-04-11 12:34:44 UTC-6 [Device] sleeping until 1428777343000

    • Nice! I'm guessing it has to do with the connection between the Arduino and the Imp. Did you modify the jumpers on the Imp shield? This is documented on Wireless Arduino Bootloading tutorial.

      • Member #353919 / about 7 years ago / 1

        I'm having the same issue with serial timeout error using the code from Github with no modifications and I have modified the jumpers on the imp shield.

        It is broadcasting data to Wunderground but periodically encounters the Serial Timeout error. I believe this is also draining my battery faster than it can charge (extended serial read using more power) as my battery keeps draining over a period of days to a week.

        Was this figured out??

        Any help is greatly appreciated.

  • Member #548518 / about 7 years ago / 1

    I have a project I am working on that is similar in nature to this one. It is a solar / lipo battery powered beehive monitor and I'm concerned about the battery. Since this would be an outdoor application in Michigan, the temps would be below zero and some of the documentation I've seen on Lipo batteries indicate they are only rated to zero degrees celsius. Looking through this weather station project, it looks like it would be exposed to the same kind of temps but I don't recall reading about any concern for the battery. Was that a concern?

    • I have had a few projects running on LiPos out in the hard Colorado weather. The batteries have weathered a few seasons without problem. The current problem is my solar cell gone blown by the wind so that it's facing due east instead of south so charging got significantly reduced. Gotta get the ladder and climb up there... in February...

      I assume (google search would validate) lower temps will reduce usable capacity when temps are super low but should return to normal once temperatures return to balmy. That's why I over-sized the batt to 6Ahr. I could go with less but may lose power during a good snow storm.

  • Member #434790 / about 7 years ago / 1

    I just completed my version of this project, and have had a really good time putting it all together. Thanks for taking the time to put together the tutorial, I learned a lot. The station is up and running, and reporting happily:

    I did have to make some changes to the code, in particular the agent code. I fixed a bug re: calculating daylight savings time, and I also had the endless-loop of uploading the sketch problem mentioned below, so I fixed that as well. If interested, I can upload those details. I made a few other modifications as well, to the device and arduino, but nothing major.

    Thanks again, its been tons of fun!

    • Member #361278 / about 7 years ago / 1

      Could you post your code changes?

    • Congrats on a successful build! I too found a DST bug back in December. I think it's been fixed in the agent code:

      if(month > 3 && month < 11) dst = true; //DST is happening!
      (Original had ||, corrected has &&)

      Lemme know if there's still problems. Please do share links to your code. It would be great to see your improvements!

  • Member #602694 / about 8 years ago / 1

    Hey Nate, First, I think this project is pretty rad. I have a few questions about why you chose the boards you did. Mainly, I am wondering why you chose to use an Arduino board for processing and to use the Imp only for Wifi connectivity. Is it possible to use only the Imp for connectivity and for the board that reads/communicates with the sensors?

    I am currently attempting to connect an Imp with the DHT22, to start. Eventually I would like to incorporate the RGB Light sensor (ISL29125), and an analog CO2 sensor. From my limited knowledge with the imp, I was under the impression that 6 pins would be more than enough to accommodate these sensors. 1 pin for DHT22, 2 pins for ISL29125 leaving up to 3 pins for the CO2 sensor.

    Additionally, I have not had many issues with the Sunny Buddy running the Imp directly.


    • Thanks for reading! The Imp should be able to connect to all the I2C sensors but I'm not sure how Imp does interrupts to monitor the reed switches on the wind speed and rain gauge. I also can't get my head wrapped around the Squirrel language to really use the Imp. For me, the Imp is excellent at cloud interactions and Arduino is excellent at hardware interactions so using them together just made sense. Let us know how your project goes! I've almost got a 2nd station built up for the new SparkFun building.

  • Member #353919 / about 8 years ago / 1

    I am building a weather station using the wimp weather tutorial and I’m a little confused by how this is being powered. I didn’t see a good explanation in the tutorial (maybe I'm missing it) but it looks like it is supplied power through the electric imp from the Sunny Buddy and wired to the 5V pin? Is the Uno, weather shield and imp all powered through the imp 5V pin?

    I am currently supplying power through the barrel jack on the Uno which works with a wall plug / 9 volt battery but doesn’t work with the power from the Sunny Buddy, when connected this way it appears to gather no info from the weather shield (serial error) and reports no data to send then goes to sleep.

    It's a great tutorial and being a newer user I've definitely learned from it but just not clear on details of power hookup.

    • PhilC857 / about 7 years ago / 1

      Great project, having a blast with it! Seeing the same thing, though I did leave the battery sitting for a couple of months, so I wonder if that may be an issue.

    • Sorry for the confusion! The LiPo 3.7V is wired directly to the 5V pin on the Arduino. 3.7V is not enough to run the board at 5V but it's enough for the ATmega328 to operate happily. The sub-boards (weather and Imp) have their own on-board regulators and take the 3.7V down to a clean 3.3V.

      I'm not sure what issues you're having with the sunny buddy + lipo. Be sure you're wiring to the 5V pin and not the Vin pin - the Vin pin requires more voltage because the regulator requires head room. You can read more about voltage regulators and unregulated power supplies in our tutorials.

      • PhilC857 / about 7 years ago * / 1

        Nate, I missed this comment completely, though I see the alternate connection in the photo. Can you show how you go right to the 5V pin?

        Update - I see it now. Missed it in the bootloading photo, hooked to the Imp shield. I'll give that a try.

    • Member #477670 / about 8 years ago / 1

      Nevermind - I found the answer in the blogpost below Hope you found it already too!

    • Member #477670 / about 8 years ago / 1

      I am having the exact same issue. Did you ever figure it out? I am using an original Arduino, not a redboard, and it's a 5v board. I was not sure what the tutorial was talking about in the following section:

      "The voltage of the LiPo battery will vary from 4.2V when 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 RedBoard can also detect what the system voltage is at by doing an analog to digital conversion. Basically we connect the 3.3V rail of the Arduino to one of the analog pins so that we can establish what the battery level voltage actually is. You can read more about this trick over on the ML8511 UV tutorial."

      Everything works fine when it's plugged into a 9V wall jack, but I get no lights on the weather board with the Sunny Buddy.

  • Member #361278 / about 8 years ago * / 1

    Does the setup still work well down to 3.2V? I'm wondering if some of the weather shield sensors or the IMP stop working before you hit 3.2V.

    • Hmm. Hard to say what will happen. The 3.3V regulator will have a few hundred millivolts of drop out and will have less regulation. Minimum on Imp is 1.8V and 2.5V. Check the datasheets for the other shield sensors. I'm guessing they'll be quite happy down to 2.5-ish volts.

  • Member #361278 / about 8 years ago / 1

    When I try to use the wireless sketch upload feature of this code the imp ends up in a loop where it constantly tries to upload new firmware. Have you experienced this?

    • I have experienced that once or twice. It had to do with Imp code either calling itself multiple times (the Squirrel language still escapes me) or when the device fails to notify the agent.

      • Agent send the program then says "burn".
      • Device receives "burn" and sends program to Arduino
      • Device sends "done" to Agent
      • Agent reports completion to user

      If the Agent misses "done" then Agent may try to send again and again.

      The example code should work out of the box. If you're running into problems consider contacting tech support or our support forum. They should be able to point you in the right direction.

  • Member #556358 / about 8 years ago / 1

    I've been putting together some tips on the build process that weren't covered here along with some extra bits:

  • Member #60510 / about 8 years ago * / 1

    I see you talked about (hopefully) preventing rain from causing a problem to the circuit boards, but what about condensation on the sensors when the temperature reaches the dew point? I have thought about building an outdoor weather station, but was concerned about condensation, and what effect it would have on the sensors, especially the humidity sensor. 5/30/2014 I looked at the spec sheet for the humidity sensor and it says it can measure up to 100% humidity, so it appears that condensation is not a problem.

    • So far I've been really impressed with the reliability of the system. Been up and running for many months now. I have however run into a problem with my humidity sensor (now reads really high) but I haven't figured out if it's a condensation problem or not. If I can pin down the problem I will certainly let you know!

      • Member #60510 / about 8 years ago / 1

        I have been looking at the product sheets for the Honeywell humidity / temperature sensors, and there are ones that are described as "without filter, non-condensing", and "with filter, condensation resistant". So, i think the answer is that only sensors that have a filter on them can be used outdoors, and since the humidity sensor on the weather shield does not have one, that might explain why it is producing really high readings. The data sheet for the HTU21D says that there is a optional PTFE filter/membrane, so that would allow the weather shield to be used outdoors.

        • We have looked into the PTFE filter and have not pulled the trigger on that version of the IC due to lead time and sourcing concerns. This is going to sound like a bad hack but I just covered my sensor in teflon tape (aka PTFE). It's performing quite well.

          • Member #654428 / about 7 years ago / 1

            Hi Nate. Would you happen to have a photo of what the PTFE tape looks like?

            Is it the plumbers PTFE tape or do you have some electrical version. If so is it possible to get it in a small quantity for this project?.

            • Here you go. It's not the best but it gets the point across. It's just plumber's PTFE (also known as pipe or thread sealing tape) from the local hardware store. I wrapped it over the two sensors then twisted the tape on the back side to hold it in place.

              • Member #654428 / about 7 years ago / 1

                Thanks for that Nate. It is what i was thinking of when you described what you did.

  • Member #551854 / about 8 years ago / 1

    Hello I'm having some problems with the weather station. I can't get it to update to WU and getting Serial timeout error initial. Any ideas on this?

    • You've built your own version of the station I built? Cool! Thanks for going that far! Unfortunately it's really hard to say without knowing a lot more about your setup and what steps you've tried. I'd recommend posting on our support forum and seeking out help from other users.

  • MartyH / about 8 years ago / 1

    The RJ45 jacks should be actually replaced with the RJ11 jacks.

If you've found a bug or have other constructive feedback for our tutorial authors, please send us your feedback!