In the rush to get out in the morning, do you take five minutes to check the weather alert for the day? Wouldn’t you prefer to spend those five minutes with a warm cup of coffee, or get those extra five minutes getting some much needed sleep? Let your umbrella stand do more than just stand there. Equip it to check the weather for you, and it will let you know whether you need to carry that umbrella with you that day or not. As you pass in front of it on your way out, it will alert you with a red light if it will rain later that day. Stop! Take that umbrella with you! Or don’t.
one or two Grove LED (we suggest red and blue , but the choice of color is up to you).
A grovePi case (highly recommended for this project but not strictly necessary)
Or you can get all of the above (and more for future projects) in our kits: GrovePi+ Starter Kit (all the above items)
or GrovePi+ Base Kit if you already own the first four items on the above list and don’t want the GrovePi case.
the supplied code (it’s free)
a Weather Underground API key (we’ll help you get a basic one – it’s free)
an umbrella stand (although not really needed. You could just have the alert system next to the outside door)
some frosted glass lampshade. We used the small Knubbig from Ikea:
some lace doily (or other cover if you’re not into lace)
Plug the Wifi dongle into the Raspberry Pi USB port (any of them)
Plug the rain/red LED into Port D7
If you choose to have a clear sky/blue LED, plug it into Port D8
Put the SD card in the Pi, if not done already
Power up the Pi
The electronics part of the project is over!
Step 2: Connecting to WiFi
Your project will need to be connected to your WiFi network. If your Pi is already connected to your WiFi network from a previous project, you can skip this step, and go straight to step 3.
If this is your first time connecting a Dexter product to WiFi, you can follow the steps found under the GoPiGo section. They are equally valid for GrovePi+. Follow the explanations for Step 1 / Option 2, and Step 2.
You will need the Ethernet cable to connect to your laptop or desktop. Once WiFi is set up, the Ethernet cable will no longer be needed for the remainder of this project.
Step 3: Getting the Rain Notifier Software
With your Pi/GrovePi+ connected to the Internet, use your computer to remote login into the Pi (either via VNC, or a terminal)
If you have VNC:
Run DI Software Update to update the SD card.
If you’re using a terminal:
Type in the following commands: cd /home/pi/Desktop
sudo git clone https://github.com/DexterInd/GrovePi
This will pull down all enhancements for the GrovePi+, including the software needed for the Rain Notifier project.
If you want just the code for this project, you will need to use the Terminal window and do the following:
Navigate to where the projects reside:
Test to see if the code is already on the card
Navigate to this specific folder: cd rain_notifier
If this line gives you an error, then the software is not yet on your card and you will need to manually download it. First let’s create the folder where it will reside and move into the new folder sudo mkdidr rain_notifier
Download the python code itself
Enter the following all in one line : sudo wget https://raw.githubusercontent.com/DexterInd/GrovePi/master/Projects/rain_notifier/rain_notifier.py
At this point, you’re ready to test your present setup! sudo python rain_notifier.py test
This should turn the blue LED on, and blink the red LED for 10 seconds, then turn the LEDs off.
Step 4: Getting your Weather Underground Weather Key
Weather Underground is a service that provides weather information from all over the world. You can read more about them on theirabout page.
Then fill in the signup form, the one on the left (you can safely ignore the form on the right for now):
Your handle will be your username. Use a password that will be unique to this site and make a note of it on a piece of paper (unless you really trust your memory). Also don’t forget to read their Terms of Service, and agree to them by clicking that little box.
Once you click on Sign Up>>, an email will be sent to you with an activation link. Wait for that email to be delivered, and click the provided link! The subject line of that email will be “Weather Underground Email Service” and it will be delivered from email@example.com
>In certain cases, this automated email might be caught in your spam filter, but it made it through ours easily.
Clicking on the link doesn’t mean you’re done yet though. The API key itself hasn’t been created yet.
You now have your Weather Underground account, but not your API key. Now is the time to fill in the form on the right, the one we ignored previously! (Hopefully you noted your password down on paper)
Once you click on Login, it will create your account, display some info really quickly in your browser, then move on to another page. Don’t worry, you can still get your key. Now click on , make sure you have the Stratus plan, with a total of $0 USD (we like free!) and click on “Purchase Key”.
Almost there! One more hoop to jump through and we’re done with this API Key. Fill in that final survey:
Your contact name is yours, the project contact email is also yours. The fields that are filled in are just our suggestions. Feel free to adjust. Every field in this form must be answered. And then click on “Purchase Key” (your cost is still $0)
Your key will be listed here:
but it’s not copy/paste-able (and yes, that’s now a word). You can either take a note of it on paper or click on to get a form where the key can be selected and copied into your computer clipboard for safekeeping. Voilà! You’re done with step 4, getting your Wunderground key! Congratulations!
Step 5: Customizing the Code
For this project to work properly, you will have to make a minimum of two changes in the code, although we provide a few more options that you may wish to play with.
The two mandatory changes are:
entering your zip code (or your postal code)
entering you Weather Underground Key
To do this, you will need to edit the program by typing: sudo nano rain_notifier.py
and scroll down a few lines until you find the one that states zipcode = ‘YOUR_ZIP_CODE’
Change YOUR_ZIP_CODE for your own zip code (or postal code), keeping the opening and ending quote. Your Zip Code is not sent to Dexter Industries, but it is sent to Weather Underground as a way of customizing the weather information for where you live.
Change YOUR_WUNDERGROUND_API_KEY for the key that you got on the Weather Underground website in the previous step. Here too, keep the opening and closing quote around the key.
Then press Control-X to exit
Click the Y key to confirm that you want to save the changes
And then press Enter to confirm the filename
Your changes are done!
To launch the program, run the following in the command line:
sudo python rain_notifier.py
Will it rain today for you?
Customizing the Code - Video Instructions
Step 6: Launching the Rain Notifier Automatically
It’s best if you set up the Pi to run the Rain Notifier without human intervention. That means that you only need to power up the Pi, and the program will run.
Type the following:
sudo nano /etc/rc.local
Scroll down near the end of the file. Before the line exit 0, type in
Now there are a few more features that you can activate or deactivate within the code.
If you go back in and scroll down a bit, you will find the following:
sudo nano rain_notifier.py
If you have chosen to use a second LED to indicate the absence of rain, this is where you would set its port. The default is port 8. If you do NOT want a second LED, change the 8 to -1 If you don’t want your rain LED to blink at all, you can change it here. Just set it to False (yes, the uppercase F is important, in case you were wondering)
Put the two LEDs at the bottom of a small frosted glass. We got one from Ikea, called Knubbig. Fix the lampshade near your umbrella stand, or near your front door.
Cover the GrovePi+ case with a doily, or anything that fits your decor. Watch the video to see how a doily is actually advantageous.
How to get the code for this project:
The easiest way to get the code is to update your Dexter Industries software through the “DI Software Update”. When you do this, all of the code files for new projects like this will show up!
Once you’ve run the DI Software Update, this project will be found in this location: /home/pi/Desktop/GrovePi/Projects/rain_notifier The project is named rain_notifier.py
If you are not using the Dexter Industries custom software, Raspbian for Robots, and you still want to download this file, you can download it here: Rain Notifier on Github.
You can run this command (all on one line) to download the file: sudo wget https://raw.githubusercontent.com/DexterInd/GrovePi/master/Projects/rain_notifier/rain_notifier.py
Have a question or a problem? Post it on the forums and we’ll help you out.