GPS Hacking: Turning a USB GPS receiver into serial TTL
This article will explain how to turn an USB GPS Receiver into a TTL serial one (and later RS-232).
GPS receivers are nowadays cheap and easy to find... at least Bluetooth and USB ones. But what if you need a serial GPS? If you're developing an embedded device you probably need a serial GPS (RS-232 or TTL: the difference will be explained later).
Serial GPS, on the other hand, are really hard to find (often the choice is limited to obsolete early GPS chips) and really expensive, especially compared to modern ones.
Here's the hack. The most USB GPS receivers do NOT have a native USB interface. What does it mean? It means that in the most cases their chip, in the inside, has a serial interface which is attached to a TTL to USB converter (another small chip) that terminates with an USB plug.
The idea of this tutorial is to show how to bypass the TTL to USB internal converter and connect directly to the GPS serial interface (so the USB cable will be effectively used to transport serial data).
PL2303 TTL to USB converter
Each GPS manufacturer chooses its own USB converter. The most common chip (or at least the one in my GPS receiver) is the PL2303. The goal is to detach the PL2303 (or at least disconnect all its pins) and connect the USB D+ D- wires (usually the green and white wires) directly to the TX and RX pins of the GPS chip.
Note: once you turn the GPS unit into a serial one, a dedicated +5V VDD rail will be required (in the USB version it's taken from USB power, usually red wire).
Bypass the PL230
Carefully cut edges of the unit with a knife or, better, a Dremel.
This operation requires a bit of patience as you should not cut too deep into the plastic housing (you may damage the internal GPS unit).
Once done open the plastic housing (do not throw it away as you will need it later to remount the unit). Is should look as the following picture.
Here comes the tricky (and delicate of course) part. Using a small screwdriver open the metal housing and reach the GPS eninge circuitry. Cut the USB D+ and D- wires from the white plastic connector (usually green and white).
Detach the PL2303 chip than connect the cut wires to pins 1 and 5 (serial TX and RX lines connected to the GPS core). Be very accurate when soldering wires on the damn small SMD board and make sure not to create accidental short circuits nor to damage any other component.
Once the work is done it's a good idea to lock all the thin soldered wires with a silicone glue in order to make sure they will not accidentally disconnect.
Reassemble all detached parts (eventually put a piece of rub around the wires to protect them) and cut the USB connector from the other end of the cable.
If wire colors match you should now have:
- Black wire: GND
- Red wire: +5V VDD
- White wire: TX (or RX)
- Green wire: RX (or TX)
First of all apply 5V power to the GND-VDD pins. If the green light turns on we got the first good sign :).
Now we must assure that internal serial connections are OK. IMO the best way to do this is connecting an oscilloscope to the TX wire and check for a pulse train signal.
The signal you get (at least I hope so) is the serial-encoded NMEA data the GPS is transmitting (please note that usually GPS modules require a couple of minutes to align to satellites before starting to output NMEA data).
TTL vs RS-232
Now we got the serial signal, does it mean that we can solder a DB9 serial connector, connect it to PC and see NMEA data with a serial terminal software? Absolutely NOT.
In most of the cases, the signal we get from the GPS unit is a TTL signal.
It means that the two logic states 0 and 1 are referred to 0V (Logic 0) and +5V (Logic 1) volt levels. This levels should be ok if you plan to use the unit with a micro-controller (such as a STx or a Microchip PIC). The most micro-controllers, in fact, use TTL logic for on-board I/O operations so no level translation is needed.
PC Serial ports are a bit different: the RS-232 standard, in fact, use different voltage levels (although timing is the same).
+5 to +12V means Logic 0. -5V to -12V means Logic 1.
So if you plan to use the GPS unit with PC you need a TTL to RS-232 level translator. It's absolutely simple to realize, all you need is a MAX232 level translator chip and some capacitors. I'll describe this in another article.