loading

Heya guys....This one here is interesting as well as one of the crucial projects we have done so far. It uses a wide range and coolest of devices. We have sacrificed many a nights of sleep, bunked hours of classes and toiled in order to complete this project since we had a short span of time to complete it. The main intention of this project was to establish a systematic irrigation system in rural areas and hence help increase in production rate for farmers.

This tutorial deals with every aspect of fabricating a robust irrigation remote.This guide incorporates the theory of operations of almost all elements, the making of the remote from its most basic components to its dense circuit design and also the configuration and innermost working of the softwares.

This remote can control pumps and sprinklers that are at a 2 mile radius from it. We have created two systems in
order to analyze our work. One system is the remote itself and the other is a miniature model of the agricultural field. The remote consists of LCD, a microcontroller, a RF module and switches. On the other hand the model of the field consists of a small suction pump, sprinklers, sensors, a microcontroller and another RF module.

Step 1: BASIC REQUIREMENTS TO DO THE REMOTE AND PROTOTYPE OF THE FIELD

I did this with the help of my team members and hence we were able to complete this job in a week. So you will
need the knowledge of the following things:
1) Basic electronics or electrical.
2) How to write codes in C language (programming Arduino boards to be precise)
3) Making small models from thermocol and plywood.
4) How to solder.
Don't freak out if you do not know any of the above mentioned things. You can learn of of them while doing this project. Its easy and quite a lot of fun at the same time.
And of course you will need abundance of time and resources.

Step 2: COMPONENTS REQUIRED

The below list contains all the components to build this remote along with the model of the field. Do keep in
mind that the softwares used are not mentioned in this list. We will reveal them in the next step.

  • Xbee Pro S2B – 2 pieces (other versions of Xbee can also be used)
  • AVR Microcontroller –ATMega328 and Arduino board- 2 pieces ( or make your own board using microcontroller, capacitors, resistors and 16 MHz crystal)
  • B-bus cables.
  • Graphical Liquid Crystal Display – KS0108B
  • Switches – 3
  • Relay Drivers – 5V trigger
  • Temperature sensors,Water level indicators and Moisture sensors (we made our very own water level indicators and moisture sensors).
  • DC 9V battery and 12V LIPO battery.
  • 10 pin wire sets and loads of multi strand and single strand wires.
  • Potentiometer.
  • Resistors.
  • Capacitors 104 PF and 103PF.
  • Suction Pump.
  • Thermocol- for constructing a small model of the field.
  • Plywood- for the frame of the remote
  • Male pins.
  • PCB board
  • IC 7805
  • IC ULN2803
  • Solder gun, flux and lead.

Step 3: SOFTWARES USED

We have used only two softwares and luckily they are both freely available on the internet. They
provide a very user friendly platform to run codes.

  • 1) X-CTU IDE
  • 2) Arduino IDE.

X-CTU is software provided by Digi International to configure their Xbee modules that run on Zigbee protocol. On the other hand the Arduino Integrated Development Environment is a software where in you can tell your Arduino what to do by writing code in the Arduino programmming language. Sadly two computers are required when you are working with two arduinos simultaneously, and in this case you definitely have to if you want to test your own codes. If you are a person with a time and patience then this is definitely your type of work. To be frank you need not be a geek in order to configure these softwares.

Step 4: CONFIGURING XBEE USING X-CTU

XBee PRO S2B is a radio module which uses ZigBee protocol IEEE 802.14.5 for wireless transmission of data. It has a range of 2 miles in line of sight and 90 meter indoors. It has got 11 digital input or output pins and 4 analog input pins.

We have made use of only 4 pins of XBee out of 20 pins. This is sufficient to transmit data between different modules. We have given a power supply of 3.3V with current rating of 40mA. The radio has data rate of 250kbps with the frequency of 2.4GHz. Along with the XBee it is preferable to buy an adapter as it makes the configuration easy. For long distance transmission of data using XBee modules RF modules, a minimum of two XBee’s are compulsory that is one coordinator and a router.
We have elaborated what a coordinator and a router is in the following sections:
Coordinator – Every network requires one coordinator and it is in charge of setting up the network. It can never sleep or shut down.

Router – Multiple routers may exist in a network. It relays signals from other routers and hence may or may not sleep depending on the network. (End points also can be present in a network but we have not made use of them)

There are two modes of operation when we are dealing with configuration of the XBee.

Transparent– If data is generated from the XBee itself then both XBee’s should be set to AT. In this scenario two way communication is possible .
Command – If one XBee is sensing data, that XBee should be in AT mode while the receiving one should be in API mode.
Sleep Mode - The other mode is the sleep mode wherein the XBee goes into low power state and shuts down data transmission.
Since our project requires two way communication, both the XBee’s are configured to AT mode. The configuration is as follows.

As mentioned in the software section XBee is configured using X-CTU. You can download the software from the site http://www.digi.com/support/productdetail?pid=335... Download the XCTU ver. 5.2.8.6 installer. Once the download is complete, run the setup and choose the directory you desire. Open the software and follow the below instructions.
In X-CTU software select the tab PC Settings where you will get a list of ports and then select your appropriate port using the device manager. On the right hand side you can find options such as Baud, Flow control, Data
bits, Parity and Stop Bits. Set the following values:
Baud: 9600
Flow Control: Hardware
Data Bits: 8
Parity: NONE
Stop Bits: 1
Then press Test/Query. You will obtain the following dialog box COM TEST/QUERY. If such a dialog box doesn’t appear then another box INFO(COM PORT) will appear. If the latter box appears then connect the ground to the reset pin of the Xbee till the first dialog box appears.
Next click on the modem configuration tab. Set the modem and version to the values that appeared in the dialog box. The following instructions are the most important ones. Set one of the XBee to coordinator in AT mode and another XBee to router in AT mode in the Function Set. Then click on PAN ID and give same values for both the XBees. In the IDE of the router set the channel verification to 1. The Serial Number High of the router should be
same as the Destination Address High of the coordinator and the Serial Number Low of the router should be same as the Destination Address Low of the coordinator. On the other hand Serial Number High of the coordinator should be same as the Destination Address High of the router and the Serial Number Low of
the coordinator should be same as the Destination Address Low of the router. Now your XBees are ready to be used in the circuit.

Step 5: HOW TO DOWNLOAD AND WORK WITH ARDUINO

The Arduino board is a flexible electronic platform that has elegant hardware and software. It can be interfaced with a large number and variety of devices. It has 14 digital input/ output pins( of which 6 can be used as PWM outputs), 6 analog inputs, a 16MHz clock, a USB connection, a power jack, and a reset button. It has a flash memory of 32KB and 1KB EEPROM.The core component of the Arduino board is the microcontroller IC Atmel ATMEGA328 that controls every device interfaced with the board. It can be programmed using the Arduino Integrated Development Environment that has a very user friendly window of interfacing options.
The Arduino IDE can be downloaded from the site http://www.arduino.cc/ . The latest version is Arduino 1.0.5 and can be executed all the platforms mentioned on the site.


The Arduino IDE runs on the embedded C platform. The program mainly consists of two functions.
1) void setup() and
2) void loop()


void setup() is used only once after the inception of the program whereas the function void loop() gets executed indefinitely.void setup() is used to tell the microcontroller what pins have been used and to establish the baud rate in serial communication. Whereas in void loop() all the inputs are obtained, processed based on the program and outputs are produced. All the conditional statements and functions are written in void loop().
Arduino site offers all the tutorials a beginner requires to learn all the syntax of Arduino programming language.
We have given a list of syntaxes that we have used in the Arduino IDE.
#include: This line is used to include a library that contains the definitions of all serial communication programs. This is written at the beginning of the program.
Xbee.begin(Baud rate): This is used to establish serial communication between the microcontroller and the XBee.
Xbee.read(): To read all the values from the XBee by connecting the TX of the Arduino to the RX of the Xbee.
Xbee.write(): To write all the values into the XBee by connecting the TX of the Xbee to the RX of the Arduino.

Step 6: INTRODUCING THE GLCD AND INTERFACING WITH ARDUINO

The graphic LCD that I have used is ks0108B which consists of 128x64 pixels. You can download the documentation from the internet and yes it is free again. Also this is compatible with Arduino and one of the main reasons that I have used this LCD is that there is a pre existing library for the GLCD in the Arduino site. Make sure to download Version 3 onto your computer and import it by using the command: #include

There are other libraries that come along with download which have to be imported also. You can do it by simply writing: #include "fonts/SystemFont5x7.h".

Make sure to write the above mentioned commands are written at the start of the program. The 128X64 pixels are divided into 127columns and 8 rows. The sole purpose of this LCD is to provide a graphical interface to the user where in the user can monitor the tasks currently being performed. It is initialised using the command: GLCD.init(); which is written in the setup section.

The cursor on the LCD can be set using the command: GLCD.CursorTo(column,row);.

The data’s can be printed using the command: GLCD.print();.

Also the screen can be cleared with the command: GLCD.ClearScreen();.

So these are all the softwares and devices that you will be needing to build this project. In the coming steps I will guide you to make circuits and the two systems mentioned earlier.

Step 7: DEVICES ON THE FIELD

MOTOR DRIVER (relay):

Relays are electrically operated switches. They use an electromagnetic coil to pull the poles of the switch into position. Most relays return to the normally closed position by a spring when the coil is de-energized, so relay contacts are usually identified as a momentary contact switch.

Inner view of a relay:

The relays triggered using the ULN2803 IC .ULN2803 IC is an eight NPN Darlington connected transistors. This family of arrays are ideally suited for interfacing between low logic level digital circuitry (such as TTL, CMOS or PMOS/NMOS) and the higher current/voltage requirements of lamps, relays and printer hammers.

TEMPERATURE SENSOR:

The LM35 series are precision integrated temperature sensor. The LM35 is rate to operate over a -55degree to +15 degree Celsius. This sensor senses the field temperature and it is interfaced with the microcontroller. The proposed system maintains the temperature range between 24°C to 35°C. This value is manually changed according to the seasonal temperature.

SOIL MOISTURE SENSOR:

This sensor senses the field humidity and it is connected to the microcontroller. It consists of two electrodes that are separated by a small distance. When there is no water there is no connection between the two and the output is zero. But when there is water in the field the output is high as water is a good conductor of electricity.

Step 8: CONSTRUCRTION OF THE REMOTE

The frame of the remote was constructed using light weight high strength plywood. We first fabricated the remote as per our need and then bolted the components such as Xbee, Arduino, LCD and switches onto it. We made a remote that could be opened from the front and Velcro was used to seal it tightly. Slots of sizes corresponding to the devices were made and then they were glued down using hot glue. All the required circuit connections were done and the entire circuit of the design was placed inside the remote. To make sure that our remote had an attractive appearance we covered it up using seat covers.

Step 9: CONSTRUCTION OF THE FIELD

For the field to be similar to an actual field, 100x50x4 cms thermocol was used for easy modifications. To create the crop irrigation field, 40x30 cms rectangular area was cut side by side. 6 mm plywood of the exact dimensions as that of the thermocol was attached below the altered field to ensure greater strength to the thermocol.
All the electronics was fitted inside the shed which was built using 4 mm plywood. As a water reservoir is usually present in an irrigation area, a small water resource was made using a plastic box. The plumbing work was done by cutting slots that fitted the pipe diameter exactly, thus no pipes could not be seen on the surface of the field. Later the slots were covered with tissue paper and a coat of fevicol with water was applied. Allow the coat to dry for a day. Apply 3-4 coats of tissue paper for better strength and water resistance. The wiring of the field was also done in the same manner as that of piping. To prevent leakage of water from the field the polyethylene plaster, which is a good water resister was applied. A small fountain was built near the water reservoir using gravels and grout. Once the final coating of tissue paper is applied on the complete field, corresponding colours of the field was painted using poster colours. Before painting, ensure that the coat of tissue paper is completely dried. For a darker shade apply another coat of colour depending on your taste.The built shed is placed on the planned area in the field. The field is water tested. If any leakage is found put another coat of polyethylene plaster to seal the leakage. If no leakage is found, the field is filled with mud and two different crops are ploughed. Sprinkle required amount of water every day for a steady growth of the crops. The field can be fenced along the edge of the field.

Step 10: CIRCUIT DIAGRAM

There are two main circuit diagrams in this entire project. One is the circuit of the remote and the other the field's circuit.

The remotes circuit consists of a LCD, an Arduino, a Xbee, IC 7805, Switches and loads of wires. The remote's circuit is shown in the images using Fritzing.

The field circuit comprises of an Arduino, a Xbee, IC 7805, motor driver, moisture sensors and temperature sensors. Also a suction pump is connected so that water can be pumped onto the filed.

Step 11: CODES

REMOTE PROGRAM:

#include <glcd.h>

#include<SoftwareSerial.h>

SoftwareSerial xbee(2,3);

#include "fonts/SystemFont5x7.h"

int p;

int s, au;

char a,b,c;

void setup()

{

Serial.begin(9600);

xbee.begin(9600);

pinMode(A5,INPUT);

pinMode(12,INPUT);

pinMode(13,INPUT);

GLCD.Init();

GLCD.CursorTo(6,1);

GLCD.print("DREAMERS");

GLCD.CursorTo(3,3);

GLCD.print("BRINGING DREAMS");

GLCD.CursorTo(6,5);

GLCD.print("TO REALITY");

delay(2000);

GLCD.ClearScreen();

}

void loop()

{

if(xbee.available())

{

a = xbee.read();

b = xbee.read();

c = xbee.read();

}

Serial.print("a:");

Serial.print(a);

Serial.print("\t");

Serial.print("b:");

Serial.print(b);

Serial.print("\t");

Serial.print("c:");

Serial.print(c);

Serial.print("\t");

Serial.println();

int btn1 = analogRead(A5);

int btn2 = digitalRead(12);

int btn3 = digitalRead(13);

if( btn3 == 1 )

{

au = 49;

p=48;

s=48;

}

else if ( btn3 == 0 )

{

au = 48;

if( btn1 > 1000 )

{

p=49;

}

else

{

p=48;

}

if( btn2 == 1 )

{

s=49;

}

else

{

s=48;

}

}

xbee.write(au);

xbee.write(p);

xbee.write(s);

if( btn3 == 1 )

{

GLCD.ClearScreen();

GLCD.CursorTo(4,0);

GLCD.print("AUTOMATIC MODE ");

}

else if ( btn3 == 0 )

{

GLCD.ClearScreen();

GLCD.CursorTo(5,0);

GLCD.print("MANUAL MODE ");

if( btn1 > 1000 )

{

GLCD.CursorTo(0,2);

GLCD.print("PUMP ON ");

}

else

{

GLCD.CursorTo(0,2);

GLCD.print("PUMP OFF ");

}

if( btn2 == 1 )

{

GLCD.CursorTo(0,4);

GLCD.print("SPRINKLER ON ");

}

else

{

GLCD.CursorTo(0,4);

GLCD.print("SPRINKLER OFF ");

}

}

if( a== '1' && au == 49)

{

GLCD.CursorTo(0,2);

GLCD.print("PUMP ON ");

GLCD.CursorTo(0,4);

GLCD.print("SPRINKLER ON ");

}

else if(a== '0' && au == 49)

{

GLCD.CursorTo(0,2);

GLCD.print("PUMP OFF ");

GLCD.CursorTo(0,4);

GLCD.print("SPRINKLER OFF ");

}

delay(10);

}

FIELD PROGRAM:

#include<SoftwareSerial.h>

SoftwareSerial Rxbee(2,3);

int pump;

int sprink;

char au,b,c,m,lev;

void setup()

{

Serial.begin(9600);

Rxbee.begin(9600);

pinMode(8,OUTPUT);

pinMode(A0,INPUT);

pinMode(A1,INPUT);

pinMode(A2,INPUT);

pinMode(A3,INPUT);

pinMode(A4,INPUT);

}

void loop()

{

if(Rxbee.available())

{

au = Rxbee.read();

Serial.print(au);

Serial.print("\t");

b = Rxbee.read();

Serial.print(b);

Serial.println("\t");

c = Rxbee.read();

Serial.println(c);

}

if( au == '1')

{

int temp = analogRead(A0);

float t = temp * .48828125;

Serial.print("t:");

Serial.println(t);

if( lev == 48 )

{

if(mos < 1000)

{

digitalWrite(8,LOW);

pump = 48;

Serial.print("auto pump off");

}

else

{

pump=49;

digitalWrite(8,HIGH);

Serial.print("auto pump on");

}

else

{

pump = 48;

digitalWrite(8,LOW);

}

}

else if( au == '0')

{

if( b == '1' && c == '1' )

{

digitalWrite(8,HIGH);

Serial.println("man both on");

}

else if ( b =='1' && c == '0')

{

Serial.println("man pump on");

digitalWrite(8,HIGH);

}

else if ( b =='0' && c == '1')

{

Serial.println("man sprink on");

digitalWrite(8,HIGH);

}

else if ( b =='0' && c == '0')

{

Serial.println("man both off");

digitalWrite(8,LOW);

}

else

{

Serial.println("no");

digitalWrite(8,LOW);

}

}

int lev0 = analogRead(A1);

int lev1 = analogRead(A2);

int lev2 = analogRead(A3);

int mos = analogRead(A4);

Serial.println(lev0);

Serial.println(lev1);

Serial.println(lev2);

Serial.println(mos);

//******* water level indicator ******

if((lev0 < 1000) && (lev1 < 1000) && (lev2 < 1000))

{

Serial.println("water level full");

lev = 51;

}

else if((lev0 < 1000) && (lev1 < 1000))

{

Serial.println("level 2");

lev = 50;

}

else if (lev0 < 1000)

{

Serial.println("level 1");

lev = 49;

}

else

{

Serial.println("no water");

lev = 48;

}

/***********moisture value***********/

if(mos > 1005)

{

Serial.print("mos no water");

m = 48;

}

else if(mos >990)

{

Serial.print("partially wet field");

m = 49;

}

else if (mos > 980)

{

Serial.print("wet field");

m =50;

}

else if(mos > 960)

{

Serial.print("Sufficient water");

m = 51;

}

else

{

Serial.print("water overflow");

m = 52;

}

Rxbee.write(pump);

Rxbee.write(lev);

Rxbee.write(m);

delay(10);

}

<p>Very nice project - Surprisingly not more popular.</p><p>I've created about the same thing with various differences to actually remote control our irrigation pumps although went with the S3B XBee for better signal reliability.</p><p>If interested the project is @ </p><p>https://github.com/tgit23/AgIrrigationRemoteControl</p>
<p>Nice project!</p>

About This Instructable

4,717views

38favorites

License:

More by Johnson Tellis:COMPACT AND ROBUST AUTOMATED AGRICULTURE REMOTE Home Made Mecanum Wheels  
Add instructable to: