Notices
Results 1 to 1 of 1

Thread: GPS Tracker Project ( BS2P + GPS module + JP Module + LCD )

  1. #1 GPS Tracker Project ( BS2P + GPS module + JP Module + LCD ) 
    New Member
    Join Date
    Aug 2008
    Posts
    3
    Hello all,

    I just finished a summer project which is a GPS tracker demonstration program with data logging capacity. It uses BasicStamp 2P to interface with a GPS Module, JP Module and 16x2 LCD display. Code used is standard PBasic 2.5, it should work with most of the BasicStamp chips.

    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: http://www.parallax.com
    Datasheet: http://www.parallax.com/tabid/440/Default.aspx

    (2) GPS Module 40EBLS
    Manufacturer: http://www.mightygps.com
    Datasheet: http://www.mightygps.com/oem/MightyGPS40EBLS.pdf

    (3) JP Module
    Manufacturer: http://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%20Index.htm

    Attached files:
    (1) Schematic


    (2) Code
    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 picture 1


    (4) Project picture 2


    (5) Project picture 3


    (6) GPS map


    (7) Google earth map 1


    (8) Google earth map 2


    (9) Google earth map 3


    Thanks to TheScienceForum team and all forum users,
    OldSpring (Author of the project)

    For more projects @ OldSpring project website:
    www.oldspring.110mb.com
    www.oldspring.vndv.com


    Reply With Quote  
     

  2.  
     

Bookmarks
Bookmarks
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •