|EE & Hardware (back to list)
|GPS for Graphing Calculators project page
|Global Position System (GPS) capabilities have long been a feature of high-end smartphones as well as dedicated GPS units. Given that graphing calculators are powerful pocket computers, it seemed clear that a calculator could be use to receive and decode GPS information. While this turned out to be the case, several technical challenges had to be solved first. A serial library was created despite missing timing features in the hardware, and a poorly-document USB OTG IP was hacked to provide 5V at 50mA to operate the device.
|January 8, 2014
|February 4, 2014
Graphing calculators are nothing less than powerful pocket computers, capable of doing many of the same things as smartphones, desktops, and laptops. Given that they have reasonably fast processors, a display, memory, and ports to interface with the outside world, I set out to making graphing calculators capable of determining their location using standard GPS hardware. I started with the TI-84 Plus / Silver Edition series of graphing calculators, which have a 15MHz processor, a 96x64-pixel monochrome screen, rudimentary timers (as well as one 32KHz crystal timer), and perhaps most importantly, two ports to interface with the outside world. One is a USB OTG port, a mini-USB port capable of acting as either a host or device, and therefore capable of producing 5V for peripherals. The other is a "serial" I/O port with two bidirectional TTL-level data lines. For my project, I chose to use the USB port for power, and the I/O port to communicate with a TTL serial GPS module. I created both the hardware and software necessary to make the project a reality, then suffered through two weeks of trying to get a GPS fix amid the metal canyons of a major US city.
Figure 1: GPS module connected to TI-84 Plus Silver Edition, successfully reading GPS information from 8 satellites.
Along the way, the two major technical challenges I faced were building a serial library and powering the module from the calculator. First, the serial library: I needed to create a reliable serial communication library capable of operating in an interrupt and maintaining correct timing without consuming too much CPU time. The TI-84 Plus and TI-84 Plus Silver Edition have a series of timers that can be set to fire interrupts either at fractions of the clock speed (15MHz) or fractions of the crystal timer (32KHz). Unfortunately, the crystal timebase cannot easily be used to get a 4800Hz interrupt for 4800bps serial communication, and the CPU clock speed is set by resistors and is neither completely reliable nor consistent across different handheld units. I ended up using the timer set at a base of 195 ticks of (15MHz/16) in between interrupts, or a nominal 4807Hz. Because of the differences between units, the user can use the up and down arrow keys to adjust the number of ticks in between interrupts. In practice, pressing [up] twice, yielding a spacing of 197 ticks or what should be 4758.9Hz for a perfect 15MHz clock produced the most accurate serial reception. Luckily, NMEA0183, the protocol spoken by GPS modules, includes a checksum at the end of each "sentence" or message, allowing the calculator to discard corrupted sentences. The second problem, generating a reliable 5V from the USB port, required building on the work of other experiences calculator hackers who have reverse-engineered details of the proprietary USB IP used in these calculators. Unfortunately, the calculator burns through batteries very quickly when powering the GPS module, but it functions and requires neither its own battery nor charging circuitry.
The remainder of this writeup presents photos and a video, as well as the software and schematics necessary to replicate my work. If you have questions, feel free to post on the Cemetech forum. 2. Photos and Video
I created a short video of the TI-84+SE pulling data from the GPS module, dumping the raw NMEA sentences at the top of the screen and decoding the sentences at the bottom. You can see that demonstration in the following video.
The figure in the previous section showed the module (with its plastic cover removed) successfully connected to 8 GPS satellites, sending time, date, and location information to the graphing calculator for display. The following two figures show two more views of the modules, one with it disconnected, the other connected and active but with no GPS fix. Note that in these photos an external GPS antenna is not connected, so the GPS module uses its built-in antenna.
Figure 2: GPS module above TI-84 Plus Silver Edition graphing calculator, with I/O ("serial") and USB plugs shown. This image was taken with the protective plastic cover over the GPS module removed for clarity.
Figure 3: GPS module connected to calculator, powered and operating, but with no GPS fix.
Minimal extra hardware is required to connect the GPS module to the graphing calculator. The prototype uses a SiRFStar III GPS module with internal antenna attached to perfboard. It has an on-board power indicator LED, and connects to both the calculator's I/O port and USB port. You can directly control the two bidirectional data lines in the I/O port from the calculator's CPU via z80 assembly, so the I/O port is used for serial communication with the GPS module. The USB port is used as a simple 5V source to power the module.
The software side uses a 2KB z80 assembly program to communicate with the module. An interrupt running at roughly 4800Hz is used to implement serial communication, transferring data between the I/O port and a pair of buffers. The program verifies the integrity of each NMEA sentence received using its checksum, and if it's valid, parses GPGGA, GPRMC, and GPGSA sentences. From these sentences, it extracts information about the time, date, type of fix, latitude, longitude, altitude, and number of connected satellites. Finally, this information is displayed on the screen. Although it would be possible to create vector maps that could be stored in the calculator's memory and overlaid with the user's position on the map, unless there turn out to be practical applications of this that smartphones and GPS devices doesn't cover, I have no plans to add that feature.
GPS for Graphing Calculators software driver
Figure 4: Schematic of GPS module attached to graphing calculator. Data is sent and received through the 2.5mm link port, while the USB OTG port is used purely for power.