Tuesday, July 14, 2009

The Arduino Now Pumps Water!

It was really just a matter of changing a few lines of code and then attaching the relay wires to the breadboard to get the pump working via the Arduino. Although I really didn't have any doubts that it would work, it was nice to see it in action.
What I have now is a small working model of how the automated irrigation system is going to work. Here is the basic setup:
  1. On the far left is the Arduino connected to a small white solder-less breadboard. Two white wires connect to the two nails acting as the humidity sensor (input).
  2. Two more two white wires connect to the relay (output) that is a small black box between the breadboard and the small pot where the nails are inserted.
  3. The relay is connected to the water pump with two more white wires (22 gage).
  4. The nails are inserted into the soil and the resistivity of the soil between the nails changes based on the humidity level of the soil.
  5. The Arduino reads the resistance as an input that is scaled from 0 to 1024 (theoretically anyway). 0 means maximum resistance, or no electrical flow, and 1024 means no resistance.
  6. The Arduino checks this value to see if it is below a threshold, and then sends a LOW signal to the relay. The relay switches (via an electromagnet) and opens up the electrical flow to the pump completing the circuit (its pretty cool, you can hear the "click" of the electromagnet moving in the housing).
  7. The pump turns on, the soil gets wet and the Arduino sees the change in the resistivity between the nails, so it then turns off the pump.
I see this being a great lab exercise for students to test out with some nails and a little pump and small container of soil. It really covers the basic control flow of any robotic system - input, decision, output.
There are some modifications that will need to be made, but I will talk about those next time. I will also post the code and schematic as soon as I can.

4 comments:

Alpay Kasal said...

i was just looking for a low cost pump at a pet store yesterday, i've been planning to do this for awhiel and finally i'm about to start... your code would be much appreciated. I plan to add to it by running a couple of plants from my arduino, maybe more if possible. thanks for your post, it's a nice bit of inspiration.

Steve Temple said...

Thanks Alpay, I posted the code, and if you have any questions, let me know.

constanze said...

Hei Steve Temple,

I will shortly explain what I do want to do and for what I do need our help.
I do have two silicon-volumes, both are filled with water and I want to exchange the water via a pump (left-turning/right-turning) to see a movement an the round silicon-shapes.
Can you suggest any pump that is easy to program in that way and how I should proceed with the programming?
I am a total beginner with arduino but want to visualize my project as good as possible that why I want to build it.
Would be nice if you can help me with that.

Igor said...

Hi Steve,

Can you tell me where I can find information about your project and the code you said you posted. I can't seem to find it.

Thanks in advance.