Building a Remote Bonsai Watering System

When I got my own apartment last summer, I decided to visit my local bonsai shop and buy two trees. I did absolutely zero research and later realized that bonsai trees require more attention than regular house plants.

The watering instructions I received for my Brazilian Rain Tree and my Philippine Tea Tree were to submerge them in water for 15–20 minutes once the soil dried out. Usually once or twice a week.

But the question quickly arose: what should I do when I’m out of town?

Commercial automatic plant watering systems wouldn’t work for my bonsai trees as they need to be submerged for a set period. One initial idea was to buy two watering systems. The first would fill my mixing bowls with water. I would schedule the second to pump the water out 20 minutes later.

While this might work, it gives me very little control and visibility over the system when I’m not at home. I would simply have to hope I programmed it correctly. This would run on a set schedule too. I couldn’t adjust the watering schedule based on factors like apartment temperature, plant appearance, soil moisture, etc.

The only option left was build my own solution to monitor and water my plants when I traveled. I could even use this new system when I am at home. I wouldn’t even have to lift a finger!

As it turns out I do have to lift a finger to push the “Water Plants” button, but that’s as hard as it gets.

What my digital button looks like

The Solution

I looked into Arduino, which you can think of as a tiny computer, and found it to be a perfect fit! I could connect an Arduino to a water pump, and pump water into a tank with my bonsai trees. I can communicate with the Arduino via the cloud, meaning I can control it from anywhere with an internet connection.

Once 20 minutes is up, I have a second pump also connected to the Arduino to drain the water out back into the bucket it came from.

Details of the Setup

What the bucket with the extra water looks like. And what the tank looks like with all the equipment and plants in place.

Grant us eyes, grant us eyes!

To give me visibly when I’m away, I bought a home monitoring camera which can stream video of the pump in action. This way, I would avoid overfilling my tank. I have the added bonus of seeing my plants now and observing the color of their leaves as well as the amount of sun in my apartment. Both are two factors important for adjusting my watering schedule.

Third photo is a screenshot from my monitoring camera

While I could buy soil moisture and water level sensors to fully automate the watering process, I feel much more secure with some literal visibility rather than trusting the machinery to work without fault.

How I put it together

Choosing the Tank

The size of the tank was an important decision. I had to balance a few different constraints

  • I need my plants to be raised high enough in the tank so excess water can drain
  • I need my plants to not be raised too high such that I need extra water to fill the tank
  • I need the tank to be high enough to minimize the risk of overflowing
  • I need the tank to not be too high as to get in the way of my tree’s branches
  • I need the tank to be wide enough so both my trees have enough space from each other to get sun
  • I need the tank to not be too wide, as to reduce the volume of water needed to fill it
  • I needed the volume of water required to fill the tank to not be too great, as my water reservoir (a bucket) will evaporate over time

I took careful measurements of acceptable thresholds (at least 6" tall, but no more than 7"). I prayed to Marie Kondo and walked into the Container Store. Marie heard me! I found a pantry divider 15" wide, 8" deep, and 6" high.

It certainly wasn’t designed to hold water, but anything from the Container Store is good quality. And it would only be holding water for 20 minutes at a time. Hopefully not enough to strain it!

I settled on an 11 quart sized bucket from Target. My selected tank could hold a max of 12.5 quarts. I only needed to fill up the tank up to 3.75" which results in a required volume of 7.8 quarts. If you factor in the volume of the plants themselves (plus the pump and the Legos raising the plants up a half inch), that is roughly 1.3 quarts. This leaves us with only needing 6.5 quarts, leaving an excess amount of 4.5 from the 11 quart capacity.

There is always a slight risk of partially flooding my apartment if the filling pump goes rouge and pumps up all the water, but up to 4.5 quarts seems like an acceptable risk. This amount of water is unlikely to cause much harm.

When I’m out of town, the plan is to move this setup into the bathtub where overflowing isn’t an issue. If needed, I can just use the entire bathtub as a bucket to ensure I have more water than can evaporate away. Buying a larger bucket for this setup seems like the more obvious move, but storage space is hard to come by in NYC; you have to come up with creative space saving solutions.

Circuitry

I bought a Arduino MKR WiFi 1010 and an Arduino MKR Relay Proto Shield. From there, I bought the pumps, the power adapters, and the tubes linked in this Arduino pump example project.

If you’re trying to copy this project, you might need to buy a USB A/B cable if you don’t already have one. Same with any electrical wiring equipment. I mostly used the wires I cut off of the power adapters but didn’t skimp when buying electrical tape or the insulated disconnects to secure the circuits together — electricity is dangerous!

The two 12V adapters plug into the relay. The Arduino controls the relay connecting (and disconnecting) the circuit, which activates each pump.

Exactly what is going on is best explained in this IoT Cloud to relay control guide. The pump part of the action is explained in the Arduino pump example project.

Physics Problems

When filling the tank, I knew to avoid a siphon effect by ensuring my tank was placed higher than my water bucket. This would prevent my tank from overflowing with water. I didn’t think to be concerned about siphoning in the other direction! Initially, the water-in pipe was position at the bottom of the tank. One the filling motor turned off, the siphon effect would pull the water back out. For this reason, the water-in tube is carefully positioned to be near the top of the tank. This ensures the water won’t drain prematurely.

1-The pipe bringing water in. It’s positioned at the top with binder clips to avoid a siphon effect. 2 & 3- The pump taking water out. The pump is arranged vertically, so the water input is as close to the bottom as possible. I added the washers and metal plate at the bottom to weigh the pump down and keep its position permanent.

With the pump responsible for draining, I found that the siphon effect worked in my favor! I only need to turn on this pump for 5 seconds to start the flow of water and air pressure does the rest of the work. You can see this in the video above.

Hardware Problems

My initial testing of all hardware components went well. The one thing I didn’t think to test was if both my 12V adapters worked. I ended up having to buy a spare from my nearest hardware store, which is why my adapters aren’t identical.

With this one minor hiccup resolved, I did an integration test and found that I was able to successfully pump water in and out of my tank. I had a working system! I thought I had completely avoided integration hell. Now all I needed to do was nail it all down . . . this is where it all went wrong.

Aside from the trouble I had buying and cutting wood in Manhattan (I hate shopping in cities), things started mysteriously going wrong after affixing my circuitry. My pumps started misbehaving and turning on sporadically every 20 minutes or so. Eventually, the pumps just stopped responding to the Arduino entirely! I took everything apart, tested each component again, and deduced that there was some issue with the Arduino no longer triggering the relays.

I took the Arduino off the relay and put it back on. It started working again! When I nailed every component to the board, the hammer must have shook loose the connections . . . this is why I choose to work professionally in software, not hardware.

Software Problems

I had a sufficiently working system, but one persistent issue was that my Arduino would crash whenever I had it pump water for more than 15 seconds. It takes about two minutes for the tank to fill up and I’d prefer not to press the fill button repeatedly.

I’d also prefer to minimize the amount of times the Arduino has to restart. I tend to take shortcuts when working on personal coding projects, but in this case, a shortcut here might result in flooding my apartment.

A quick Google search indicated that my issue was with using the delay function. This function blocks all processes and eventually causes the Arduino to run out of memory and crash. I would have to switch to using timestamps for future actions.

Before

startFillingTank();
delay(twentySeconds);
stopFillingTank();

After

// loop that runs continuously
void loop() {
// this value increments every millisecond
currentTime = millis();
if (currentTime > timeToStopFillingtank) {
stopFillingTank();
}
}
void startFillingTank() {
turnOnPump();
timeToStopFillingtank = currentTime + twentySeconds;
}

The above is pseudocode; see my full project source code.

The new code is not nearly as succinct, but it works nicely. The best part is that I’m no longer using delay and blocking any other code from executing. I don’t have to worry about pressing the “water plants” button too many times and having those commands stack up. With the current code, those commands will overwrite timeToStopFillingtank, so it will only start and stop once.

This gave me a true appreciation for being a web developer. Every computer I usually write code for has gigabytes of memory to spare with little risk of running out.

Cost

Just out of curiosity, I decided to keep track of the cost of project materials. It ended up being almost as much as I spent on my bonsai trees* & equipment! This is certainly not the most cost effective solution to automating the watering of your plants. Slightly inconveniencing your neighbor is much cheaper. But it’s definitely worth it for the cool factor.

╔════════════════════════════════════════════════════╦═════════╗
ItemPrice
╠════════════════════════════════════════════════════╬═════════╣
║ Arduino Board & Relay ║ $ 61.73 ║
║ Pumps, Tubing, and Power Adapters ║ $ 56.54 ║
║ Tank ║ $ 20.35 ║
║ Bucket ║ $ 6.53 ║
║ Misc. Wiring Equipment & Hardware ║ $ 72.75 ║
║ Camera ║ $ 43.53 ║
║ Extra 12V adapter because the first one was faulty ║ $ 16.32 ║
Total$277.77
╚════════════════════════════════════════════════════╩═════════╝

*I unfortunately managed to kill one tree when I was inexperienced. Like the 12V adapter, I also had to buy an extra

Appendix

Code

GitHub

Bonus pic of my plant stands

When watering the trees, the ideal level is to fill the plants to just below the rim of the pots. The Philippine Tea tree has a shorter pot than the Brazilian Rain rain tree. I needed to even this out if the two trees were to be bathing together. Both trees also needed to be slightly suspended to drain any excess water and remain above any water left after draining the tank.

My original plan was to cut a few thin sheets of plywood and stack them on top of each other to create a stand for the smaller tree. As mentioned before, my wood buying experience in Manhattan (and even in Brooklyn too) was more limited than I expected. Looking around my living room, I found some spare Legos and realized I could craft a stand with a precise and easily adjustable height. I went to the Lego store to grab just the right pieces.

Plant stands made out of legos
The wall of Legos in the store was pretty limited. I had to prioritize piece shape over aesthetics.

Siphon explanation video

A cooler siphon video

Arduino pump control example project

Arduino IoT Relay Guide

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store