Introduction: Irrigation Control Via Internet + Arduino + Ethernet

I would like to introduce you to a project that I have implemented during the holiday season this year. I created a web-oriented system for horticulture, which specializes in the sale and cultivation of various types of plants, trees, flowers.


1x Arduino Mega 2560
1x Ethernet Wiznet W5100 shield
1x FC37 - analog water detection sensor
1x DS18B20 temperature sensor
6x relay SRD-05VDC-SL-C
4x Solenoids 24V DC

Step 1: Requirements for Web-based System

The web-based system was designed to meet the following requirements:

  • Temperature recording, rain levels
  • Temperature / Heating / Cooling Control
  • Control of irrigation at set times or on request, taking into account weather conditions statistics
  • Remote reboot board
  • Logs
  • Login system

Arduino Mega was used as the control microcontroller, as Uno was on the edge with memory and became stuck. The Arduino Mega was an excellent choice due to the sufficient number of pins and especially the large memory for a program with a larger RAM memory. Arduino sends temperature and rain data to the web via the Wiznet W5100 Ethernet Shield. The temperature is read digitally from the DS18B20 sensor and rain data via an analog value. After sending the data board executes PHP logic script, which updates all outputs.

Step 2: Arduino's Rule in Project

The board then only downloads ON / OFF states for each output it applies. There is no operation on the microcontroller side that would load the board. The overall system response is within 6 seconds. The temperature sensor is in the greenhouse where it is necessary to maintain the temperature. During hot summer days it is cooled to the set temperature with optional hysteresis, during the winter months it is heated with the set temperature and hysteresis. The heating / cooling selection must be made manually in the system. It is also possible to manually cool / heat (ON / OFF) indefinitely.

Circuit management consists of four physical circuits that are time-based, with a selection of days of the week when these times apply. If this mode is not selected, the output is always off and turns on the user's request for a set time in minutes. If it rains during the request, the system turns off and does not turn on again. However, if the automatic time mode is set and it starts raining during this time, the circuit will turn off and if it stops raining before the end of the set interval, it will turn on again.

Arduino has implemented a watchdog for trouble-free operation, when Arduino is restarted if it hangs. In the event of an Internet crash or unavailability of the site, for example for maintenance purposes, both the heating and cooling circuits and the heating and cooling relays are automatically turned off after two minutes until the web connection is established. After Arduino restarts, all outputs are off. The logs record an unsuccessful login to the interface (wrong name or password) with the IP address of the client who attempted to connect. The logs also record data on invalid data from the DS18B20 sensor 85.00, or -127.00, which are typical sensor failures due to poor wiring, CRC errors.

Step 3:

The system also includes graphs where you can view the temperature development 24 hours after the graph was loaded and 7 days ago, as well as circuit activity and cooling / heating activity. The activities are recorded every minute and the temperature is recorded every 5 minutes into the database (does not apply to working with real-time data). All inputs / outputs that the system works with can be called by themselves, for clarity, where the circuit is used for irrigation. Solenoids, pumps with a total output of 2.3kW per relay can be used as outputs on the relay, i. 230V 10A.

The whole system is hidden behind the login, which can also be changed from the web interface. The system is practical, functional and helps horticulture in matters of regular irrigation. If you are interested in more information about the project: