Thursday, July 28, 2011

My first 'useful' Arduino project - Garden Sprinkler

My goal was to automate watering of my garden plants. It's not that I do not 'enjoy' watering them, but it is more for the sake of the poor plants who sometimes suffer when I 'forget' to water them or have to go out of station for more than few days. There are commercial solutions available, but mine is cheaper and proudly 'home made'. It also gives me the liberty of changing what I want with it.

Currently this is supposed to:
- detect soil humidity
- automatically turn on sprinkler when soil is dry
- keep sprinkler system clean from algae by periodic flushing
- learn and auto modes: learn mode calibrates the system for auto modes.

Below are some snaps of some of the stuff I used to give you an idea. These are for my need and may not suit all scenarios. I have a small kitchen garden around 300sft and mostly multiple beds of shrubs.



Humidity sensor: was made using Plaster of Paris (PoP) and a couple of long nails. Humidity is the resistance through the PoP. And PoP gives a more uniform medium than plain soil. PoP absorbs and loses water pretty quickly. Linearity of resistance, accuracy of values and degradation of the sensor do not affect the system much because it works only on threshold values and can be calibrated easily.

Valve: was a 24V DC solenoid operated one as I did not want any mains voltage where there's water and wanted a simpler circuit for controlling it. For mains operated valves, one would probably use a relay to switch it and keep the valve in a dry place.

Electronics: Atmega328 with external clock, TIP 120 to switch the valve, green and red LED to convey status, and 5 - 22V dual power supply using 78xx for regulation.

Apart from this I needed small bits and pieces of stuff like wires, screws, PVC container, gum and sealants.

I've used materials available locally, and since it was an experiment things are loosely coupled, over-designed and too custom for my purpose. Though the logic got tested on a breadboard, I'm yet to observe it work in practice since it's been raining since I set it up fully. I'll post more in my next post and if things are fine or if I do any changes. If the past is any indication, I'll surely have some more problems to address before everything is fine. I'll post the hardware list, code and more details after few days. Practical hardware is the most difficult thing to get right.

The circuit as it is today can be made compact to fit a 6x6 box along with the power supply and can use Atmega8. Or it can also be enhanced to support multiple zones for a larger setup using Atmega328.

Would also be happy to learn from you if you have tried something similar. Would be glad to provide any details if you are interested in doing it for yourself. If you are at the same place as me (either Bangalore or Bhubaneswar), and would rather prefer one unit built and deployed for you, I'd be happy to do it.

Updates:
  • 29 Aug 2011: Here is the circuit and the Arduino sketch.
  • 12 Sep 2011: Sketch updated. A leakage sprung again at one of the joints in the PVC pipe; arrested through m-seal. I think I should get something to program and debug the Arduino on my minimal board.
  • 03rd Oct 2011: New LCD screen, more information on display and no more blinking LEDs. Added another socket to the Atmega to prevent pin damage from repeated removal. Will continue programming using the Uno board.
  • 30 Oct 2011: New post detailing how to make a sensor.

4 comments:

Ron K Jeffries said...

I am very interested.

A possible enhancement would be to use a latching solenoid, so if the whole thing runs off a battery charged by a small solar panel, you are not consuing the 24 volt for the period the sprinkler is on.

I need to get my stuff together and follow your lead on this very practical project.

Be well

rjeffries@gmail.com

@ronkjeffries [twitter]
also use G+ as ron k jeffries

Tanmay said...

@Ron, thanks!

I'm just back from a holiday. The Arduino powered sprinkler has been working fine meanwhile, but it's been raining here mostly. Waiting to test it through a series of dry days before I build the next prototype.

I'll try and procure a latching solenoid and solar panel next. I'll be in touch with you for any advice you may have regarding these.

thnx!

Anonymous said...

Dear Tanmay,
Would you please post more detailed information about your PoP humidity sensor (I mean at least photo and dimensions)?
Thanks in advance.

Peter Volchanski

Tanmay said...

Hi Peter, I don't think the dimensions would matter much as the trigger can be calibrated. However would post details of making the sensor this weekend anyway.