Thursday, March 28, 2024

Standalone GPS Receiver with LCD Display

By Sani Theo and Prince Gupta

Software program

The program for the microcontroller is written in ‘C’ language using AVR Studio 4.

NMEA protocol. The basic working of the project is based on decoding of National Marine Electronics Association (NMEA) protocol through software program. The iWave GPS module uses NMEA-0183, which is a subset of NMEA protocol. This protocol includes a set of messages that use ASCII character set and have a defined format. These messages are continuously sent by the GPS module to the interfacing device. Each message starts with a ‘$’ (hex 0x24) and ends with (hex 0x0D 0x0A).

These messages include GGA, GGL, GSA, GSV, RMC, VTG and ZDA. For this project we need not know about all of these messages. We just need the GGA message string, which represents the time, position and fixed data for this application. This string has a format like:

$GPGGA, 002153.000, 3342.6618,
N,11751.3858, W, 1.2, 27.0, M, -34.2,
M,,0000*5E

Here each field separated by comma (‘,’) represents a particular information. We are using only five of these fields for our purpose of displaying the time, latitude, latitude-direction, longitude and longitude-direction, which are 2nd, 3rd, 5th, 4th and 6th fields, respectively.

- Advertisement -

The project uses two software programs, namely, ‘gpss.c’ and ‘lcd2.h,’ where ‘gpss.c’ is the main program and ‘lcd2.h’ driver file for the LCD module.

The main ‘C’ program starts with the following code lines:

#include
#include
#include
#include “lcd2.h”

- Advertisement -

where ‘#include’ is the AVR microcontroller header file for input/output (I/O) ports and ‘#include “lcd2.h”’ is the header file for the LCD module.

EAD_Fig_3
Fig. 3: GPS module

The codes have been commented wherever necessary. For details of LCD interfacing and message display on the LCD, please refer the ‘Moving Message Display On LCD’ project published in EFY Dec. 2011 issue.

Data transfer between the GPS module and microcontroller through their respective transmit and receive pins is straightforward and therefore we have not discussed it here.

Compiling and programming the code. To work with the Atmel AVR microcontroller using ‘C’ programming language, you need two tools: AVR Studio and WinAVR. Both of these tools are freely available for download from the Internet.

AVR Studio is an integrated development environment that includes an editor, assembler, etc. It can be downloaded from the link.

WinAVR is a GCC-based compiler for AVR. It appears in AVR Studio as a plug-in. WinAVR also includes a program called Programmer’s Notepad that can be used to edit and compile ‘C’ programs, independently of AVR Studio. WinAVR setup file is available at http://winavr.sourceforge.net/

Remember to install AVR Studio before WinAVR.

To compile the gpss.c code, first launch AVR Studio from the desktop. You need to create a new project for the gpss.c code. Next, click ‘Build→Rebuild All’ to compile the ‘C’ code. If there is no error message, a file called ‘gpss.hex’ will be generated. This file contains the machine code that is ready to be downloaded to the ATmega16 microcontroller. The file is stored in sub-folder ‘\default’ of your project. If there are error messages, check your ‘C’ code. Most often these are caused by some typo or syntax errors.

Burn the hex code into the chip using EFY-KnS AVR development board or any other standard AVR programmer/burner.

2 COMMENTS

SHARE YOUR THOUGHTS & COMMENTS

Electronics News

Truly Innovative Tech

MOst Popular Videos

Electronics Components

Calculators