Arduino Plant Watering System

220K556100

Intro: Arduino Plant Watering System

This Instructable will explain how to make a plant watering system powered by Arduino. Each of the components is specified with a link to where they can be purchased online. The process of making the system will be detailed step-by-step from the hardware to the code.

STEP 1: SHOPPING LIST

Arduino Uno - http://www.ebay.co.uk/itm/UNO-R3-Arduino-Rev3-ATME...

Soil Moisture sensor - http://www.ebay.co.uk/itm/Soil-Sensor-Moisture-Hyg...

Bread board + cables [170 points clear option]- http://www.ebay.co.uk/itm/Solderless-Prototype-Bre...

Cables - [40x male to male 20cm option] - http://www.ebay.co.uk/itm/Dupont-Jumper-Cable-Wire...

More cables - [40x female to female 20cm option] - http://www.ebay.co.uk/itm/Dupont-Jumper-Cable-Wire...

12v pump - https://www.google.com/url?hl=en&q=http://www.ebay...

12v power supply - http://www.ebay.co.uk/itm/DC-12V-LED-Driver-Power-...

Hose for irrigation - http://www.ebay.co.uk/itm/4mm-Car-Van-Vehicle-Wind...

Chocolate block connector (5a) - http://www.ebay.co.uk/itm/Chocolate-Block-Connecto...

Vessel for water - http://www.ebay.co.uk/itm/1L-1000ML-BOROSILICATE-G...

Additionally you will need:

- some wire cutters

- plant pot with hole in bottom for drainage + tray for underneath (if inside)

- plant + 50/50 compost/soil mix

- a stand/base to compile the parts on (possibly piece of 12mm plywood (350 x 200mm - if using a small plant pot this should be okay)

TOTAL COST: £54.31 (note that prices will vary depending on supplier and the country you order within).

STEP 2: Wiring the Arduino

This sketch gives an overview of the logic behind the system. The system takes 240v of mains electricity through a step-down converter power supply transforming it to a 12v output. The Arduino is connected to a moisture sensor and relay via a breadboard. The Moisture sensor takes multiple readings from the soil each minute and when the moisture content drops below the pre-set value the relay is triggered sending 12v to the water pump. The power is cut again when the moisture sensor reads a value greater than 70% content.

STEP 3: Wiring the Power Supply

This step is specific to the specified power supply. If you have no previous experience of wiring you MUST seek the advice of a qualified professional. 240v is potentially deadly.

POWER IN - Mains Electricity

1. Take the live wire and connect it to the 'L' terminal on the power supply. In the image this is the brown wire.

2. Take the Neutral wire and connect it to the 'N' terminal. Ensure that both are securely connected with none of the copper wire exposed.

POWER OUT - 12v Conversion

1. Connect a brown wire to the V+ terminal.

2. Connect a blue wire to the Com(Neutral) Terminal.

STEP 4: Chocolate Block

This component is called a 'Chocolate Block', it is used to take a single wire input and connect it to multiple wire outputs. For this project you need two channels.

1. Wire the brown live wire from the power supply output to one side of the chocolate block.

2. Wire the blue neutral wire from the power supply output to the other channel of the chocolate block.

3. Run two wires of the same colour from the other side of each channel. These steps are best understood when read in conjunction with the image above.

STEP 5: Wiring the Arduino

The Arduino is the 'brains' of the system. Follow these steps to wiring it up, it is important that you use the same coloured wire as in my explanation to avoid confusion further down the line.

1. Connect a 'male' red wire to the pin hole marked '5v' leave the the other end disconnected for now.

2. Connect a grey wire to the pin hole marked 'A1' leave the other end disconnected for now.

3. Connect the one of the blue wires running from the chocolate block to the pin hole marked 'GND'.

4. Connect one of the brown wires running from the chocolate block to the pin hole marked 'VIN'.

5. On the other side of the Arduino Board, connect a red wire to the pin hole marked '12v' leave the other side disconnected for now.

STEP 6: Wiring the Breadboard

This component is called a breadboard, I elected to use it in this project to save myself and others from having to solder components together. It works like this;

HOW IT WORKS

The board is rectangular, place it on the surface you are working on in a portrait orientation. the holes are electrically connected to one another horizontally, but not vertically. This means that you can plug in various pins to the board running horizontally and power will flow through them all in series.

BACK TO THE PROJECT

You may find it useful to refer to the sketch at the top of this Instructable in addition to following the written instructions.

In connected series (Horizontally at a portrait orientation) connect the following wires.

1. The '5v' pin that runs from the Arduino board and is currently not connected at the other end. - In this same series connect two more wires of the same colour and leave the other end of the wires disconnected for now.

2. Below take the wire that runs from the 'GND' pin hole on the arduino. Connect another two wires of the same colour to the same line and leave the other end of the wires disconnected for now.

STEP 7: Moisture Sensor Module

1. From the breadboard take one of the positive wires (Brown) and connect it to the moisture sensor module

2. From the breadboard take one of the neutral wires (Blue) and connect it to the other second input hole on the moisture sensor module.

STEP 8: The Moisture Sensor Itself

From the sensor module in the last step connect two 'female' wires to the other side, run these to the moisture sensor itself. The length of these wires is important for you to decide as it is what will dictate how far the plant can sit from the components on completion.

STEP 9: The Relay

This component is called a 'Relay' it is essentially a switch. When the moisture sensor takes a reading that is less that 40% moisture content of the soil the arduino will trigger the relay which sends 12v from the power supply to the water pump.

1. Take the last remaining positive (brown) wire that is connected to the breadboard and connect this to the pin hole on the relay marked 'NC'

2. Take the last remaining neutral (blue) wire that is connected to the breadboard and connect this to the pin hole marked 'NO'

3 On the other side of the Relay connect a red wire to the hole marked 'VCC', a yellow wire to 'GND' and a brown wire to 'INN'

STEP 10: The Water Pump

WARNING - DO NOT RUN THE PUMP DRY, IT WILL DESTROY THE PLASTIC COGS

1. Take the positive wire (brown) running from the relay and connect it to one of the pins of the water pump. It doesn't matter which pin you connect it to, however, by changing this around you change the direction that the pump will push the water in.

2. Take the remaining neutral (blue) cable from the chocolate block and connect it to the other pin on the water pump. Ensure that these two cables do not touch as they will spark.

3. Cut the plastic tube in two parts and connect a piece to each end of the water pump, you may also choose to secure the pipe with zip-ties and epoxy. It is extremely important that the pump does not leek given its proximity to live electrical components.


STEP 11: Building a Housing for Your Watering System

I built the housing seen in the images from 16mm birch faced ply offcuts from a previous project, you can make the housing however you please. If you choose to stick the components to the housing, ensure that you do not use a conductive adhesive as this will risk short-circuiting the system.

STEP 12: Coding the System

The final step is to write the code and upload it to the Arduino. The code seen in the image above works for this system. In essence this code works to take an almost constant moisture content reading. When the reading is below 30% 'humidity real', the relay is triggered, sending 13v to the water pump. The water pump is cut again when the moisture content is read as having risen. You may wish to change this value depending on the plant type, environmental conditions etc.

71 Comments

Hi! Thanks for this awesome tutorial.
However, some of the part links (12v pump, 12v power supply, Hose for irrigation, etc) lead to "Not Found" items on eBay. Could you update the list?
have you considered using a load sensor
and hx711 to keep track of plant's moisture needs? Weigh plant two or three times a day (missing data no problem); plot 15-20 points over week. That info can be used for predictive watering with a metering pump.
This one removes the need for serial monitoring and adds 5v to 13pin for the relay so you can run them both off the board.

int waterpump = 3; //pump relay pin

void setup() {
pinMode(waterpump, OUTPUT);
Serial.begin(9600);
pinMode(13, INPUT_PULLUP);

}

void loop() {
int humidityRaw = analogRead(A0); //1023 to 0 ===> 0 to 100%
int humidityReal = map(humidityRaw, 1023, 0, 0, 100);
delay(1000);
if (humidityReal > 35)
{
digitalWrite(waterpump, HIGH);
Serial.write("Pump On");
}else{
digitalWrite(waterpump, LOW);
Serial.write("Pump Off");
}

}
I'v never liked using higher voltages with water for such DIY housed projects. Much safer to use a 12V lead acid battery and this will only be using short bursts of current for the pump on an occasional basis. Add a 12 charger port to plug in it when voltage drop detected necessary and could send an alert if you added a wifi/bluetooth module or even just a low voltage indicator LED.
You can use the This moisture sensor if you don't want to order from Ebay.
Has any1 got the code for this (if you made it and it works) as in the thing there is just an image. Also would this work if I replaced the 12v psu with a 5v battery pack, and used a 5v pump and stuff. ty
Careful where you place that glass of water. If you have a cheap impeller pump, water might continue to flow even after the pump is off.
The water glass should be slightly lower than the plant. Otherwise the pump will start the flow and the siphon will empty the rest of the container into the plant.
A picture of the code is not really useful at all.
You should include the code properly.

Power supplies are sold at a variety of powers and currents. What is the power or current output of the power supply recommended for this project?
Most current-consuming part is pump, so you need to calculate current needed by pump and add a llitle bit for safety and for Arduino. E.g. if you have 6W (so 0,5A) water pump, I think that you don't need power supply with output current bigger than 1A

Hi, the problem with the system is that as the arduino is measuring the humidity constantly, i.e. the sensor is "on" all the time, it corrodes within a very short time. By corroding I mean that all the tin from the seor dissolves in the soil in about a week or so.

Any solution to this? Anyone else having this issue?

that doesen't do it for my sensor. i still measure voltage on it, even though no measurements are taken.

Hi! What kind of relay do I need to use? Thank you.
Any type of a normal open relay is fine.
Where do the gray wires connect to in the arduino as the image shows they connect to the same pin.

Also the code says pin A0 but your instructions say pin A1 what's the deal here?
Where do the Grey wires connect to in the arduino Uno board?
More Comments