Earlier in the summer, I posted about using the D2523T 50 Channel Helical GPS Receiver with the Beaglebone Black. I have also found the Copernicus II DIP Module from Sparkfun to be a very good GPS option. At $74.95, the price is similar to the D2532T. To help with reception indoors at my desk while doing development, I am using this antenna.
The Python code below is very similar to my earlier post, but I have added a line showing how easy it is to write configuration commands to the module using the PySerial library.
For more information on the NMEA configuration commands, see Appendix C of the Copernicus II manual. The command must include a 2-digit checksum after the asterisk. See this page for an online tool to calculate the checksum.
VCC P9 3
GND P9 1
TX-B P9 26
RX-B P9 24
os.system("echo uart1 > /sys/devices/bone_capemgr.9/slots")
# Adjust the connection speed as needed.
# You can use Triimble Studio on your PC to detect/set speed
# if you can't figure it out.
serial = serial.Serial("/dev/ttyO1", baudrate=115200)
# Send NMEA config cmd to output only $GPRMC message every second
nmeaCmd = "$PTNLSNM,0100,01*56\r\n"
resp = ""
while (serial.inWaiting() > 0):
resp += serial.read()
if "\r\n" in resp:
if "$GPRMC" in resp:
data = resp.split(',')
info = "UTC: %s Date: %s N Lat: %s W Long: %s" % (
data, data, data, data)
resp = ""