final progress report

Upload: nalumino-kopano

Post on 03-Apr-2018

244 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/28/2019 Final Progress Report

    1/29

    P a g e | 1

    CHAPTER 1: PROJECT DEFINITION

    1.1INTRODUCTION

    A data logger kit is a stand - alone electronic device that can read various types of

    information in form of electrical signals and store the data in internal memory over a period

    of time. The data can be from data acquisition devices. These devices measure real world

    physical conditions and parameters, and convert them into electrical signals that can be

    read by the computer, such as analog and digital signals. Physical conditions can be

    measured using sensors. Physical parameters include the temperature of the environment,

    humidity, voltages, chemical composition and motion. Data loggers are composed of

    microcontroller, memory, rechargeable battery, and sensors. Data loggers are important

    because they provide us with factual information that is needed to make good decisions

    that will maximize operations. They find applications in many areas such as;

    Transportation industry

    the data logger access GPS data and hence work as a tracking device of

    valuable and fragile merchandise and minimize theft [1]

    Environmental Monitoring

    Internal environmental monitoring of houses, offices, warehouses or

    museums

    External environmental monitoring of oceans, rivers, aquaculture, climate

    and general research into the natural world. The concentration of chemicals

    in the water can be recorded over time.

    Vandalism monitoring of installations such as underground cables.

    Disaster management and mitigation

  • 7/28/2019 Final Progress Report

    2/29

    P a g e | 2

    Floods and earthquake prone areas can be monitored using sensors and the

    data sent to a monitoring center and early warning system.

    The supply of essentials to affected people can be monitored using GPS data

    loggers. [2]

    A data logger that is interfaced to a GPS module is able to receive and store location

    coordinates in the form of longitude and latitude. This is raw data and needs to be

    processed into a more meaningful form such as a map.

    This project is aimed at interfacing the data logger with GPS. The data logger stores the

    position coordinates on a Media Card. The GPS coordinates are then transmitted to

    authorized personnel through a text message via GSM. A computer can be connected to the

    data logger through a serial cable and data on the memory card is accessed. GPS visualizer

    software can be used to convert these latitude and longitude numbers to something that

    digital maps (e.g google maps) can understand.

    The progress report is outlined as follows. Chapter one gives a general overview of the

    subject i.e. problem statement, rationale, and objectives.

    Chapter two is the Methodology. The third Chapter covers literature review on the pic

    microcontroller and PCB designs. Chapter four explains the GPS and GSM technologies. It

    further gives a description of the communication methods selected and the overall system

    integration.

    Chapter five discusses the interfacing and script language programming of the GPS module.

    The last chapter gives a conclusion of the works done towards the completion of the

    project. This is then followed by conclusions and the Appendices.

    1.2 Problem Statement

    Challenges in Water Sensor Monitoring and data capture location identification and

    data transmission

    Challenges in Vehicle Asset Tracking

  • 7/28/2019 Final Progress Report

    3/29

    P a g e | 3

    Challenges in Disaster Management and Emergency Response e.g Earthquakes,

    Tsunamis, Floods-Early warning Sys., tracking transportation of supplies to people

    1.3 Rationale

    A data logger that is able to interface GPS and GSM can be used in many industries and a

    variety of applications such as Early Warning systems and Remote Sensing. In October 2010,

    Konkola Copper Mines polluted the river again, resulting in another shutdown of water

    supply [3]. Dennison Uranium mines has been closed after pollution of the Zambezi River in

    Siavonga. New mines have been established. There are continued risks of harmful effluents

    being discharged in the rivers that supplier water to sustain livestock, humans supply of

    fresh water and the farming sector. Such effluents have led to illnesses and also death of

    aquatic life. Such disasters can be avoided by monitoring the effluents of mining wastes in

    the rivers and streams. A data logger with GPS and GSM can be used for remote sensing and

    hence provide early warning to the relevant authorities. These data loggers can be placed in

    key areas where mines are located. Sensors are used to monitor the levels of toxic

    substance and the data transmitted to a central location. However, it has been challenging

    to identify the source of the data. A GPS/GSM data logger can be used to transmit location

    coordinates that can be used in an effective early warning system.

    Interfacing GPS and GSM to the data logger will make it possible to locate the source of

    logged data. Hence, the success in one data logger can be modified to other data loggers.

    Figure 1.1 below depicts how GPS/GSM data loggers placed in strategic mining areas can be

    used in Remote Sensing and Early Warning Systems.

  • 7/28/2019 Final Progress Report

    4/29

    P a g e | 4

    Figure 1.1: Map showing how Remote Sensing is achieved

    1.4 Project Objectives

    The objectives of the project are outlined below;

    1) To interface the data logger kit with Global Position System (GPS) and Global System

    Mobile (GSM) communication

    2) To design a system that will incorporate hardware and software based in the field for

    data logging and transmission protocols

    3) To redesign, assemble and configure a cost effective and efficient PIC Microcontroller

    based data logger

    4) To display data logger output to a computer screen and automatically generate SMS

    messages to monitoring personnel

    The overall system architecture is shown in figure 1.2

  • 7/28/2019 Final Progress Report

    5/29

    P a g e | 5

    Figure 1.2: System architecture of the Data logger

    1.5 SCOPE OF WORK DONE

    Literature review on the pic 18F27J53 microcontroller, GPS and GSM modules has been

    done. The EM408 GPS module has been selected for the project. Literature review on Easy

    Applicable Graphical Layer Editor (EAGLE) has been done. EAGLE software has been used for

    the preliminary system design of the data logger and explained further in chapters 3 to 5.

    Familiarisation of programing PIC microcontrollers using micro-IDE in C language, Proteus

    software for simulation of the preliminary system design has been done. Some of the

    components to be used in the project have been acquired. These include the pic

    microcontroller, voltage regulator, resisters, capacitors, and connector blocks.

    The GPS and GSM modules will be procured when the programming and simulation of the

    code is complete.The scope of work to be done is shown in the Appendix A, table A.1.

  • 7/28/2019 Final Progress Report

    6/29

    P a g e | 6

    CHAPTER 2: METHODOLOGY

    A modular approach has been undertaken to ensure that the project is completed in time.

    The project has been divided into two sections or modules. The electronic part will range from

    the GPS receiver to the microcontroller and the telecommunications part which will tackle

    modem communication and interface to the mobile phone Global System for Mobile

    communication (GSM). Literature review has been carried out to get familiarisation of the

    hardware and software used.

    2.1 System Design

    A System is a set of interrelated components which interact with one another in an

    organized fashion toward a common purpose. Design is the process of conceiving or

    inventing the forms, parts, and details of a system to achieve a specified purpose. Design

    can also be said to be an innovative act whereby the engineer creatively uses knowledge

    and material content of a system. The objective of systems engineering and design is to see

    to it that the system is designed, built, and operated so that it accomplishes its purpose in

    the most cost-effective way possible, considering performance, cost, schedule and risk. [4]

    This creates a technical solution that satisfies the functional requirements for the system.

    Therefore, using a systematic design plan, I will be able to come up with a fully operational

    and cost effective GPS/GSM data logger kit. The system design process has five steps these

    are;

    1) Identify design goals

    2) Model the new system design as a set of subsystems

    3) System Implementation

    4) Testing and debugging

    5) Report writting/Documentation

  • 7/28/2019 Final Progress Report

    7/29

    P a g e | 7

    2.2 System design Goals

    The system design goals have been highlighted in the Objectives of the project. In summary

    the goal is to build a cost effective data logger kit that is interfaced with GPs and GSM

    technology.

    2.3 Subsystems

    A system composed of interconnected modular subsystems is easier to design, document,

    debug, and modify. The data logger Preliminary system Block Diagram is shown in figure 3.

    The subsystems that will be considered are;

    i) Hardware connection of the pic18F27J53 microcontroller.

    ii) Serial communication interface.

    iii) Interfacing the GPS module.

    iv) Interfacing the GSM modem.

    v) Interfacing the media card and programming the full system.

    Figure 2.1 depicts the interfacing of the GPS and GSM modules to the PIC18F27J53.

    Figure 2.1: Subsystem interface

  • 7/28/2019 Final Progress Report

    8/29

    P a g e | 8

    2.4 System Implementation

    System implementation involves putting the planned system into action. This involves

    combining and organizing the subsystems systematically to form a complete system. The

    program code for each system is then linked and assembled into one code. The hardware

    and software developed are put together and installed in the simulation design software.

    After successful testing and debugging the prototype printed circuit board (PCB) is built. The

    components are soldered on the PCB board.

    2.5 Testing and debugging

    Testing is done to find deffects in the code and remove errors in the system. A correct

    hardware (software inclusive) setup of the system does not entail proper functioning of the

    system, it takes many steps of testing and debugging for the system to work as intended.

    2.6 Report writing/Documentation

    This is the process of providing written details/information about the project work.

  • 7/28/2019 Final Progress Report

    9/29

    P a g e | 9

    CHAPTER 3: LITERATURE REVIEW ON THE PIC 18F CONTROLLER ARCHITECTURE

    3.1 Key features of the pic microcontroller

    A Microcontroller is an inexpensive single-chip computer. The microcontroller has the

    capabilities of storing and running a program. Therefore, a complete system can be built

    using one MCU chip and interfacing it with a few Input and Output devices such as a keypad,

    display and other circuits. The PIC18 family utilizes a16-bit program word architecture and

    nearly all instructions execute in a single cycle making this Reduced Instruction Set

    Computer (RISC) architecture extremely efficient. RISC architecture has 32 level-deep stacks,

    8x8 hardware multiplier, and multiple internal and external interrupts. The PIC18 was

    selected for this project because programs that run on it can be written in C programming

    language. [5]

    Figure 3.1: MCU Features

    Figure 3.2 below shows the 28 pin diagram for the PIC 18F27J53 family and the pin configuration.

  • 7/28/2019 Final Progress Report

    10/29

    P a g e | 10

    Figure 3.2: Pin configuration

    The PIC18 family has a rich set of integrated communication and connectivity peripherals to

    reduce application system cost, and many of the PIC18 devices include Nano Watt

    technology for power management. Like all of Microchips microcontrollers, these products

    offer socket, software and peripheral compatibility for easy migration and scalability.

    3.2 Memory Organization

    There are two types of memory in PIC18 Flash microcontrollers. These are;

    Program Memory

    Data RAM

    As Harvard architecture devices, the data and program memories use separate busses; this

    allows for concurrent access of the two memory spaces.

  • 7/28/2019 Final Progress Report

    11/29

    P a g e | 11

    3.2.1 Program Memory

    PIC18 microcontrollers implement a 21-bit program counter, which is capable of addressing

    a 2-Mbyte program memory space. Accessing a location between the upper boundary of the

    physically implemented memory and the 2-Mbyte address returns all 0s.The PIC18F47J53

    family offers a range of on-chip Flash program memory sizes, from 64 Kbytes (up to 32,768

    single-word instructions) to 128 Kbytes (65,536 single-word instructions).

    3.2.2 Data Memory

    The data memory in PIC18 devices is implemented as static RAM.

    Each register in the data memory has a 12-bit address, allowing up to 4096 bytes of data

    memory. The memory space is divided into as many as 16 banks that contain 256 bytes each

    FIGURE 3.2:PIC18F27J53 MEMORY MAP

    The PIC18F47J53 family implements all available banks and provides 3.8 Kbytes of data

    memory available to the user.

    The Flash program memory is readable, writable and erasable during normal operation over

    the entire VDD range. A read from program memory is executed on 1 byte at a time. A write

    to program memory is executed on blocks of 64 bytes at a time or 2 bytes at a time.

    Program memory is erased in blocks of 1024 bytes at a time. A bulk erase operation may not

  • 7/28/2019 Final Progress Report

    12/29

    P a g e | 12

    be issued from user code. Writing or erasing program memory will cease instruction fetches

    until the operation is complete. The program memory cannot be accessed during the write

    or erase, therefore, code cannot execute. An internal programming timer terminates

    program memory writes and erases.

    3.3 Communication Features of the Pic18F27J53

    2.3.1 Master Synchronous Serial Port (MSSP) Module

    The Master Synchronous Serial Port (MSSP) module is a serial interface, useful for

    communicating with other peripheral or microcontroller devices. These peripheral devices

    include serial EEPROMs, shift registers, display drivers and A/D Converters. [5]

    3.3.1. Master SSP (MSSP) Module Overview

    The MSSP module can operate in one of two modes:

    Serial Peripheral Interface (SPI)

    Inter-Integrated Circuit (I2C)

    - Full Master mode

    - Slave mode (with general address call)

    The I2C interface supports the following modes in hardware:

    Master mode

    Multi-Master mode

    Slave mode with 5-bit and 7-bit address

    The modules operate independently:

    PIC18F27J53 devices:

    - MSSP1 can be used for either I2C or SPI communication

    - MSSP2 can be used only for SPI communication

  • 7/28/2019 Final Progress Report

    13/29

    P a g e | 13

    3.3.2 ENHANCED UNIVERSAL SYNCHRONOUS ASYNCHRONOUS RECEIVER TRANSMITTER

    (EUSART)

    The Enhanced Universal Synchronous Asynchronous Receiver Transmitter (EUSART) module

    is one of two serial I/O modules. (Generically, the EUSART is also known as a Serial

    Communications Interface or SCI.) The EUSART can be configured as a full-duplex

    asynchronous system that can communicate with peripheral devices, such as CRT terminals

    and personal computers. It can also be configured as a half-duplex synchronous system that

    can communicate with peripheral devices, such as ADC integrated circuits, serial EEPROMs.

    The Enhanced USART module implements additional features, including Automatic Baud

    Rate Detection and calibration, automatic wake-up on Sync Break reception, and 12-bit

    Break character transmit. These make it ideally suited for use in Local Interconnect Network

    bus (LIN/J2602 bus) systems.

    3.3.3 UNIVERSAL SERIAL BUS (USB) Peripheral

    PIC18F family devices contain a full-speed and low-speed, compatible USB Serial Interface

    Engine (SIE) that allows fast communication between any USB host and the PIC MCU. The

    SIE can be interfaced directly to the USB, utilizing the internal transceiver. Some special

    hardware features have been included to improve performance. Dual access port memory

    in the devices data memory space (USB RAM) has been supplied to share direct memory

    access between the microcontroller core and the SIE. Buffer descriptors are also provided,

    allowing users to freely program endpoint memory usage within the USB RAM space. Figure

    23.1 provides a general overview of the USB peripheral and its features.

  • 7/28/2019 Final Progress Report

    14/29

  • 7/28/2019 Final Progress Report

    15/29

    P a g e | 15

    PCB design software provides a complete package of the PCB design services. An example is

    Easy Applicable Graphical Layout Editor (EAGLE). This includes the PCB editor, the design

    capture technology, an interactive router, a constraint manager, interfaces for

    manufacturing CAD, and the component tools. The PCB editor edits the layers in the PCB,both single and multilayered. Both two dimensional and three dimensional rendering of the

    image are possible. 3D rendering is preferred, since it is possible to analyze both the inner

    and outer designs vividly.

  • 7/28/2019 Final Progress Report

    16/29

    P a g e | 16

    CHAPTER 4: GPS AND GSM TECHNOLOGIES

    4.1 How GPS Works

    Advances in communication technology in the area of Global Position System andGeographical Information System are able to provide a means to navigate the area around

    us. This information can be accessed remotely. Global Positioning System is a real-time

    satellite based positioning available on the earth. The uniqueness of the system lies in the

    fact it is a cheap, accurate and easy way of locating any place on earth. Because of its

    features, it has become an essential part of any travel.

    The maturity of GPS (Global Positioning System) technology has led to its increasing

    utilization in commercial applications. Popularly used as navigational aid, GPS technology

    has, in recent years, made a tremendous in-road as a reliable tracking system for mobile

    objects. Combined with mobile communication network such as GSM network, it evolves

    into GPS tracker that capable of tracking mobile objects in real-time. Acting like a beacon,

    GPS tracker transmits positional information to a monitoring station at regular prescribe

    intervals allowing instant analysis of data transmitted. GPS tracker has been successfully

    deployed in business environment where there is a need to monitor large mobile

    workforces and assets such as commercial fleets, logistics and transportation companies.

    Tracking ability of such system is only limited to the availability of GSM network coverage

    [8].

    The GPS is currently the only fully-functional satellite navigation system. More than 24 GPS

    satellites are in medium Earth orbit, transmitting signals allowing GPS receivers to

    determine the receiver's location, speed and direction Since the first experimental satellite

    was launched in 1978, GPS has become one of the important devices for navigation around

    the world and an important tool for map-making and land surveying. GPS also provides a

    precise time reference used in many applications including scientific study of earthquakes

    and synchronization of telecommunications networks [8].

    The GPS has three components namely:

    1. The space segment: consisting of 24 satellites orbiting the earth at an altitude of

    11000 nautical miles.

    http://en.wikipedia.org/wiki/Medium_Earth_orbithttp://en.wikipedia.org/wiki/Geographic_locationhttp://en.wikipedia.org/wiki/Cartographyhttp://en.wikipedia.org/wiki/Time_transferhttp://en.wikipedia.org/wiki/Time_transferhttp://en.wikipedia.org/wiki/Time_transferhttp://en.wikipedia.org/wiki/Cartographyhttp://en.wikipedia.org/wiki/Geographic_locationhttp://en.wikipedia.org/wiki/Medium_Earth_orbit
  • 7/28/2019 Final Progress Report

    17/29

    P a g e | 17

    2. The user segment: consisting of a receiver, this is mounted on the unit whose

    location has to be determined.

    3. The control segment: consists of various ground stations controlling the satellites.

    4.1 User Segment

    The user's GPS receiver is the user segment (US) of the GPS system. In general, GPS

    receivers are composed of an antenna, tuned to the frequencies transmitted by the

    satellites, receiver-processors, and a highly-stable clock (often a crystal oscillator). They may

    also include a display for providing location and speed information to the user. A receiver is

    often described by its number of channels: this signifies how many satellites it can monitor

    simultaneously

    4.2 Calculating Positions

    The coordinates are calculated according to theWGS84 coordinates system. To calculate its

    position, a receiver needs to know the accurate time. The satellites are equipped with

    extremely accurate atomic clocks, and the receiver uses an internal crystal oscillator-based

    clock that is continually updated using the signals from the satellites. The receiver identifies

    each satellite's signal by its distinct C/A code pattern, and then measures the time delay for

    each satellite. To do this, the receiver produces an identical C/A sequence using the same

    seed number as the satellite. By lining up the two sequences, the receiver can measure the

    delay and calculate the distance to the satellite, called the pseudo range.

    The orbital position data from the Navigation Message is then used to calculate the

    satellite's precise position. Knowing the position and the distance of a satellite indicates that

    the receiver is located somewhere on the surface of an imaginary sphere centered on that

    satellite and whose radius is the distance to it. When four satellites are measured

    simultaneously, the intersection of the four imaginary spheres reveals the location of the

    receiver. Earth-based users can substitute the sphere of the planet for one satellite by using

    their altitude. Often, these spheres will overlap slightly instead of meeting at one point, so

    the receiver will yield a mathematically most-probable position (and often indicate the

    uncertainty).

    http://en.wikipedia.org/wiki/Crystal_oscillatorhttp://en.wikipedia.org/wiki/WGS84http://en.wikipedia.org/wiki/Geographic_coordinate_systemhttp://en.wikipedia.org/wiki/Atomic_clockhttp://en.wikipedia.org/wiki/Random_seedhttp://en.wikipedia.org/wiki/Pseudorangehttp://en.wikipedia.org/wiki/Pseudorangehttp://en.wikipedia.org/wiki/Pseudorangehttp://en.wikipedia.org/wiki/Random_seedhttp://en.wikipedia.org/wiki/Atomic_clockhttp://en.wikipedia.org/wiki/Geographic_coordinate_systemhttp://en.wikipedia.org/wiki/WGS84http://en.wikipedia.org/wiki/Crystal_oscillator
  • 7/28/2019 Final Progress Report

    18/29

    P a g e | 18

    Calculating a position with the P(Y) signal is generally similar in concept, assuming one can

    decrypt it. The encryption is essentially a safety mechanism; if a signal can be successfully

    decrypted, it is reasonable to assume it is a real signal being sent by a GPS satellite. In

    comparison, civil receivers are highly vulnerable to spoofing since correctly formatted C/Asignals can be generated using readily available signal generators. [RAIM] features will not

    help, since RAIM only checks the signals from a navigational perspective.

    4.3 Accuracy and Error Sources

    The position calculated by a GPS receiver requires the current time, the position of the

    satellite and the measured delay of the received signal. The position accuracy is primarily

    dependent on the satellite position and signal delay.

    To measure the delay, the receiver compares the bit sequence received from the satellite

    with an internally generated version. By comparing the rising and trailing edges of the bit

    transitions, modern electronics can measure signal offset to within about 1% of a bit time,

    or approximately 10 nanoseconds for the C/A code. Since GPS signals propagate nearly at

    the speed of light, this represents an error of about 3 meters. This is the minimum error

    possible using only the GPS Position accuracy can be improved by using the higher-speed

    P(Y) signal. Assuming the same 1% accuracy, the faster P(Y) signal results in accuracy

    of about 30 centimeters

    4.4 GPS DATA

    The National Marine Electronics Association (NMEA) has developed a specification that

    defines the interface between various pieces of marine electronic equipment. The standard

    permits marine electronics to send information to computers and to other marineequipment.

    GPS receiver communication is defined within this specification. Most computer programs

    that provide real time position information understand and expect data to be in NMEA

    format. This data includes the complete PVT (position, velocity, time) solution computed by

    the GPS receiver. The idea of NMEA is to send a line of data called a sentence that is totally

    self-contained and independent from other sentences. There are standard sentences for

    each device category and there is also the ability to define proprietary sentences for use by

    http://en.wikipedia.org/wiki/Speed_of_lighthttp://www.nmea.org/http://www.nmea.org/http://en.wikipedia.org/wiki/Speed_of_light
  • 7/28/2019 Final Progress Report

    19/29

  • 7/28/2019 Final Progress Report

    20/29

    P a g e | 20

    4.5 GSM Technology- an Overview

    GSM, Global System for Mobile communications, is today the most successful digital mobile

    telecommunication system. This second-generation (2G) system provides voice and limited

    data services and uses digital modulation with improved audio quality.

    AT commands are instructions used to control a modem. AT is the abbreviation of

    ATtention. Every command line starts with "AT" or "at". That's why modem commands are

    called AT commands. Many of the commands that are used to control wired dial-up

    modems, such as ATD (Dial), ATA (Answer), ATH (Hook control) and ATO (Return to online

    data state), are also supported by GSM/GPRS modems and mobile phones. Besides this

    common AT command set, GSM/GPRS modems and mobile phones support an AT command

    set that is specific to the GSM technology, which includes SMS-related commands like

    AT+CMGS (Send SMS message), AT+CMSS (Send SMS message from storage), AT+CMGL (List

    SMS messages) and AT+CMGR (Read SMS messages).

    Note that the starting "AT" is the prefix that informs the modem about the start of a

    command line. It is not part of the AT command name. For example, D is the actual AT

    command name in ATD and +CMGS is the actual AT command name in AT+CMGS

    Mobile phone manufacturers usually do not implement all AT commands, command

    parameters and parameter values in their mobile phones. Also, the behavior of the

    implemented AT commands may be different from that defined in the standard. In general,

    GSM/GPRS modems designed for wireless applications have better support of AT commands

    than ordinary mobile phones.

  • 7/28/2019 Final Progress Report

    21/29

    P a g e | 21

    AT Command Functionality

    AT+CGMI Name of the manufacture

    AT+CGMM Model numberAT+CGSN International mobile subscriber identity

    AT+CGMR Software version

    AT+CIMI International mobile subscriber identity

    AT+CSQ Radio signal strength

    AT+CBC Charging status

    AT+CMGS Send message

    AT+CMGR Read message

    AT+CMGW Write message

    AT+CMGD Delete message

    AT+CNMI Notifications of received messages

    AT+CPBR Read phone book

    AT+CPBW Write to phone book

    AT+CPBF Search phone book

    AT+CLCK Checking whether a facility is locked

    AT+CPWD Change password

    ATO Return to online data state

    ATH Hook control

    ATA Answer call

    ATD Dial call

    Table 4.1: Basic AT commands

    In addition, some AT commands require the support of mobile network operators. For

    example, SMS over GPRS can be enabled on some GPRS mobile phones and GPRS modems

    with the +CGSMS command (command name in text: Select Service for MO SMS Messages).

    But if the mobile network operator does not support the transmission of SMS over GPRS,

    you cannot use this feature.

    4.2 Basic Commands and Extended Commands

    There are two types of AT commands: basic commands and extended commands. Basic

    commands are AT commands that do not start with "+". For example, D (Dial), A (Answer), H

    (Hook control) and O (Return to online data state) are basic commands. Extended

    commands are AT commands that start with "+". All GSM AT commands are extended

    commands. For example, +CMGS (Send SMS message), +CMSS (Send SMS message from

    storage), +CMGL (List SMS messages) and +CMGR (Read SMS messages) are extended

    commands. [10]

  • 7/28/2019 Final Progress Report

    22/29

    P a g e | 22

    CHAPTER5: INTERFACING AND PROGRAMMING MICROCONTROLLER

    5.1 Hardware Connection to the pic microcontroller

    The data logger has two UART pins and one Universal Serial Bus (USB). These are serial

    interfaces. The other input/output ports on connector block 4 named CON4 are shown in

    table 5.1.

    Table 5.1: Pin assignments for Sensors and devices

    Serial ports are required for interfacing the GSM and GPS modules. For full duplex (two way)

    communication with the microcontroller, two pins are necessary, . Therefore the

    two UART (Universal Asynchronous Receiver/Transmitter) pins on the microcontroller are

    not sufficient. However, this is overcome by using software. The two hardware components

    can be multiplexed by using the Peripheral Pin Select (PPS) feature of the PIC18F27J53

    microcontroller.

    The PPS feature not only simplifies the PC board design, but it also allows the onboard

    peripherals to be multiplexed on different lines. For example, a single UART peripheral can

    be used on different pins.

    5.2 Programming Pic microcontroller using Script Language

    The scripting language is a high-level programming language that is interpreted by another

    program at runtime rather than compiled by the computer's processor as other

    http://www.webopedia.com/TERM/H/high_level_language.htmlhttp://www.webopedia.com/TERM/I/interpreter.htmlhttp://www.webopedia.com/TERM/R/runtime.htmlhttp://www.webopedia.com/TERM/C/compiler.htmlhttp://www.webopedia.com/TERM/C/compiler.htmlhttp://www.webopedia.com/TERM/R/runtime.htmlhttp://www.webopedia.com/TERM/I/interpreter.htmlhttp://www.webopedia.com/TERM/H/high_level_language.html
  • 7/28/2019 Final Progress Report

    23/29

    P a g e | 23

    programming languages (such as C and C++) are. The scripting language is implemented on a

    virtual machine that incorporates virtual memory support and a (modified) Harvard

    architecture. The PC host program converts the source code to machine code that then

    executes on the Data Logger.

    The PC host program automatically detects the data logger once it has been connected to

    the computer.

    With the scripting language its possible to program the data logger so that the desired

    sensor can be interfaced to the data logger. Without the data logger being programmed, it

    is not possible to log any data via the sensors and devices.

    Programs written using the scripting language can be executed and debugged without the

    data logger being connected to the computer. The program for reading data from the GPS

    module has been written and tested. Figure 5.1 shows the simulation window of the

    program.

    Figure 5.1: PC host software window executing the GPS script

    http://www.webopedia.com/TERM/C/C.htmlhttp://www.webopedia.com/TERM/C/C_plus_plus.htmlhttp://www.webopedia.com/TERM/C/C_plus_plus.htmlhttp://www.webopedia.com/TERM/C/C.html
  • 7/28/2019 Final Progress Report

    24/29

    P a g e | 24

    START

    Create new log file

    UART initialization

    Set baud rate UART to 4800

    Data received?

    Detect and Receive GPS data

    Data processing

    Check sum

    Decode data

    GPSS GPRMC

    End

    Display data

    Store data

  • 7/28/2019 Final Progress Report

    25/29

    P a g e | 25

    CHAPTER 6: CONCLUSION

    Data loggers are important in almost all industries. They are used to capture and store data

    over a period of time. The data can be used to optimize the operations being carried. One

    area in which they can be used is Water Sensor Monitoring. Data captured by the loggers

    can be transmitted to a central location. This is important in remote sensing and Early

    warning systems.

    The objective of the project is to Redesign, Assembly, configuration and interfacing of data

    logger kit to GPS and GSM. The GPS coordinates obtained by the GPS module are stored on

    a memory card. The data is then transmitted to mobile phone or personal computer by

    means of the GPS modem.

    EAGLE software has been used to redesign the data logger and the GPS module has been

    interfaced. Interfacing the data logger to the GSM modem is under way using EAGLE

    software, Proteus and the PC host software for script writing. Once the interfacing of GSM is

    complete, the components that make up the data logger shall be soldered and the complete

    system tested. The findings and results shall then be documented and a final thesis

    submitted.

  • 7/28/2019 Final Progress Report

    26/29

    P a g e | 26

    References

    1. S.Smys1, Jennifer S Raj, Nixon Augustine, AUTONOUMOUS VEHICLE NAVIGATION IN

    COMMUNICATION CHALLENGED ENVIRONMENTS- A SIMULATION APPROACH, Journal of

    Automation & Systems Engineering

    2. http://www.col.org/SiteCollectionDocuments/Disaster_Management_version

    3. Zambia Weekly, Week 3, Volume 2, Issue 3, 21 January 2011

    4. NASA Systems Engineering Handbook SP6105

    5. PIC18F47J53 Family Data Sheet, 2010, Microchip Technology Inc.

    6. Christopher T. Robertson,Printed Circuit Board Designer's Reference: Basics.

    7. Jon Varteresian, Fabricating Printed Circuit Boards, 2002, Elsevier Science (USA)

    8. NYS Project Management Guidebook

    9.Ahmed El-Rabbany, Introduction to GPS: the Global Positioning System, 2010.

    10. Ahmed Al Mansur, Alvir Kabir, Shahid Jaman, Nahian Chowdhury, Sadeque Reza Khan,

    Design and Implementation of Low Cost Home Security System using GSM Network,

    International Journal of Scientific & Engineering Research Volume 3, Issue 3, March -2012.

  • 7/28/2019 Final Progress Report

    27/29

    P a g e | 27

    APPENDEX A

    Task Name Start Date End Date Duration %

    Completion

    Resources

    Needed

    1 Project Selection 4/5/2012 18/5/2012 14 d 100% Supervisor

    + Nalumino

    2 Literature

    Review

    70% Nalumino

    3 Procurement of

    Tools

    17/12/2012 8/5/1013 110 d 60% Nalumino

    4 System Design 1/1/2013 24/1/2013 25 d 90% Nalumino

    5 Review of Design 23/1/2013 1/2/2013 7 d 80% Supervisor

    + Nalumino

    6 First Oral

    Presentation

    25/1/2013 25/1/2013 1 d 100% Nalumino

    7 Progress Report

    Submission

    7/3/2013 21/3/2013 14 d 100% Nalumino

    8 Interfacing to

    GPS

    11/3/2013 25/3/2013 14 d 70% Nalumino

    9 interfacing to

    GSM

    26/3/2013 8/3/2013 10 d 0% Nalumino

    1

    0

    Building and

    System Testing

    10/4/2013 15/5/2013 10 d 0% Supervisor

    + Nalumino

    1

    1

    Work Review 20/5/2013 24/5/2013 5 d 0% Supervisor

    1

    2

    Thesis

    Compilation

    1/6/2013 25/7/2013 30 d 0% Nalumino

    1

    3

    Thesis Review 29/7/2013 2/8/2013 5 d 0% Supervisor

    1

    4

    Final Project

    Demonstration

    9/8/2013 9/8/2013 1 d 0%

    Table A.1: Work plan

  • 7/28/2019 Final Progress Report

    28/29

    P a g e | 28

    APPENDIX B

    The script file for the GPS interface was developed and simulated. The program is as follows;

    header simpleGPS

    {// The script shows how to use the UART to connect to a GPS module, the EM408

    // The USB Data Logger can automatically decode GPSS GPRMC NMEA sentences.

    }

    script simpleGPS

    {

    // Creates A new Log File for this script from scratch, "GPSDecoder.txt"

    clearFile "GPSDecoder.txt";

    // Initialise the UART, pin D0 is Tx, pin D1 is Rx...

    // Baudrate 4800 bps is the default for the GPS module...

    // the special GPS decoding mode is enabled by using the define constant

    // in the mode definition when opening the serial port #GPSDecodingUART...@@openUART(#GPSDecodingUART + #noRxInvUART + #noTxInvUART, 4800, #D0,

    #D1);

    print "Sending commands to the GPS module...", newline;

    // Refer to the datasheet of the EMS408 for details...

    // The nmea built in command sends the output to the serial port, but it

    // also keeps a running XOR checksum that is appended to the end of the sentence for error checking

    // The NMEA CRC is sent by using the print function pf(#nmea), as shown below. The following

    // command sets the output sentences for the EMS408 module to be GPSS

    // GPRMC (recommended minimum

    // specific settings...

    nmea "$PSRF100,1,4800,8,1,0", pf(#nmea);

    nmea "$PSRF103,4,0,5,0", pf(#nmea);

    print "Waiting for GPS Sentences...", newline;

    precision(3);

    while(1)

    {

    if(@@receivedNMEAUART())

    {

    print newline, "Rx: [", pf(#serialInPipe), "]", newline;

    // #GPRMCNumBytesToMatch==32 is the number of bytes output

    // by the internal automatic match for GPRMC sentences...if($$nmea.outputPtr>=#GPRMCNumBytesToMatch)

    {

    print "Output: ", $$nmea.outputPtr, newline;

    print newline, "Longitude: ", @@abs($$longitude), " ";

    if($$longitude>=0)print "E"; else print "W";

    print newline, "Latitude : ", @@abs($$latitude), " ";

    if($$latitude>=0)print "N"; else print "S";

    print newline, "Speed : ", $$speed, " knots (over

    ground)";

    print newline, "Heading : ", $$course, " degrees ";

    print newline, "GPS Time : ", pf(#vmTime), newline;}

  • 7/28/2019 Final Progress Report

    29/29

    P a g e | 29

    @@clearUART();

    sleep(1);

    }

    }

    }