Friday, October 4, 2013

Bonsamatic! Bonsamatic!

The Hanoi pictures take time as usual. Meanwhile I'd like to answer the one question no doubt burning in the back of your throat: "Did Bonsai-kun survive our absence? And if he did, how on earth did he manage?" The answer is "Bonsamatic!" But first, a digression:

Bonsai-kun. He's a three year-old Japanese black pine. And amazingly still alive after more than six months with us.

I work with big, complicated computer systems to run big, complicated neural models. It's a far cry from the days when I first learned programming on very simple (and very primitive) home computers. But the very simplicity made it a lot of fun. You could learn and understand the entire computer from the inside out.

To recapture some of that fun, I've begun playing with the Arduino in my spare time. It's a series of cheap, simple micro-controller boards with a complete software environment and lots of documentation and examples. You can use it for robotics, home automation or any other kind of electronics project. It's programming stripped to its bare essentials. It's easy to use with electronics and there's a lot of good tutorials around, so if you, like me, have little practical electronics experience, the Arduino is a great way to start.

A bonsai is planted in a fairly small, shallow pot and needs water every day in summer. When you travel, keeping it well watered becomes a real problem. So, what better way to use the Arduino than to help my little black pine friend above survive our week-long absence in Hanoi?

Bonsamatic Mini.

There's four major parts to the Bonsamatic above: The pump and controller housing; below it the water tank (freezer container from a 100-yen shop); an open-air vessel (discarded PET bottle); and the watering tube in the pot, which is just a T-connector and a loop of clear tubing with a few holes drilled into it.

The Bonsamatic Mini is really a simple timer-based plant watering device, with the Arduino acting as the timer. My eventual plan is to have a moisture sensor that tells Bonsamatic when to water, but I didn't have the time to build and calibrate1 the sensor in time for the trip.

The picture above is mostly self-explanatory. When the time is up (I set it to 36 hours), the Arduino runs the water pump for 30 seconds. The pump draws water from the tank below and into the open-air vessel, on to the watering tube and out into the pot.

You might wonder about the open-air vessel. The pump has no active shut-off valve, so water can still flow through it. Without the open-air vessel the end of the tube in the pot would sit lower than the water tank intake and act as a siphon, slowly emptying the tank even without the pump running.

I figured that out the hard way, by the way, when I found my workbench completely soaked ten minutes after a trial run. First lesson of any water-related construction: do all your testing in the bathroom.

Bonsamatic Mini
Controller housing close-up. You can see the diaphragm pump on the left, the Arduino on the right, while my home-built motor controller board is sitting right underneath the Arduino board. The housing itself is water resistant and designed for outside use. I put the whole thing out on the balcony next to Bonsai-kun, with a 12V cable through the air conditioning duct for power.

The most difficult problem was finding a suitable pump. Small water pumps are used in products everywhere of course, but few retail shops sell them as parts2. You have to go to manufacturers and distributors directly, but they usually deal only with large lots. If I wanted a hundred pumps there's lots of suppliers, but when I want just one there's far less. Some Chinese industrial component websites sell single units, but the freight and handling charges are steep.

Fortunately I discovered this website, where a group of Japanese manufacturers offer all sorts of electronic and mechanical components to designers and hobbyists that don't need big batches of stuff. The site is not an e-commerce site — there's usually no listed prices, you can't order from the site itself and the links simply take you to the manufacturer product pages, but at least you know the stuff is available for people like myself.

There I found this membrane pump from Denso Sangyou. It's perfect — tiny and nearly silent; most versions pump both air and liquid; there's various motor alternatives; and it can pump about 300ml per minute. Bonsai-kun needs about 150ml for a good soak, so it's just the right size. A quick test shows it can pump at least a meter upwards and probably more without a significant reduction in flow.

I sent them an email enquiry in my broken Japanese, and after a few brief exchanges I had ordered two3 of these pumps for a surprisingly low price of 3500 yen each, and a paltry 900 yen shipping charge, cash on delivery. Delivery was quick as well, and arrived just a couple of days after my order. Excellent service.

The pumps work great. A thirty-second run is plenty to water the bonsai. When out on the balcony I can't hear the pump at all, even if I strain to listen; the wind and the traffic below completely drown it out. The motor is rated for 300 hours and the pump housing for far longer, so if I'd regularly use this to water Bonsai-kun the pump would last more than half a century.

My next step is to make a moisture sensor (a couple of nails, a thermistor and a makeshift transistor amplifier) and calibrate it. It will basically involve a cup of soil that I measure when wet and dry, at various temperatures from near-freezing up to 50° or so. Then I'll take a look at that data and find a simple way to model the temperature dependency.

The water tank will be replaced with a larger, more stable version. I also want to get a smaller, cheaper Arduino board to use for this, so I can free the regular board for other things. And I need a way to get data from the Arduino to my web server for a live display of the temperature and moisture — and balcony ambient temperature too while I'm at it. And perhaps measure the light level throughout the day while I'm at it.

The one thing I'm unsure of is if I should always automate the watering in the future, or only use it when we're travelling. On one hand this automated system is really cool. On the other, part of the point of a bonsai is to see it and interact with it on a daily basis, and this would remove some of that. We'll see.

#1 The data from a resistance-based moisture sensor — that is, you measure the resistance between two nails stuck into the soil — depends on the soils temperature. So you need a temperature sensor, and measure how the resistance changes in order to figure out the real moisture level.

#2 Those that do tend to cater to laboratory and medical fields, which means very precise, very clean, very certified and very expensive.

#3 Always try to get spare components when you're tinkering; that way you're not stuck when you break the primary component by accident.

No comments:

Post a Comment

Comment away. Be nice. I no longer allow anonymous posts to reduce the spam.