JeremyBlum.com

v3.1

Introducing the RainCloud Umbrella Minder – Because everything is better when it’s connected to the internet.

| 13 Comments

Update (March 2015) – It’s now possible to build most of this project’s functionality purely using IFTTT (no programming required!). Learn more here.

Never Forget your Umbrella! - Animation by LittleBits

Never Forget your Umbrella! – Animation by LittleBits

RainCloud Smart Umbrella Holder

The RainCloud umbrella stand illuminates to remind you to grab your umbrella if it’s going to rain.

The RainCloud is a web-connected smart umbrella holder. Built around the LittleBits Cloud Bit, the RainCloud allows you to tell with a glance if you need to bring your umbrella with you for the day! A 3D-printed stand holds the umbrella, and features a subtle EL-wire pattern that illuminates if rain is imminent. If you’re very forgetful, the RainCloud will even ping your phone to inform you that you’ve left your umbrella behind if you leave home without it on a potentially rainy day.

I built this project to help LittleBits beta-test their new Cloud module and services, but also because I do actually forget my umbrella all the time. I’ve actually had this idea for a long time. When LittleBits asked me to try out their new Cloud Bit, I saw it as the perfect opportunity to build a prototype. Check out this video of the RainCloud, and read on for detailed instructions on how to make it yourself, and how it works!

How it works…

RainCloud Block Diagram

RainCloud Block Diagram

The RainCloud system actually isn’t all that complicated. In your home, you setup the RainCloud umbrella stand, which consists of 3D-printed parts, some fastners, the LittleBits Cloud bit, a pressure sensor, and light wire. The RainCloud Server is nothing more than a python script (included in the GitHub repo linked at the end of this blog post). The script can be run in a number of modes. In the default run state, you use a cron job on the server to trigger it once every 10 minutes. Each time it runs, it uses the Forecast.io weather API to get the precipitation report for your location. If it’s going to rain, it uses the LittleBits Cloud API (documented here) to send a command to your Cloud Bit that turns on the EL wire. If it’s not going to rain, then it uses the API to send a message telling the Cloud Bit to ensure the EL wire is turned off. Notably, this project does not use the simpler IFTTT channel that LittleBits has created, because the RainCloud requires functionality that IFTTT does not offer. The RainCloud server can also listen for incoming data from your smartphone. When you leave you home, you can setup your phone to ping the RainCloud server. This prompts the RainCloud to check the state of the pressure sensor attached to the Cloud Bit. If the pressure sensor is active (the umbrella is in the holder), and it’s going to rain, then the RainCloud server will send an alert to your phone telling you to go back for your umbrella.

Read on to learn how to build this system yourself.

As per usual, the RainCloud is totally open source hardware and software. Here’s all the documentation you should need to make your own…

What You’ll Need

You’ll need a variety of materials and tools to build the RainCloud system:

Preparing the Hardware

Once you’ve collected everything that you need, you’ll need to get your hardware all setup.

  1. Follow the links at the bottom of this post to either the RainCloud GitHub page, or Thingiverse page. I’ve posted the original Sketchup desing files, and the ready-to-print .STL/.OBJ files at both locations.
  2. Print both the top and bottom STL/OBJ files. Note, you should print the “repaired” version of the top STL. For additional flair, print in two colors! I recommend using PLA. You do not need to print with support materials. The finished top piece will look something like this:

    Printing out the top part of the umbrella stand

    Printing out the top part of the umbrella stand

  3. Take the bottom piece, and pressure fit the four nuts into the cutouts as shown:

    Press fit the nuts into place.

    Press fit the nuts into place.

  4. Next, you’ll install the EL wire into the top part of the stand. The stand prints with support beams around the length of the spiral cutout. This is to support the printing process. Before you install the EL wire, you’ll need to use a pair of wire cutters or pliers to carefully remove all the support beams. Once you’ve done that, snap the EL wire into the place, starting from the top. Once you’re done, it will look like this:

    The EL wire fits snugly into the cutout around the top part of the stand.

    The EL wire fits snugly into the cutout around the top part of the stand.

  5. Now, assemble the LittleBits onto the mounting board as shown below. I chose to tie down the excess EL wire too:

    Setup the LittleBits as shown on the mounting board.

    Setup the LittleBits as shown on the mounting board.

  6. You’ll also notice that I’ve extended the leads on the pressure sensor. Use your soldering iron to carefully unsolder the sensor, and to insert ~.5in wires in-line with both of the leads. The result will look like this:

    Solder wires inline with the Pressure sensor.

    Solder wires inline with the Pressure sensor.

  7. Place the pressure sensor in the center of the steel disk. Put the disk in the cutout of the bottom part of the stand. Then, align the top part of the stand on top of the weight and bottom part. Before inserting the screws, ensure that you can see the pressure sensor centered within the stand cutout from the top:

    Ensure the pressure sensor is centered. You might want to use a flashlight.

    Ensure the pressure sensor is centered. You might want to use a flashlight.

  8. Once you’re sure it’s centered, install the screws. Be careful not to overtighten. Once that’s done, the hardware aspect is complete! The final product will look like this:

    Ensure the umbrella fits nicely.

    Ensure the umbrella fits nicely.

Setting up the Software

Now that you’ve got the hardware ready to go, you’ll need to set up all the software that will make the RainCloud tick!

Get the Files and Prepare the Configuration File

  1. On your local machine, or on the always-on linux server that you’re planning to run this on (could be a Rapsberry Pi, or something similar), download the software. If you download to your local machine, you’ll need to transfer the files to your server later. You can clone the repository from the link below via git, or you can simply download the zip file, and work with that. The files you need are in the “server” directory.
  2. Rename “config_sample.ini” to “config.ini”.
  3. The server that you’re going to be running this on must be accessibly via a fully-qualified domain name (FQDN) if you want to take advantage of the force sensor and smartphone feature that will ping you when you leave your umbrella behind. If you want to this using a raspberry pi that sits on your home network and has a dynamic IP, go checkout my other Raspberry Pi tutorial that covers setting up a dynamic DNS service. If you don’t plan to use that, then you don’t need to configure the Server section. Enter your FQDN, the port number (7777 is the default, and you probably shouldn’t change it), and pick a strong alpha-numeric key that will be used to identify requests coming from your smartphone. Do not share this key.
  4. Visit https://developer.forecast.io/register and sign up for an account. This is the service your RainCloud will use to get precipitation predictions.
  5. Copy your API from the bottom of the page into the config.ini file in the ForecastIO section.
  6. We’ll come back to the CloudModule section later.
  7. Set your Preferences. By default, the RainCloud will activate if there is a greater than 10% chance of rain in any of your preset locations during the next 12 hours.
  8. Add lat/lng coordinates in the “Location” section, using the format shown. You can determine the lat/lng of your location by searching for it in Google Maps, and copying the latitude and longitude from the resulting search URL. For each day of the week, include a list of the places where you’ll be. This is usually your home/work coordinates on weekdays, and your home coordinates on weekends. The script will check for chances of precipitation at those locations. The default values in the script are San Francisco and Mountain View, California (where I live and work, respectively).

Setup your LittleBits CloudMole, and set its Token/Device ID

  1. Visit http://littlebits.cc/cloudstart and follow the instructions to setup the module.
  2. Set an easily recognizable, unique label for your cloud module.
  3. SSH into the linux machine that you’ll be using as your server, if you haven’t already.
  4. Ensure json_pp is installed to make the next steps easier:
    sudo apt-get install libjson-pp-perl
  5. Follow these instructions to locate your access token.
  6. Specify your access token in the config.ini file.
  7. In your linux terminal, enter this command, replacing TOKEN with the actual token value that you just copied into config.ini:
    curl -XGET -H "Authorization: Bearer TOKEN" -H "Accept: application/vnd.littlebits.v2+json" http://api-http.littlebitscloud.cc/devices | json_pp
  8. Find the cloud module specified by your unique label, and add the “id” field output into the config.ini file.

Install the Python Prerequisites

  1. You should still be SSH’ed (or directly logged into) into your linux machine that will run the RainCloud server.
  2. Install Python 2.7 if don’t already have it installed:
    sudo apt-get install python2.7
  3. Install Python PIP if you haven’t already:
    sudo apt-get install python-dev python-pip
  4. Install the Python Requests Library:
    sudo pip install requests
  5. Install the Forecast.IO Library:
    sudo pip install python-forecastio

Setting up the Server

  1. Copy the config file and python file to your server. I recommend putting them both in /home/USERNAME/RainCloud/
  2. Make the python script executable:
    chmod 755 PATH_TO_FILE/RainCloud.py
  3. Setup a Cronjob that will check the weather every 10 minutes and update the umbrella stand lighting. Open the crontab editor:
    crontab -e
  4. Add the following line to the end of the crontab file and save it:
    */10 * * * * cd /PATH_TO_FILE;./RainCloud.py

Optional: Set Up the Umbrella Reminder Service

By following the above steps, you’ve already finished setting up the RainCloud to glow when it’s going to rain. But what about the pressure sensor? Follow these optional steps to subscribe your server to HTTP POST updates from your LittleBits Cloud bit. These will allow your server to keep track of whether your umbrella is currently inserted into the stand. The follow steps will also show you how to setup your android phone to ping your server when you leave your home. Using both of the these pieces of information, the RainCloud will be able to send an alert to your phone if your leave your home on a potentially rainy day, but the umbrella is still in the stand.

Additional Server configuration

  1. Populate the Server fields in config file if you didn’t earlier.
  2. From the terminal, run the following command to automatically complete a one-time setup of your Cloud module. This will tell your cloud module to report to your server when the pressure sensor changes state:
    ./RainCloud.py - s
  3. We need to have a continuously running application on your server listening for these pings from the RainCloud, as well as for pings from your phone. To do that, again edit your crontab:
    crontab -e
  4. Add the following to the end of your crontab:
    @reboot cd /PATH_TO_FILE/RainCloud;./RainCloud.py -l > log.txt 2>&1 &
  5. Your server is now configured to listen for incoming commands from your RainCloud and from your phone (which we’ll setup in the next step). Reboot your remote server, to and check the log.txt file in your RainCloud directory. You should see it logging requests when you trigger the pressure sensor in your umbrella stand.

Set Up Tasker

On your phone, you’ll use a program called Tasker to handle sending messages to your server. Tasker will determine that you’ve left your home by waiting for you to disconnect from your WiFi network. When that happens, it will send an HTTP GET request (with your secret key) to your server. If the key’s match, the umbrella is still in the stand, and it’s going to rain, the server will reply back with a message that you should return home for your umbrella. If all three of those conditions are not met, then you won’t be bothered by a message.

  1. Install Tasker on your phone. You can find it in the Play Store.
  2. Go to the “Tasks” Tab. Press the “+” icon at the bottom of the screen. Name your new task: “Leave Home”. You’ll be brought into the “Task Edit” screen.
  3. Press the “+” button at the bottom of the screen to add a step to the task.
  4. In the “Task” section, select the “Wait” action. Set “Seconds” to 10. This delay gives the phone sufficient time to switch to a data network after leaving WiFi so it can send its request successfully. Now, go back to the previous screen by tapping on the top left arrow.
  5. Next, add another action by hitting the “+” again on the “Task Edit” screen.
  6. Choose “HTTP Get” in the “Net” section. Fill in the “Server:Port” section with your FQDN:PORT that your specified in the config file. In the “Attributes” field, enter “key=YOUR_KEY” without quotes. Replace YOUR_KEY wi the secret key that you specified for your server in your config file earlier. Set “Timeout” to 10, and set “Mime Type” to “text/plain” without the quotes.
  7. When your done, go back to the “Task Edit” Screen again. Hit “+” one more time.
  8. Choose the “Notify Vibrate” option from the “Alert” section. Set “Title” to “RainCloud” without quotes. Set “Text” to “%HTTPD” without quotes. At the bottom, click the “+” next to “If”. Set the left text area to “%HTTPD” without the quotes. Change the box in the middle to “Set”. This ensure that you’ll only get an alert if data is returned from the server.
  9. When you’ve completed all those steps, the “Task Edit” screen for the “Leave Home” task will look like this:

    The "Task Edit" Screen

    The “Task Edit” Screen

  10. Now, return to the “Profiles” tab. Hit the “+” at the bottom of that screen. Choose the “State” Option.
  11. Select the “Wifi Connected” option in the “Net” state. Enter the name of your network in the “SSID” field. You can leave the other fields blank. Then, hit the arrow in the top left.
  12. On the pop-up that opens under your new profile, select the “Leave Home” task that you just created. You’ll now see a green arrow pointing from “Wifi Connected …” to “Leave Home.” But, that will trigger when you get onto the Wifi network, which is the opposite of what we want.
  13. Click and Hold on “Leave Home” and choose “Move to Exit.” The green arrow will now turn to a red arrow in the opposite direction. Now, the ” Leave Home” task will trigger when you leave your Wifi Network. The screen should look like this when you’re done:

    The "Profiles" Screen

    The “Profiles” Screen

You have now finished setting up the reminder server. When you leave your home’s Wifi network, your phone will send a message to the RainCloud, which will reply if you need to back for your Umbrella!

Supporting Code and Designs

The RainCloud is released as entirely open source hardware and software. All materials are distributed under the GNU General Public (Open-Source) License. Please Attribute and Share-Alike. All files are hosted on GitHub.

GNU GPL LicenseOpen Source HardwareGet it on GitHubDownload from Thingiverse

13 Comments

  1. Jeremy!
    This is awesome.You are creative genius ! You always inspire me and you are my teacher. Thanks for everything.

  2. Jeremy,

    I recommend you submit this to Quirky.com. This is right up their ally especially as it relates to their GE collaborations.

    Best regards,
    Charles

  3. Hi Jeremy

    This is a great project – thanks for sharing – I’m going to try and make it myself. I just wondered if there’s an iOS alternative to Tasker ? Would it be possible to use IFTTT instead ?

    thanks
    Rowena

  4. Sorry – I should add that I did see your note about IFTTT – I’m just hoping there’s a workaround or another iOS option for this. Don’t have an android device yet – much as I’d like one !

  5. Hello jeremy!

    Awesome innovative genius project. Very useful one.
    I haven’t gone through your whole project but is great. You can add all your projects and tutorials in instructable.com
    It is a great place for all this kind of projects and you can make tutorials there.

    Keep making Keep inovating Have fun

  6. hey Jeremy……
    I working on a project similar to this one….I am using TI’s cc2541 bluetooth chip and temp sensor LM50. I want to send the temp data via Bluetooth to my iPhone. I am working on a PCB board in eagle.
    can You help me with my Project??

  7. Pingback: Introducing the RainCloud Umbrella Minder – Because everything is better when it’s connected to the internet. - Arduino collector blog

  8. Pingback: LittleBits Hue Lighting Controller | JeremyBlum.com

  9. Pingback: LittleBits Hue Lighting Controller - Arduino collector blog

  10. Pingback: RainCloud Umbrella Minder v2 – (The Easy Version) | JeremyBlum.com

  11. Pingback: RainCloud Umbrella Minder v2 – (The Easy Version) - Arduino collector blog

Leave a Reply

Required fields are marked *.