---
title: "Design and Implementation of an Automated Irrigation Control System for Optimal Water Usage"
url: "https://maker.wiznet.io/mayuri/projects/design-and-implementation-of-an-automated-irrigation-control-system-for-optimal-water-usage/"
markdown_url: "https://maker.wiznet.io/mayuri/projects/design-and-implementation-of-an-automated-irrigation-control-system-for-optimal-water-usage/md"
type: "UCC: User Created Content"
author: "Innocent Ncube"
author_url: "https://ubrisa.ub.bw/bitstream/handle/10311/2452/Ncube_Unpublished%20%28MSc%29_2018.pdf?sequence=1&isAllowed=y"
editor: "WIZnet"
editor_url: "https://maker.wiznet.io/"
original_author: "Innocent Ncube"
original_url: "https://ubrisa.ub.bw/bitstream/handle/10311/2452/Ncube_Unpublished%20%28MSc%29_2018.pdf?sequence=1&isAllowed=y"
published: "2023-01-31"
language: "en"
hardware: ["Arduino Ethernet Shield 2", "WIZnet W5500 Ethernet Shield"]
likes: 3
views: 262
comments: 0
source: "WIZnet Makers (https://maker.wiznet.io/)"
---

# Design and Implementation of an Automated Irrigation Control System for Optimal Water Usage

> In the field of weather monitoring, there are global platforms which keep track of weather conditions around the world.

Original author: Innocent Ncube (source: https://ubrisa.ub.bw/bitstream/handle/10311/2452/Ncube_Unpublished%20%28MSc%29_2018.pdf?sequence=1&isAllowed=y)

## Components

- **Arduino Ethernet Shield 2** x 1 ([docs](https://docs.arduino.cc/hardware/ethernet-shield-rev2))
- **WIZnet W5500 Ethernet Shield** x 1

## Article

Arduino Ethernet Shield

The Arduino Ethernet shield makes it possible to connect and configure the Arduino board over the Internet using an Ethernet cable connection medium [23, pp. 43-47]. An Ethernet shield is a printed circuit board designed to mount on top of an Arduino board by connecting the headers on the Arduino. Shields are used to extend the hardware features of the Arduino [23, pp. 45]. The Ethernet Arduino shield gives the Automatic Irrigation controller some Internet capability through use of an Ethernet cable connection. The Arduino Ethernet shield shown in Figure 3.9 and Figure 3.10 is a microcontroller communications board that works together with the Arduino microcontroller board. Ethernet shield uses a Wiznet W5500 hardwired TCP/IP embedded Ethernet controller interface to enable connection to the Internet. The Ethernet shield has 14 digital input/output pins, 6 analog input pins, a 16 MHz crystal oscillator, and an RJ45 Ethernet connection port. The Ethernet shield also accommodates a micro-SD card memory chip for data logging.

![](https://maker.wiznet.io/upload/ckeditor5/76807258%5F1675199518%2Epng)

![](https://maker.wiznet.io/upload/ckeditor5/76807258%5F1675199542%2Epng)

Special Function Pins: Serial pin 0 (RX) and pin 1 (TX): Used to receive and transmit TTL serial data External Interrupts pins 2 and 3: can be configured to trigger an interrupt Pulse Width Modulation (PWM) pins 3, 5, 6, 9 and 10: provide 8-bit PWM output with the analogWrite() function Serial Peripheral Interface (SPI) pins: pin10 Slave Select (SS), pin11 (MOSI), pin12 (MISO), pin 13(SCK): These pins support SPI communication using the SPI library Inter-Integrated Circuit/Two Wire Interface (I2C/TWI) pins A4 Serial data line (SDA) and pin 5 Serial Clock Line(SCL): These support TWI communications using the wire library. AREF: Reference voltage for the analogue inputs used with analogReference() function Reset: Brings this line LOW to reset the microcontroller The Arduino communicates with both W5500 and SD card using the Serial Peripheral Interface (SPI) bus (through the ICSP header). That is, digital pins 11, 12, 13 on Uno and pins 50, 51 and 52 on the Mega. On both Boards, pin 10 is used to select the W5500 and pin 4 for the SD card. These pins cannot be used for general input/output. On Mega, the hardware SS pin 53 is not used for either W5500 or SD card, but it must be kept as an output or the SPI interface won’t work. Because both the W500 and the SD card share the SPI bus, only one can be active at a time. To deselect the SD card, set pin4 as an output and write a HIGH to it. For the W5500, set digital pin 10 as a HIGH output. 3.4.4 YL-69 Soil Moisture Sensor and YL-69 Amplifier/Comparator PCB The YL-69 soil moisture sensor shown in Figure 3.11 is an electrical variable resistance sensor which is made up of two electrodes. It reads the soil moisture content of the soil surrounding it. Current passes across the electrodes via the soil. The resistance to current in the soil depends on the soil moisture content. If the soil has more water, resistance will be low and hence more current flows. On the other hand when the soil moisture is low, the probe will give out a higher resistance. The YL-69 sensor module provides both digital and analogue outputs. The analogue output pin is used in this case since the YL-69 sensor is connected to an analogue port of the Arduino microcontroller board.

The Code for the Automated Irrigation Control System

![](https://maker.wiznet.io/upload/ckeditor5/76807258%5F1675199652%2Epng)// include the ethernet library #include //include SPI library #include // include the SD memory library #include //include the wire library #include // declare libraries LiquidCrystal #include //declare libraries for Aduino javascript notation #include // declare libraries for ESP8266 #include // declare libraries Wi-Fi client lcd(3,5,7,8,9,2); // Initialising the LCD #include

![](https://maker.wiznet.io/upload/ckeditor5/76807258%5F1675199686%2Epng)

![](https://maker.wiznet.io/upload/ckeditor5/76807258%5F1675199715%2Epng)

![](https://maker.wiznet.io/upload/ckeditor5/76807258%5F1675199742%2Epng)

![](https://maker.wiznet.io/upload/ckeditor5/76807258%5F1675199771%2Epng)

![](https://maker.wiznet.io/upload/ckeditor5/76807258%5F1675199800%2Epng)

![](https://maker.wiznet.io/upload/ckeditor5/76807258%5F1675199830%2Epng)

![](https://maker.wiznet.io/upload/ckeditor5/76807258%5F1675199853%2Epng)

![](https://maker.wiznet.io/upload/ckeditor5/76807258%5F1675199878%2Epng)

![](https://maker.wiznet.io/upload/ckeditor5/76807258%5F1675199897%2Epng)

![](https://maker.wiznet.io/upload/ckeditor5/76807258%5F1675199924%2Epng)

![](https://maker.wiznet.io/upload/ckeditor5/76807258%5F1675200088%2Epng)

![](https://maker.wiznet.io/upload/ckeditor5/76807258%5F1675200125%2Epng)

![](https://maker.wiznet.io/upload/ckeditor5/76807258%5F1675200162%2Epng)

![](https://maker.wiznet.io/upload/ckeditor5/76807258%5F1675200190%2Epng)

![](https://maker.wiznet.io/upload/ckeditor5/76807258%5F1675200225%2Epng)

![](https://maker.wiznet.io/upload/ckeditor5/76807258%5F1675200256%2Epng)

---

Source: https://maker.wiznet.io/mayuri/projects/design-and-implementation-of-an-automated-irrigation-control-system-for-optimal-water-usage/
