My Cal Poly Senior Project was remote device tracking using SMS and Google Maps. It involved interfacing a GPS receiver and cell phone to a development board with an LCD, an embedded web server running Microchip’s TCP/IP Stack serving a dynamic Google Maps page, and communication between the development board and server through SMS text messages

[ ----------- 100% ------------ ]

Status:   Completed

At California Polytechnic State University, San Luis Obispo (Cal Poly SLO), there is a Senior Project that needs to be completed before graduation. Generally speaking, it is a culmination of the things you have learned and/or have taken particular interest in while at Cal Poly, so it can be used to represent the one project that pieces everything together.

For my Senior Project, I chose to interface several devices and technologies to implement a real-time (more accurately, a near real-time) GPS tracker that displayed location updates on a Google Maps page served by an embedded web server, and data was communicated between the web server and tracker device through SMS messages (text messages). This project took a lot of time, code, learning (languages, implementation details, and background research), reading through datasheets, and testing.

At the core of the web server (the device that displays the tracker interface) and remote device (the device that was tracked) are two different Olimex development boards running PIC18F series microcontrollers. The web server has built-in Ethernet PHY and comes with a TCP/IP Stack from Microchip, and the remote device comes with a monochrome 84×48 LCD and a mini-joystick. They were perfect for this project, and they let me focus on the firmware as opposed to the hardware and firmware.

The high-level overview of the project is that the web server serves a Google Maps page with a few user choices and buttons. The user can select the rate of location updates, the number of previous locations to remember (as a history), and then can start/stop the updates from occurring. The remote device acquires GPS data through a connected GPS chip, and then can display the Lat/Long/Elevation/Speed/Heading/Time information as text on the LCD, or on a compass that is drawn on the screen. The user operating the remote device can also select the location update rate, and has the ability to permanently disable updates (which cannot be overridden by the web server). Both devices can force a single update (so long as the remote device has not permanently disabled updates).

    

Under normal operation, the remote device will acquire GPS coordinate updates at 1Hz, and will update the information internally (along with on the LCD if the user has selected one of the information screens). If it is time to send a new location update (due to a forced update or because enough time has passed since the last update), the remote device packages the data up into an SMS message. Packaging consists of storing the data into known locations within the entire payload, and then 7-bit packing the entire payload (converting 8-bit bytes into 7-bit .. somethings). We don’t need the most significant bit in ASCII, so by removing it, we can send a maximum of 160 characters per message instead of 140 characters. Once the data is packed, the remote device pre-pends the appropriate SMS header (destination number, SMS service center number, “TTL”, and some other options), and then sends a few special commands to the phone before our custom SMS message is allowed to be sent. These special messages are probably going to vary quite a bit between phones and protocols used, but using Nokia 3310s and the FBUS protocol, they were certainly necessary along with some interesting timing and retries.

On the web server side, when a location update message comes in, the phone automatically sends the full SMS message to the web server board. The web server unpacks the data (7-bit -> 8-bit), and then reads the parts it cares about. It then updates the internal variables to store this latest location information which are queried by a client in a “pull” fashion. When a user views the Google Maps page, the Javascripts read a few CGI pages which display the contents of the variables we care about. It does this through XMLHTTPRequests which happen periodically, so the updates appear automatically to the user. The user can select the number of location updates to show in the history (which are stored locally), and each previous location update is displayed using a different color.

Overall, this system gives a max update speed of about one update every 20s (in 2009 using two very slow phones..), and it gives visual location information to both the “tracker” and the “tracked”. It was a very fun project which involved my passions (embedded systems, computer networks, and wireless communication), and I certainly learned a lot.

For more detailed information on the technologies used, the components in the system, or how it was all implemented, read out my full report here: Senior Project Final Report