In this project, we are going to build an automatic irrigation system using Arduino which senses the moisture of the soil and opens or closes the valve according to the moisture value. The moisture value and the valve status is shown on the Nokia 5110 LCD display.
Before we proceed, let’s take a look at another project – a plant watering system using Arduino, which is very similar to our application. You may also read our other tutorials on – interfacing Nokia LCD to Arduino and our tutorial on interfacing Soil Moisture Sensor to Arduino.
The components required for this project are as follows
- Nokia 5110 LCD
- FC-28 Soil Moisture Sensor
- Single Relay Module
- 1K potentiometer
- 4 X 10K resistors
- 1K resistor
- 330 ohm resistor
Circuit Diagram – Automatic Irrigation System
Nokia 5110 LCD operates on 3.3V, and if we connect it directly to the data pins of Arduino the life time of Nokia 5110 LCD will decrease (notice that the LCD will still work even if you connect directly without current limiting resistors). So, if you want to use it for a longer span, it’s good to connect via resistors as we have shown in this project.
To connect the Nokia 5110 LCD with the Arduino, make the connections for the Nokia 5110 LCD with the Arduino as follows
- Connect the pin 1 of Nokia 5110 LCD which is the reset Pin to the pin 6 of Arduino through the 10K resistor.
- Connect the pin 2 of Nokia 5110 LCD which is the chip select pin to the pin 7 of Arduino through the 1K resistor.
- Connect the pin 3 of Nokia 5110 LCD which is the data or command pin to the pin 5 of Arduino through the 10K resistor.
- Connect the pin 4 of Nokia 5110 LCD which is the data input pin to the pin 4 of Arduino through the 10K resistor.
- Connect the pin 5 of Nokia 5110 LCD which is the clock pin to the pin 3 of Arduino through the 10K resistor.
- Connect the pin 6 of Nokia 5110 LCD which is the VCC pin to the 3.3V pin of Arduino.
- Connect the pin 7 of Nokia 5110 LCD which is the LED pin to the middle pin of 1k potentiometer through 330 ohm resistor and connect the other two pins to the VCC and the ground.
- Connect the pin 8 of Nokia 5110 LCD which is the ground pin to the GND of Arduino.
The potentiometer used here is for increasing or decreasing the backlight contrast of LCD. If you want full back light, then you can connect it directly to 5V or if you want no backlight, then connect it to ground.
After that, connect the relay module with the Arduino as follows
- Connect the VCC pin of relay to the 5V of Arduino.
- Connect the ground pin of the relay to the GND of Arduino.
- Connect the IN pin to the pin 8 of Arduino.
On the other side of the relay, connect the positive of the battery to the NC terminal (No Connection) of the relay and the C terminal of the relay to the positive of the solenoid valve. Finally, connect the negative of the battery to the negative of the solenoid valve.
In last, connect the FC-28 soil moisture sensor to the Arduino as follows
- Connect the VCC pin of FC-28 to the 5V pin of Arduino.
- Connect the GND pin of FC-28 to the GND pin of Arduino.
- Connect the A0 pin of FC-28 to the A0 of Arduino.
Working – Automatic Irrigation System
The soil moisture sensor senses the moisture present in the soil and gives the output to Arduino. The output of the sensor will be from 0-1023. The moisture is measured in percentage; therefore we should map these values to 0-100.
Whenever the moisture value is lower than the value we have set inside our code as the threshold value, the relay will turn ON and the valve will turn open and whenever the moisture value is lower than this threshold value, the relay will relay will turn OFF and the valve will get closed.
Read more: Automatic Irrigation System using Arduino