We often want to keep in track of such things which are much precious to us. For such things, we seek for any best possible means to secure it. These things can be car, truck, containers, and even our loved ones ;). This device was built to perform the particular task.
The main idea for this device is to keep it portable and handy, with the people in touch with the global location of this device and some other information achieved by interfacing sensors to this device. Although, we also intended to control things, using it. Let us suppose that your car has been stolen, so if you wish to, you can simply turn the car off, using any internet facility after covering some encryption.
We chose GSM based tracking system because its cheap and by using its GPRS connectivity we can either send the data with higher frequency, due to few number of bytes for information and for actuation. Its range its vast enough that it can work across the country wherever the GSM SIM’s vendor signal are available. The basic idea was to update the database on the server using this device. Therefore, it is another meaningful reason for using GSM for easy GPRS accession.
A GUI based application was equally necessary to provide a user the facility to easily track his device whenever he wishes too. The software can also plot the route between different time intervals.
The GPS Tracking Device is controlled throughout by ATMEL’s ATMega32U4 microcontroller. The block diagram is clearly illustrating the whole process.
Figure 1 - Block Diagram
The ATMEL’s ATMega32U4 communicates with GPS and GSM Module over UART with a BAUD Rate of 4800. Since the microcontroller has only one UART for communication, we need to seek several other options for communicating with a single UART to GPS and GPS Module.
Since we just need a receiver RX pin from GPS module, because it samples the data each second over UART with a predefined BAUD Rate of 4800. Therefore, we just need to multiplex the two RX from GPS and another from GSM, with the control selection from microcontroller. The multiplexer IC used for multiplexing is 74LS257. It has quad 2-line-to-1-line data selectors/multiplexers (with non-inverted 3-state outputs).
Now I will explain in brief the working and operation of both the modules.
I. GPS Module - GR89
GR89 is a product from HOLUX Company. HOLUX Technology Inc. is a professional consumer GPS (Global Positioning System) products provider. It was established in 1994. Since then, they develop and sell GPS and RF products. Current products include Handheld GPS, GPS Receiver and GPS module.
Figure 2 - GR89 - GPS Module
HOLUX GR-89 is a high performance, low power consumption, small size, very easy integrated GPS module designed for a broad spectrum of OEM system applications. This product is based on the proven technology found in other HOLUX 20 channel GPS receivers and SiRF GSC3f chipset solution. The GPS module will track up to 12 satellites at a time while providing fast time-to-first-fix and one-second navigation updates. Its far reaching capability meets the sensitivity requirements of car navigation as well as other location-based applications. Therefore, HOLUX GR-89 module is very fit to the customers who devote themselves to AVL system integration and location-based service.
The GR-89 design utilizes the latest surface mount technology (BGA) and high level circuit integration to achieve superior performance while minimizing space and power requirements. This hardware capability combined with software intelligence makes the board easy to be integrated and used in all kinds of navigation applications or products. The application system may communicate with the module set via two RS232 compatible bi-directional communication channels with CMOS 3V voltage level.
1.SiRF GSC3f chipset with embedded ARM7TDMI CPU available for customized applications in firmware.
2.20-Channel GPS Receiver for fast acquisition and reacquisition.
3.Very compact size, only 25.4 x 25.4 x 3 mm.
4.200,000 effective correlators for fast Time To First Fix (TTFF), even at poor satellite signal.
5.Built-in WAAS/EGNOS Demodulator.
6.Low power consumption with Advanced Trickle-Power and Push-To-Fix mode.
7.Support NMEA-0183 v2.2 data protocol and SiRF binary code.
8.Real time navigation for location based services.
9.For Car Navigation, Marine Navigation, Fleet Management, AVL and Location-Based Services, Auto Pilot, Personal Navigation or touring devices, Tracking devices/systems and Mapping devices application.
The GR89 by default samples the data including GPS Coordinates, Date, Time and various related fields each second, with a BAUD Rate of 4800. This BAUD Rate is configurable. “Global Positioning System Fix Data (GGA)” called as GPGGA includes the data for global position. While date and time can be fetched by the “Recommended Minimum Specific GNSS Data (RMC)” called as GPRMC. The logic, used for programming the controller, behind fetching the data is given below:
This function polled until the UART receives ‘GPGGA’ totally. On calling this function, one must be sure that he is going to receive ‘GPGGA’
Code 2 - GPRMC finding loop
Now to read values and then storing the latitude, longitude, date and time defined in the globally defined variables. Note, the function fillString() and findChar() has dedicated task to start reading and storing the no. of characters one by one into the string defined in the argument and returning the hold to the program after a specified char has been found respectively.
Code 3 - Reading GPS function
II. GSM Module - SIM900
The GSM module SIM900 is the product of SIMCOM Internationals. This is a complete Quad-band GSM/GPRS module in a SMT type and designed with a very powerful single-chip processor integrating AMR926EJ-S core, allowing you to benefit from small dimensions and cost-effective solutions.
Featuring an industry-standard interface, the SIM900 delivers GSM/GPRS 850/900/1800/1900MHz performance for voice, SMS, Data, and Fax in a small form factor and with low power consumption. With a tiny configuration of 24mm x 24mm x 3 mm, SIM900 can fit almost all the space requirements in your M2M applications, especially for slim and compact demands of design.
The modem needed only 3 wires (TX, RX, GND) except Power supply to interface with microcontroller/Host PC. Using this modem, you will be able to send and read SMS, connect to internet via GPRS through simple AT commands.
Figure 3 - SIM900 GSM Module
GPRS Command Set
Its datasheet lists various commands and their response types over different conditions. To power-up the GSM module, PWR_KEY must be pulled down for 2-3 seconds. As in our case we are using the GPRS connectivity for porting our data to a free server by a free hosting service, I will just explain you the commands related to it.
Bearer Settings for Applications based on IP - AT+SAPBR
Format: AT+SAPBR = <cmd_type>,
0 Close Bearer
1 Open Bearer
2 Query Bearer
3 Set Bearer Parameters
4 Get Bearer Parameters
5Save the Values of Parameters to NVRAM
< ConParamTag >
“CONTYPE” Type of Internet connection.
“APN” Access point name string: maximum 50 characters.
“USER” User name string: maximum 50 characters.
“PWD” Password string: maximum 50 characters.
“PHONENUM” Phone number for CSD call.
“RATE” CSD connection rate.
< ConParamValue_ConType >
“CSD” Circuit-switched data call.
“GPRS” GPRS connection.
Set HTTP Parameter Value - AT+SAPBR
Format: AT+ HTTPPARA=< HTTPParamTag>,
< HTTPParamTag >
“CID” (Mandatory Parameter) bearer profile identifier refer to AT+SAPBR
“URL” (Mandatory Parameter) HTTP client URL
"server": FQDN or IP-address
"path": path of file or directory
If param. is omitted the service connects to HTTP default port 80.
1.Setting bearer parameter, connection type to GPRS:
2.Setting Access Point Name:
4.Now initializing HTTP:
5.Setting configuration to 1 as defined above in SAPBR:
HTTP Method Action - AT+HTTPACTION
Format: AT+HTTPACTION =
< Method >
Read the HTTP server response - AT+HTTPREAD
Format: AT+ HTTPREAD=<start_address><byte_size>
<start_address> The starting point for data output.
<byte_size> The length for data output.
1.Setting target URL to HTTP parameters, we can also specify optional data by giving parameters:
2.After applying HTTPACTION to 0, GET session starts:
3.It is an optional argument, when in case we want to read the response from the server, basically the data. After HTTP GET method we can read the response. The example below, starts reading from pointer 0 to a size of 2 characters:
4.HTTPTERM terminates the session.
Figure 4 - Schematic Diagram
I. Windows based software
The software for windows was built using Visual Studio C#.NET. The code is divided into three parts.
2.HTTP Web Request (System.NET).
3.XCoolForms for Windows (additional feature).
The code uses GMap.NET.dll and GMap.NET.WindowsForms.dll to add controls to the form. It’s quite easy and simple to use. First of all the GMapControls are needed to be initialized using:
Code 4 - GMAP Initialization Procedure
Placing a Marker on the Map
Code 5 - Method to place a Marker on the Map
Plotting Route on the Map
Code 6 - Plotting route on the Map
To display related information of pointers we need to add tooltip functionality to it. It can be added using these code segments.
Code 7 - Adding tooltip to each marker
HTTP Web Request
Fetching the Data from Server
The following request will return data from the server stored by a GPS Device and save it as a string.
Code 8 - HTTP Web Request
Although it’s not necessary, We wanted to add a little colors to our dull looking form, so we decided to add XCoolForms for windows in our project, which we got from http://www.codeproject.com/Articles/33716/Fancy-Windows-Forms. This is not a major part of our project and we just wanted to add some colors so the code and explanation for this feature can be found in the given link.
As an additional feature we also added custom markers in our map like red dot, blue dot, arrow. For this purpose we obtain a custom marker class from http://www.codeproject.com/Articles/32643/GMap-NET-Great-Maps-for-Windows-Forms-and-Presenta
Figure 5 - GPS Tracking Device without Antennas
Figure 6 - GPS Tracking Device Application