0% found this document useful (0 votes)
6 views12 pages

Arduino UNO for Automated Irrigation

This document describes the use of sensors with Arduino Uno to automate an irrigation system. It explains how to program Arduino to read data from soil moisture, temperature, pH, and electrical conductivity sensors and control an irrigation electrobomb. It also covers how to wirelessly transmit the sensor data to monitor and control irrigation remotely using solar panels as a power source.

Translated by

ScribdTranslations
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views12 pages

Arduino UNO for Automated Irrigation

This document describes the use of sensors with Arduino Uno to automate an irrigation system. It explains how to program Arduino to read data from soil moisture, temperature, pH, and electrical conductivity sensors and control an irrigation electrobomb. It also covers how to wirelessly transmit the sensor data to monitor and control irrigation remotely using solar panels as a power source.

Translated by

ScribdTranslations
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

SENSORS IN ARDUINO

UNO AND ITS APPLICATION IN


Automated Irrigation
THANK YOU

A special thanks to my colleagues from the National University of Juliaca, with whom I
I carry out the project 'IMPLEMENTATION OF THE AUTOMATED IRRIGATION SYSTEM WITH AR-'
DRAINAGE IN THE GREENHOUSE OF THE NATIONAL UNIVERSITY OF JULIACA-2019

Yana Huarancca Gabriela


Mendoza Mamani Liz Sandra
Chambi Quispe Sheila Elenny
Vilca Vilca Hitsson
Mamani Gil Elvis Edicson
Great idea Leslie Diana
Jesus Mamani Quispe
Mamani Chuyo Alexsander
Luque Luque Jose Angel
Alex Huaman Soto.
With whom the project could not have been carried out, total thanks.
Programming with Arduino UNO for automated irrigation

Arduino is a software development company.


Free software and hardware were introduced in 2005.
Free software is computer programs
whose code is accessible by anyone to
that anyone who wants can use it and modify it.
The Arduino is a board based on a microcontroller
ATMEL controller. The microcontrollers
they are integrated circuits in which you can gra-
give instructions, which you write with the
programming language that you can use in
the Arduino IDE environment.
Arduino boards also have another type Arduino UNO board, price 30 soles
of components called Shields
backpacks. It's a kind of plates that
they connect to the main board to add a
a multitude of functions, such as GPS, clocks in
real-time, radio connectivity, touch screens
LCD tiles, development boards, and a very long
etcetera of elements.

For our purpose, we will need the Ar- board.


Arduino UNO (price S/.45 approx) and download the
software of your website:
Unable to access external URLs for content translation.
We will also need the sensors that go- Placaboard, price 10 soles
we are going to use,

pH Sensor for Arduino, Analog Electrical Conductivity Sensor For


price 40 dollars Arduino. Price 70 dollars
Unable to access links or external content.
Soil moisture sensor HL-69

The code that we will copy to the Arduino is:


#define sensor A0

void setup(){
pinMode(sensor, INPUT);
[Link](9600);
}

void loop(){

The analog reading of pin A0 (sensor) is done and passed through


the function
//map() to adjust the read values to the percentages that
we want to use
int humidityValue = map(analogRead(sensor), 0, 1023,
100, 0);
The price of the sensor is S/.15
[Link]("Humidity: "); Which you can find in the
[Link](humidityValue); stores on Jr. San Martin with Jr.
% Gonzales Prada in Juliaca

delay(5000);
}

To load the code and the library after everything is done.


connected we click on
The sensor and the Arduino must be connected to the
next way:

To view the data recorded by the sensor we are going to


to the TOOLS option and we click on the op-
Monitor series
Temperature and humidity sensor DHT11

The code that we will copy to the Arduino is:

#include <dht.h>
dht DHT;
#define DHT11_PIN 8

void setup(){

[Link](9600);
}

void loop()
{
DHT.read11(DHT11_PIN);

TEMPERATURE
[Link]("Temperature = ");
[Link]([Link]);
C
The price of the sensor is S/.13
Relative Humidity Which you can find in the
[Link]("Humidity = "); stores on Jr. San Martin with Jr.
[Link]([Link]); Gonzales Prada in Juliaca
%
delay(2000);
}

After copying the code, we will add a library, which we will download from:
Unable to access external links or files.
After extracting the file we will have the following folders:

Let's go to the ARDUINO program and click on program, then we'll go to the option to include library.

The sensor and the Arduino must be connected to the


the following way:

To load the code and the library after everything is


connected we click on

To visualize the data recorded by the sensor we will


to the option TOOLS and we click on the op-
series monitor
The use of various sensors using the placaboard is possible, an example:

int lightValue = 0;
int temValue = 0; // we change it to lluvValue
int humValue = 0;
int soniValue = 0; // we change to humeVule
int nivValue = 0;
int temperature;
int humidity;
int light;
int sound;
int waterLevel;
int regarPin = 2;
#include <dht.h>
int temperatureSensor = A5;
int humiditySensor = A5;
int lightSensor = A4;
int soundSensor = A3;
int waterLevelSensor = A2;
dht DHT;
#define DHT11_PIN 8
void setup() {
set the pin mode of regarPin to OUTPUT;

[Link](9600);
}
void loop() {
analogRead(sensorLuz);
temValue = analogRead(temperatureSensor);
analogRead(sensorHumidity);
analogRead(sensorsonido);
nivValue = analogRead(waterLevelSensor);
delay(1500);
// ----------------------------------------------------
// Print values
// ----------------------------------------------------
(100.0 * temValue) / 1024;
[Link]("temperature:");
[Link](temperature);
C
humidity = (100.0 * humValue) / 1024;
[Link]("humidity:");
[Link](humidity);
%
light = (100.0 * lightValue) / 1024;
Light:
[Link](light);
%
(100.0 * soniValue) / 1024;
sound:
[Link](sound);
(100.0 * nivValue) / 1024;
water level:
[Link](waterlevel);
%
[Link]
("=======================================================================");
// ----------------------------------------------------
I check if I should water
// ----------------------------------------------------
if (temperature == HIGH) {
NO Rain Detected

if( temperature <= 50 && light < 70 ) {


digitalWrite(regarPin, HIGH);
You must water
}
}
else{
digitalWrite(regarPin, LOW);
It should NOT water
}
[Link]
("=======================================================================");
}
When we are developing our 'inventions' we often feel the need to be able to turn them on and off.
like electrical devices in our environment. For example, let's imagine that we want to lower or raise the blinds.
using an electric motor, we would need to turn that motor on or off, which typically operates at
220V. To be able to do this, we would need a switch that we could turn on and off from our
ARDUINO board. Well, that switch is called a relay. The code we will use to turn on the relay is:

int ledPin = 9; // Piezo on Pin 8


int ldrPin = 0; // LDR on analog pin 0
int ldrValue = 0;

void setup() {
[Link](9600);
pinMode(ledPin, OUTPUT);

void loop() {

analogRead(ldrPin);
[Link](ldrValue);
if (ldrValue >= 1010){
digitalWrite(ledPin,HIGH);
}

else { The 12V relay, price 7 soles


digitalWrite(ledPin,LOW);

delay(500);
}

The relay and the Arduino must be connected from the si-
the following way:
The interesting thing is that the ARDUINO board allows you to save information, which means it can be left in the
greenhouse or place where the data will be taken, I would only need power which can be adapted to small ones
solar panels and through wireless transmission, the information can be sent to activate the electro-
pump and the irrigation is automatic. A screen can also be attached to observe the recorded data.
through the sensors, it is necessary to mention that to carry out the irrigation it is necessary to set in the code to which humidity
Ground dad is going to start the irrigation, it should also be scheduled how often the data will be taken.
part of the sensors, also how many seconds will be needed to turn on and for how many values.

Motherboard, will be responsible for receiving-


give the data and open the solenoid valve
valve

The issuing plate will be responsible for


send the data via a
wireless antenna
Greenhouse where it will be held
sprinkler irrigation using the
humidity sensor with AR-
DUINO, the humidity sensor and
ambient temperature only as
data indicator.

P&ID diagram of the system of


irrigation

Block diagram of the system


of irrigation
Motherboard code:
#include <SoftwareSerial.h> if(last_min != minutes && sync_var){
#include <SPI.h> [Link](16);
#include "epd2in13b.h" [Link](32);
#include "epdpaint.h" draw_values(false);
minutes;
#define REF_RATE 2000 sync_var = false;
#define RX_PIN A2 }
#define TX_PIN A3 Here are the decisions
#define NUM_DIG 5 if(sync_var){
#define GND_MIN_HUM 800 if(chan[0] < 1000){//if the sensor is disconnected show values
#define BOMBA_OUT 2 over 1000
#define BOMBA_SECS 10 if(chan[0] > GND_MIN_HUM){
#define MISTKS 3 chan_mistakes[0]++;
if(chan_mistakes[0] > MISTKS){
#define COLORED 0 The pump will turn on in 10 seconds.
#define UNCOLORED 1 String(String(chan[2]) + "%").toCharArray(charBuf, 5);
draw_values(true);
digitalWrite(BOMBA_OUT, HIGH);
unsigned char image[1024]; delay(BOMBA_SECS*1000);
Paint paint(image, 16,200); digitalWrite(BOMBA_OUT, LOW);
Epd epd; chan_mistakes[0]=0;
SoftwareSerial rfSerial(RX_PIN, TX_PIN); relay_used = true;
We obtain the values in buffer
void setup(){ update_channel_values();
[Link](9600); delay(10000);
[Link](9600); Here just updated
setPinMode(BOMBA_OUT, OUTPUT); update_channel_values();
draw_values(false);
if ([Link]() != 0) { }
e-Paper init failed else {
return; chan_mistakes[0]=0;
} }
[Link](ROTATE_90); }
[Link](); false
Deep sleep }
//[Link](); update_time_counters();
}
[Link](UNCOLORED);
[Link](0, 0, "FLOOR", &Font16, COLORED); /////////////////////////////////////////////////
[Link]([Link](),80, 7, void update_channel_values(){
[Link](), [Link]()); sync_var = false;
[Link](UNCOLORED); while([Link]()>0){
[Link](0, 0, "Humidity:", &Font12, COLORED); tmp = [Link]('\n');
[Link]([Link](), 65, 7,
[Link](), [Link]()); if ([Link]() == 32){
if ( tmp[0] == '{' && tmp[30] == '}' ) {
[Link](UNCOLORED); for (int n = 0; n<5; n++){
[Link](0, 0, "ENVIRONMENT", &Font16, COLORED); chan[n]=[Link]((NUM_DIG*n)+(n+1),(NUM_DIG*n)+
[Link]([Link](), 50, 7, (n+NUM_DIG+1)).toInt()-10000;
[Link](), [Link]()); Channel
[Link](UNCOLORED); }
[Link](0, 0, "Humidity: Temperature:", &Font12, [Link]();
COLORED); sync_var = true;
[Link]([Link](), 35, 7, }
[Link](), [Link]()); }
} }
}
int chan[] = {0,0,0,0,0}, chan_mistakes[]={0,0,0,0,0}; //chan[0]
Store the floor moisture sensor void update_time_counters() {
long days = 0, hours = 0, minutes = 0, seconds = 0, high_millis if(millis() >= 3000000000){
= 0, rollover = 0, last_min = -1; high_millis=1;
String tmp;
char charBuf[7]; }
bool sync_var = false, relay_used = false; if(millis() <= 100000&&high_millis==1){
rollover++;
void loop(){ high_millis=0;
We receive the sensor data }
while(!sync_var) long secs_up = millis()/1000;
update_channel_values(); seconds = secs_up % 60;
(secs_up/60)%60;
if(sync_var && relay_used){ hours = (secs_up/(60*60))%24;
draw_values(false); (rollover*50)+(secs_up/(60*60*24));
sync_var = false; }
relay_used = false;
}
void draw_values(bool watering){
if(watering){ Emitter plate code:
[Link](16);
[Link](48);
String(String(chan[0])+'u').toCharArray(charBuf,5);
#include <DHT.h>
[Link](UNCOLORED);
[Link]([Link](),65, 65, //#include <SoftwareSerial.h>
[Link](), [Link]());
[Link](0, 0, charBuf, &Font12, COLORED);
[Link]([Link](),65, 65, [Link]
#define REF_RATE 1000 Refresh rate in milliseconds
(), [Link]()); conds
#define GND_HUM_PIN A4
[Link](16); #define AIR_HT_PIN 2
[Link](24);
String(String(chan[1]) + "%").toCharArray(charBuf, 5);
#define DHTTYPE DHT11
[Link](UNCOLORED);
[Link](0, 0, charBuf, &Font12, COLORED); DHT dht(AIR_HT_PIN, DHTTYPE);
[Link]([Link](),35, 65,
[Link](), [Link]());
String(String(chan[2]) + "%").toCharArray(charBuf, 5);
int gnd_hum;
[Link](UNCOLORED); int air_hum
[Link](0, 0, charBuf, &Font12, COLORED); void setup() {
[Link]([Link](),35, 180, [Link](9600);
[Link](), [Link]());
[Link](16);
[Link]();
[Link](100); }
[Link](UNCOLORED);
Drawing string at (0, 0): "Watering...", with font size 16, colored.
void loop() {
[Link]([Link](), 20, 30, [Link])
(), [Link]());
analogRead(GND_HUM_PIN);
[Link](); air_hum = [Link]();
air_tm = [Link]();
[Link](16); [Link](air_tm, air_hum,
[Link](48);
String(String(chan[0]) + "u").toCharArray(charBuf, 5);
false);
[Link](UNCOLORED);
[Link]([Link](), 65, 65, [Link] [Link]("{");
() , [Link]()); [Link](gnd_hum+10000);
[Link](0, 0, charBuf, &Font12, COLORED);
[Link]([Link](),65, 65,
[Link](";");
[Link](), [Link]()); [Link](air_hum+10000);
[Link](",");
[Link](16); [Link](air_tm+10000);
[Link](24);
String(String(chan[1]) + "%").toCharArray(charBuf, 5);
[Link](";");
[Link](UNCOLORED); [Link](air_tm_hit+10000);
[Link](0, 0, charBuf, &Font12, COLORED); ,10000}
[Link]([Link](),35, 65, delay(REF_RATE);
[Link](), [Link]());
String(String(chan[2]) + "@").toCharArray(charBuf, 5);
}
[Link](UNCOLORED);
[Link](0, 0, charBuf, &Font12, COLORED);
[Link]([Link](), 35, 180,
[Link](), [Link]());
[Link](16);
[Link](100);
[Link](UNCOLORED);
[Link]([Link](), 20, 30, [Link]
( ), [Link]()); Libraries used:
[Link]();
}
}
DISCUSSION
Modern irrigation systems could be used effectively to water plants when it
They need, the measurement of soil moisture, humidity, and sunlight are important for management.
to irrigate the crops efficiently (Zaragoza & Kim, 2017), but this manual irrigation process requires
two important aspects to consider, when and how much to water. To replace the activities ma-
annuals and facilitate work in agriculture, an Arduino UNO automatic irrigation system is created where
the soil moisture sensor is used to prevent plant dehydration (Shifa, 2018). To me-
To improve irrigation efficiency, a greater number of sensors can be used: humidity, temperature,
pressure and water flow (Gilarranz, Altares, & Loizu, 2017), in other works the sensor has been included
Soil pH, since soil is one of the most fragile resources whose soil pH property is used.
to describe the degree of acidity or basicity, which affects the availability of nutrients and, ultimately,
tancia, the growth of plants (Minz, Saha, & Dev, 2019), a web server can be included for the
storage of measurements in a MySQL database also allows for querying and manipulation
statistical correlation of these variables (Perea Palacios, 2016), Bluetooth can also be used
to establish communication between the Arduino and a mobile application for automatic irrigation
in real time (Guijarro-rodr, Torres, Preciado-maila, Nagib, & Manzur, 2018). In the greenhouse has
the soil moisture sensor has been successfully used which works as follows: the sensor
The humidity sends the signal to the Arduino board that activates the water pump to turn on and supply.
the water to the respective plant using the rotating platform. When the moisture level is reached
desired, the system stops by itself and the water pump turns off (Ojha, Mohite, Kathole, & Tarwa-
In 2016, wireless devices can include a power source to ensure
continuous power supply of the device (Rodrigo & Livizaca, 2016), for the test of automatic irrigation
With Arduino, it is possible to build a model to conduct the test (Barroso Garcia, 2015), it can be
improve the system by including a virtual instrument such as LabVIEW for monitoring and control
motor in the greenhouse (Guadalupe & Vaca-rosas, 2017).

BIBLIOGRAPHY
Control and Monitoring of a Greenhouse through a Mobile Application
Intelligent Irrigation System Based on Arduino
Guadalupe, N., & Vaca-rosas, C. (2017). Design and implementation of a prototype for automation and
sustainable control for greenhouse, 3(10), 1–10.
Guijarro-rodr, A. A., Torres, L. J. C., Preciado-maila, D. K., Nagib, B., & Manzur, Z. (2018). System of
automated irrigation with Arduino.
Arduino Based Automatic Irrigation System
Ojha, M., Mohite, S., Kathole, S., & Tarware, D. (2016). MICROCONTROLLER BASED AUTOMATIC
PLANT WATERING SYSTEM, 5(3), 25–36.
Perea Palacios, J. W. (2016). Design of a monitoring, recording, and control system for temperature and hu-
method for greenhouse cultivation.
Implementation of greenhouse with control and monitoring system
wireless 424.16.9.
Moisture Sensing Automatic Plant Watering System Using Arduino Uno
Khan Shifa American Journal of Engineering Research (AJER), (7), 326–330.
Zaragoza, M. G., & Kim, H. (2017). Comparative Study of PLC and Arduino in Automated Irrigation
System, 10(6), 207–218.

DATE: pH and electroconductivity sensors could be used in places where monitoring is required
These parameters and send the data wirelessly in real time to the people who require it and implement
to comment on an app

You might also like