What options are available for Spark automated rain barrel project?

I have started an open source rain barrel project over on GitHub.

I was earlier working with an Arduino Yun but I would rather do the wunderground web queries, JSON parsing, and control logic in the cloud, sending basic commands to the microcontroller.

  1. if someone is interested in joining me, then I would be near ecstatic.
  2. what do you think is the best way to do this? Is there a nice and simple yet powerful enough online development or interface environment to use that is compatible with the spark core?

Some background: I am an environmental engineer working on this as a side project. I would like to present on how the open source community canon develop environmentally relevant technologies. I like the idea of the spark core because most houses have wifi and the core can enable the rain barrel to be a simple wifi accessory to a household. There is also a wonderful group of people working with the core.

  1. I could be persuaded; I just need to get rain barrels. Do you have any specific recommendations for this project?
  2. You can use the existing Spark web IDE, or are you thinking something a little different?

If you can get started on the project, we can help you with any roadblocks or feedback.

Do you have any recommendations for controlling mosquito populations near a rain barrel? That has been one of my main sticking points with them. Even if you use the BT “mosquito dunks”, they still tend to swarm around the stagnant water, even if the larvae die off.


Here is the background for those who are interested


The automated rainbarrel project is designed to determine how quickly open-source collaborative efforts can result in a functioning, intelligent, “internet of things” product that can serve both people and the environment. This is part of an independent research project and the results (specifically documentation on who is contributing and how it takes shape) will be presented at a conference on water resources in June of 2014 and again when the project is considered complete (that is, a functioning automated rain barrel exists).


The current repository has some logical diagramming, hardware specifications, and open-source software. It is expected to change and multiple contributors are welcome.


The primary purpose is to provide homeowners with the water they need to irrigate (e.g. lawns, gardens) or use for non-potable purposes. It is designed to alert the homeowner when it hasn’t rained for some time. It can automatically irrigate, and it is designed to allow connectivity with other sensors (e.g. ground moisture sensors or an on-site weather station).

The second objective is to prepare the rainbarrel for an oncoming storm by emptying it beforehand. In stormwater control, the concept of Low Impact Development (LID), is to mitigate rainfall-runoff close to the source. Roofs are one of the largest producers of directly connected runoff from single family homes. Rainbarrels are generally full or near full before a storm, particularly in areas with rainy wet seasons. This doesn’t do anything to reduce urban runoff or “shave” the peak of the storm. If the rainbarrel is intelligent enough to prepare itself for an oncoming rainstorm, then it will make the correct volume available to mitigate runoff.

More on green infrastructure here:

More on rainbarrels here:


Wgbartley, the parts list on GitHub has what I am working with so far. I also have some pumps and valves. I think it will take less energy to use calving but considering both a pump and a valve for each of a regular drain and a drain to the sewer. (See the flow diagram or project description for details on why I’d want to drain to sewer).

Rain barrel: as far as this goes, I’ve seen mostly positive comments but it is a little on the flimsy side. I have a structure sensor that I will use to create a 3D mesh of the volute. This is totally unnecessary but pretty cool.
-Reccomended rain barrel for this project is the EarthMinded 65-Gallon Granite Plastic Rain Barrel with Diverter Spigot
-Larger capactiy than most rainbarrels of similar footprint.
-Available at most Lowe’s stores
-Includes drill bits and pieces to divert flow from downspout

Microcontroller and electronics:

  • Spark Core (if processing is done in cloud) allows connection to WiFi
    –Recommended to combine the Spark Core with the solar power shield to minimize power consumption and also recharge (still in development)
1 Like

As far as mosquito breeding, I think the closed top design minimizes the entry of Mosquitos.

It’s good to see the prices of rain barrels coming down! Last I checked, something like that was $150-200. It’s been a few years, so I guess competition is starting to drive prices down.

I just placed an order for some solar components today so that I can start learning that stuff. I’m also running uptime tests on the Core connected to a 3.7v 600mAh lipo battery to see just how long they’ll go. Sure, we can do math on it all day long, but A) I don’t feel like doing that math on a long weekend, and 2) Math doesn’t always equate to real world usage. Once I’ve finished my tests, I’ll write up a post here on the forums. Hopefully this will help in your project as well!

1 Like

Yes. They’ve come down quite a bit.
You should also have a look at this thread, I think it would be a good complement to this project.

Thanks to @timb

1 Like

I’ve been watching that like a hawk. I think it’s the 2nd most popular thread next to the CFOD one.


@wgbartley In response to your “2.” I am wondering how we would most easily allow a homeowner/tinkerer to run the following routine. Should they have their own we server somewhere? Run a local we page on their computer? or use a service like IFTTT, Heroku, Temboo, or the like?

The homeowner would need to be able to
Know how much water is in the rain barrel by sampling water depth (at this moment I am considering using a milonetech etape)
Know how much rain is coming and when by performing a query from wunderground (currently wunderground is the only service to offer hourly forecasting over many hours into the future, vs yahoo weather or NWS or other governmental sites)
Let the user specify the connected roof area in the web app, once, and use that data to calculate the potential volume of runoff during the next storm.
The web app then needs to do some high falutin’ calculations to determine how much of the barrel should be empty based upon the likelihood of the storm and how soon it is expected to rain, etc.
The web app could then either tell the rain barrel to open a valve to drain to the sewer or it can tell the homeowner (by email) to irrigate if the storm is days away or it could even automatically irrigate if the homeowner allows.

These steps require some logic that I don’t think can be done using the spark tools. Now, @bko has some good tutorials on setting up a webpage to do some reading and control using a spark. Others have contributed code to use node.js. I had always thought that this would be a project where the homeowner/tinkerer wouldn’t set up their own server but rely on available web services.

Does anybody have any good ideas?
Also, all the logic I just wrote out is in a flow diagram on the github repository

If it’s open source, I would give options for self-hosted and managed-hosted. Self-hosted being where the user can run a web app on their own server, and managed-hosted would be something that is hosted and managed by you (or someone else) that runs on a platform such as Heroku or the others you mentioned.

I would definitely offload all of the data processing to whatever is hosting the web app. It would take a lot of resources on the Spark Core to be able to reliably process that sort of information. The Core could then check the web app in frequent intervals (1 minute, 5 minutes, 1 hour, etc) to get its instructions.

I saw the flowchart in the GitHub repository, and it’s quite extensive! Very well done. It’s almost like a “scope”. After 15+ years of software/web development, I’ve never actually seen one of those mythical “scope” things.

You may also want to check out the Forecast API. I haven’t used it myself but I know they have some accurate tracking of rainfall on the 2 apps mentioned.


That actually looks like a very cool service. Do you know someone who is intimately familiar with Forecast or nay least someone who has worked with it quote a bit?

Hi @ruben,

I’m curious to hear how your research project has been going since I’ve been daydreaming about smarter gardening and maybe using a rain barrel at home. No pressure of course, just curious! :smiley:


I’m just getting back to it.I got some sweet performing automated ball valves hooked up to the rain barrel. I will KISS for now and simply open and close the two valves. I talked with the folks from Forecast but they can’t provide qpf, just the chance of rain, so I may have to stick w underground for now.

1 Like

For mosquito control there are these little donut looking things, think they are calls mosquito dunks. They have work really well in my barrel over the last couple years. Also using a “closed” barrel is better than those that cascade water into an open vessel. This can be easily done with an earth minded barrel diverter. Cheap 55 gallon barrels can be had on most craiglist site locations. They are $20 in Ohio.

@ruben I have been looking into making something very similar. I think a raspberry pi arduino team would work well for this. I just built a brewpi and that got my wheels turning. The pi can deal with java stuff and host the web interface much like brewpi. Maybe even using a xino rf so that the pi can be kept indoors. Here is what I am currently looking into:
Sonar vs tape for h2o level
Moisture sensor
SureFlow or Jetflo 12v pump(w/ internal pressure switch)
Arduino and a Rpi
Rain gauge or local weather station and/or intake of underground forecast info
Solar powered of course so add a charge regulator, panel, and battery.

I have one 65gal barrel. I want to add two more. This is a pretty ambitious project as I am still very new to this. I travel a lot for work so the web interface would be clutch to have.

Heya @Shadoe607,

If you were okay with a simple web interface, you could use the Webduino (web server) library, and host a web server from and connect the sensors to a single Spark Core. (Please excuse the shameless promotion) :smiley:



I have used them in other water features like water gardens over the years. They do well at killing the larvae (which is what the BT bacteria in those dunks do). However, mosquitoes still tend to congregate around open water. So you’re keeping the overall population down, but you’re inviting the survivors over to hang out near your water. I don’t have experience with a closed rain barrel system, so it’s probably not nearly as bad as an open water garden!

You can sometimes get them for free from a car wash. The soap they use is usually shipped in the 55 gallon barrels. Sometimes they’re free, but there could also be a waiting list.

Excellent. The rain barrel I purchased is a closed version

@Shadoe607 Awesome. I am glad to see other people working on this. The valves I ended up buying that work very well are http://www.amazon.com/gp/product/B009YVCMX4/ref=oh_details_o00_s00_i00?ie=UTF8&psc=1

1 Like