Arduino Irrigation System #1

As with everything, I like to jump in head first and work it out from there. That’s exactly what I did with my Arduino Irrigation System, only it took quite a long time to accomplish the ‘working it out from there’ bit (about 6 months I’d say), but I did it, and here it is in all its glory.

What do you mean you can’t see it!?

This is a picture of my Mum’s Nursery, when it’s full of stock like this, it takes ages to water all the plants. If the site is particularly full, it can easily take between an hour and a half and 2 hours to get around all the plants, and keep untangling the hoses, and that’s twice a day! The solution, obviously, is MORE ARDUINOS! In other words, an Irrigation System.

The Nursery already has an Irrigation System built in, but you must manually turn on all the taps to get it going, and manually turn them all off again (doing that last part without getting wet is where the skill is!) We need a system that is easy to operate, doesn’t get you wet and most of all, gives you back 3 – 4 hours of your day.

Arduino Irrigation System Checklist

Desired Functions:

Automatic handling of the day-to-day watering requirements

Simple operation

Energy efficient

Less wasted water

Watering based on soil moisture levels

Remote operation

Limits/Potential Problems:

Nursery has no mains power. System must be battery operated

Energy efficiency and power management

As you can see, there is a fair amount to do, and that doesn’t include learning and testing all the different potential options, so I have broken the project down into the following phases:

Phase 3:

Phase 4:

Automation; have the system decide when to water a bay and how much water to use.

Phase 5:

Further power optimisations if necessary.

Remote control; tell the system what to do and when to do it using SMS, and have the system report its status if necessary (also using SMS).

Part 1:

Phase 1 and 2 took a long time, but eventually I settled on an Arduino / MOSFET / Solenoid solution. In my testing, I used a DC motor, which is why you see a motor in the video below rather than a solenoid.

Here you can see a DC motor that switches on when I press the button on the breadboard. What’s happening here is that the Arduino looks to see if the switch has been pressed, and if it has it switches on the motor by sending 5V to the MOSFET (the black and silver thing standing out on the breadboard). The Motor however needs more than 5V, so it gets its power from the 9V battery you can just see on the right. However if you put 9V into the Arduino anywhere other than its power socket, you could well kill it, this is why we use the MOSFET. When the Arduino switches the MOSFET on, a connection is made inside the MOSFET which allows the motor’s circuit to connect to ground. As we know, a circuit needs to be whole before it will work, so the MOSFET acts like a switch, allowing the motor to connect to ground, and thus turn on, when I press the button on the breadboard, and then cutting the motor’s connection to ground when I release the switch.

The important part here is working out how the MOSFET works. This took me a little while because they give the pins silly names like the source, the gate and the drain. I will refer to them as Pin 1, 2 and 3. Notice the Purple wire connected to Arduino Pin 9, the other end of that wire connects to what we will call MOSFET Pin 1. The Yellow wire, between the Brown and the Purple wires, is connected to MOSFET Pin 2 (the middle pin) and the Brown wire is connected to MOSFET Pin 3.

Now notice the Motor’s ground wire. It is not connected to either of the two ground rails like you would expect. Instead it is connected to the back of a diode and to the Yellow wire that is connected to MOSFET Pin 2.

If I tell the Arduino to make Arduino Pin 9 HIGH, then it will send 5V to Pin 9. Because Pin 9 is connected to MOSFET Pin 1, this causes the MOSFET to switch on. When the MOSFET switches on, an internal connection between MOSFET Pin 2 & MOSFET Pin 3 is made. Because MOSFET Pin 3 is connected to ground, this allows the Motor’s ground to connect to the ground and thus the motor’s circuit is whole and the motor can operate.

When I tell the Arduino to make Arduino Pin 9 LOW, it turns off the 5V signal, which terminates the connection inside the MOSFET and thus disconnects the motor from the ground.

The eagle-eyed among you will have noticed a distinct similarity between the above picture and the circuit on page 96 of the Arduino Projects Book, and there’s a very good reason for that; it is that circuit.