For this project, except for a GPS-enabled mobile phone to record GPS NMEA sentences, no hardware is required. I used an Android phone, and several applications are available in the Play Store which will allow you to record NMEA sentences either in the “.txt” or in the “.log” format. Since not all users have access to an Android phone, I have attached two sets of GPS sentences to allow you to complete this project. Since no GPS signal could be obtained indoors, the first set of GPS sentences were recorded by walking for approximately 100 metres outdoors. The second set of GPS sentences were recorded indoors for a no GPS signal condition. The only other hardware that is needed is a Host PC. For this project, I used a HP Pavilion G6 series laptop with an Intel 2.1GHz processor and 3 GB RAM running Windows 7 Home Basic 64-bit OS. The following software is needed to complete this project successfully:
1) GPS Sim
2) Labcenter Proteus v7.6 or upwards (for this project, v7.8 with SP2 was used)
3) Eltima Serial Port Splitter v5.0
Figure 1: GPS Simulator window
Figure 1 shows the GPS Simulator window. To begin browsing to the folder which has the NMEA sentence log files, click on the browse button. Select the interval as 8 seconds. 4 seconds can also be selected; however, any interval lower than this will cause errors in Proteus and latitude and longitude information will not be viewed for every sentence. Also, select RMC as the sentence type, as only these sentences are passed to the Proteus simulation and are used to obtain latitude and longitude information. Next, select the COM1 port in the port selection menu. Any available port can be selected as long as it is not the COM2 port. The COM2 port is used in Proteus to transmit data to the controller’s USART RX pin. Also the port selected from this menu has to be the same port that is used to create a virtual link (using Eltima Serial Splitter) between the port and the COM2 port in Proteus. The GPS Simulator software can be downloaded from the following link: ]]>http://www.lichtenheld-mch.de/gpssim.htm]]>
Figure 2: Serial Splitter window
Figure 2 shows the window for Serial Splitter 5.0 by Eltima Software. To create the virtual link between the port selected in GPS Simulator and the COM2 port used in Proteus, select the ‘Complex Bundles’ tab. For the input side, select the ‘Virtual port’ option and then the COM port used by GPS Simulator to pass the sentences to Proteus (COM1 in this case). Then click the ‘Add port’ button. Repeat the same procedure for the output side, but select the COM2 port. Once both, input and output ports have been added, click on the ‘Add bundle’ button. A successfully created bundle will show up in the left side of the software’s window as shown in the figure. A 14-day trial version of Serial Splitter can be downloaded from the following link: ]]>http://www.eltima.com]]>
Circuit diagram tab shows the Proteus circuit for the simulation. A 15.9744 MHz crystal is connected across pins 13 and 14 of the PIC18F458 microcontroller. Switch SW1 is the reset switch. The RXD pin of the P2 COMPIM component is connected to the RX pin (pin 26) of the controller. A MAX232 IC is not required as it is built into the COMPIM component. Port D of the controller is connected to the parallel data lines D0:D7 of the LCD display. Pins VSS and VDD of the LCD are grounded and supplied a voltage of 5V respectively. The RS, R/W and E pins of the LCD are connected to pins 38, 39 and 40 respectively on Port B.
To develop the control logic for parsing GPS sentences, the UART module was configured and latitude and longitude information was parsed using string manipulation. To configure the UART module, the RX pin was set for input and serial reception was enabled by assigning a value of 0x90 to the RCSTA receive register. The baud rate generator register SPBRG was assigned a value of 0x19 for 9600bps baud rate. Asynchronous mode was chosen by clearing the SYNC bit in the TXSTA transmit status and control register. The receive flag was cleared and data was copied from the receive register RCREG to a temporary variable when the flag set upon reception of data. The continuous receive enable bit CREN in the RCSTA receive register was then cleared to allow for continuous reception of data.
$GPRMC sentences were passed from the GPS simulator to the controller's RX pin via the COMPIM component. Two sets of these sentences were pre-recorded using a GPS-enabled mobile phone for two conditions – a changing GPS location and no GPS signal. For a changing GPS location, the first set of sentences was recorded over a 100m distance. For no GPS signal, the second set of GPS sentences was recorded indoors. The $GPRMC and $GPGGA sentences (GPS signal found condition) had the same length (76 characters). If no GPS signal was found, sentences which had a length less than 76 characters did not contain latitude and longitude information, instead a series of commas were found in the recorded sentences. These characteristics of the recorded sentences were used to identify the $GPRMC sentence and then extract latitude and longitude information. Identification of the $GPRMC sentence and the no GPS signal was achieved using string comparison. Once the GPS signal and the $GPRMC were found, the latitude and longitude were extracted by determining the starting position and number of characters in the latitude and longitude values. Figure 5 shows the control logic for parsing the $GPRMC sentence.
Figure 5: Control logic for parsing GPS sentence
To run the simulation the following steps should be performed in the order indicated:
1) Launch Serial Splitter and create the complex bundle between the in port of GPS Simulator and COM2 port of Proteus circuit
2) Open ‘gps.DSN’ in Proteus
3) Launch GPS Simulator and select the log file
4) Start the simulation in Proteus and then begin transmission of the log file in GPS Simulator
The LCD display will show that the GPS signal is found and display latitude and longitude information. Only part of this information is shown in Figure 6, as the LCD display is cleared and then following information on latitude and longitude is shown. For the second log file, the LCD display will show that the GPS signal is not found.
Figure 6: Latitude information shown partly