Update (March 2015) – It’s now possible to build most of this project’s functionality purely using IFTTT (no programming required!). Learn more here.
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…
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:
- Some LittleBits!
- Cloud Bit (Includes Cloud Bit, USB Power Bit, and USB Power Adapter)
- Micro USB Power Bit
- Pressure Sensor Bit
- Light Wire Bit
- LittleBits Mounting Board
- A soldering iron and some wire (to extend the leads slightly on the pressure sensor bit)
- An always-on Linux Machine. This can be a Raspberry Pi, a server in a remote data center, or anything in between. These instructions assume a debian-based distro, like ubuntu.
- An umbrella! I designed the 3D-printed holder for this one – you might need to adjust the design if you’re using a different umbrella.
- 1/4″ thick, 3″ Diameter Stainless Steel Plate. This acts as a weight for the base, and as a sturdy backer for the force sensor.
- A wireless network
- An Android phone with the Tasker App
- 4 10mm M3 socket head cap screws and matching nuts.
- An M3 Hex wrench for installing the screws
- A 3D printer. I used a MakerBot Replicator for this project.
Preparing the Hardware
Once you’ve collected everything that you need, you’ll need to get your hardware all setup.
- 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.
- 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:
- Take the bottom piece, and pressure fit the four nuts into the cutouts as shown:
- 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:
- Now, assemble the LittleBits onto the mounting board as shown below. I chose to tie down the excess EL wire too:
- 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:
- 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:
- 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:
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
- 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.
- Rename “config_sample.ini” to “config.ini”.
- 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.
- Visit https://developer.forecast.io/register and sign up for an account. This is the service your RainCloud will use to get precipitation predictions.
- Copy your API from the bottom of the page into the config.ini file in the ForecastIO section.
- We’ll come back to the CloudModule section later.
- 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.
- 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
- Visit http://littlebits.cc/cloudstart and follow the instructions to setup the module.
- Set an easily recognizable, unique label for your cloud module.
- SSH into the linux machine that you’ll be using as your server, if you haven’t already.
- Ensure json_pp is installed to make the next steps easier:
sudo apt-get install libjson-pp-perl
- Follow these instructions to locate your access token.
- Specify your access token in the config.ini file.
- 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
- Find the cloud module specified by your unique label, and add the “id” field output into the config.ini file.
Install the Python Prerequisites
- You should still be SSH’ed (or directly logged into) into your linux machine that will run the RainCloud server.
- Install Python 2.7 if don’t already have it installed:
sudo apt-get install python2.7
- Install Python PIP if you haven’t already:
sudo apt-get install python-dev python-pip
- Install the Python Requests Library:
sudo pip install requests
- Install the Forecast.IO Library:
sudo pip install python-forecastio
Setting up the Server
- Copy the config file and python file to your server. I recommend putting them both in /home/USERNAME/RainCloud/
- Make the python script executable:
chmod 755 PATH_TO_FILE/RainCloud.py
- Setup a Cronjob that will check the weather every 10 minutes and update the umbrella stand lighting. Open the crontab editor:
- 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
- Populate the Server fields in config file if you didn’t earlier.
- 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
- 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:
- Add the following to the end of your crontab:
@reboot cd /PATH_TO_FILE/RainCloud;./RainCloud.py -l > log.txt 2>&1 &
- 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.
- Install Tasker on your phone. You can find it in the Play Store.
- 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.
- Press the “+” button at the bottom of the screen to add a step to the task.
- 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.
- Next, add another action by hitting the “+” again on the “Task Edit” screen.
- 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.
- When your done, go back to the “Task Edit” Screen again. Hit “+” one more time.
- 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.
- When you’ve completed all those steps, the “Task Edit” screen for the “Leave Home” task will look like this:
- Now, return to the “Profiles” tab. Hit the “+” at the bottom of that screen. Choose the “State” Option.
- 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.
- 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.
- 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:
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.
This is awesome.You are creative genius ! You always inspire me and you are my teacher. Thanks for everything.
I recommend you submit this to Quirky.com. This is right up their ally especially as it relates to their GE collaborations.
Did you miss the bold link at the top of this post? I already did – it’s being considered now.
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 ?
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 !
Well, the phone aspect of this is totally optional. Even without that, the stand will still light up when you need to take your umbrella.
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
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??
płoty ƅetonowe wielkopolskie bramy hoｒmann kolory