# GPS Tracker Project ( GPS Module + JP Module + LCD Dispaly )

#### oldspring

##### New Member
Hello all,

I just finished a summer project which is a GPS tracker demonstration program with data logging capacity. It uses BasicStamp 2P (also you can use PIC chip) to interface with a GPS Module, JP Module and 16x2 LCD display. Sample code used is standard PBasic 2.5 ( It can be changed to PicBasic or PicBasic Pro very easy).

It can record GPS data to a MMC/SD card with latitude and longitude information. The data can be processed from Google Map at the website: http://www.gpsvisualizer.com. If you have Google Earth installed, the data also can be processed into a KML file (Google earth data file format) at the website: http://www.gpsvisualizer.com/map?form=googleearth

Main components:
(1) Basic Stamp 2P
Manufacturer: www.parallax.com
Datasheet: http://www.parallax.com/tabid/440/Default.aspx

(2) GPS Module 40EBLS
Manufacturer: www.mightygps.com
Datasheet: http://www.electro-tech-online.com/custompdfs/2008/07/MightyGPS40EBLS.pdf

(3) JP Module
Manufacturer: www.jianpingusa.com
Datasheet: http://www.jianpingusa.com/datasheet...nstruction.pdf

(4) 16x2 LCD Display
Manufacturer: http://www.femacorp.com/
Datasheet: http://www.femacorp.com/Products/LCD...es Index.htm

Attached files:
(1) Schematic

(2) Code
'======================================================
' File...... GPS Tracking Data Logger Demo
' Purpose... BS2P + JP Module + GPS Module + 16x2 LCD
' Author.... OldSpring
' Email..... OldSprings@yahoo.com
' Started...
' Updated... 18 July 2008
'
' {$STAMP BS2p} ' {$PBASIC 2.5}
'
'=======================================================

#SELECT $STAMP #CASE BS2, BS2E, BS2PE T2400 CON 396 T4800 CON 188 T9600 CON 84 T19K2 CON 32 #CASE BS2SX, BS2P T2400 CON 1021 T4800 CON 500 T9600 CON 240 T19K2 CON 110 #CASE BS2PX T2400 CON 1646 T4800 CON 813 T9600 CON 396 T19K2 CON 188 #ENDSELECT '------------------------------------------------------- ' I/O Definitions '------------------------------------------------------- E PIN 1 'LCD Enable Pin SOUT PIN 15 'Send command and data to JP Module StatePin PIN 14 ResetPin PIN 13 GPS_In PIN 12 'GPS Data in RecIndicator PIN 11 'GPS Data record Indicate '------------------------------------------------------- ' Constants '------------------------------------------------------- '------------------------------------------------------- ' Variables '------------------------------------------------------- RecCount VAR Byte x VAR Nib GPSData VAR Byte(24) 'GPS Data from module JP_Baud CON T19K2 ' 19200,8,N,1 GPS_Baud CON T4800 ' 4800,8,N,1 '-------------------------------------------------------- ' LCD command '-------------------------------------------------------- LcdCls CON$01 ' clear the LCD
LcdHome CON $02 ' move cursor to home LcdLine1 CON$80 ' Lcd address for line 1
LcdLine2 CON $C0 ' Lcd address for line 2 Init_LCD: PAUSE 1000 ' LCD self init LCDCMD E, %00110000 ' wakeup PAUSE 10 LCDCMD E, %00100000 ' set data for 4 bits LCDCMD E, %00101000 ' set 2(4) line mode with 5x8 font LCDCMD E, %00001100 ' turn cursor off LCDCMD E, %00000110 ' auto increment cursor '------------- First Screen --------------- LCDCMD E, LcdCls LCDOUT E, LcdLine1, [" GPS Tracking "] LCDOUT E, LcdLine2, [" Data Logger "] PAUSE 2000 '*********************************************************** ' Format MMC/SD Card with FAT16 'Warning: Format will erase ALL data on your MMC/SD card!!!! '=========================================================== ' GOSUB Formatting If formatting MMC/SD Card '=========================================================== GOSUB Init_JP_Module ' ---------------------------------------------------------- ' Initialization ' ---------------------------------------------------------- Initialize: RecCount = 0 ' OUTPUT RecIndicator LCDCMD E, LcdCls LCDOUT E, LcdLine1, ["La:"] LCDOUT E, LcdLine2, ["Lo:"] '----------------------------------------------------------- ' Main program '----------------------------------------------------------- HIGH RecIndicator 'Turn LED ON Main: GOSUB DisplayData 'LCD Dispaly GPS Data GOSUB RecordData 'Record Record Data PAUSE 5000 'About per sample/per 5 sec. GOTO Main END ' ---------------------------------------------------------- ' Subroutines '----------------------------------------------------------- RecordData: GOSUB Rec_GPS_Data 'Get GPS Data for record '*********************************************************** ' Change GPS Data format "xxxx.xxxx,N,xxxxx.xxxx,W" ' to Google Earth Data format "xxxx.xxxx,-xxxxx.xxxx" '*********************************************************** 'DEBUG GPSData(11),CR IF GPSData(11) = "N" THEN GPSData(0) = " " ELSE GPSData(0) = "-" ENDIF 'DEBUG GPSData(24),CR IF GPSData(24) = "W" THEN GPSData(12) = "-" ELSE GPSData(12) = " " ENDIF GPSData(11)= " " 'DEBUG STR GPSData\23,CR SEROUT SOUT, JP_Baud, [STR GPSData\23, CR,"!!"] 'Data recording RETURN '----------------------------------------------------- DisplayData: GOSUB LCD_GPS_Data LCDOUT E, LcdLine1 + 5, [STR GPSData\11] FOR x = 0 TO 12 GPSData(x) = GPSData(x+12) NEXT LCDOUT E, LcdLine2 + 4, [STR GPSData\12] RETURN '------------------------------------------------------- LCD_GPS_Time: GPSData(6) = 0 SERIN GPS_In, GPS_Baud, [WAIT ("$GPRMC"), SKIP 1, STR GPSData\6]
RETURN
'-------------------------------------------------------
LCD_GPS_data:
GPSData(24) = 0
SERIN GPS_In, GPS_Baud, [WAIT ("$GPRMC"), SKIP 13, STR GPSData\24] RETURN '------------------------------------------------------- Rec_GPS_data: GPSData(24) = 0 SERIN GPS_In, GPS_Baud, [WAIT ("$GPRMC"), SKIP 12, STR GPSData\25]
RETURN
'-------------------------------------------------------
Formatting:
LCDCMD E, LcdCls
LCDOUT E, LcdLine1, [" Formatting... "]
SEROUT SOUT, JP_Baud, ["MF!"] 'Format MMC/SD Card
PAUSE 50
SEROUT SOUT, JP_Baud, ["OldSpring!!"] 'Volume label
PAUSE 1000

Waiting:
IF StatePin = 1 THEN
LCDOUT E, LcdLine1, [" Finished! "]
ELSE
PAUSE 1000
GOTO Waiting
ENDIF
RETURN
'-----------------------------------------------------
Init_JP_Module:
OUTPUT ResetPin
ResetPin = 0
PAUSE 1000
ResetPin = 1
PAUSE 1000

SEROUT SOUT, JP_Baud, ["MA!"] 'Open data file
PAUSE 50
SEROUT SOUT, JP_Baud, ["GPSTrack.CSV!!"] 'File Name
PAUSE 1000

IF StatePin = 0 THEN 'If file not find, create a new file
ResetPin = 0
PAUSE 1000
ResetPin = 1
PAUSE 1000
SEROUT SOUT, JP_Baud, ["MC!"] 'Create a new file
PAUSE 50
SEROUT SOUT, JP_Baud, ["GPSTrack.CSV!!"] 'File Name
PAUSE 1000
SEROUT SOUT, JP_Baud, ["Latitude,Longitude", CR,"!!"] 'Data title
PAUSE 1000
ENDIF
RETURN
(3) Project photo

Thanks to electro-tech-online team and all forum users,
OldSpring (Author of the project)

#### VISHAL PATEL 555

##### New Member
what application?

#### mohsinans

##### New Member
hi.....u know what....ur project would be very helpful to me....coz we have been given the same project for our final year.........but the problem is.......i have been told to make the module of GPS myself.....now can you pz let me know as to what all things may be necessary to study to make this possible.....and whethr it is possible to be made on our own.......plz reply soon...thanx....tc

#### oldspring

##### New Member
I think I have already posted all of information ( including manufactures and parts datasheet) for this project. You can follow the project schematic put every parts togather, load the code to MCU. It should work.

#### Ubergeek63

##### Well-Known Member
hi.....u know what....ur project would be very helpful to me....coz we have been given the same project for our final year.........but the problem is.......i have been told to make the module of GPS myself.....now can you pz let me know as to what all things may be necessary to study to make this possible.....and whethr it is possible to be made on our own.......plz reply soon...thanx....tc
What do you have at your disposal? In all likelihood you do not have the capability to build it yourself without using a GPS module. The 2GHz satellite signal is far beyond the ability of many engineers, never mind students, even with the appropriate ICs in hand.

Unless you have a \$10K+ prototyping system capable of double sided plate through PCBs and are capable and willing to solder 0.5mm pitch 100 pin ICs for 5-10 prototype runs to work out the bugs do not even bother.

And that is if you are lucky, most of the chips on the market are fine pitch BGAs- you can not even check your soldering with out an x-ray machine!

Dan

#### tariq7868

##### New Member
Hello,, i am new to GPS receiver modules, so Can you please refer any good guide/tutorial to GPS modules & interfacing the GPS module with microcontroller.?? Thankyou

#### Diver300

##### Well-Known Member
All GPS receivers that I have used will output several strings each second. All you need to do is apply power to the GPS receiver and the data strings start being sent. One of those is the RMC string which tells you all you usually need for position.

The usual rate is 4800 baud. If you can connect to the 3 V serial level from the GPS, that can be connected directly to the USART receive input on a PIC. If you set the USART to 4800 baud, 8 bits, 1 stop bit, it should receive each character, and then the code takes each character from the USART.

The GPRMC Sentence

That shows you how the data is encoded. Your code will have to pull the correct numbers from each part of that.

#### dare4351

##### New Member
hi i am a final year student, doing same project here. I am using a garmin 15l reciever and an Atmega32 microcontroller. till now am able to display all the values onto the LCD, but am not ablt to store the data onto MMC. i'm using a mobile handset mmc for this. PLs can u help me the code for atmega32. I have tried so hard for this and now stuk there... please.

#### Oznog

##### Active Member
All GPS receivers that I have used will output several strings each second. All you need to do is apply power to the GPS receiver and the data strings start being sent. One of those is the RMC string which tells you all you usually need for position.

The usual rate is 4800 baud. If you can connect to the 3 V serial level from the GPS, that can be connected directly to the USART receive input on a PIC. If you set the USART to 4800 baud, 8 bits, 1 stop bit, it should receive each character, and then the code takes each character from the USART.

The GPRMC Sentence

That shows you how the data is encoded. Your code will have to pull the correct numbers from each part of that.
That's NMEA 0183. Since the NMEA 0183 standard is very limited in what it's specified to provide and not very compact, many modules have a vendor-specified binary protocols like SiRF Binary Protocol at more modern baudrates like 38400, and/or custom NMEA sentences- such as a command to use a higher baud rate- which aren't specified in the NMEA 0183 protocol.

I second the opinion that there's NO way you could build the GPS module itself. That takes literally years of development by people with lots of letters in their degrees and considerable experience in the industry. Your project is to get a microcontroller to USE a module you bought and do... something with it.