I started this project since i tend to forget to water my plants.
The Idea is fairly simple, use water level sensors to test the moisture in the ground. if one of the plants is dry or the average plant ground moisture drops below 50%, the the ground should be watered.
The first project was a simple measuring system turning a red LED on when the plants needed to be watered.
A few month after i installed the system i started thinking it was fairly silly no to have the system water the plant as soon as the ground is dry. So this second version came about. I hope you have fun building and installing it.
Please note i added links to the products i bought, this is not a recommendation to buy nor am i in anyway affiliated with the sellers behind those links. this could be built in a million different configurations, and everything could be guilt from scrap drooping the price as low as 5$ for the Arduino controller and water level sensor controllers :-)
To build the watering system i used the following:
Breakout board - This one will save you a lot of work.
Prototype Board - I find this one very convenient to work with.
Water Sensor - This is rather expensive but will last longer, there are cheaper options starting with simple foil.
Arduino Pro Mini - This will control the system, naturally you can use any other Arduino.
USB 2 TTL - This will be used to program the Arduino board
Motor controlled valve - To control the water flow
In addition you will need Solder, Jumper Wire, Prototyping Jumper Wires and a computer with Arduino IDE.
A water tank or connecting the system to the house water system
Irrigation system - to actually water the plants
Now lets get to it!
Step 1: Wiring the Controller
You can follow the weiring instruction as they are, it should work.
I will explain the logics so you could make a power saving, battery powered version as well.
- Power supply should be connected ether to the barrel jack (5V ONLY) or to the VIn Terminals 6-18V
All the ground wires should be connected together.
I daisy chained the 5V from the barrel central pin to the relays COM connectors. (Relay1 will power the sensors, Relay2 will control the valve).
As for the Ground connectors i soldered all of them to the prototyping board
- On the left you will find the water level sensor modules these have 4 connectors:
- + (5V)
- - (Ground)
- D0 (dry contact - the potentiometer on the top sets the level) we are not using this one.
- A0 (Analog output )
The sensor itself takes about 85mA (there are 4 of them)
Since they are only needed when taking measurements, i find 0.5sec every 5 hours good enough, there is no need to contently power them. Therefor I connected them to the prototyping board and the power feed is controlled by the Arduino via Relay1. if you are not concerned with power consumption, you can skip the whole wiring system, attach the power directly and just connect the A0 wires to the board.
Red - 5V
Green - Ground
Yellow - Control (5V/NC)
Connect the 5V and Ground to the power supply.
the Yellow wire should be connected to the NO terminal of Relay2 (NO2).
Step 2: Programming the Pro Mini
First of all, make sure you are using the 5V version of the Pro Mini (there is a 3.3V version)
This tutorial is very good, follow it:
From the link this is the most important part:
Connections CP2102 USB-to-TTL 5pins to Arduino Mini Pro:
CP2102 USB-to-TTL: TXD (green) -> Arduino Mini Pro
RXCP2102 USB-to-TTL: RXD (yellow) -> Arduino Mini Pro
TXCP2102 USB-to-TTL: GND (black) -> Arduino Mini Pro
GNDCP2102 USB-to-TTL: +5V (red) -> Arduino Mini Pro
Configure the Arduino IDE as below:
Arduino IDE -> Tools -> Board -> Arduino Pro or Pro Mini
Arduino IDE -> Tools -> Processor -> ATmega328 (5V, 16 MHz)
Arduino IDE -> Tools -> Port -> /dev/tty.SLAB_USBtoUART
Arduino IDE -> Tools -> Programmer -> AVRISP mkII
When uploading the sketch you need to press the reset button on the Pro Mini just before the compilation is over and before the Upload has started.
You will get the timing right after a couple of tries...
Step 3: The Code
In the attached files you will find a ready sketch (.ino) and a library for power-saving functions.
The power-saving is included in the code but commented out throughout the code, feel free to remove it all together.
Step 4: Connecting to a Water Source
Since i don't have a water supply nearby, I used an elevated water tank and a simple PVC pipe which i punched some tiny holes in.
You can use any thing at hand, naturally connecting it to the water supply is preferred.
Step 5: Testing
Once you Have everything in place, you can use a cup of water to test the system.
Place 3 sensors in the cup of water and leave one sensor out.
As the system will start it will detect a "dry ground" the valve will open.
Place the sensor in the cup with the rest. It should be detected within 30sec and the valve will shut.
Measurements are taken every 25min when the ground is moist and every 30sec while watering.
Each of the 4 sensors has a digit to display the water level.
9 - Maximum measurable moisture level
0 - less the 30% of measurable moisture level
Step 6: The Final Result