Copyright: | Copyright 2007 Dean Hall. All rights reserved. |
---|---|
Author: | Dean Hall |
Revision: | 03 |
Date: | 2007/11/26 |
After comparing two affordable GPS modules, I found the EverMore GM-R900 (see at right) to be better-suited for connecting to a microcontroller. It has its UART-to-USB converter circuit built into a little pod in the USB cable, not in the module housing. Best of all, the pod is easily opened with a small Phillips-head screwdriver and the converter circuit board has all wires labeled for easy access!
Take a small phillips-head screwdriver to the little pod near the USB connector. Remove the two screws and the pod opens to reveal the UART-to-USB bridge circuit.
On the left side of the circuit board, the yellow silkscreen text reads (from top to bottom): GND, RxD, TxD, VCC, GND. The GND at the top is for the cable shielding. The GND at the bottom is for the circuit. These two GNDs are connected. The RxD and TxD lines are the TTL-level UART lines that we will connect to the microcontroller's UART. The C4 and C5 capacitors are not important to this project, leave them alone.
On the right side of the circuit board, the yellow silkscreen text reads (from top to bottom): GND, D-, D+, VDD, GND. The top GND is shielding and the bottom is for the circuit, just like before. The D- and D+ are the differential signals for the USB lines.
The following table explains the color coding of the wires:
Meaning of the wire color... | ||
---|---|---|
Color | ...on the module-side | ...on the USB connector side |
Black | GND (cable shield) | GND (cable shield) |
Green | TXD [1] | USB D+ |
White | RXD [2] | USB D- |
Red | VCC | VDD (+5 V) |
Black | GND (digital) | GND (digital) |
[1] | On the PCB the Green wire's connection point is labeled RxD, that is the receive line for the Silicon Labs CP2102, which is connected to the transmit line of the GPS module. That's why Green is the GPS' Tx. |
[2] | On the PCB the White wire's connection point is labeled TxD, that is the transmit line for the Silicon Labs CP2102, which is connected to the receive line of the GPS module. That's why White is the GPS' Rx. |
In the little pod in the cable, unsolder the five wires on the GPS module side. This will leave you with TWO useful things. On one hand, you have a GPS module with wires for UART output. On the other, you have a USB Type-A connector with a bus-powered USB-to-UART bridge. So not only will we have a SiRFstar III GPS, but we'll have a USB serial dongle that connects to TTL-level devices and provides up to 500 mA current. All for $43!
Once the pod is unsoldered from the GPS module, clean out the holes where the wires were removed. Reheat each hole until its solder flows, remove the heat source and quickly use a solder sucker or protect your eyes and blow forcefully. The bottom four (of the 5) holes are 0.1" apart. Insert a 1x4 female header socket and solder it in place. This female socket will accept the male headers that will be soldered to the GPS module's wires, but it also lets you put jumper wires (say, from a breadboard) into the holes for other projects that need an ad hoc serial to USB conversion.
The GPS module now has 5 stray wires with bare ends. Solder these to a four (4) pin male 0.1" header connector in the order specified in the table below. Note that the Cable shield GND and the digital GND are already internally connected and both wires will be soldered to the same post on the four pin connector.
Color | Header Pin No. | Meaning | Use |
---|---|---|---|
Green | 1 | TXD | Connects to microcontroller's UART RX |
White | 2 | RXD | Connects to microcontroller's UART TX |
Red | 3 | VCC | +5V (73 mA approx) |
Black (x2) | 4 | GND | Ground (combines shield and digital GND) |
A benefit of this pin ordering is that it makes a header plug that is pin compatible to the Handyboard (and my MMB103 board) for read-only operation of the GPS module.
When soldering stray wires to a header like this, I recommend using heat shrink tubing for electrical isolation and physical strain relief. I also use low-temp hot glue for more strain relief and to provide a nice grip for the plug. Use a clear glue stick so you can see the wire colors after gluing.
Before connecting the GPS module to my STK500, I measured the current that the module draws: roughly 73 mA. That's a good number to know. I connected the module's black wire to GND and red wire to VTG (voltage of target device).
The first test was to see if the module was producing inverted or non-inverted TTL serial levels. So I connected the green wire to the RS232 SPARE TXD. I used PySerial and was able to read valid NMEA sentences through a serial cable connected to RS232 SPARE. This means the data is non-inverted and should be able to be read by the ATmega8 directly. So, I changed the GPS module's green wire to connect to PD0, which is the ATmega's USART receive (RXD) pin.
The second test was to have the microcontroller echo everything from the RXD to the TXD. This little program works for an AVR, provided you build with usart.c and usart.h:
#include <stdio.h> #include "usart.h" int main() { usart_init(4800); for (;;) { putchar(getchar()); } }
Seeing NMEA output here confirms that the microcontroller is able to get output from the GPS module! Next up, an USART interrupt service routine that contains a state machine to swallow whole NMEA sentences at a time.