Green and clean

Irrigation controller

A very useful project if you plan to travel for a few days and you don't want to bother anybody to look after your garden.

Design

Controller should be compatible with standard 24V sprinkler valves (available for sale for irrigation systems).
Should be Arduino-based, because Arduino’s have widely available libraries and community support.
Sd-card as data collector to view/control the system operation.
RTC timer module to know the watering time.
Rain detection.
AC water pump - 20L/min, 2A
Solid state relay, able to control the water pump.
Rotating sprinkler + dripping sprinkler

irrigation_1

Software


Code flow

Init
-Init Mega2560 ports
-Init Mega2560 ADC inputs
-Init Ssd1306 OLED
-Deactivate main water valve
-Deactivate AC pump
-Set watering hours, mins and duration(mins)
-Init tempr.sensor LM75
-Init sd-card
-Init RTC (Ds3232)

Main
Wait for watering hours to come. Note: watering is set at 5am.
Check soil moisture
Check the RTC hrs.
Check if watering hrs = rtc_hrs
If OK, start watering.
Power 12v to 24v voltage converter
Power the 24v valve (to open the water flow)
Power the AC water pump.
Wait for watering duration mins to end.
Deactivate the AC pump, 24v valve.
Record data to sd-card.

flow_code_1

The main job of Arduino is to wait for the correct time.
If the time was set to 5am at the morning,
Arduino will activate the system components (pump+valve)
and wait for watering duration to finish.
When it is done, the pump and valve deactivated.
Data is saved to sd-card and Arduino waits for the next day 5am morning time to do it again.

Update 28 Oct 2020
Water flow calculation is activated.

YF-G1_Flow_sensor-1

YF-G1 sensor has output in pulses per time.
I couldn't find the correct number and used 65 impulses per litre number.
It is a very rough number. This number should be corrected by using the known time value and known litres value.