Mornings are harried. Who has time to check the weather report?
This cool Raspberry Pi build was put together for ZDNetters by John Cole of Dexter Industries. It turns your dumb umbrella stand into a smart rain detector. As you pass in front of it on your way out, it will alert you to expected rain with a red light.
Note: I have not affiliation with Dexter Industries, but plenty of admiration for their DIY ethos. If the maker bug catches you, check out their great assortment of build tools and ingredients.
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.
With the Raspberry Pi *not* under power:
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.
With your Pi/GrovePi+ connected to the Internet, use your computer to remote login into the Pi (either via VNC, or a terminal)
Run DI Software Update to update the SD card.
Type in the following commands:
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 this specific folder:
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 foldersudo mkdidr rain_notifier cd rain_notifier
Enter the following all in one line:
sudo wget https://raw.githubusercontent.com/DexterInd/Grove...
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.
Weather Underground is a service that provides weather information from all over the world. You can read more about them on their about page.
To get your API key, go tohttp://www.wunderground.com/weather/api/ and click on "Sign Up for FREE!"
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 "EXPLORE MY OPTIONS," 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!
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:
To do this, you will need to edit the program by typing:sudo nano rain_notifier.pyand 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;
To launch the program, run the following in the command line:
sudo python rain_notifier.py
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.
sudo nano /etc/rc.local
Scroll down near the end of the file. Before the line exit 0, type in
Adjust the path according to your needs.
Boot up the pi and let it do its magic.
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 -1If 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.
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:
The project is named rain_notifier.py