GPS modem is a device which receives signals from satellite and provides information about latitude, longitude, altitude, time etc. The GPS navigator is more famous in mobiles to track the road maps. The GPS modem has an antenna which receives the satellite signals and transfers them to the modem. The modem in turn converts the data into useful information and sends the output in serial RS232 logic level format. The information about latitude, longitude etc is sent continuously and accompanied by an identifier string.
This article shows how to interface the GPS modem with ATmega16 and extract the location (latitude and longitude) from the GPGGA string and display it on LCD.
The connection of GPS modem with AVR microcontroller (ATmega 16) is shown in the circuit diagram. The ground pin of max 232 and serial o/p of GPS modem is made common. Pin2 of MAX232 is connected to pin 3 of GPS modem and pin 3 of max 232 is connected to pin 2 of modem. This type of connection is called a serial cross cable.
Pin 2 of MAX232
Pin 3 of GPS Modem
Pin 3 of MAX232
Pin 2 of GPS Modem
Pin 5 Ground Pin of MAX232
Pin 5 Ground of GPS Modem
The commonly available GPS modem gives output in serial (RS232) form. The output consists of a series of string.
The following is an example of the output string from the GPS module with its explanation. This output strings contains information about latitude, longitude, time etc and will always start with $GPGGA. Refer NMEA Standards for more details on string formats.
An example string has been given and explained below:
1. A string always start from ‘$’ sign
2. GPGGA :Global Positioning System Fix Data
3. ‘,’ Comma indicates the separation between two values
4. 100156.000 : GMT time as 10(hr):01(min):56(sec):000(ms)
5. 2650.9416,N: Latitude 26(degree) 50(minutes) 9416(sec) NORTH
6. 07547.8441,E: Longitude 075(degree) 47(minutes) 8441(sec) EAST
7. 1 : Fix Quantity 0= invalid data, 1= valid data, 2=DGPS fix
8. 08 : Number of satellites currently viewed.
9. 1.0: HDOP
10. 442.8,M : Altitude (Height above sea level in meter)
11. -42.5,M : Geoids height
12. __ , DGPS data
13. 0000 : DGPS data
14. *71 : checksum
The following algorithm is used to extract the latitude and longitude information from the GPS module using $GPGGA string and display it on a LCD:
1. Get data in UDR and check weather that data is equal to $. If the data matches go to step(2) else get a new data.
2. Get data byte by byte and check if the received byte is equal to GPGGA
3. If the step (2) matches completely then go to step (4) else go back to step(1)
4. Leave first comma and wait till second comma (since we not looking for time).
5. Start taking data in an array lati_value[ ] till the next comma.
6. Get latitude direction in lati_dir
7. Do the same for longitude
8. Display the values on LCD and go back to step (1).
The MAX232 IC is used to convert the TTL/CMOS logic levels to RS232 logic levels during serial communication of microcontrollers with PC. The controller operates at TTL logic level (0-5V) whereas the serial communication in PC works...
LCD (Liquid Crystal Display) screen is an electronic display module and find a wide range of applications. A 16x2 LCD display is very basic module and is very commonly used in various devices and circuits. These modules are preferred over seven segments...
ATmega16 is an 8-bit high performance microcontroller of Atmel’s Mega AVR family with low power consumption. Atmega16 is based on enhanced RISC (Reduced Instruction Set Computing) architecture with 131 powerful instructions. Most of the instructions execute in one machin...
Click Here For Source Code
Tags: Create Your Own, Electronic projects, How to Make..., Microcontroller
This post was written by:
Hi,I'm Mukesh Kumar who has written more than 1500 posts on S2P Tech ,from India. I love blogging, making Electronics Projects, SEO, Web Developing and Designing.I like to learn and share technical hacking/security tips with you.
Get Free Email Updates to your Inbox!