Mid Eval Report

download Mid Eval Report

of 50

Transcript of Mid Eval Report

  • 7/31/2019 Mid Eval Report

    1/50

    Micro controller based automated irrigation system

    OVERVIEW

    1.1 Introduction:

    Irrigation system uses valves to turn irrigation ON and OFF. These valves may be

    easily automated by using controllers and solenoids. Automating farm or nursery irrigation

    allows farmers to apply the right amount of water at the right time, regardless of the

    availability of labor to turn valves on and off. In addition, farmers using automation

    equipment are able to reduce runoff from over watering saturated soils, avoid irrigating at

    the wrong time of day, which will improve crop performance by ensuring adequate water

    and nutrients when needed. Automatic Drip Irrigation is a valuable tool for accurate soil

    moisture control in highly specialized greenhouse vegetable production and it is a simple,

    precise method for irrigation. It also helps in time saving, removal of human error in

    adjusting available soil moisture levels and to maximize their net profits.

    Dept. Of E&C, MCE, Hassan Page 1

  • 7/31/2019 Mid Eval Report

    2/50

    Micro controller based automated irrigation system

    Block Diagram:

    Fig: 1.1 Block diagram

    1.2 Problem Definition:

    Farm Lands & Fields situated miles away from your home. Extensive travel

    required, sometimes several times in a day to start & stop the irrigation water pumps.

    Rough & Tough terrains and bad roads in country sides make the travel all the more

    tedious. Long walk-ways in remote agricultural lands also face associated threats from wildanimals, bugs, bees, spiders, snakes, scorpions and other potential hazards from lightning

    or electrical shock. Hostile weather can play a havoc endangering the life of Farmers.

    Reaching pump house at times can turn out to be a night mare. Availability of non-stop

    power is scarce in many of the villages around India, resulting in several trips a day to

    Dept. Of E&C, MCE, Hassan Page 2

  • 7/31/2019 Mid Eval Report

    3/50

    Micro controller based automated irrigation system

    operate the pumps. Protecting your equipment from theft and power fluctuations could also

    be a serious concern for many.

    1.3 Methodology:

    Implemented project is carried out using an ATMEL 89S52 microcontroller ,

    which is programmed using the Keil microvision2 software .the LCD is connected to port0

    of the micro controller to display the alert message. The microcontroller is connected to the

    GSM modem using DB9 cable. The sending of information across network via sms is

    possible using AT (attention) commands serially to the GSM module.

    1.4 Working:

    Here we have designed a module using a microcontroller and GSM. Once the three

    phase power comes module will send an SMS to authenticated users. If the farmer wants to

    switch on the motor he just needs to give a ring to the particular modem no which is

    implemented near the motor. microcontroller checks whether the call is coming from

    authenticated person, if it matches it will start the motor. If the password doesnt match

    means some other person is calling then no action will be taken. In every stage it will send

    the status to the farmer(authenticated user).i.e., whether the motor is on or off by the ring.

    If the motor is on by ring and the farmer needs to switch off he just needs to call back to

    the same number. The complete operation can be handled by sending SMS also that is by

    sending ON motor gets on, and by sending OFF motor gets OFF. As the farmers dont have

    sufficient knowledge for sending SMS we implemented calling future here.

    We have one more future called auto switch. If this switch is in ON STATE the

    motor gets on instantly the three phase power comes .i.e there is no need of calling or

    sending the SMS. Once the motor is on the module send sms like motor is on by auto

    switch. If the farmer wants to switch off he just needs to call back to the particular GSM

    number which we have implemented in module.

    Dept. Of E&C, MCE, Hassan Page 3

  • 7/31/2019 Mid Eval Report

    4/50

    Micro controller based automated irrigation system

    1.5 Limitation of the project:

    The system works wherever there is coverage of a local Mobile Network (GSM).

    The loss of user cell phone would lead to the miss handling of the device.

    1.6 Literature survey:

    To carry out the project in a phased manner it is necessary to conduct the literature

    survey. To establish communication we use the concept of wireless communication. The

    fundamental concept and information about wireless communication is excellently

    described by Theodre S Rappaport. Mobile computing service creation are completely

    discussed by Asoke K Talukder, Roopa R Yavagal in Mobile computing, Technology

    Applications and Service creations. The information regarding the latest developments in

    GSM have been obtained from the websites www.gsmworld.com. Various websites have

    been visited to get necessary information.

    The project is implemented using Embedded C language. To develop the code for

    establishing communication between the terminals, we have refer to the books of The

    Complete Reference C. Knowledge about the usage of AT commands to exchange Short

    Message Service (SMS) was learnt from AT commands Manual.

    The information regarding programming in C was referred from Muhammed Ali

    Mazidi, Janice Gillispie Mazidi, Rollin D. Mc Kinlay, The 8051 Microcontroller and

    Embedded System using Assembly and C and the 8051 Microcontroller and Embedded

    System, by Kenneth J Ayala.

    1.7 Merits:

    Dept. Of E&C, MCE, Hassan Page 4

    http://www.gsmworld.com/http://www.gsmworld.com/
  • 7/31/2019 Mid Eval Report

    5/50

  • 7/31/2019 Mid Eval Report

    6/50

    Micro controller based automated irrigation system

    2.1 Introduction to ATMEL 89S52 microcontroller:

    The AT89S52 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 Atmels 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 AT89S52 is a powerful microcomputer which provides a

    highly-flexible and cost-effective solution to many embedded control applications.

    The AT89S52 is a low-power, high-performance CMOS 8-bit

    microcomputer with 4Kbytes of Flash programmable and erasable read only memory

    (EPROM). The device is manufactured using Atmels high-density nonvolatile memory

    technology and is compatible with the industry-standard MCS-51 instruction set and pin

    out. 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 AT89S52 is a powerful microcomputer which

    provides highly-flexible and cost-effective solution to many embedded control

    applications.

    The AT89S52 provides the following standard features: 4K bytes of Flash, 128

    bytes of RAM, 32 I/O lines, two 16-bit timer/counters, a five vector two-level interrupt

    architecture, a full duplex serial port, on-chip oscillator and clock circuitry. In addition, the

    AT89S52 is designed with static logic for operation down to zero frequency and supports

    two software selectable power saving modes. The Idle Mode stops the CPU while allowing

    the RAM, timer/counters, serial port and interrupt system to continue functioning. The

    Power-down Mode saves the RAM contents but freezes the oscillator disabling all other

    chip functions until the next hardware reset

    2.2 Pin Diagram

    Dept. Of E&C, MCE, Hassan Page 6

  • 7/31/2019 Mid Eval Report

    7/50

    Micro controller based automated irrigation system

    Fig: 2.1 Pin diagram of 89S52

    2.3 Block Diagram

    Dept. Of E&C, MCE, Hassan Page 7

  • 7/31/2019 Mid Eval Report

    8/50

    Micro controller based automated irrigation system

    Fig: 2.2 Block diagram of 89S52

    2.4 Ports

    Dept. Of E&C, MCE, Hassan Page 8

  • 7/31/2019 Mid Eval Report

    9/50

    Micro controller based automated irrigation system

    Port 0

    Port 0 is an 8-bit open drain bidirectional I/O port. As an output port, each pin can

    sink eight TTL inputs. When 1s are written to port 0 pins, the pins can be used as high-

    impedance inputs. Port 0 can also be configured to be the multiplexed low order

    address/data bus during accesses to external program and data memory. In this mode, P0

    has internal pullups. Port 0 also receives the code bytes during Flash programming and

    outputs the code bytes during program verification. External pullups are required during

    program verification.

    Port 1

    Port 1 is an 8-bit bi-directional I/O port with internal pullups. The Port 1 output

    buffers can sink/source four TTL inputs. When 1s are written to Port 1 pins they are pulled

    high by the internal pullups and can be used as inputs. As inputs, Port 1 pins that are

    externally being pulled low will source current (IIL) because of the internal pullups. Port 1

    also receives the low-order address bytes during Flash programming and verification.

    Port 2

    Port 2 is an 8-bit bi-directional I/O port with internal pullups. The Port 2 output

    buffers can sink/source four TTL inputs. When 1s are written to Port 2 pins they are pulled

    high byte internal pullups and can be used as inputs. As inputs, Port 2 pins that are

    externally being pulled low will source current (IIL) because of the internal pullups. Port 2

    emits the high-order address byte during fetches from external program memory and during

    accesses to external data memory that uses 16-bit addresses (MOVX @ DPTR). In this

    application, it uses strong internal pull-ups when emitting 1s. During accesses to external

    data memory that uses 8-bit addresses (MOVX @ RI), Port 2 emits the contents of the P2

    Special Function Register. Port 2 also receives the high-order address bits and some control

    signals during Flash programming and verification.

    Port 3

    Dept. Of E&C, MCE, Hassan Page 9

  • 7/31/2019 Mid Eval Report

    10/50

    Micro controller based automated irrigation system

    Port 3 is an 8-bit bi-directional I/O port with internal pullups. The Port 3 output

    buffers can sink/source four TTL inputs. When 1s are written to Port 3 pins they are pulled

    high by the internal pullups and can be used as inputs. As inputs, Port 3 pins that are

    externally being pulled low will source current (IIL) because of the pullups. Port 3 also

    serves the functions of

    Table 2.1 Port3 Pin Description

    2.5Oscillator Characteristics

    XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier

    which can be configured for use as an on-chip oscillator, as shown in Fig 2.3. Either a

    quartz crystal or ceramic resonator may be used. To drive the device from an external clock

    source, XTAL2 should be left unconnected while XTAL1 is driven as shown in Fig 2.4.

    There are no requirements on the duty cycle of the external clock signal, since the input to

    the internal clocking circuitry is through a divide-by-two flip-flop, but minimum and

    maximum voltage high and low time specifications must be observed.

    Dept. Of E&C, MCE, Hassan Page 10

  • 7/31/2019 Mid Eval Report

    11/50

    Micro controller based automated irrigation system

    Fig: 2.3 Oscillator connection

    Fig: 2.4 External clock drive configuration

    2.6 RS 232 STANDARDS

    To allow compatibility among data communication equipment made by various

    manufacturers, an interfacing standard called RS232 was set by the Electronics Industries

    Association (EAI) in 1960.In 1963 it was modified and called RS 232A, RS232B and

    RS232C.This standard is used in PCs and numerous types of equipment. However, since

    the standard was set long before the advent of TTL logic family, its input and output

    voltage levels are not TTL compatible. In RS 232, a 1is represented by -3 to -25 volt, while

    0 bit is +3 to +25 v, making -3 to +3 undefined. For this reason, to connect any RS232 to

    Dept. Of E&C, MCE, Hassan Page 11

  • 7/31/2019 Mid Eval Report

    12/50

    Micro controller based automated irrigation system

    microcontroller system we must use voltage converter such as MAX232 to convert the

    TTL logic level 2 to the RS232 voltage level, and vice versa.

    RS232 HANDSHAKING SIGNALING

    To ensure fast and reliable data transmission between two devices, data transfer

    must be coordinated. Just as in case of printer , due to the fact that in serial data

    communication the receiving device may have no room for the data, there must a way to

    inform the sender to stop sending data. Many of the pins of the RS232 connector are used

    for handshaking signals.

    DTR (data terminal ready).When the terminal (or a PC COM port) is turned on,

    after going through a self-test, it sends out signal DTR to indicate that it is ready for

    communication.

    DSR (data set ready).When DC (modem) is turned on and has gone through the

    self-test, it asserts DSR to indicate that it is ready to communicate.

    RTS(request to send).When the DTE device(such as PC)has a byte to transmit it

    asserts RTS to signal modem that it has byte or data to transmit.RTS is an active-

    low output from the DTE and an input to the modem.

    CTS(clear to send ) .In response to RTS, when the modem has room for storing the

    data it is to receive, it sends out signal CTS to the DTE (PC) to indicate that it can

    receive data now.

    Dept. Of E&C, MCE, Hassan Page 12

  • 7/31/2019 Mid Eval Report

    13/50

  • 7/31/2019 Mid Eval Report

    14/50

    Micro controller based automated irrigation system

    6 9

    Fig: 2.5 DB-9 9-PIN CONNECTORThe MAX232 has two sets of line drivers for transferring and receiving data, as

    shown in fig. The line drivers used for TxD are called T1 and T2, while the line drivers for

    RxD are designated as R1 and R2.IN many applications only one of each is used. InMAX232 that the T1 line driver has designation of T1 IN and T1 OUT on pin no 11 and

    14, respectively. The T1 IN pin is the TTL side and is connected to TxD of the

    microcontroller, while T1 OUT is the RS232 side that is connected to the RxD pin of

    RS232 DB connector. The R1 line driver has a designation of R1 IN and R1 OUT on pin

    no 13 and 12, respectively. R1 IN (pin 13) is the RS 232 side that is connected to the TxD

    pin of the RS232 DB connector and R! OUT (pin 12)is the TTL side that is connected to

    RxD pin of the microcontroller ,as shown in fig2.6. Max232 requires 4 capacitors ranging

    from 1 to 22 microfarad. The most widely used value for these capacitors is 22 microfarad.

    Dept. Of E&C, MCE, Hassan Page 14

  • 7/31/2019 Mid Eval Report

    15/50

    Micro controller based automated irrigation system

    Fig 2.6 INSIDE CONFIGURATION OF MAX232

    Dept. Of E&C, MCE, Hassan Page 15

  • 7/31/2019 Mid Eval Report

    16/50

    Micro controller based automated irrigation system

    Idle Mode

    In idle mode, the CPU puts itself to sleep while all the on chip peripherals remain

    active. The mode is invoked by software. The content of the on-chip RAM and all thespecial functions registers remain unchanged during this mode. The idle mode can be

    terminated by any enabled interrupt or by a hardware reset.

    It should be noted that when idle is terminated by a hard ware reset, the device normally

    resumes program execution, from where it left off, up to two machine cycles before the

    internal reset algorithm takes control. On-chip hardware inhibits access to internal RAM in

    this event, but access to the port pins is not inhibited. To eliminate the possibility of an

    unexpected write to a port pin when Idle is terminated by reset, the instruction following

    the one that invokes Idle should not be one that writes to a port pin or to external memory.

    Power-down Mode

    In the power-down mode, the oscillator is stopped, and the instruction that invokes

    power-down is the last instruction executed. The on-chip RAM and Special Function

    Registers retain their values until the power-down mode is terminated. The only exit from

    power-down is a hardware reset. Reset redefines the SFRs but does not change the on-chip

    RAM. The reset should not be activated before VCC is restored to its normal operating

    level and must be held active long enough to allow the oscillator to restart and stabilize.

    Program Memory Lock Bits

    Dept. Of E&C, MCE, Hassan Page 16

  • 7/31/2019 Mid Eval Report

    17/50

    Micro controller based automated irrigation system

    On the chip are three lock bits which can be left unprogrammed (U) or can be

    programmed (P) to obtain the additional features listed in the table below. When lock bit 1

    is programmed, the logic level at the EA pin is sampled and latched during reset. If the

    device is powered up without a reset, the latch initializes to a random value, and holds that

    value until reset is activated. It is necessary that the latched value of EA be in agreement

    with the current logic level at that pin in order for the device to function properly.

    Lock Bit Protection Modes

    Table2.1: protection modes

    Programming the Flash

    The AT89S52 is normally shipped with the on-chip Flash memory array in the

    erased state (that is, contents = FFH) and ready to be programmed. The programming

    Dept. Of E&C, MCE, Hassan Page 17

    Program Lock BitsProtection Type

    LB1 LB2 LB3

    1 U U U No program lock features

    2 P U U

    MOVC instructions executed from

    external program memory are

    disabled from fetching code bytes

    from internal memory, EA is

    sampled and latched on reset, and

    further programming of the Flash is

    disabled.

    3 P P U Same as mode 2, also verify is

    disabled

    4 P P P Same as mode 3, also external

    execution is disabled.

  • 7/31/2019 Mid Eval Report

    18/50

  • 7/31/2019 Mid Eval Report

    19/50

    Micro controller based automated irrigation system

    Input the desired memory location on the address lines.

    Input the appropriate data byte on the data lines.

    Activate the correct combination of control signals.

    Raise EA/VPP to 12V for the high-voltage programming mode. Pulse ALE/PROG once to program a byte in the Flash array or the lock bits. The

    byte-write cycle is self-timed and typically takes no more than 1.5 ms.

    Repeat steps 1 through 5, changing the address and data for the entire array or until the end

    of the object file is reached.

    Data Polling: The AT89S52 features Data Polling to indicate the end of a write

    cycle. During a write cycle, an attempted read of the last byte written will result in

    the complement of the written datum on PO.7. Once the write cycle has been

    completed, true data are valid on all outputs, and the next cycle may begin. Data

    Polling may begin any time after a write cycle has been initiated.

    Ready/Busy: The progress of byte programming can also be monitored by the

    RDY/BSY output signal. P3.4 is pulled low after ALE goes high during

    programming to indicate BUSY. P3.4 is pulled high again when programming is

    done to indicate READY.

    Program Verify: If lock bits LB1 and LB2 have not been programmed, the

    programmed code data can be read back via the address and data lines for

    verification. The lock bits cannot be verified directly. Verification of the lock bits is

    achieved by observing that their features are enabled.

    Chip Erase: The entire Flash array is erased electrically by using the proper

    combination of control signals and by holding ALE/PROG low for 10 ms. The code

    array is written with all 1s. The chip erase operation must be executed before the

    code memory can be re-programmed.

    Dept. Of E&C, MCE, Hassan Page 19

  • 7/31/2019 Mid Eval Report

    20/50

  • 7/31/2019 Mid Eval Report

    21/50

    Micro controller based automated irrigation system

    Write Code Data H L H/12V L H H H

    Read Code Data H L H H L L H H

    Write

    Lock

    Bit - 1 H L H/12V H H H H

    Bit - 2 H L H/12V H H L L

    Bit - 3 H L H/12V H L H L

    Chip Erase H L (

    1)

    H/12V H L L L

    Read Signature Byte H L H H L L L L

    Table2.3: flash programming modes

    2.7 Circuit Diagram

    Dept. Of E&C, MCE, Hassan Page 21

  • 7/31/2019 Mid Eval Report

    22/50

  • 7/31/2019 Mid Eval Report

    23/50

    Micro controller based automated irrigation system

    Fig 2.7: Programming the Flash

    Dept. Of E&C, MCE, Hassan Page 23

  • 7/31/2019 Mid Eval Report

    24/50

    Micro controller based automated irrigation system

    Fig 2.8:Verifying the Flash

    Dept. Of E&C, MCE, Hassan Page 24

  • 7/31/2019 Mid Eval Report

    25/50

    Micro controller based automated irrigation system

    Flash Programming and Verification Waveforms - High-voltage Mode (VPP = 12V)

    Flash Programming and Verification Waveforms - Low-voltage Mode (VPP = 5V)

    Dept. Of E&C, MCE, Hassan Page 25

  • 7/31/2019 Mid Eval Report

    26/50

    Micro controller based automated irrigation system

    3. GSM AND AT COMMANDS

    3.1 Overview and GSM architecture

    The GSM network was designed keeping in mind the voice activities of the user

    and its main purpose was to provide voice connectivity like Public Switched Telephone

    Networks but with mobility. So Call Processing activities were the major criteria to decide

    and fix the implementation standards of GSM. The data communication was of secondary

    importance to this network but to support this also, designers have considered the circuit

    switching itself the mechanism for transmitting data packets.

    Fig. 3.1GSM architecture

    Dept. Of E&C, MCE, Hassan Page 26

    SIM

    ME

    BTS

    BTS

    BSC

    BSC

    MSC

    HLRRR

    VLR

    EIR AuC

    PSTN,ISDN,PSPD

    N

    CSPDN

    UmAbis

    A

    Mobile

    StationBase Station Subsystem Network Subsystem

  • 7/31/2019 Mid Eval Report

    27/50

    Micro controller based automated irrigation system

    Mobile Station

    The mobile station (MS) consists of the mobile equipment (the terminal) and a

    smart card called the Subscriber Identity Module (SIM). The SIM provides personal

    mobility, so that the user can have access to subscribed services irrespective of a specific

    terminal. By inserting the SIM card into another GSM terminal, the user is able to receive

    calls at that terminal, make calls from that terminal, and receive other subscribed services.

    The mobile equipment is uniquely identified by the International Mobile Equipment

    Identity (IMEI). The SIM card contains the International Mobile Subscriber Identity (IMSI)

    used to identify the subscriber to the system, a secret key for authentication, and other

    information. The IMEI and the IMSI are independent, thereby allowing personal mobility.

    The SIM card may be protected against unauthorized use by a password or personal

    identity number.

    Base Station Subsystem

    The Base Station Subsystem is composed of two parts, the Base Transceiver Station

    (BTS) and the Base Station Controller (BSC). These communicate across the standardized

    Abis interface, allowing (as in the rest of the system) operation between components made

    by different suppliers. The Base Transceiver Station houses the radio transceivers that

    define a cell and handles the radio-link protocols with the Mobile Station. In a large urban

    area, there will potentially be a large number of BTSs deployed, thus the requirements for a

    BTS are ruggedness, reliability, portability, and minimum cost.

    The Base Station Controller manages the radio resources for one or more BTSs. It

    handles radio-channel setup, frequency hopping, and handovers, as described below. The

    BSC is the connection between the mobile station and the Mobile service Switching centre

    (MSC).

    Network Subsystem

    Dept. Of E&C, MCE, Hassan Page 27

  • 7/31/2019 Mid Eval Report

    28/50

  • 7/31/2019 Mid Eval Report

    29/50

    Micro controller based automated irrigation system

    that stores a copy of the secret key stored in each subscribers SIM card, which is used for

    authentication and encryption over the radio chanel.

    3.2 The Switching System

    The switching system (SS) is responsible for performing call processing and

    subscriber-related functions. The switching system includes the following functional units:

    Home locations register (HLR)The HLR is a database used for storage and

    management of subscriptions. The HLR is considered the most important database,

    as it stores permanent data about subscribers, including a subscriber's service profile,

    location information, and activity status. When an individual buys a subscription

    from one of the PCS operators, he or she is registered in the HLR of that operator.

    Mobile services switching center (MSC)The MSC performs the telephony

    switching functions of the system. It controls calls to and from other telephone and

    data systems. It also performs such functions as toll ticketing, network interfacing,

    common channel signaling, and others.

    Visitor location register (VLR)The VLR is a database that contains temporary

    information about subscribers that is needed by the MSC in order to service visiting

    subscribers. The VLR is always integrated with the MSC. When a mobile station

    roams into a new MSC area, the VLR connected to that MSC will request data about

    the mobile station from the HLR. Later, if the mobile station makes a call,the VLR

    will have the information needed for call setup without having to interrogate the HLR

    each time.

    Authentication center (AUC)A unit called the AUC provides authentication and

    encryption parameters that verify the user's identity and ensure the confidentiality of

    each call. The AUC protects network operators from different types of fraud found in

    today's cellular world.

    Dept. Of E&C, MCE, Hassan Page 29

  • 7/31/2019 Mid Eval Report

    30/50

  • 7/31/2019 Mid Eval Report

    31/50

    Micro controller based automated irrigation system

    Message center (MXE)The MXE is a node that provides integrated voice, fax,

    and data messaging. Specifically, the MXE handles short message service, cell

    broadcast, voice mail, fax mail, e-mail, and notification.

    Mobile service node (MSN)The MSN is the node that handles the mobile

    intelligent network (IN) services.

    Gateway mobile services switching center (GMSC)A gateway is a node used

    to interconnect two networks. The gateway is often implemented in an MSC. The

    MSC is then referred to as the GMSC.

    GSM interworking unit (GIWU)The GIWU consists of both hardware and

    software that provides an interface to various networks for data communications.

    3.3 AT commands

    Dept. Of E&C, MCE, Hassan Page 31

  • 7/31/2019 Mid Eval Report

    32/50

  • 7/31/2019 Mid Eval Report

    33/50

    Micro controller based automated irrigation system

    Description:

    This command allows the application to read stored messages. The messages are read from

    the memory selected by +CPMS command.

    Syntax:

    Command syntax: AT+CMGR=

    Response syntax for text mode:

    +CMGR:,,[,] [,,,

    ,,,,] (forSMS-DELIVERonly)

    +CMGR: ,,[,] [,,,,, [], ,

    ,] (forSMS-SUBMIT only)

    +CMGR: ,,,[],[],,, (for SMS-STATUS

    REPORT only)

    Response syntax for PDU mode:

    +CMGR: , [] ,

    A message read with status REC UNREAD will be updated in memory with the status

    REC READ.

    Note:The parameter for SMS Status Reports is always READ.

    Example:

    Table:3.2 read message commands

    3.3.3 Write Message to Memory +CMGW

    Dept. Of E&C, MCE, Hassan Page 33

  • 7/31/2019 Mid Eval Report

    34/50

    Micro controller based automated irrigation system

    Description:

    This command stores a message in memory (either SMS-SUBMIT or SMS-DELIVERS).

    The memory location is returned (no choice possible as with phonebooks

    +CPBW).

    Text or PDU is entered as described for the Send Message +CMGS command.

    Syntax:

    Command syntax in text mode : ( is returned in both cases)

    AT+CMGW= [, [, ] ]

    enter text

    Command syntax in PDU mode :

    AT+CMGW= [,]

    give PDU

    Response syntax: +CMGW: or +CMS ERROR: if writing fails

    Table:3.3 Write Message to Memory commands

    Defined values:

    Dept. Of E&C, MCE, Hassan Page 34

  • 7/31/2019 Mid Eval Report

    35/50

    Micro controller based automated irrigation system

    Parameter Definition:

    : Originating or Destination Address Value in string format.

    : Type of Originating / Destination Address.

    : Integer type in PDU mode (default 2 for +CMGW), or string type in text mode

    (default STO UNSENT for +CMGW). Indicates the status of message in memory. If

    is omitted, the stored message is considered as a message to send.

    0: REC UNREAD

    1: REC READ

    2: STO UNSENT

    3: STO SENT

    Length of the actual data unit in octets

    Delete message +CMGD

    Dept. Of E&C, MCE, Hassan Page 35

  • 7/31/2019 Mid Eval Report

    36/50

    Micro controller based automated irrigation system

    Description:

    This command deletes one or several messages from preferred message storage (BM

    SMS CB RAM storage, SM SMSPP storage SIM storage or SR SMS Status-Report

    storage).

    Syntax:

    Command syntax: AT+CMGD= [,]

    Table:3.4 Delete message commands

    Defines values

    Dept. Of E&C, MCE, Hassan Page 36

  • 7/31/2019 Mid Eval Report

    37/50

    Micro controller based automated irrigation system

    (1-20) When the preferred message storage is BM

    Integer type values in the range of location numbers of SIM Message memory when the

    preferred message storage is SM or SR.

    0 Delete message at location .

    1 Delete All READ messages

    2 Delete All READ and SENT messages

    3 Delete All READ, SENT and UNSENT messages

    4 Delete All messages.

    Note:When the preferred message storage is SR, as SMS status reports are assumed to

    have a READ status, if is greater than 0, all SMS status reports will be

    deleted.

    Send Message From Storage +CMSS

    Description:

    Dept. Of E&C, MCE, Hassan Page 37

  • 7/31/2019 Mid Eval Report

    38/50

    Micro controller based automated irrigation system

    This command sends a message stored at location value .

    Syntax:

    Command syntax: AT+CMSS=[, [,] ]

    Response syntax: +CMSS : or +CMS ERROR: if sending fails

    If a new recipient address is given, it will be used instead of the one stored with the

    message

    Table:3.5 Send Message From Storage commands

    4. FLOW CHART

    Dept. Of E&C, MCE, Hassan Page 38

  • 7/31/2019 Mid Eval Report

    39/50

    Micro controller based automated irrigation system

    5. SOFTWARE DETAILS

    In this project we use two software.

    Dept. Of E&C, MCE, Hassan Page 39

  • 7/31/2019 Mid Eval Report

    40/50

    Micro controller based automated irrigation system

    1. Keil Software.

    2. Atmel Flash Programmer.

    5.1 KEIL SOFTWARE:

    Configuring uVision2 to Use Any Drive

    uVision2 places all files in the drive:/folder specified by the user when a New Project is

    defined. The drive used must be one that can be written to. Identify or create a new folder on the

    desired drive and start uVision2.

    Open the Projects menu and select New Project. A Create New Project Window will appear

    with a Save in box where the project files are to be stored. Browse until the desired disk and folder are

    found and type in a project name. Click the Save button. A uVision2 project (.UV2) file has now been

    created in the folder, along with a project log (.PLG) file.

    Fig5.1:Snapshot showing the creation of new project

    Dept. Of E&C, MCE, Hassan Page 40

  • 7/31/2019 Mid Eval Report

    41/50

    Micro controller based automated irrigation system

    The Files window will show a "Target 1" folder, and a "Select Device for Target 'Target 1'

    " window will appear. Browse to the Intel folder, open it, and select 89S52. Expanding the

    Target 1 folder in the Files window shows that it contains a sub-folder named "Source

    Group 1.

    Open the project menu. In that select the Targets, Groups, Files. Select the Groups/add

    files which pop up the Add files to Group Source Group 1 window.

    Fig5.2:Snapshot showing the edition of source file to project

    Unless a C code source program with the same name as the one typed into the File

    name box exists, it must be created. (A red "X" next to the source file name indicated

    uVision2 cannot find it).

    Dept. Of E&C, MCE, Hassan Page 41

  • 7/31/2019 Mid Eval Report

    42/50

    Micro controller based automated irrigation system

    EPROM Programming Using uVision2 HEX Output Files

    If EPROMs are to be programmed, a project.HEX file must be created by uVision2. Go to the

    Project menu and select Options for Target 'name'. From the Options window, select the Output tab

    and check the Create HEX File box before closing the window.

    Fig5.3: selecting output as HEX format

    Dept. Of E&C, MCE, Hassan Page 42

  • 7/31/2019 Mid Eval Report

    43/50

    Micro controller based automated irrigation system

    To compile the code open the project menu. In that select the build target option.

    The HEX file will be created at the specified location.

    Fig5.4: compiled output

    Variables within a processor are represented by either bits, bytes, words or long

    words, corresponding to 1, 8, 16 and 32-bits per variable. C51 variables are similarly

    based, for example:

    Bit = 1 bit 0 - 1

    char = 8 bits 0 - +/- 127

    unsigned char = 8 bits 0 - 255int = 16 bits 0 - +/-32768

    unsigned int = 16 bits 0 - 65535

    long = 32 bits 0 - +/- 2.147483648x109

    unsigned long = 32 bits 0 - 4.29496795x109

    float = 32 bits +/-1.176E-38 to +/-3.4E+38

    Dept. Of E&C, MCE, Hassan Page 43

  • 7/31/2019 Mid Eval Report

    44/50

    Micro controller based automated irrigation system

    pointer = 24/16/8 bits Variable address

    5.2 Atmel Flash Programmer:

    Flash programmer is a software used to load program into the memory of

    microcontroller. It can be used for all 8051 family.

    PROCEDURE

    Connect the burner to the PC port.

    Load the HEX file created by the Keil software into the Flash programmer.

    Select the type of micro controller (AT89S52).

    Lock the program bit to avoid any accidental changes (bit 1 & bit 2).

    Now burn the HEX file by selecting write key.

    Dept. Of E&C, MCE, Hassan Page 44

  • 7/31/2019 Mid Eval Report

    45/50

    Micro controller based automated irrigation system

    Fig5.5: snapshot showing the flash programmer window

    6. Conclusion

    6.1 Summary

    In our project we have designed an model to help the farmers in rural zones.

    Our Remote Controller could be installed on existing pump sets for a nominal cost.

    Operating our Remote Controller does not require any special skills. It is as simple

    as sending a SMS or a missed call.

    Dept. Of E&C, MCE, Hassan Page 45

  • 7/31/2019 Mid Eval Report

    46/50

    Micro controller based automated irrigation system

    The user can send a SMS message from anywhere in the world to operate this

    equipment. The security feature in the software will make sure that it works only

    with pre-assigned phone numbers.

    The system has various add-on features. It can notify you by return SMS, when the

    pump starts or trips. It can even alert you if someone breaks into your pump room

    to steal the equipment.

    6.2 Limitations

    The system works wherever there is coverage of a local Mobile Network(GSM).

    The loss of user cell phone would lead to the miss handling of the device.

    6.3 Future work

    You can also incorporate a feature to turn-ON a flood-light remotely or initiate a

    siren in case of a theft attempt.

    APPENDIX A

    INTERFACING AN LCD DISPLAY

    In recent years the LCD is finding a wide spread use replacing LEDs. This is due to

    declining prices of LCDs, the ability to display numbers, characters, and graphics. This is

    in contrast to LEDs which are limited to numbers and a few characters. Due to

    incorporation of refreshing controller into the LCD there by leaving the CPU from

    refreshing and ease of programming for characters and graphics makes LCD more popular.

    Dept. Of E&C, MCE, Hassan Page 46

  • 7/31/2019 Mid Eval Report

    47/50

    Micro controller based automated irrigation system

    BLOCK DIAGRAM

    Fig- lcd block diagram

    PIN ASSIGNMENT

    Pin No. Symbol Function

    1 VSS Ground

    2 VDDPowersupply

    3 VLCDPower Supply forLCD

    4 RS Select Display Data("H") or Instructions("L")

    Dept. Of E&C, MCE, Hassan Page 47

    DB0~DB77-14

    E 6LCD

    R/W

    5controlle

    r

    RS 4

    VLCD 3VDD 2

    VSS1

  • 7/31/2019 Mid Eval Report

    48/50

    Micro controller based automated irrigation system

    5 R/WRead or Write SelectSignal

    6 E Read/Write Enable Signal

    7 DB0

    8 DB1

    9 DB2

    10 DB3 Display Data Signal

    11 DB4

    12 DB5

    13 DB6

    14 DB7

    15 KCathode ofBacklight

    16 A Anode of Backlight

    Table: Pin description

    LIST OF LCD COMMANDS

    Dept. Of E&C, MCE, Hassan Page 48

  • 7/31/2019 Mid Eval Report

    49/50

    Micro controller based automated irrigation system

    Command RS R/W DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0 Execution time Remark(fosc=270KHz)

    c ear . mssp ay

    Return L L L L L L L L H X 1.53ms Cursor move to first digitome

    Entry mode L L L L L L L H I/D SH 39us I/D:set cursor move directionset ncrease

    ecrease

    : pec f es s ft of d sp ay

    SH H Display is shifted

    L Display is not shi fted

    sp ay us sp ay

    on/off D H Display on

    control L Display off

    Cursor

    C H Cursor on

    ursor off

    n ng

    B H Blinking on

    L Blinking off

    Cursor L L L L L H S/C R/L X X 39us SC H Display shift

    or L Cursor move

    Display Shift R/L H Right shift

    eft s ft

    function L L L L H DL N F X X 39us DL H 8bits interface

    Set L 4bits interface

    N H 2 line display

    ne d spay

    sp ay on

    L Display off

    et us data s sent and

    a ress rece ve a er s se ngSet DDRAM L L H AC6 AC5 AC4 AC3 AC2 AC1 AC0 39us DDRAM data is sent and

    address rece ved after t s sett ng

    Read busy L H BF AC6 AC5 AC4 AC3 AC2 AC1 AC0 0us

    f ag usy

    address eady

    -Reads BF indication

    internal operating is being

    performed

    -Reads address countercon en s

    r te data us r te data nto or o

    Read data H H D7 D6 D5 D4 D3 D2 D1 D0 43us Read data from DDRAM or from

    Table: LCD Commands

    REFERENCES

    Dept. Of E&C, MCE, Hassan Page 49

  • 7/31/2019 Mid Eval Report

    50/50

    Micro controller based automated irrigation system

    [1] Asoke K Talukder, Roopa R Yavagal, TMH, 2006 Mobile computing,

    technology, application and service creation.

    [2] Atmel 8 bit microcontroller with 8k bytes in system programmable Flash [pdf],

    http:// www.Atmel.com .

    [3] GSM World: http://www.gsmworld.com .

    [4] www.8052.com

    [5] Muhammad Ali Mazidi and Janice Gillispie Mazidi, Pearson Education The 8051

    Microcontroller and Embedded Systems, Pearson Education, 2003.

    [6] Overview of Global System for Mobile Communication, http://www.wikipedia.com

    .

    [7] Theodre S Rappaport Wireless Communications, Principles and Practice.

    [8] www.MicroDigitalEd.com

    [9] Kennreth J Ayala The 8051 Microcontroller Architecture, Programming &

    Applications, Penram International, 1996

    http://www.atmel.com/http://www.gsmworld.com/http://www.8052.com/http://www.wikipedia.com/http://www.microdigitaled.com/http://www.atmel.com/http://www.gsmworld.com/http://www.8052.com/http://www.wikipedia.com/http://www.microdigitaled.com/