Will 12 hours of code keep my plants alive?

As I’m writing this 1000 miles away from my home; my plants were watered, soaked, and drained without a living soul in my apartment.

With a week of Independence Day vacation separating me from my tiny tree, this project — affectionately known as “FloodBot” — will be the only lifeline my plant has for hydration. I’ll either come back to a thriving achievement in zen-based home automation, a dying twig symbolizing my lack of foresight, or a house flood.

Let’s start this story the weekend before the holiday… With the existential crisis of Facebook baby season to process, I had figured out the best way to solve my life’s problems was to buy a Juniper trimming. Turns out, it only cost me $39 to become zen; who knew?

And Here It Is, Your Moment of Zen

In my newly found botanical bliss, I had forgotten I’ve never owned a plant before — or ever asked someone to be a plant-sitter. Now, the easy solution would be to ask the neighbors of my building (which I have never met) - but, and hear me out on this - I’m not gonna. Instead, I’ll buy convoluted electronics and parts!


Disclaimer: Do not try this at home. I’m not responsible for any damages or injury if you copy any of these ideas - of which they are not guaranteed to be fully tested for safety. You take on all risk and responsibility of building such a system as described below.


Planning to be an absentee plant-father…

First thing’s first — we need to design our system for long-term operation with minimal supervision and maintenance. We also need to remember we’re dealing with an unattended water supply system, next to a power supply, directly connected to the wall — what could possibly go wrong?

From what information I’ve found on the USDA Plant Hardiness website, the Juniper Bonsai in my area will require 3+ hours of direct sunlight and ideally a full saturation of water in soil every other day (i.e. “drown it until the bubbles stop”.) Living on the “not-sun” side of a city apartment tower means a balcony pot is my only option to catch the sliver of sunlight we get. This also puts a large constraint on the source of our primary design goal: water.

Because we’re in an apartment, we can’t exactly connect a long garden hose from the sink and drag it through the living room on a drip for 10 days — so any ‘dumb’ passive solutions are out. After seeing what water damage can do first hand, we need to design our “water source-drain cycle” with a lot of forethought.

And finally, what happens in the event of rapid unplanned disassembly? We’re holding a lot of water, in proximity to both wired power sources and computer hardware, in an area susceptible to water damage, where we won’t be able to respond in-person to any malfunction…this really could end badly. (In my case, I have an outdoor concrete area that can safely flood / spark without a real risk of damage potential when cleared, but it’s still a risk.)


Gathering the Requirements

There were a few other discoveries made during the initial construction that can be glossed over for brevity, but with the thoughts above, we can derive our final design requirements list:

  • Able to operate without input from a user daily
  • Able to operate without internet connection
  • Able to operate after unintentional reboot
  • Will not damage property in case of water spray containment failure
  • Will not induce electrical issues in case of water pump/structure failure
  • Will not unintentionally siphon and cause damage in the event of pump failure
  • Able to record all operations to log file
  • Will be power efficient and manage current draw properly
  • Will not overtax motor pumps
  • Will survive in harsh outdoor weather
  • Will sit in direct sunlight for >3 hours of summer weather
  • Will prevent FOD from entering pumps
  • Able to control the water level of soaking to prevent flooding
  • Will contain subsystem failures and stop preventable damage

The Water Cycle

The central part of this whole project is to fully automate water going in, and water going out. First thing we need to deal with is our source (since we lack an outdoor tap). We also run the risk of running out of water (and being wasteful) if we’re simply letting it evaporate after it has already drained — so we’ll simply return our water back to the source container to keep a full cycle loop. I eventually settled with a covered plastic container for my water reservoir. I don’t have many still-water bugs in my area, but it’s always good to keep contaminants out.

Next, we need to get the water to-and-from the plant. I get to cheat here on the design a bit because I already had pumps from a separate project (food grade alleviated any concerns about oil or something contaminating the water).

Diaphragm-style and Submersible-style water pumps

The first “watering” pump (black) is a submersible aquarium-type pump that is also found in those tiny garden and desk fountains. Nothing really powerful is needed, and more power would probably be a hindrance considering we’d like to avoid the need for a separate additional voltage regulator. As for your spray nozzle, simply capping off the end of your hose and drilling a line of holes at the end will usually be enough to create a good spray.

The second “siphon” pump (white) is a primer diaphragm-style pump (and is not at all waterproof as it has holes in the chassis). The benefit of working with this style of pump is that it can “run dry” — meaning we can over-pump our soaking basin without risking damage if there’s no water to pump. The diaphragm is also fairly strong when pulling down an air+water mix through the filter — as opposed to the submersible style which is a lot more finicky.

Both source (top) and drain (bottom) pump hoses — a slight tilt will help direct drainage as well.

After this, we just need to add a few hoses and our water cycle setup is complete. Depending on what your layout is, you can direct your spray and siphon tubes for their best position ( I used helping hands to direct the shower flow.) Remembering our initial requirements to prevent FOD from going into either pump, a filter of some sort should be added to both the intake from the water source as well as the plant basin (I used a simple cheesecloth and rubber band over the pipe.)


Botanical Brains

In order to make our black magic work we only need two pieces of electronic equipment: A minicomputer like an Arduino or a RaspberryPi, and a Relay Controller (plus wires and power adapters). The first part is the actual brains of the operation that coordinates everything, while the second is the muscle for directing power.

The relay controller (blue) on top of the RaspberryPi case during an initial test of the pumps

While I will save the full schematic and tutorial for a more detailed future write-up; the basic idea is that we connect our device’s GPIO pins to the relay board, and the minicomputer will control when the relays connect power to the pumps. (A “Relay” is used in electronics where high-power demands can be isolated and controlled separate from a direct connection to a more delicate processor. It’s analogous to an electrically-controlled light switch)

In my previous work with the RaspberryPi, I’ve also discovered it can be a bit sensitive to dips in the supply current. To avoid this situation happening with the pumps kicking on, I use two separate wall adapters to deliver my power. This could obviously be improved upon with a better power filter and supply — but this isn’t that kind of project quite yet. If you have issues with random restarts, this may be worth looking into.

Project box finished with grommets for waterproofing

This computer and relay area is the most sensitive to water damage. Unlike a major electrical fire or water flooding, it only takes a single, well-placed water drop to kill this hardware. This will be a priority in our waterproofing efforts. For some peace-of-mind, I created project boxes with water-resistant grommets for the pumps in order to protect them from the weather (and failure).


The Final Assembly

After fiddling with spray holes in hoses, mounting wires in boxes, drilling holes to fit grommets, and getting everything in your project area soaking wet; we finally have our physical build complete.

Two project boxes contain the siphon pump and RaspberryPi/Relay combo — with a construction bucket containing our sheltered water and submersible source pump.

Be sure to follow me for updates, and check out my twitter @au42; The follow-up Part 2 will be published within the next week. Updates will cover source code and my results after I returned from my trip — as well as improvements for the next version…

Like what you read? Give Alex C.U. a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.