



To recreate this experiment you will need the following hardware (in addition to the Raspberry Pi itself):

Ultimate GPS Breakout

USB to TTL serial cable

Half-size bread board

Male/male jumper wires Plug the GPS module into the breadboard as shown and connect red to VIN, black to GND, green to RX and white to TX, using the jumper wires and the USB to TTL serial cable. Plug the USB end of the cable into the Raspberry Pi (powered down). Power up your Raspberry Pi.







The GPS module starts to transmit data shortly after power up and will continue to do so until it is unplugged from a power source.



In a terminal start the Wolfram Language using the following command:

> wolfram



Wolfram Language (Raspberry Pi Pilot Release)

Copyright 1988-2013 Wolfram Research

Information & help: wolfram.com/raspi



In[1]:=





You can now open the serial port using the

serial = DeviceOpen["Serial",{"/dev/ttyUSB0","BaudRate"->9600}]



This returns a DeviceObject which can be used to read GPS data from. In this case we use

data = DeviceReadBuffer[serial,"String"]

The data returned is in a comma separated format, called $GPRMC,154541.000,A,4005.8369,N,08814.7322,W,0.04,253.32,201113,,,A*79

$GPVTG,253.32,T,,M,0.04,N,0.07,K,A*3B

$GPGGA,154542.000,4005.8369,N,08814.7322,W,1,8,1.07,228.0,M,-33.9,M,,*6B

$GPGSA,A,3,04,12,10,17,23,24,25,02,,,,,1.31,1.07,0.76*04

$GPGSV,3,1,12,04,65,040,24,02,63,265,16,10,55,135,39,12,48,302,21*7D

$GPGSV,3,2,12,17,35,096,33,05,19,190,17,25,13,321,33,24,12,247,16*71

$GPGSV,3,3,12,23,05,061,31,13,02,090,27,20,02,036,35,45,,,*45

$GPRMC,154542.000,A,4005.8369,N,08814.7322,W,0.06,253.32,201113,,,A*78



We can import the data with the Wolfram Language using ImportString: csv = ImportString[ data, "CSV" ]

The NMEA sentences which contain GPS coordinates start with $GPRMC so we filter for those using Cases and pattern matching: gps = Cases[ csv, {"$GPRMC", ___} ]

The coordinates (latitude and longitude) are in the 4th and 6th position of each list, for example this is the GPS coordinate for the first data point: Part[ gps, 1, {4,6} ] / 100

which returns the GPS location for Champaign, Illinois, where Wolfram Research is located 40' North, 88' West): {40.0583, 88.1474} This post shows how to build a simple GPS tracker with the Wolfram Language on a Raspberry Pi.To recreate this experiment you will need the following hardware (in addition to the Raspberry Pi itself):Plug the GPS module into the breadboard as shown and connect red to VIN, black to GND, green to RX and white to TX, using the jumper wires and the USB to TTL serial cable. Plug the USB end of the cable into the Raspberry Pi (powered down). Power up your Raspberry Pi.The GPS module starts to transmit data shortly after power up and will continue to do so until it is unplugged from a power source.In a terminal start the Wolfram Language using the following command:You can now open the serial port using the DeviceOpen by entering:This returns a DeviceObject which can be used to read GPS data from. In this case we use DeviceReadBuffer to read all available GPS data that has been generated up to this point:The data returned is in a comma separated format, called GPS NMEA sentences We can import the data with the Wolfram Language using ImportString:The NMEA sentences which contain GPS coordinates start with $GPRMC so we filter for those using Cases and pattern matching:The coordinates (latitude and longitude) are in the 4th and 6th position of each list, for example this is the GPS coordinate for the first data point:which returns the GPS location for Champaign, Illinois, where Wolfram Research is located 40' North, 88' West):