Showing posts with label rabbit semiconductor. Show all posts
Showing posts with label rabbit semiconductor. Show all posts

Sunday, May 31, 2009

Automatic plant watering system, Part II

Last summers automatic plant watering system worked well, but it never ended up leaving the breadboard. So as I already have my pepper plants planted for this year, I wanted to get a more permanent system up and working. I took the design from last year and built it on a Rabbit Flex dev board I have had laying around since I had used the rc3400 I built last years on for a separate project. One of the nice parts of this board is that it has on-board Ethernet which I plan to take advantage of.

This version will have a web based interface to allow me to control the watering times remotely. Along with the rain detector that was built last year, it will also have temperature and humidity sensors that will allow me to adjust watering accordingly based on current conditions. Ideally it will also be able to show how much water I am using per day once I calculate the flow rate of my system.

Design:


The basic system is operational right now along with the external sensors, the web interface is the last step of the project, along with a case to mount the project in.

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...

Tuesday, June 10, 2008

Cooperative multitasking

Sitting down this past weekend for a large amount of time to begin a new project (details will be provided in the next post)... I discovered an amazing feature with Rabbit Semiconductors microcontrollers. Cooperative multitasking. I have actually always known about the multitasking capability of these processors, but never actually used them in any real form.

Cooperative multitasking unlike preemptive multitasking has many benefits. For one, variables can be easily shared among different tasks. This simplifies the necessary code needed immensely as you don't need to take any necessary precautions while sharing variables in a typical interrupt driven preemptive environment. Cooperative multitasking also allows many tasks to be run at once (as they only appear to... time slices are actually given to each function running just like in any modern multitasking OS). The microcontrollers also take advantage of the natural delays that occur in most code execution to provide cpu cycles to other tasks.

Playing with this multitasking environment I was able to update information on an LCD via an array of switches in real-time, without taking any time away from any other running timers or processes. It essentially allows me to run several tasks at the same time while providing data input without the necessity of any type of interrupt. This is extremely powerful.

I have nearly finished the code for the current project tonight, I hope to have the project finished by the end of the week as an update to what this project is will be given upon completion.