This circuit is a system that could automatically water your plants. It would send messages for you to refill the water, the soil moisture, the pump on, the water level and more. Instead of having to do all of these things yourself, the system does it by itself. It uses the Arduino software to program it. It holds the code in the motherboard which connects the circuit through the pins. The system is always working meaning that you do not need to turn on the pump but it turns on whenever the plant needs to be watered. It is a very useful system that could make gardening a lot easier.
This video shows how the irrigation system works as it boots up and how it measure the moisture levels of the soil.
The next video shows how the water level sensor works in the watering system. It shows how the LEDs work with the sensor.
The final video shows how the entire system works and how it automatically waters your plants.
Arduino Motherboard
LCD Screen
5V Relay
10K Potentiometer
Water Level Sensor
Capacitive soil moisture sensor v1.2
Speaker
5V Pump
Hose
Wires
Mini Breadboard
PCB Board
9V Battery with Clip
AC Adapter
3 LEDs (Green, Yellow, Red)
3 220 Ohm Resistors
Solder wire used to connect wires together
This is the circuit diagram that I made for the Watering System. The circuit is made of many components that usually connect to ground, positive, and to the pin. Some of the components need extra things like resistors for the LEDs and a potentiometer for the LCD screen. I added a 9V battery to the pump as the 5V is not enough power to power the circuit and the pump together.
The circuit is simple but consists of many components. Most of the components connect to signal, ground, and vcc, but others need resistors or potentiometers to function. I decided to connect the circuit together by using a PCB board. This uses soldering to connect the components together by connecting the holes with solder wire or wire. This allows for the circuit to be more organized and clean instead of being all over the place. It also makes it more compact and tidy. The components' positives and negatives would be connected to a central rail that would then be separately connected to the ground and 5 V. Then the wire from the board is soldered to pins that could sit in the pins of the Arduino Board.
The front of the PCB board shows how the wires are connected from the components to the pins on the Arduino board. The top is where all of the components lay.
The bottom of the PCB board shows the connection between all of the components in the circuit by the use of soldering.
In order to use more components for a circuit that need to be programmed, then they need to be assigned to a pin. There are digital pins and there are analog pins on the arduino board. I assigned the LEDs, Speaker, and Relay to digital pins as they are only outputting a 0 or a 1. I set the moisture sensor and the water sensor as analog inputs as they need to receive many different input data than just 1s and 0s. Liquid Crystal is a built in code that is used for coding on LCD screens. #include is a command that tells the code to use the Liquid Crystal commands. The next command sets the lcds pins in the order of VO, E, D4, D5, D6, and D7.
The setup on the program is used to setup all of the pins and start off the code before the main code begins. In the code I set the LCD to a 16 by 2 dimension and the text is cleared from the LCD by the use of the command lcd.clear. pinMode is a way to set your hardware to outputs or inputs. I set my LEDs, Relay, and Speaker to outputs. I then used the digitalWrite command which allows you to set the pin to high or low which means to turn it on or off. I set the Relay to high to turn it off at the beginning so that it doesn't pour water at the beginning. The reason that I used high is because the Relay that I used works oppositely than a normal component. The Serial.begin sets the data rate to 9600 bits per second. The following code afterwards is a text command that says what the program is before the main code starts. I used the setCursor command in this code which allows me to use both lines of the LCD screen.
The speaker is used as an indication that the pump is on and working. The speaker begins its sequence when the pump is on and turns off when a new loop begins. The first image shows how I defined each note as a certain number. These numbers signify the frequency that would be used for each note. By defining the notes as frequencies, it helps keep the code easier to write and read as they are notes instead of numbers for frequencies. The tone command is used to allow the speaker to play a frequency. The frequency is set to a note and the number afterwards (100) is how long the sound lasts in milliseconds. The delay afterwards for 200 milliseconds allows there to be a small pause between each note to make each sound more defined.
In order to receive different levels of sensitivity within the sensors, I would have to set them as analog inputs. The analog Read is used to read the values that are inputted from the set pin. I did this for both the Water sensor and moisture sensor. Then the data is printed into the serial ports.
In order for the watering system to work the water level needs to be checked all the time. This is good as it lets you know whether there is enough water or if the water source is empty/low. The water level sensor also helps by being a way to check to either turn on or to turn off the pump. The water variable is checked every time by the use of analog Read to check whether the value changed. Each of the four loops on the right display each of the water levels. The first one displays when the water is empty. When the sensor reads a value below 100 then all of the LEDs are turned off to signify that the water level is empty. If the water senses a value greater than 100 but less than 275, then only the read LED is turned on to represent a low water level. If the water senses a value greater than 275 but less than 290, then the yellow LED is turned on representing medium water level. Lastly, if the water sensor senses a value greater than 290, then the green LED is turned on which displays that the water level is high. The else if is used so that if the first if statement is not done, then the next three could be played.
The moisture sensor is an essential part of the watering system as it checks whether the soil is dry, moist, and wet. In order for the pump to start and stop, the moisture needs to be checked all the time. The moisture sensor works by using capacitance. The first if statement is used to determine whether the soil is dry. If the moisture is greater than 430, then that loop is started. The cursor of the screen is set to the first line with the set cursor command. Then the LCD prints out "dry soil" by using the lcd.print code. The next command shows how you can put a loop within a loop. I added another if statement in the if moisture loop which would start the pump if there is enough water in the water source. The water level is checked for the minimum amount of water so that water could be taken from the supply. Then the Relay is set to low which actually turns on the relay as it works oppositely. Then the next cursor of the LCD is set to the next line where "WATER PUMP: ON" is printed out on the LCD. Then the speaker plays its sounds while the pump works. This is cool as it would tell you whether the pump is on even if you aren't near the system. You would just hear the sound of the speaker so you would know that it is on without seeing it.