You are on page 1of 52

TRIBHUWAN UNIVERSITY INSTITUTE OF ENGINEERING KATHFORD INTERNATIONAL COLLEGE OF ENGINEERING & MANAGEMENT DEPARTMENT OF ELECTRONICS AND COMPUTER ENGINEERING

Balkumari, Lalitpur A FINAL YEAR PROJECT ON GPS DATA LOGGER EG777EX Submitted By Dinesh subedi (74864) Nawaraj katiwada(74874) Prasis poudel(74876) Prawesh pathak (74883) Lalitpur, Nepal January, 2011

TRIBHUWAN UNIVERSITY INSTITUTE OF ENGINEERING KATHFORD INTERNATIONAL COLLEGE OF ENGINEERING & MANAGEMENT DEPARTMENT OF ELECTRONICS AND COMPUTER ENGINEERING Balkumari, Lalitpur A FINAL YEAR PROJECT ON GPS DATA LOGGER EG777EX Submitted By Dinesh subedi(74864) Nawaraj katiwada(74874) Prasis poudel(74876) Prawesh pathak (74883) Lalitpur, Nepal Project work submitted to the department in the partial fulfillment of the requirement For the Bachelor of Electronics and Communication Engineering January, 2011

LETTER OF APPROVAL The undersigned certify that they have read, and recommended to the Institute of engineering for acceptance, a project entitled GPS DATA LOGGER by Mr. LokNath Regmi, Mr. Rastra Kr. Subedi, Mr.Saroj Sharma , and Mr. Subash Dangal in the partial fulfillment of the requirements for the degree Bachelor of Electronics and Communication Engineering.

. .. Supervisor, Er.Basanta Aryal Senior Engineer Civil Aviation Of Nepal

Er. Yagya Murti Pokharel Head of the Department Kathford Intl College

.. .. Project Coordinator, Department of Electronics and Computer Engineering, Kathford Intl College

Prof. Dr. External Examiner Director of BIACF Deputy Head, Department of Electronics and Computer Engineering, Pulchowk Campus

DATE OF APPROVAL: 11th January, 2011

COPYRIGHT

The author has agreed that the Library, Department of Electronics and Computer engineering, Kathford International College of Engineering and Management may make this report freely available for inspection. Moreover the author has agreed that permission for extensive copying of this project report for scholarly purpose may be granted by the supervisors who supervised the project work recorded herein, or in their absence, by the Head of Department wherein the project report was done. It is understood that the recognition will be given to the author of this report and to the Department of Electronics and Computer engineering, Kathford International College of Engineering and Management in any use of the material of this project report. Copying or publication or the other use of this report for the financial gain without approval of to the Department of

Electronics and Computer engineering, Kathford International College of Engineering and Management and authors written permission is prohibited. Request for permission to copy or to make any other use of the material in this report in whole or in part should be addressed to:

Head Department of Electronics and Computer Engineering, Kathford International College of Engineering and Management, Lalitpur, Nepal

ACKNOWLEDGEMENT

First of all we would like to thank Department of Electronics and Computer Engineering for accepting our project proposal on GPS DATA LOGGER and granting us the opportunity of the work undertaken. We express our earnest gratitude for providing us with all essential cooperation, valuable suggestion and the necessary resources during all the quarters of the completion of the project. We are extremely grateful to our supervisor Er. Basanta Aryal and our HOD Er. Yangya Murti Pokharel and Project Coordinator Er. Deepak Parajuli for their valuable support and genuine guidance in all happenings regarding the project. We are deeply grateful to our teachers Dr. Surendra Shrestha, Er. Santosh Shrestha, Er. Bikash Bahadur Shrestha, Er.Ashok Giri, Er Suneel Chaudhary for providing us suggestions and encouragement about the project. Our sincere appreciation is extended to all the staffs of the department for genuine cooperation. We would also like to offer our gratitude to all our teachers whose lectures and ideas were the basis for our project research and appreciate the support rendered by Department of Electronics and Computer Engineering, IOE.

Lastly we are also indebted to our friends for their helpful suggestions.

Thank You. Dinesh Subedi Nawaraj Katiwada Prasis Poudel Prawesh Pathak

ABSTRACT

In this project we present the Gps Data Logger that has been one of the most significant considerations in the establishment in micro hydro project. The main objective of this paper is to present a review of the literature and available technology, as well as general background research into Electronic Load Controllers (ELCs) for off-grid micro-hydro systems in the developing world. The financial and technical issues surrounding the control of typical micro-hydro system components under variable loading conditions shall be discussed. In this project we purpose to design and build a Electronic micro hydropower controller which can control the load of the micro hydropower and also transmit data of load and generated power to a control room.The project is divided into four parts: Hardware, Software, Communication and Control system. Two different digital meter measures the generated power from the induction motor of generator and power consumed by the load.The ELC controls the load as the required power.The remaining power is sinked into the dummy load.The generated and load power is transmitted and received by the antenna with the help of RF communication.The ELC use the controller which controls the load with the help of the software. This report discusses the design of a microcontroller based Electronic Load Controller for standalone applications in Pico/Micro-hydro power generating stations. The main goal of the project was to design a cheap control system which would facilitate the installation of the large number of proposed Pico-Hydro Power Stations across India which has not been possible until now due to the lack of a cheap and robust control system.

TABLE OF CONTENTS

LETTER OF APPROVAL......................................................................... ..........................II COPYRIGHT..................................................... .................................................................III ACKNOWLEDGEMENTS................................................................................................IV ABSTRACT.........................................................................................................................V TABLE OF LIST OF CONTENTS...................................................................................................VI FIGURES..........................................................................................................VIII

LIST OF TABLES........................................................................................................ ......XI LIST OF SYMBOLS AND ABBREVIATIONS................................................................X 1. INTRODUCTION.................................................................................................. ..........1 1.1 Motivation...1 1.2 Background.3 1.2.1 Paper Based Voting System.3 1.2.2 Direct Recording Electronic (DRE) Voting System4 1.2.3 Public Network DRE Voting System..5 1.3 Objectives...6 1.4 Overview of Project7 2. THERORETICAL FOUNDATIONS...................................................................................9 2.1 Microcontroller.10 2.2 GSM Modem20 2.3 Serial Communication..21 2.4 AT Commands..25 2.5 Software Used...26 2.5.1 Kiel Vision 326 2.5.2 Proteus 6 Professional27 2.5.3 Database Software and Interface Software30 3. SYSTEM DESIGN............................................................... ..................................31 3.1 Block Diagram..31 3.2 Methodology.32

3.3 Hardware Implementation33 3.3.1 Interfacing Keyboard with Microcontroller..33

3.3.2 Interfacing Microchip with Control Keys.36 3.3.3 Interfacing 16x2 LCD Display to Microcontroller37 3.3.4 Interfacing LEDs with Microchip..42 3.3.5 Interfacing Microchip with GSM modem using MAX232...43 3.4 Languages Used43 3.5 PCB Design..44 4. RESULTS..........................................................................46 5. EPILOGUE.................................................................49 5.1 Cost Estimation.49 5.2 Problems Faced.50 5.3 Future Enhancements51 5.4 Conclusions...52 REFERENCES ................................................................................................................53 APPENDIX..................................................................................54

vii

LIST OF FIGURES
Figure 1.1 Figure 2.1 Figure 2.2 Figure 2.3 Figure 2.4 Figure 2.5 Figure 2.6 Figure 2.7 Figure 2.8 Figure 2.9 Figure 2.10 Figure 2.11 Figure 2.12 Figure 2.13 Figure 2.14 Figure 2.15 Figure 2.16 Figure 2.17 Figure 2.18 Figure 2.19 Figure 3.1 Regulator IC 7812 Regulator IC 7805 RF transmitting side RF receiveing side RF 433 module Block diagram of the project GPS system GPS module 16*2 LCD display Pin description of LCD Atmel AT89S52 microcontroller Block diagram of microcontroller 1 4 5 6 7

vii i

ix

LIST OF TABLES
Table1.1.1 Communication specification of GPS module......................................1 Table1.1.2 Pin description of GPS module5 Table 2.1.1 Pin description of Port 3 of AT89S52...........................................................13 Table 2.2.1Pin description of GPS module.....................................................................20 Table 3.3.1: Pin description of the LCD.........................................................................38 Table 3.3.2: Code description of the LCD......................................................................40 Table 3.3.3 Table 5.1: Cost Estimation...............................................................................................49

i x

LIST OF SYMBOLS / ABBREVIATIONS


GPS Global positioning system

DC E EMHC GND Hz INT LED LC LCD PCB RAM ROM EEPROM R/W

Direct Current Enable Electronic Micro Hydro Controller Ground Hertz Interrupt Light Emitting Diode Liquid Crystal Liquid Crystal Display Printed Circuit Board Random Access Memory Read Only Memory

Electrically Erasable Programmable Read-Only Memory


Read Write

SDA SCL W/P RS RXD TTL TXD GND Vcc

Serial data Serial clock input Write protect Register Select Receiver data Transistor Transistor Logic Transmitter data Ground Power Supply x

x i

x ii

1. INTRODUCTION

a. Background The Global Positioning System, usually called GPS, is the only fully-functional satellite navigation system. A constellation of more than two dozen GPS satellites Broadcasts precise timing signals by radio to GPS receivers, allowing them to accurately Determine their location (longitude, latitude, and altitude) in any weather, day or night, Anywhere on Earth. GPS has become a vital global utility, indispensable for modern navigation on land, sea, and air around the world, as well as an important tool for mapmaking and land surveying. GPS also provides an extremely precise time reference, required for telecommunications and some scientific research, including the study of earthquakes. i. Basic concept of GPS operation: A GPS receiver calculates its position by carefully timing the signals sent by the constellation of GPS satellites high above the Earth. Each satellite continually transmits messages containing the time the message was sent, a precise orbit for the satellite sending the message (the ephemeris), and the general system health and rough orbits of
13 | P a g e

all GPS satellites (the almanac). These signals travel at the speed of light through outer space, and slightly slower through the atmosphere. The receiver uses the arrival time of each message to measure the distance to each satellite, from which it determines the position of the receiver (conceptually the intersection of spheres ) The resulting coordinates are converted to more user-friendly forms such as latitude and longitude, or location on a map, then displayed to the user. It might seem that three satellites would be enough to solve for a position, since space has three dimensions. However, a three satellite solution requires the time be known to a nanosecond or so, far better than any non-laboratory clock can provide. Using four or more satellites allows the receiver to solve for time as well as geographical position, eliminating the need for a very accurate clock. In other words, the receiver uses four measurements to solve for four variables: x, y, z, and t. Although four satellites are required for normal operation, fewer may be needed in some special cases. If one variable is already known (for example, a ship or plane may already know its altitude), a receiver can determine its position using only three satellites. Also, in practice, receivers use additional clues (Doppler shift of satellite signals, last known position, dead reckoning, inertial navigation, and so on) to give degraded answers when fewer than four satellites are visible.

Fig. 1.1- satellite positioning Actually GPS is: -a space based positioning system used for navigation, tracking and mapping -it is designed and maintained by the US Military -truly global in scope -available every hour of every day all year long, and is cheap to use!

14 | P a g e

Fig: 1.2: Showing how GPS Works b. Objectives

ii. Course objectives This project work is included in the course with the following objectives: For the partial fulfillment of the requirement for the Bachelor of Electronics and communication Engineering. To bring theoretical knowledge into practice and explore beyond the books. To develop professionalism, teamwork, management and organizational skills. To promote latest technology.

iii. Specific objectives This project is proposed for the possibility of more reliable , economical and portable GPS tracking System with the following major objectives:

15 | P a g e

To Create a portable GPS logger that continuously records GPS position information at time interval automatically. To transmit the GPS recorded data through RF transmission and display in LCD which can be used by the user at home

Approach and Methodology The project is mainly adopted in the explorative and experiment based approach .It includes both the hardware and software sections and moreover its interfacing. The project team designed a circuit with hardware comprising ADC0808 ,microcontroller , liquid crystal display(LCD ),Power meter,Thyristor etc while the software section consists Keil,ISP Flash programmer .

1.1 Application Micro Hydropower Controller(EMHC) has wide applications .This project is mainly targeted for the micro hydro power . This system can also be implemented in protecting the high cost machines from being damaged due to high voltage with a simple modification.

2. THEORY OF BASIC COMPONENTS


16 | P a g e

2.1 GPS MODULE The GPS module is a device which is a compact all-in-one GPS receiver that continuously tracks all satellites in view and provides accurate satellite positioning data. Its 65 parallel channels and 20000+ correlators provide fast satellite signal acquisition and short start-up time. Acquisition sensitivity of -155dBm and tracking sensitivity of -158 dBm offer good performance even under difficult environments. The GPS MODULE is optimized for applications requiring good performance and low cost; it is suitable for a wide range of handhelds, asset tracking, Notebook, PDA-centric personal navigation system, and vehicle navigation products. The GPS module used in this project is GT-3721 which is featured by 16 channels to acquire and track satellites simultaneously Industry-leading TTFF speed Signal detection better than -155 dBm SBAS (WAAS/EGNOS) capable Cold start < 60sec Hot start < 5sec Accuracy 5m CEP RS232 signal output via 6 6-pin PS2 connector. 49.8 mm x 43.7 mm x 17.6 mm RoHS compliance

Fig 1.2 :GPS module

c.

GPS STATUS INDICATOR

The GT-3721R provides GPS status indicator. On board LED shows fix or non-fix. In fix mode the LED will light for 1 second and turn-off for 1 second. In another mode, the pin will light for 2 seconds and turn off for 2 seconds
17 | P a g e

d. . COMMUNICATION SEPECIFICATIONS

18 | P a g e

2.2 Liquid Crystal Display

A liquid crystal display (LCD) is a flat panel display, electronic visual display, video display that uses the light modulating properties of liquid crystals (LCs). LCs do not emit light directly. They are used in a wide range of applications, including computer monitors, television, instrument panels, aircraft cockpit displays, signage, etc. They are common in consumer devices such as video players, gaming devices, clocks, watches, calculators, and telephones. LCDs have displaced cathode ray tube (CRT) displays in most applications. They are available in a wider range of screen sizes than CRT and plasma displays, and since they do not use phosphors, they cannot suffer image burn-in. LCD comes in different shapes,sizes and features.The most common type of type of LCD module is the character(alpha-numeric) type LCD kmodule.In general all the readily available LCD modules make up of Hitachi HD44780(or compatible) controller chip,and have the ability to display 16,32 or 40 characters in one or two lines versions.

Figure2.1 16*2 LCD Display

19 | P a g e

2.2.1 Pin Description

Figure 2.2 2*16 LCD PIN NO. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 NAME Vss Vcc Vee RS RW E D0 D1 D2 D3 D4 D5 D6 D7 LED + LED FUNCTIONS Ground +ve Supply Contrast Register Select Read/Write Enable Data bit 0 Data bit 1 Data bit 2 Data bit 3 Data bit 4 Data bit 5 Data bit 6 Data bit 7 +ve Supply for backlight Ground for backlight

20 | P a g e

Pins 1 and 2 ie.ground(Vss) and Vcc are the power supply lines.The positive supply is connected to the Vcc and Vss is connected to the ground.Normally DC supply of 5 V is supplied to the LCD.But LCDs work well in thr range of 4-6V. Pin 3, Vee is a control pin which is used to alter the contrast of the display. Ideally, this pin should be connected to a variable voltage supply. A preset potentiometer is connected between the power supply lines with its wiper connected to the contrast pin is suitable in many cases. For simplicity, this pin can be connected to the ground. Pin 4 RS (Register Select) is used to differentiate the data and the command bytes. When this line is low data bytes transferred to the display are treated as commands, and data bytes reads from the display indicates its status. When set, character data can be transferred to and from the module. Pin 5 is the RW (Read/Write line). This line is pulled low in order to writes commands or character data to the module and should be pulled low to read character data or status information from its registers. Pin 6 is the E (Enable) line. This input is used to initiate the actual transfer of commands or character data between the module and data lines. When writing to the display, data is transferred only on high to low transition of this signal. However, when reading from the module, data will become available shortly after the low to high transition and remain available until the signal falls low again. Pin 7 to 14 are the 8 bit data bus lines (D0 to D7). Data can be transferred to and from the display either or a single 8 bit byte or as to 4 bit nibbles. In the latter case, only upper four data lines (D4 to D7) lines are used. Pin 15 and 16 are used as the supply for the backlight led. The backlight is immensely useful when the external light is insufficient for the visibility of the LCD.

2.3.2 LCD Commands Configuration and control of the LCD module is done by sending the command words to the LCD. There are many control words supported. Some of the basic control words that are frequently used are described below in brief: Clear Display D7 0 D6 0 D5 0 D4 0 D3 0 D2 0 D1 0 D0 1

21 | P a g e

The command word 01 clears display by writing 20H (space codes) to all the DDRAM address, sets DDRAM address 00H, into AC (Address counter) and returns the cursor to the original status i.e. home position. D7 0 Return Home D6 0 D5 0 D4 0 D3 0 D2 0 D1 0 D0 1

The command sets DDRAM address to 00H into the address counter, return cursor to the original site and return display to its original status if shifted. The contents of DDRAM do not change. Set Entry Mode D7 0 D6 0 D5 0 D4 0 D3 0 D2 1 D1 I/D D0 SH

The command sets the moving direction of the cursor and display. I/D: Increment / Decrement of DDRAM address (Cursor or blink) When I/D = High, cursor blinks moves to right and DDRAM address is increased by 1. When I/D = low, cursor blinks moves to left DDRAM address is decreased by 1. SH: Shift of Entire Display If SH = high, and DDRAM write operation, shift of entire display is performed according to I/D value i.e. if I/D = high, shift left else shift right. When SH = Low, no shift is performed. Display ON/OFF Control D7 0 D6 0 D5 0 D4 0 D3 1 D2 D D1 C D0 B

D: Display on/off control bit When D = High, entire display is turned on. When D = Low, display is turned off, but display data remains in DDRAM.

22 | P a g e

C: Cursor on/off control bit When C = High, cursor is turned on. When C = Low, cursor is disappeared in current display, but I/D register preserves its data. 14 B: Cursor blink on/off control bit When B = High, cursor blinking is on. When B = High, cursor blinking is off. Cursor or Display Shift D7 0 D6 0 D5 0 D4 1 D3 D/C D2 R/L D1 D0 -

D/C: Display or Cursor shift When D/C = High, the display is shifted and cursor moves accordingly. When D/C = Low, the cursor is shifted. R/L: Shift Direction When R/L: High, shifting is done to the right else shifting is done to the left. Function Set D7 0 D6 0 D5 1 D4 DL D3 N D2 F D1 D0 -

DL: Interface data length control bit. When DL: = High, it means 8-bit bus mode with MPU. When DL: = Low, it means 4-bit bus mode with MPU. N: Display Line Number control bit N: =High, for double line mode. N: =Low, for single line mode. F: Display font type control bit When F = High, 5*11 Dot format display mode is set. When F = Low, 5*8 Dot format display mode.
23 | P a g e

Set DDRAM Address D7 1 D6 AC6 D5 AC5 D4 AC4 D3 AC3 D2 AC2 D1 AC1 D0 AC0

When 1- line display mode (N=low), DDRAM address is from 00H to 4FH. In 2-line display mode (N=high), DDRAM address is the 1st line is from00H to 27H, and DDRAM address is the 2nd line is from40H to 67H. 2.3.3 Algorithms Initializing the LCD module - Write Clear Display command - Write Entry Mode command(can be left default by skipping it) - Write Display On/Off command(can be left default by skipping it) - Write Functions command Write command/data to the LCD - Clear R/W line - Set clear RS line - Set E(Enable ) line - Put command data on data line - Clear E(enable) line Read Status/Address from the LCD - Set R/W line - Clear RS line - Set E line - Read data from data line - Clear E line D7 BF D6 AC6 D5 AC5 D4 AC4 D3 AC3 D2 AC2 D1 AC1 D0 AC0

2.3 Microcontroller

24 | P a g e

A microcontroller is a general purpose device, but one of that is meant to read data, performs calculation on the data, and control its environment based on those calculations. The prime use of microcontroller is to control the operation of a machine using fixed program that is stored in ROM and that does not change over a lifetime of the system. It is a true computer on a chip with a ROM, RAM, memory decoders, an oscillator and a number of input/output devices such as parallel and serial data ports.

Figure 2. Atmel AT89S52 Microcontroller The AT89S52 is a low-power, high-performance CMOS 8-bit microcontroller with 8K bytes of in-system programmable Flash memory. The device is manufactured using Atmels high density nonvolatile memory technology and is compatible with the industrystandard 80C51 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 in-system programmable Flash on a monolithic chip, the Atmel AT89S52 is a powerful microcontroller which provides a highly-flexible and cost-effective solution to many embedded control applications. The AT89S52 provides the following standard features: a) 8K bytes of in system programmable (ISP) Flash memory. b) Endurance: 1000 Write/Erase cycles. c) Voltage level: 4.0 V to 5.5 V DC d) Fully static operation: 0 Hz to 33 MHz e) 256 bytes of internal RAM32 programmable I/O lines. f) Eight interrupts/ Fast programming time (Six sources). g) A full duplex serial port, on-chip oscillator, and clock circuitry. h) Fully static logic for operation down to zero frequency and supports two software selectable power saving modes. i) Idle Mode stops the CPU while allowing the RAM, timer/counters, serial port, and interrupt system to continue functioning. j) The Power-down mode saves the RAM contents but freezes the oscillator, disabling all other chip functions until the next interrupt or hardware reset. 2.3.1 Pin out Diagram

25 | P a g e

Figure 2.5 AT89S52 Pin out

2.3.2 Block Diagram of AT89S52

26 | P a g e

Figure 2.6 Block Diagram of AT89S52 Microcontroller 2.4.3 Pin Description VCC: Supply voltage. GND: Ground. 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 highimpedance inputs. Port 0 can also be configured to be the multiplexed low-order
27 | P a g e

address/data bus during accesses to external program and data memory. In this mode, P0 has internal pull-ups. Port 0 also receives the code bytes during Flash programming and outputs the code bytes during program verification. External pull-ups are required during program verification. Port 1 Port 1 is an 8-bit bidirectional I/O port with internal pull-ups. 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 pull-ups 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 pull-ups. In addition, P1.0 and P1.1 can be configured to be the timer/counter 2 external count input (P1.0/T2) and the timer/counter 2 trigger input (P1.1/T2EX), respectively, as shown in the following table. Port 1 also receives the loworder address bytes during Flash programming and verification. Port Pin Alternate Functions P1.0 T2 (external count input to Timer/Counter 2), clock-out P1.1 T2EX (Timer/Counter 2 capture/reload trigger and direction control) P1.5 MOSI (used for In-System Programming) P1.6 MISO (used for In-System Programming) P1.7 SCK (used for In-System Programming) 21 Port 2 Port 2 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 2 output buffers can sink/source four TTL inputs. When 1s are written to Port 2 pins, they are pulled high by the internal pull-ups 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 pull-ups. 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, Port 2 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 Port 3 is an 8-bit bidirectional I/O port with internal pull-ups. 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 pull-ups and can be used as inputs. As inputs, Port 3 pins that are externally
28 | P a g e

being pulled low will source current (IIL) because of the pull-ups. Port 3 receives some control signals for Flash programming and verification. Port 3 also serves the functions of various special features of the AT89S52, as shown in the following table. Port Pin Alternate Functions P3.0 RXD (serial input port) P3.1 TXD (serial output port) P3.2 INT0 (external interrupt 0) P3.3 INT1 (external interrupt 1) P3.4 T0 (timer 0 external input) P3.5 T1 (timer 1 external input) P3.6 WR (external data memory write strobe) P3.7 RD (external data memory read strobe) 22 RST Reset input. A high on this pin for two machine cycles while the oscillator is running resets the device. This pin drives high for 98 oscillator periods after the Watchdog times out. The DISRTO bit in SFR AUXR (address 8EH) can be used to disable this feature. In the default state of bit DISRTO, the RESET HIGH out feature is enabled. ALE/PROG Address Latch Enable (ALE) is an output pulse for latching the low byte of the address during accesses to external memory. This pin is also the program pulse input (PROG) during Flash programming. In normal operation, ALE is emitted at a constant rate of 1/6 the oscillator frequency and may be used for external timing or clocking purposes. Note, however, that one ALE pulse is skipped during each access to external data memory. If desired, ALE operation can be disabled by setting bit 0 of SFR location 8EH. With the bit set, ALE is active only during a MOVX or MOVC instruction. Otherwise, the pin is weakly pulled high. Setting the ALE-disable bit has no effect if the micro controller is in external execution mode. PSEN Program Store Enable (PSEN) is the read strobe to external program memory. When the AT89S52 is executing code from external program memory, PSEN is activated twice each machine cycle, except that two PSEN activations are skipped during each access to
29 | P a g e

external data memory.

EA/VPP External Access Enable, EA must be strapped to GND in order to enable the device to fetch code from external program memory locations starting at 0000H up to FFFFH. Note, however, that if lock bit 1 is programmed, EA will be internally latched on reset. EA should be strapped to VCC for internal program executions. This pin also receives the 12volt programming enable voltage (VPP) during Flash programming. Quartz Crystal A crystal oscillator is an electronic oscillator circuit that uses the mechanical resonance of a vibrating crystal of piezoelectric material to create an electrical signal with a very precise frequency. This frequency is commonly used to keep track of time (as in quartz wristwatches), to provide a stable clock signal for digital integrated circuits, and to 23 stabilize frequencies for radio transmitters and receivers. The most common type of piezoelectric resonator used is the quartz crystal, so oscillator circuits designed around them became known as "crystal oscillators. Quartz crystals are manufactured for frequencies from a few tens of kilohertz to tens of megahertz. It is used mostly in small devices for consumer devices such as wristwatches, clocks, radios, computers, and cell phones. It is also found inside test and measurement equipment, such as counters, signal generator, and oscilloscopes. The crystal used is quartz crystal used to generate 11.0592 MHz to generate frequency for the microcontroller. XTAL1 Input to the inverting oscillator amplifier and input to the internal clock operating circuit. XTAL2 It is the output from the inverting oscillator amplifier. 2.4.4 Memory Organization MCS-51 devices have a separate address space for Program and Data Memory. Up to 64K bytes each of external Program and Data Memory can be addressed.
30 | P a g e

Program Memory If the EA pin is connected to GND, all program fetches are directed to external memory. On the AT89S52, if EA is connected to VCC, program fetches to addresses 0000H through 1FFFH are directed to internal memory and fetches to addresses 2000H through FFFFH are to external memory. Data Memory The AT89S52 implements 256 bytes of on-chip RAM. The upper 128 bytes occupy a parallel address space to the Special Function Registers. This means that the upper 128 bytes have the same addresses as the SFR space but are physically separate from SFR space. When an instruction accesses an internal location above address 7FH, the address mode used in the instruction specifies whether the CPU accesses the upper 128 bytes of RAM or the SFR space. Instructions which use direct addressing access the SFR space. For example, the following direct addressing instruction accesses the SFR at location 0A0H (which is P2). 2.4.5 Timer/Counters: Atmels 89s52 consists of three 16- bit timer/counters, that can operate as either timers or an event counters. Timer 0/Timer 1 Timer 0 and Timer 1 have similar operations (except for that Timer 1 can be used for the baud rate generator) and function essentially the same way. Configurations regarding these timers are done by setting the SFRs- TCON and TMOD. These timers may operate in any one of four modes that are determined by the mode bits, M1 and M0, in the TMOD register. Timer Mode 0 Setting timer X mode to 00b in the TMOD register in using the THX register as an 8 bit counter and TLX as a 5-bit counter; the pulse input is divided by 32d in the TL so that TH counts the original oscillator frequency reduced by a total 384d. Timer Mode 1 Mode 1 is similar to mode 0 except TLX is configured as a full 8-bit counter when the mode bits are set to 01b in TMOD. The timer flag would be set in .1311 seconds using 6 MHz crystal. Timer Mode 2

31 | P a g e

Setting the mode bits 10b in TMOD configures the timer to use the TLX counter as an 8bit counter. THX is used to hold a value that is loaded into TLX every time TLX overflows from FFh to 00h.The timer flag is also set when TLX overflows. This mode exhibits an auto-reload feature; TLX will count up from the number in THX, overflow, and be initialized again with the contents of THX. Timer Mode 3 Timers 0 and 1 may be programmed to be in mode 0, 1, or 2 independently of a similar mode for other timer. The timers do not operate independently if the mode3 is chosen for timer 0.Placing timer 1 in mode 3 causes it to stop counting; the control bit TR! And the timer 1 flag TF1 are then used by timer 0. Timer 0 in mode 3 becomes two completely separate 8-bit counter.TL0 is controlled by the gate arrangement and sets timer flag TF0 whenever it overflows from FFh to 00h. TH0 receives the timer clock (the oscillator divided by 12) under the control of TR1 only and sets the flag when it overflows. Timer 1 may still be used in modes 0, 1, and 2, while timer 0 is in mode 3 with one important exception: No interrupts will be generated by timer while timer 1 while timer 0 is using the TF! Overflow flag. Switching timer 1 to mode 3 will stop it (and hold whatever count is in timer 1). Timer 1 can use for baud rate generation for the serial port, or any other mode 0, 1, and 2, functions that does not depend on an interrupt (or any other use of the TF1flag) for proper operation. Counter The only difference between counting and timing is the source of the clock pulses to the counter. When used as a timer, the clock pulses are sourced from the oscillator through the divide- by- 12d circuit. When used as a counter, pin T0 supplies to counter 0, and pin T1 to counter 1.The C/T bit in TMOD must be sent to 1 to enable pulses from the TX pin to reach the control circuit. The input pulse on TX is sampled during P2 of the state 5 every machine cycle. A change on the Input from high to low between samples will increment the counter. Each high to low state of the input pulse must thus be held constant for at least one machine cycle to ensure reliable counting. Since this takes 24 pulses, the maximum input frequency that can be accurately counted is the oscillator frequency divided by 24. Timer 2 The operations of Timer 2 are controlled by the T2CON SFR. Timer 2 has three operation modes: capture, auto-reload (up or down counting), and baud rate generator. Capture Mode

32 | P a g e

In capture mode, two options are selected by bit EXEN2 in T2CON. If EXEN2 = 0, timer 2 is a 16-bit timer or counter which upon overflow sets bit TF2 in TCON. This bit can then used to generate an interrupt. If EXEN2 = 1, Timer 2 performs the same operation, but a 1to-0 transition at input T2EX also causes the current value in TH2 and TL2 to be captured into RCAP2L, respectively. In addition, the transition at T2EX causes bit EXF2 in TR2CON to set. The EXF2 bit, like TF2, can generate an interrupt. Auto-Reload (Up or Down Counter) Timer 1 can be programmed to count up or down when configured in its 16-bit auto-reload mode. This feature is invoked by the DCEN (Down Enable Counter) bit located in the SFR T2MOD. Upon reset, the DCEN bit is set to 0 so that the timer 2 will default to count up. When DCEN is set, timer 2 can count up or down, depending on the value of the T2EX pin. In this mode, two options are selected by bit EXEN 2 in T2CON. If EXEN2 = 0, timer 2 counts up to 0FFFFh and then sets the TF2 bit upon overflow. The overflow also causes timer register to be reloaded with the 16-bit value in RCAP2 and RCAP2L.The values in timer in capture mode RCAP2H and RCAP2L are preset by software. If EXEN2 = 1a 16bit reload can be triggered either by an overflow or by a 1 to 0 transition at external input T2EX.This transition also sets the EXF2 bit. Both the TF2 and EXF2 bit can generate an interrupt if enabled. Baud Rate Generator The baud rate generator mode is similar to the autoreload mode, in that a rollover in TH2 causes the timer 2 registers to reload with the 16-bit value in registers RCAP2H and RCAP2L, which are preset by software. The timer operation is different for timer 2 when it is used as a baud rate generator. Normally, as the timer, it increments every machine cycle that is at 1/12 the oscillator frequency, but as a baud rate generator, however, it increments every state time (at 1/12 the oscillator frequency).Baud Rate= (oscillator frequency)/ [32*(65536-RCAP2H, RCAP2L)] (RCAP2H, RCAP2L) is the content of RCAP2H and RCAP2L taken as a 16 bit unsigned integer. For 11.0592 MHz Crystal Oscillator: XTAL= 11.0592 MHz Machine cycle frequency= 11.0592 MHz/12 = 921.6 KHz Frequency provided by UART to Timer 1 to set baud rate= 921.6 KHZ/ 32 = 28800 Hz Thus for 9600 baud rate;
33 | P a g e

Baud rate in HEX= 256-28800/9600= 256-3=253 d=FD h e. EEPROM

EEPROM stands for Electrically Erasable Programmable Read-Only Memory and is a type of nonvolatile memory used in computers and other electronic devices to store small amounts of data that must be saved when power is removed, e.g., calibration tables or device configuration. EEPROM is user-modifiable read-only memory (ROM) that can be erased and reprogrammed (written to) repeatedly through the application of higher than normal electrical voltage generated externally or internally in the case of modern EEPROMs. EPROM usually must be removed from the device for erasing and programming, whereas EEPROMs can be programmed and erased in circuit. Originally, EEPROMs were limited to single byte operations which made them slower, but modern EEPROMs allow multi-byte page operations. It also has a limited life - that is, the number of times it could be reprogrammed was limited to tens or hundreds of thousands of times. That limitation has been extended to a million write operations in modern EEPROMs. In an EEPROM that is frequently reprogrammed while the computer is in use, the life of the EEPROM can be an important design consideration. It is for this reason that EEPROMs were used for configuration information, rather than random access memory. [8]

Figure 5.18 EEPROM

Features Low-voltage and Standard-voltage Operation


34 | P a g e

2.7 (VCC = 2.7V to 5.5V) 1.8 (VCC = 1.8V to 5.5V) Internally Organized 128 x 8 (1K), 256 x 8 (2K), 512 x 8 (4K), 1024 x 8 (8K) or 2048 x 8 (16K) Two-wire Serial Interface Schmitt Trigger, Filtered Inputs for Noise Suppression Bidirectional Data Transfer Protocol 100 kHz (1.8V) and 400 kHz (2.7V, 5V) Compatibility Write Protect Pin for Hardware Data Protection 8-byte Page (1K, 2K), 16-byte Page (4K, 8K, 16K) Write Modes Partial Page Writes Allowed Self-timed Write Cycle (5 ms max) High-reliability Endurance: 1 Million Write Cycles Data Retention: 100 Years Automotive Devices Available 8-lead JEDEC PDIP, 8-lead JEDEC SOIC, 8-lead Ultra Thin Mini-MAP (MLP 2x3), 5-lead SOT23, 8-lead TSSOP and 8-ball dBGA2 Packages Die Sales: Wafer Form, Waffle Pack and Bumped Wafers Table 5.4: Pin Description of EEPROM (ATC02A) Pin Name A0 A2 SDA SCL WP NC GND VCC Function Address Inputs Serial Data Serial Clock Input Write Protect Not Connected Ground Power Supply

35 | P a g e

Pin Description Serial Clock (SCL): The SCL input is used to positive edge clock data into each EEPROM device and negative edge clock data out of each device. Serial Data (SDA): The SDA pin is bidirectional for serial data transfer. This pin is open-drain driven and may be wire-ORed with any number of other open-drain or open collector devices. Device/Page Address (A2, A1, A0): The A2, A1 and A0 pins are device address inputs that are hard wired for the AT24C01A and the AT24C02. As many as eight 1K/2K devices may be addressed on a single bus system (device addressing is discussed in detail under the Device addressing section). The AT24C04 uses the A2 and A1 inputs for hard wire addressing and a total of four 4K devices may be addressed on a single bus system. The A0 pin is a no connect and can be connected to ground. The AT24C08A only uses the A2 input for hardwire addressing and a total of two 8K devices may be addressed on a single bus system. The A0 and A1 pins are no connects and can be connected to ground. The AT24C16A does not use the device address pins, which limits the number of devices on a single bus to one. The A0, A1 and A2 pins are no connects and can be connected to ground. Write Protect (WP): The AT24C01A/02/04/08A/16A has a Write Protect pin that provides hardware data protection. The Write Protect pin allows normal Read/Write operations when connected to ground (GND). When the Write Protect pin is connected to VCC, the write protection feature is enabled and operates as shown.

36 | P a g e

Device Operation Clock and Data Transition: The SDA pin is normally pulled high with an external device. Data on the SDA pin may change only during SCL low time period data changes during SCL high periods will indicate a start or stop condition as defined below . Start Condition: A high-to-low transition of SDA with SCL high is a start condition which must precede any other command. Stop Condition: A low-to-high transition of SDA with SCL high is a stop condition. After a read sequence, the stop command will place the EEPROM in a standby power mode. Acknowledge: All addresses and data words are serially transmitted to and from the EEPROM in 8-bit words. The EEPROM sends a zero to acknowledge that it has received each word. This happens during the ninth clock cycle. Standby Mode: The AT24C01A/02/04/08A/16A features a low-power standby mode which is enabled: (a) upon power-up and (b) after the receipt of the STOP bit and the completion of any internal operations. Memory Reset: After an interruption in protocol, power loss or system reset, any 2-wire part can be reset by following these steps: 1. Clock up to 9 cycles. 2. Look for SDA high in each cycle while SCL is high. 3. Create a start condition.

f.

Preset (10K)

It is a three terminal electronic device that has a facility to vary the resister value. The resistivity between terminal 1 and 2 is the full range of Preset value. We can get variable value of resistivity by re-setting the Preset value at required level. It is an adjustable resistor.
37 | P a g e

Figure5.8 Image of Preset

Figure5.9 Circuit Symbol of Preset

g. Resistor

It is an electronic device that possesses resistance. Their resisting characteristic is known as resistivity and is measured in Ohm () unit.

Figure5.10 Image of Different Resistor

Figure5.11 Circuit symbol of resister

Color Code of Resistor

38 | P a g e

Figure5.12 Color code of resistor h. Light Emitting Diodes LED Stands for "Light-Emitting Diode." An LED is an electronic device that emits light when an electrical current is passed through it. Early LEDs produced only red light, but modern LEDs can produce several different colors, including red, green, and blue (RGB) light. Recent advances in LED technology have made it possible for LEDs to produce white light as well.LEDs are commonly used for indicator lights (such as power on/off lights) on electronic devices. They also have several other applications, including electronic signs, clock displays, and flashlights. When a light-emitting diode is forward biased (switched on), electrons are able to recombine with electron holes within the device, releasing energy in the form of photons. This effect is called electroluminescence and the color of the light (corresponding to the energy of the photon) is determined by the energy gap of the semiconductor. LEDs are often small in area (less than 1 mm2), and integrated optical components may be used to shape its radiation pattern. LEDs present
39 | P a g e

many advantages over incandescent light sources including lower energy consumption, longer lifetime, improved robustness, smaller size, and faster switching. LEDs powerful enough for room lighting are relatively expensive and require more precise current and heat management than compact fluorescent lamp sources of comparable output. Light-emitting diodes are used in applications as diverse as replacements for aviation lighting, automotive lighting (particularly brake lamps, turn signals and indicators) as well as in traffic signals. LEDs have allowed new text, video displays, and sensors to be developed, while their high switching rates are also useful in advanced communications technology. Infrared LEDs are also used in the remote control units of many commercial products including televisions, DVD players, and other domestic appliances.

Figure 2. Light Emitting Diode(LED) 2.9 Voltage Regulator ;LM7805/7812 Voltage stabilizers are semiconductor devices that output a constant and stable DC voltage at a specified level despite fluctuations in its input voltage or variations in its load. There are several types of voltage regulatorsThe LM78XX series of three terminal positive regulators are available in the TO-220 package and with several fixed output voltages, making them useful in a wide range of applications. Each type employs internal current limiting, thermal shut down and safe operating area protection, making it essentially indestructible. If adequate heat sinking is provided, they can deliver over 1A output current. Although designed primarily as fixed voltage regulators, these devices can be used with external components to obtain adjustable voltages and currents.

40 | P a g e

Figure: 7805IC Features Output Current up to 1A Output Voltages of 5, 6, 8, 9, 12, 15, 18, 24 Thermal Overload Protection Short Circuit Protection Output Transistor Safe Operating Area Protection XX defines 5V, 9V, 12V, 15V etc. 2.5 RF Communication RF transmitters are an essential part of modern communications. Designed and assembled from core RF components, RF transmitters have many different forms and applications. We often think of RF transmitters in wireless communications, but the concept applies equally to wired applications such as cable television. Cellular phones, radar, military communications, avionics, wireless LAN, modems, and signal generators are just a few examples of systems that employ one or more RF transmitters.

41 | P a g e

Fig: RF transmitting side

Fig: RF receiver side

Some Features: High sensitive & low power consumption FSK technology, suitable for replacing ASK modules. Less interference, longer working distance. No tuning required during production. Can be used to replace ASK module W/O the need of software change.

42 | P a g e

i. Design Approach j. System methodology After the selection of project the first task of a system designer undertakes is the requirement analysis of the project. Requirement analysis of the project enables us to specify system function and performance indicate interface of various system elements and establish design constraints that system must meet. For a successful design, a throughout interaction with the user is necessary at this stage. The process equipment is designed considering needs of the user, the variables identified and availability of resources. Since the project GPS Data Logger contains the large number of devices, information of GPS module record continuously at a certain interval of time ,we have divided our project in three parts . The first works as a basic GPS logger, which displays GPS position information at timed intervals in an LCD (I). The second mode only records the position information data in an EEPROM. At last the geographical co-ordinates are transmitted through RF and displayed in LCD(ii) through receiver side via a RF transmission. The whole project was accomplished by using following methods:
Design: Firstly block diagram and layout of the proposed GPS Data Logger system is

designed and finalized.

Selection of components and software : Different components like LED, GPS module

,LCD, crystal etc. as peripherals to the microcontroller is chosen and programming software like Keil, ISP flash etc. used. flow charts are created. Then according to the flow charts drawn , code/program of the proposed system is developed using the C programming language.

Coding and simulation: The logic flow of the whole system is decided and accordingly

Circuit Testing in Breadboard: Since the simulation gives output in the ideal situation,

testing the hardware needs to be done .The circuit tested in the breadboard with wired connections.

43 | P a g e

Burning :With the desired output, the hex code of the program being created by the

software platform is burnt in memory of the microcontroller IC with the help of the programmer. the help of soldering iron, lead and flux according to the hardware schematic. appropriate program for the most proper working system.

PCB Design: All the hardware components are soldered on the printed circuit boards with Testing and Debugging : Testing and debugging is done at various levels finalize the

k. System Block diagram

44 | P a g e

Fig : Block diagram of GPS Data Logger l. Block diagram description Here there are 2 units: Car unit c unit P Car / vehicle unit: This unit is placed on the car .here we are tracking the vehicle in the off-line mode. For this we are using a RTC(real time clock).as soon as a stipulated time passes say 5 minutes the c then receives the co-ordinates of that place and stores them in the on board EEPROM . EEPROM + RTC: Here since we are tracking the vehicle in the offline mode we are making use of an on board RTC. The EEPROM stores these co-ordinates in the pre-determined memory locations. PC unit: After the car returns to the destination .the kit is joined to the pc. A Software like: keil, orcad (ckt diagram), protel (pcb designing), is used to download all the locations stored in the memory. Micro-controller: Well be using 89S52 series micro-controller. The 89S52 is also Inapplication
45 | P a g e

Programmable (IAP), allowing the Flash program memory to be reconfigured even while the application is running. The Flash program memory supports both parallel programming and in serial In-System Programming (ISP) Parallel programming mode offers gang-programming at high speed, reducing programming costs and time to market. ISP allows a device to be reprogrammed in the end product under software control. EEPROM: Well use AT24C128/256 as the storage device. The AT24C128/256 provides 131,072/262,144 bits of serial electrically erasable and programmable read only memory (EEPROM) organized as 16,384/32,768 words of 8 bits each. RS 232 Protocol: Is used for serial communication in between c to pc. In our project the master is connected to the pc via RS-232. GPS: Well be using the GPS902A board by which will be having the GPS module FLSGPSMD90 by Flaircomm. GPS Protocols: The various protocol that are available from this GPS module are : Table 3.1 Out of these have short listed two protocols which we will be using in this project. They are i) RMC protocol ii) VTG protocol These

2. Software Implementation
m. Software Software is pervasive in electronic product. It is the software that control the overall functioning of GPS module. We have stored program in a microcontroller. Software, being a crucial part of our project, is going to discussed in detail in this section. Software Language
The program used for the operation of the GPS module is written in C language.The language was carwfully selected the choice was made on the basis of the following decisive factors. I. II. III. IV. V. Memory available Required execution speed Accurate control of peripheral devices Programming experience of team member Time available

Other used tool for programming are: 46 | P a g e

Notepad, Notepad++ ISP flash programmer: For Programming Microcontroller.

4.2 Software Tools

4.2.1Kiel Vision 3 For programming the microcontroller in C language and compiling, converting it to hex file, we used Kiel Vision 3. We used this platform due to its ease and efficient processing in issue of time and cost.

Figure 2.5.1 Snapshot of Kiel Vision 3

Some of the features of Kiel Vision include: Extensive MCU specific language extensions, allowing effective u se of the underlying hardware.

MCU specific optimizations, including a global register allocator.

47 | P a g e

Adaptable MCU specific backend that should be well suited for other 8 bit MCUs A full range of data types: char (8 bits, 1 byte), short (16 bits, 2 bytes), int (16 bits, 2 bytes), long (32 bits, 4 bytes) and float (4 byte IEEE). The ability to add inline assembler code anywhere in a function.

The ability to report on the complexity of a function to help decide what should be re-written in assembler. A good selection of automated regression tests . . 4.2.2 Live wire

Livewire is a CAD product developed by New Wave Concepts. It allows the user to create and simulate electronic circuits using an extensive gallery of circuit components. The finished circuit can be exported into sister-program PCB Wizard in order to route it for a Printed circuit board. Livewire is a powerful software package for designing, simulating and analyzing electronic circuits. Switches, transistors, diodes, integrated circuits and hundreds of other components can all be connected together to investigate the behaviour of a circuit. There are no limits to what can be designed and no loose connections or faulty components to worry about.

48 | P a g e

It has the following features: Real time interactive circuit simulation Large database of component devices Schematic design and capture Realistic simulation of maximum component ratings and component destruction Standard edition includes voltmeter, ammeter and oscilloscope
Pro edition includes a comprehensive suite of virtual instruments including voltmeter,

ammeter, oscilloscope, logic analyzer, signal generator and word generator Control Studio 2, Circuit Wizard and PCB Wizard 3 file support Integrated publishing with text, graphics and spell-checking support

3. ISP Flash Programmer ISP Flash Programmer is software, which Is used to burn the program (i.e. in hex file format)In the microcontroller
49 | P a g e

4.2 Hardware Tools Self designed parallel ISP Programmer Kit (Burner) to burn the program in microcontroller.

Test Kit; to test the program in the respective hardware circuit.

16*2 LCD Display

Power supply

50 | P a g e

You might also like