Automatic Irrigation system using 8051

 INTRODUCTION

In a country like India, the agriculture plays the important role in the economy and development of the country. At the present era, the farmers have been using irrigation technique in India through the manual control in which the farmers irrigate the land at the regular intervals. This process sometimes consumes more water or sometimes the water reaches late due to which the crops get dried . There is a need in the residential/commercial irrigation industry for an irrigation controller that responds to soil moisture sensors in individual zones as a way of conserving water. An ideal controller should be "user friendly", i.e., easy to program and requiring a minimum number of keys or push-buttons to operate the controller. It should also allow irrigation to take place in zones where watering is required, while by passing zones where adequate soil moisture is indicated- To add flexibility, it should be possible to selectively deactivate any of the moisture sensors to thereby override the modification to the controller performance caused by sensor inputs. Moreover, the system should be easy to trouble shoot in the event of faults in any of the plurality of zones




BLOCK DIAGRAM:


WORKING
      When the soil is dry (putting dry cotton piece), lack of moister content, is detect in the sensor. The motor starts working, ie irrigation process starts. At the same time, a message is  send to the owner as “MOTOR ON”
      When the soil is wet (putting wet cotton piece), moister content, is detect in the sensor. The motor stops working, ie irrigation process stops. At the same time, a message is  send to the owner as “MOTOR OFF”
      The owner can conrol the operation of the motor by sending a text message as XMOF for motor off and XMON for motor on through gsm modem

CIRCUIT DIAGRAM






Program Flow Chart




PROGRAM: FOR AUTOMATIC IRIGATION SYSTEM

#include <REGX51.H>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

sbit M0 = P1^0;
sbit MS = P3^2;

unsigned char code at[] = "at\r";
unsigned char code text[] = "at+cmgf=1\r";
unsigned char code msgsend[] = "at+cmgs=\"99952468x3\"\r";
unsigned char code delete[] = "at+cmgd=1\r";
unsigned char code rec[] = "at+cmgr=1\r";
unsigned char msg[11];
unsigned char rxd = 'C',c,rxdtemp[4];
unsigned int i,flag = 0,flag1 = 0;
unsigned char code q0[10] = "MOTOR ON ";
unsigned char code q1[10] = "MOTOR OFF";
unsigned char code a1[4]="MON";
unsigned char code b1[4]="MOF";
void delay();
void messagereceive();
void messagesend();
void update();
void check();

void main()
{
TMOD = 0x20;
SCON = 0x50;
TH1 = 0xFD;
TL1 = 0xFD;
TR1 = 1;
TI = 1;
M0 = 0;
P1_0 = 0;
P3_2 = 1;
while(1)
            {
            P2 = ~P2;

            if(flag1 == 0)
            {
if(MS == 0)
                        {
                        M0 = 1;
                        sprintf(msg,"%s",q0);
                        messagesend();
                        flag1 = 1;
                        }
            }         
            else if(MS == 1)
                        {
                        M0 = 0;
                        sprintf(msg,"%s",q1);
                        messagesend();
                        flag1 = 0;
                        }

            messagereceive();
            puts(rxdtemp);
            puts(a1);
            puts(b1);
            if(flag == 1)
                        {
                        if(!strcmp(rxdtemp,a1))           
                                    {
                                    M0 = 1;
                                    sprintf(msg,"%s",q0);
                                    messagesend();
                                    }
                        else if(!strcmp(rxdtemp,b1))
                                    {
                                    M0 = 0;
                                    sprintf(msg,"%s",q1);
                                    messagesend();
                                    }         
                        flag = 0;
                        }                                             
            }            
}

void messagereceive()
{
delay();
for(i=0;i<3;i++)    
   {
   putchar(at[i]);
   }
delay();

for(i=0;i<10;i++)      
   {
   putchar(text[i]);
   }
delay();

for(i=0;i<10;i++)    
   {
   putchar(rec[i]);
   }

for(i=0;i<15;i++)
            {
            rxdtemp[i] = _getkey();
            }
rxdtemp[i] = '\0';

if(rxdtemp[13] == 'E')
            {
            goto fun_end;
            flag = 0;
            }
delay();

for(i=0;i<10;i++)     //Receiving message
   {

   putchar(rec[i]);
   }
flag = 1;

while(rxd != 'X')
   {
   rxd = _getkey();
   }
rxd = '$';
i=0;
for(i = 0;i < 3;i++)
   {
   c = _getkey();
   rxdtemp[i] = c;        
   }
rxdtemp[i] = '\0';

fun_end:
rxd = '$';
c = '$';
delay();

for(i=0;i<10;i++)      
   {
   putchar(delete[i]);
   }      
delay();
delay();
delay();
delay();              
}

void delay()
 {
 unsigned int j;
 for(j=0;j<10000;j++);
 for(j=0;j<10000;j++);
}

void messagesend()
{
delay();
for(i=0;i<3;i++)    
   {
   putchar(at[i]);
   }
delay();

for(i=0;i<10;i++)      
   {
   putchar(text[i]);
   }
delay();
 
for(i=0;i<21;i++)      
   {
   putchar(msgsend[i]);
   }
delay();

for(i=0;i<11;i++)      
   {
   putchar(msg[i]);
   }
putchar(0x1A);

delay();
}                         

HARDWARE & SOFTWARE SPECIFICATIONS

POWER SUPPLY
Power supply is a reference to a source of electrical power. A device or system that supplies electrical or other types of energy to an output load or group of loads is called a power supply unit or PSU. The term is most commonly applied to electrical energy supplies, less often to mechanical ones, and rarely to others. Here in our application we need a 5v DC power supply for all electronics involved in the project. This requires step down transformer, rectifier, voltage regulator, and filter circuit for generation of 5v DC power. 
8051 MICROCONTROLLER
         The AT89C51 is a low-power, high-performance CMOS 8-bit microcomputer with 4K bytes of Flash programmable and erasable read only memory (PEROM). The device is manufactured using Atmel’s high-density nonvolatile memory technology and is compatible with the industry-standard MCS-51 instruction set and pinout. The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional nonvolatile memory programmer. By combining a versatile 8-bit CPU with Flash on a monolithic chip, the Atmel AT89C51 is a powerful microcomputer which provides a highly-flexible and cost-effective solution to many embedded control applications.

Features
• Compatible with MCS-51™ Products
• 4K Bytes of In-System Reprogrammable Flash Memory
– Endurance: 1,000 Write/Erase Cycles
• Fully Static Operation: 0 Hz to 24 MHz
• Three-level Program Memory Lock
• 128 x 8-bit Internal RAM
• 32 Programmable I/O Lines
• Two 16-bit Timer/Counters
• Six Interrupt Sources
• Programmable Serial Channel
• Low-power Idle and Power-down Modes
TRANSFORMER
A transformer is a device that transfers electrical energy from one circuit to another through inductively coupled conductors — the transformer's coils or "windings". Except for air-core transformers, the conductors are commonly wound around a single iron-rich core, or around separate but magneticallycoupled cores. A varying current in the first or "primary" winding creates a varying magnetic field in the core (or cores) of the transformer. This varying magnetic field induces a varying electromotive force (EMF) or "voltage" in the "secondary" winding. This effect is called mutual induction. If a load is connected to the secondary circuit, electric charge will flow in the secondary winding of the transformer and transfer energy from the primary circuit to the load connected in the secondary circuit. The secondary induced voltage VS, of an ideal transformer, is scaled from the primary VP by a factor equal to the ratio of the number of turns of wire in their respective windings.
By appropriate selection of the numbers of turns, a transformer thus allows an alternating voltage to be stepped up — by making NS more than NP — or stepped down, by making it

BASIC PARTS OF A TRANSFORMER
In its most basic form a transformer consists of
A primary coil or winding
A secondary coil or winding
A core that supports the coils or windings
              The primary winding is connected to a 60-hertz ac voltage source. The magnetic field (flux) builds up (expands) and collapses (contracts) about the primary winding. The expanding and contracting magnetic field around the primary winding cuts the secondary winding and induces an alternating voltage into the winding. This voltage causes alternating current to flow through the load. The voltage may be stepped up or down depending on the design of the primary and secondary windings.

THE COMPONENTS OF A TRANSFORMER
                 Two coils of wire (called windings) are wound on some type of core material. In some cases the coils of wire are wound on a cylindrical or rectangular cardboard form. In effect, the core material is air and the transformer is called an AIR-CORE TRANSFORMER. Transformers used at low frequencies, such as 60 hertz and 400 hertz, require a core of low-reluctance magnetic material, usually iron. This type of transformer is called an IRON-CORE TRANSFORMER. Most power transformers are of the iron-core type. The principle parts of a transformer and their functions are: The CORE, which provides a path for the magnetic lines of flux. The PRIMARY WINDING, which receives energy from the ac source. The SECONDARY WINDING, which receives energy from the primary winding and delivers it to the load. The ENCLOSURE, which protects the above components from dirt, moisture, and mechanical damage.

BRIDGE RECTIFIER
A bridge rectifier makes use of four diodes in a bridge arrangement to achieve fullwave rectification. This is a widely used configuration, both with individual diodes wired as shown and with single component bridges where the diode bridge is wired internally.
BASIC OPERATION
According to the conventional model of current flow originally established by Benjamin Franklin and still followed by most engineers today, current is assumed to flow through electrical conductors from the positive to the negative pole. In actuality, free electrons in a conductor nearly always flow from the negative to the positive pole. In the vast majority of applications, however, the actual direction of current flow is irrelevant. Therefore, in the discussion below the conventional model is retained. When the input connected to the left corner of the diamond is positive, and the input connected to the right corner is negative, current flows from the upper supply terminal to the right along the red (positive) path to the output, and returns to the lower supply terminal via the blue (negative) path. When the input connected to the left corner is negative, and the input connected to the right corner is positive, current flows from the lower supply terminal to the right along the red path to the output, and returns to the upper supply terminal via the blue path.
                In each case, the upper right output remains positive and lower right output negative. Since this is true whether the input is AC or DC, this circuit not only produces a DC output from an AC input, it can also provide what is sometimes called "reverse polarity protection". That is, it permits normal functioning of DC-powered equipment when batteries have been installed backwards, or when the leads (wires) from a DC power source have been reversed, and protects the equipment from potential damage caused by reverse polarity. Prior to availability of integrated electronics, such a bridge rectifier was always constructed from discrete components. Since about 1950, a single four-terminal component containing the four diodes connected in the bridge configuration became a standard commercial component and is now available with various voltage and current ratings. For many applications, especially with single phase AC where the full-wave bridge serves to convert an AC input into a DC output, the addition of a capacitor may be desired because the bridge alone supplies an output of fixed polarity but continuously varying or "pulsating" magnitude. The function of this capacitor, known as a reservoir capacitor (or smoothing capacitor) is to lessen the variation in (or 'smooth') the rectified AC output voltage waveform from the bridge. One explanation of 'smoothing' is that the capacitor provides a low impedance path to the AC component of the output, reducing the AC voltage across, and AC current through, the resistive load. In less technical terms, any drop in the output voltage and current of the bridge tends to be canceled by loss of charge in the capacitor. This charge flows out as additional current through the load. Thus the change of load current and voltage is reduced relative to what would occur without the capacitor. Increases of voltage correspondingly store excess charge in the capacitor, thus moderating the change in output voltage / current. The simplified circuit shown has a well-deserved reputation for being dangerous, because, in some applications, the capacitor can retain a lethal charge after the AC power source is removed. If supplying a dangerous voltage, a practical circuit should include a reliable way to safely discharge the capacitor. If the normal load cannot be guaranteed to perform this function, perhaps because it can be disconnected, the circuit should include a bleeder resistor connected as close as practical across the capacitor. This resistor should consume a current large enough to discharge the capacitor in a reasonable time, but small enough to minimize unnecessary power waste.
                  Because a bleeder sets a minimum current drain, the regulation of the circuit, defined as percentage voltage change from minimum to maximum load, is improved. However in many cases the improvement is of insignificant magnitude. The capacitor and the load resistance have a typical time constant H = RC where C and R are the capacitance and load resistance respectively. As long as the load resistor is large enough so that this time constant is much longer than the time of one ripple cycle, the above configuration will produce a smoothed DC voltage across the load. In some designs, a series resistor at the load side of the capacitor is added. The smoothing can then be improved by adding additional stages of capacitor–resistor pairs, often done only for subsupplies to critical high-gain circuits that tend to be sensitive to supply voltage noise. The idealized waveforms shown above are seen for both voltage and current when the load on the bridge is resistive. When the load includes a smoothing capacitor, both the voltage and the current waveforms will be greatly changed. While the voltage is smoothed, as described above, current will flow through the bridge only during the time when the input voltage is greater than the capacitor voltage. For example, if the load draws an average current of n Amps, and the diodes conduct for 10% of the time, the average diode current during conduction must be 10n Amps. This nonsinusoidal current leads to harmonic distortion and a poor power factor in the AC supply.
                        In a practical circuit, when a capacitor is directly connected to the output of a bridge, the bridge diodes must be sized to withstand the current surge that occurs when the power is turned on at the peak of the AC voltage and the capacitor is fully discharged. Sometimes a small series resistor is included before the capacitor to limit this current, though in most applications the power supply transformer's resistance is already sufficient. Output can also be smoothed using a choke and second capacitor. The choke tends to keep the current (rather than the voltage) more constant. Due to the relatively high cost of an effective choke compared to a resistor and capacitor this is not employed in modern equipment. Some early console radios created the speaker's constant field with the current from the high voltage ("B +") power supply, which was then routed to the consuming circuits, (permanent magnets were then too weak for good performance) to create the speaker's constant magnetic field. The speaker field coil thus performed 2 jobs in one: it acted as a choke, filtering the power supply, and it produced the magnetic field to operate the speaker.

REGULATOR IC (78XX)
           It is a three pin IC used as a voltage regulator. It converts unregulated DC current into regulated DC current. Normally we get fixed output by connecting the voltage regulator at the output of the filtered DC (see in above diagram). It can also be used in circuits to get a low DC voltage from a high DC voltage (for example we use 7805 to get 5V from 12V). There are two types of voltage regulators 1. Fixed voltage regulators (78xx, 79xx) 2. Variable voltage regulators (LM317) In fixed voltage regulators there is another classification 1. +ve voltage regulators 2. -ve voltage regulators POSITIVE VOLTAGE REGULATORS this include 78xx voltage regulators. The most commonly used ones are 7805 and 7812. 7805 gives fixed 5V DC voltage if input voltage is in (7.5V, 20V).

CAPACITOR FILTER
The simple capacitor filter is the most basic type of power supply filter. The application of the simple capacitor filter is very limited. It is sometimes used on extremely high-voltage, lowcurrent power supplies for cathode ray and similar electron tubes, which require very little load current from the supply. The capacitor filter is also used where the power-supply ripple frequency is not critical; this frequency can be relatively high. Full-wave rectifier with a capacitor filter. When this filter is used, the RC charge time of the filter capacitor (C1) must be short and the RC discharge time must be long to eliminate ripple action. In other words, the capacitor must charge up fast, preferably with no discharge at all. Better filtering also results when the input frequency is high; therefore, the full-wave rectifier output is easier to filter than that of the half-wave rectifier because of its higher frequency.
LIQUID CRYSTAL DISPLAY
In this project we are using a 16*2 5*7 matrix alphanumeric LCD. The LCD panel’s Enable and Register Select is connected to the Control Port. The Control Port is an open collector / open drain output. Therefore by incorporating the two 10K external pull up resistors, the circuit is more portable for a wider range of computers, some of which may have no internal pull up resistors. I make no effort to place the Data bus into reverse direction. Therefore I had wire the R/W line of the LCD panel, into write mode. This will cause no bus conflicts on the data lines. As a result I cannot read back the LCD’s internal Busy Flag which tells us if the LCD has accepted and finished processing the last instruction. This problem is overcome by inserting known delays into my program. The 10k Potentiometer controls the contrast of the LCD panel. Nothing fancy here. I used a power supply of 5volt. The user may select whether the LCD is to operate with a 4-bit data bus or an 8- bit data bus. If a 4-bit data bus is used, the LCD will require a total of 7 data lines. If an 8-bit data bus is used, the LCD will require a total of 11 data lines. LCD with 8- bit data bus is used for this design. The three control lines are EN, RS, and RW. EN line must be raised/lowered before/after each instruction sent to the LCD regardless of whether that 36 instruction is read or write text or instruction. In short, manipulate EN when communicating with the LCD.


GSM MODEM
GSM (Global System for Mobile communications: originally from GROUPE Special Mobile) is the most popular standard for mobile phones in the world. Its promoter, the GSM Association, estimates that 80% of the global mobile market uses the standard. GSM is used by over 3 billion people across more than 212 countries and territories. Its ubiquity makes international roaming very common between mobile phone operators enabling subscribers to use their phones in many parts of the world. GSM differs from its predecessors in that both signaling and speech channels are digital, and thus is considered a second generation (2G) mobile phone system. This has also meant that data communication was easy to build into the system.
GSM Architecture
GSM is a complex system and difficult to understand. The Mobile Station (MS) refers to the mobile equipment. The Base Station Subsystem controls the radio link with the Mobile Station. The Network Subsystem performs main functions such as switching of calls between mobile users, mobility management operations, and proper operation and setup of a network. These functions are controlled by the Mobile Services Switching Center (MSC).
Technical Details
GSM is a cellular network, which means that mobile phones connect to it by searching for cells in the immediate vicinity.
GSM Frequencies :GSM networks operate in a number of different frequency ranges (separated into
GSM frequency ranges for 2G and UMTS frequency bands for 3G). Most 2G GSM networks operate in the 900 MHz or 1800 MHz bands. Some countries in the Americas (including Canada and the United States) use the 850 MHz and 1900 MHz bands because the 900 and 1800 MHz frequency bands were already allocated. Most 3G GSM networks in Europe operate in the 2100 MHz frequency band Network Structure The network behind the GSM seen by the customer is large and complicated in order to provide all of the services which are required.
: The Base Station Subsystem.
: The Network and Switching Subsystem. This is sometimes also just called the core
Network.
: The GPRS Core Network.
: All of the elements in the system combine to produce many GSM services such as voice calls and SMS.
                      Subscriber Identity Module (SIM) One of the key features of GSM is the Subscriber Identity Module, commonly known as a SIM card. The SIM is a detachable smart card containing the user's subscription information and phone book. This allows the user to retain his or her information after switching handsets . Alternatively, the user can also change operators while retaining the handset simply by changing the SIM. Some operators will block this by allowing the phone to use only a single SIM, or only a SIM issued by them; this practice is known as SIM locking, and is illegal in some countries. A GSM modem is a wireless modem that works with a GSM wireless network. A Wireless modem behaves like a dial-up modem. The main difference between them is that a dial-up modem sends and receives data through a fixed telephone line while a wireless modem sends and receives data through radio waves. Like a GSM mobile phone, a GSM modem requires a SIM card from a wireless carrier in order to operate.
Accessing GSM MODEM using Microsoft HyperTerminal Microsoft HyperTerminal is a small program that comes with Microsoft Windows. We use it to send AT commands to the GSM modem. It can be found at Start -> Programs -> Accessories -> Communications -> HyperTerminal. Before programming our SMS application, it is required to check if the GSM modem and SIM card are working properly first. The MS HyperTerminal is a handy tool when it comes to testing the GSM device. It is a good idea to test the GSM devices beforehand. When a problem occurs, sometimes it is difficult to tell what causes the problem. The cause can be the program, the GSM device or the SIM card. If GSM device and SIM card with MS HyperTerminal are operating properly, then it is very likely that the problem is caused by the program or other hardware . For Linux users, Mincom can be used instead of HyperTerminal.
       Testing of GSM Modem To use MS HyperTerminal to send AT commands to the GSM modem, the following procedure is followed
1. Put a valid SIM (MTN) card into the GSM modem. I obtain a SIM card by subscribing to the GSM service of a wireless network operator.
2. No need to install any driver for the GSM modem
3. Then I set up MS HyperTerminal by selecting Start -> Programs -> Accessories -> Communications -> HyperTerminal.
4. In the Connection Description dialog box, I enter any file name and choose an icon I like for the connection. Then I click the OK button. In the Connect To dialog box, choose the COM port that your mobile phone or GSM modem is connecting to in the Connect using combo box. I choose COM1 because my mobile phone is connected to the COM1 port. Then click the OK button. Type "AT" in the main window. A response "OK" will be returned from the mobile phone or GSM modem. Type "AT+CPIN?" in the main window. The AT command "AT+CPIN?" is used to query whether the mobile phone or GSM modem is waiting for a PIN (personal identification number,
i.e. password). If the response is "+CPIN: READY", it means the SIM card does not require a PIN and it is ready for use. If my SIM card requires a PIN, you need to set the PIN with the AT command "AT+CPIN=<PIN>".
List of Important AT Commands After successfully testing the MODEM for its correct operational state, I then set the MODEM parameters like Baud rate, Echo off etc to enable easier access via a microcontroller which I used in this project. The following are the ATCOMMAND used for programming the gsm modem Example: Changing and saving parameters
AT+IPR=9600[Enter] Transfer rate to 9600bps
AT&W [Enter] save parameters
AT+CMGF means convert the message to machine instruction format
AT+CPMS means selection of SMS memory
AT+CMGR means read message from a given memory location
AT+CMGD means delete message from a given memory location.
Microcontroller – Modem Interfacing DTE and DCE
          The terms DTE and DCE are very common in the data communications market. DTE is short for Data Terminal Equipment and DCE stands for Data Communications Equipment. As the full DTE name indicates this is a piece of device that ends a communication line, whereas the DCE provides a path for communication. Let's say I have a computer on which wants to communicate with the Internet through a modem and a dial-up connection. To get to the Internet I tell my modem to dial the number of my provider. After my modem has dialed the number, the modem of the provider will answer my call and I will hear a lot of noise. Then it becomes quiet and I see my login prompt or my dialing program tells me the connection is established. Now I have a connection with the server from my provider and I can surf the Internet RS-232
        In telecommunications, RS-232 is a standard for serial binary data signals connecting between a DTE (Data terminal equipment) and a DCE (Data Circuitterminating Equipment). It is commonly used in computer serial ports. In RS-232, data is sent as a time-series of bits. Both synchronous and asynchronous transmissions are supported by the standard. In addition to the data circuits, the standard defines a number of control circuits used to manage the connection between the DTE and DCE. Each data or control circuit only operates in one direction that is, signaling from a DTE to the attached DCE or the reverse. Since transmit data and receive data are separate circuits, the interface can operate in a full duplex manner, supporting concurrent data flow in both directions. The standard does not define character framing within the data stream, or character encoding.
RTS/CTS Handshaking
The standard RS-232 use of the RTS and CTS lines is asymmetrical. The DTE asserts RTS to indicate a desire to transmit and the DCE asserts CTS in response to grant permission. This allows for half-duplex modems that disable their transmitters when not required, and must transmit a synchronization preamble to the receiver when they are re enabled. There is no way for the DTE to indicate that it is unable to accept data from the DCE. A non-standard symmetrical alternative is widely used: CTS indicates permission from the DCE for the DTE to transmit, and RTS indicates permission from the DTE for the DCE to transmit. The "request to transmit" is implicit and continuous. The standard defines RTS/CTS as the signaling protocol for flow control for data transmitted from DTE to DCE. The standard has no provision for flow control in the other direction. In practice, most hardware seems to have repurposed the RTS signal for this function . A minimal “3-wire” RS-232 connection consisting only of transmits data, receives data and ground, and is commonly used when the full facilities of RS-232 are not required. When only flow control is required, the RTS and CTS lines are added in a 5-wire version. Specifying Baud Rate, Parity & Stop bits Serial communication using RS-232 requires four parameters: the baud rate of the transmission, the number of data bits encoding a character, the sense of the optional parity bit, and the number of stop bits. Each transmitted character is packaged in a character frame that consists of a single start bit followed by the data bits, the optional parity bit, and the stop bit or bits. A typical character frame encoding the letter "m" is shown here. I specified the parameters as baud rate – 9600 bps, 8 data bits, no parity, and 1 stop bit (9600-8 N-1). This was set in pre-operational phase while setting up the modem through the hyper terminal, as per the serial transmission standards in 8051 microcontroller.
DCE Baud Rates
110,300,1200,2400,4800,9600,19200,38400,57600,115200,230400,460800,921600 (Possible Baud Rates) Baud Rate Used Power on default rate.\


Soil Moisture Sensor
This sensor can be used to test the moisture of soil, when the soil is having water shortage, the module output is at high level, else the output is at low level. By using this sensor one can automatically water the flower plant, or any other plants requiring automatic watering technique. Module triple output mode, digital output is simple, analog output more accurate, serial output with exact readings.


Features
 Sensitivity adjustable.
 Has fixed bolt hole, convenient installation.
 Threshold level can be configured.
 Module triple output mode, digital output is simple, analog output more accurate, serial output with exact readings



KEIL Micro Vision IDE
KEIL Micro Vision is an integrated development environment used to create software to be run on embedded systems (like a microcontroller). It allows for such software to be written either in assembly or C programming languages and for that software to be simulated on a computer before being loaded onto the microcontroller. The software used is c programming μVision3 is an IDE (Integrated Development Environment) that helps write, compile, and debug embedded programs.

How to create a project in KEILuV3:
1. Select Project - New Project.
2. Select a directory and enter the name of the project file.
3. Select Project –Select Device and select a device from Device Database.
4. Create source files to add to the project
5. Select Project - Targets, Groups, and Files. Add/Files, select Source Group1, and add the Source files to the project.
6. Select Project - Options and set the tool options. Note that when the target device is selected from the Device Database all-special options are set automatically. Default memory model settings are optimal for most applications.
7. Select Project - Rebuild all target files or Build target. To create a new project, simply start micro vision and select “Project”=>”New Project” from the pull–down menus. In the file dialog that appears, a filename and directory was chosen for the project. It is recommended that a new directory be created for each project, as several files will be generated. Once the project has been named, a dialog will appear, prompting the user to select a target device. The chip being used is the “AT89C51,” which is listed under the heading “Atmel”. Next, Micro Vision was instructed to generate a HEX file upon program compilation. A HEX file is a standard file format for storing executable code that is to be loaded onto the microcontroller. In the “Project Workspace” pane at the left, right–click on “Target 1” and select “Options for ‘Target 1’ ”.Under the “Output” tab of the resulting options dialog, ensure that both the “Create Executable” and “Create HEX File” options are checked. Then click “OK”. Next, a file must be added to the project that will contain the project code. To do this, expand the “Target 1” heading, right–click on the “Source Group 1” folder, and select “Add files…” Create a new blank file (the file name should end in “.c”), select it, and click “Add.” The new file should now appear in the “Project Workspace” pane under the “Source Group 1” folder. Doubleclick on the newly created file to open it in the editor. To compile the program, first save all source files by clicking on the “Save All” button, and then click on the “Rebuild All Target Files” to compile the program as shown in the figure below. If any errors or warnings occur during compilation, they will be displayed in the output window at the bottom of the screen. All errors and warnings will reference the line and column number in which they occur along with a description of the problem so that they can be easily located. When the program has been successfully compiled, it can be simulated using the integrated debugger in Keil Micro Vision. To start the debugger, select “Debug”=>”Start/Stop Debug Session” from the pull–down menus. At the left side of the debugger window, a table is displayed containing several keyparameters about the simulated microcontroller, most notably the elapsed time. Just above that, there are several buttons that control code execution. The “Run” button will cause the program to run continuously until a breakpoint is reached, whereas the “Step Into” button will execute the next line of code and then pause.



                   The system provides with several benefits and can operate with less manpower. The system supplies water only when the soil is dry. Due to the direct transfer of water to the roots water conservation takes place and also helps to maintain the moisture to soil ratio at the root zone constant to some extend. Thus the system is efficient and compatible to changing environment. This system can be used in irrigation purpose and field monitoring purpose.



RESULT:
    By this project we can control the moisture content of the soil in the cultivating field.





Comments

  1. Hello Sarin i want to make this system but I think there is no program of lcd and its parts in the schematic please advice me.

    ReplyDelete

Post a Comment

Popular posts from this blog

Transformer

CONDUCTORS