Sunday, July 13, 2008

Plant watering system

For the past few years I have been growing various cayenne and habanero peppers in planters off of my condos balcony. The only issue with this besides lack of space has been watering. Previously I have been simply filling several large containers with water and carrying it out to the plants. This is fine in the beginning of the season, but by late July and August when the plants are large and consume much more water, this has been a chore. Multiple watering trips are necessary as well with watering them both in the morning and night. For a solution, I built a simple microcontroller based system that I could automatically water the plants on a set cycle. It also has a simple rain detector that preempts any further watering for a set amount of time after it has rained.

I designed the system around a Rabbit RCM3400 core 8-bit microcontroller. Realistically this microcontroller is rather overpowered for this system, ( a pic would have worked just fine) but I wanted to begin playing with the Rabbit's cooperative multitasking functionality... and I have a few of these micros laying around. There are a couple neat features of this micro as well such as the real-time clock and built in ADC's. For functionality, the rabbit drives a serial LCD for displaying current information on the system and has 5 microswitches along with a rain sensor for input. The system drives a latching relay which then turns on a 12v solenoid based electronic valve to start the water flow to the plants.

This is final stage of prototyping. It has been working fine for the past five days so I am beginning to build it into an enclosure this week.

The system has two adjustable parameters, frequency of the watering cycle and duration of the actual watering. The five microswitches will be placed under the lcd to allow the lcd to show the functionality of the buttons. I plan on adding a more robust menu setting that will allow control for multiple plants in the future. The left two adjust the watering frequency in hours, the next two can adjust the watering duration in seconds. For my small plants, 20 seconds or so of watering is enough to saturate the soil. The final button on the right is a forced watering function that allows me to provide a 15 second burst of water without resetting the current counters.

Once timing parameters are set, the micro begins counting down to the set watering time. The display shows how many minutes are remaining to the watering cycle. When the counter hits zero, one of the outputs fires for 250ms, enough to engage a latching relay which in turn opens the solenoid valve to start the water flow. Once the set watering duration is counted down to zero, the relay is fired for another 250ms to disengage it and cut power to the solenoid valve stopping the water flow. The process then starts over.

The rain detector is just two thin strips of aluminum foil spaced closely together on my balcony railing. When rain falls and closes the connection, a pin on the micro goes high letting it know rain is detected. The watering process is then put on hold for a set amount of time until watering begins again.

Now for a water source, I tapped into the cold water supply line underneath my sink. This is my only real option as I don't have any access to outside building watering on the top floor. The water is split with a tee fitting and ran to a solenoid valve. From here I ran a line out to my plants. Through a series of different tubing lengths and tees I was able to get an even watering distrubution among all three plants. The actual water is supplied to the plants through a polypropylene tube with a series of holes drilled through them.

The system works quite well.

Future upgrades will add control for multiple plants, and a better timing interface so I can set more precise watering cycles. If I want to go all out, I will enable the rabbit's ethernet interface to pull down real weather data automatically and have the micro set the watering cycles based on that day's conditions...