Relevant Music

Script: Use TomTom as GPS receiver for your Linux computer

GPSDrive

Running GPSDrive with TomTom

TomTom runs Linux (BusyBox) on their devices. Users can access the system using a shell and even dump the data of the GPS receiver. Instead of manually set the dump every time, which is hard work, I have made a small script for you.

Dedicated to geeks that have a TomTom and want to use their geekness for non-geek stuff, e.g. yachting.

There is an extension for TomTom devices on http://btconsole.renevoegeli.de/, that allows the user to access the internal Linux shell of the device via Bluetooth. Install it at your own risk! This allows your TomTom to dump the received NMEA information via console thus it can be used as a GPS receiver e.g. for your laptop.

Here is a script that connects to your TomTom automatically and creates a GPS device, this can take away the hard configuration on each startup. However, you should have a little knowledge about what the script is doing, because there may be some configuration that is needed.

Prerequisites

Install btconsole at http://btconsole.renevoegeli.de/ like explained. Test the installation by logging in at the console.

You need a valid Python interpreter and serial device support for the script to run. For Ubuntu and Debian users: Install the packets python and python-serial.

Installation

Put the script files into a directory. You need super-user permissions to run the script.

Be sure to set the modes to 755 (chmod 755).

Then you need to modify some files for the script work properly.

Modify the file “init”, which looks like this:

#!/bin/bash

MAC_ADDR=00:13:6C:A5:A7:EA

sdptool browse $MAC_ADDR
sudo rfcomm bind /dev/rfcomm0 $MAC_ADDR
sudo rfcomm -a

sudo mknod /var/run/gpswrapper p
sudo chmod 644 /var/run/gpswrapper

sudo ./dumpgps.py

This file starts up the bluetooth serial connection and creates a pipe /var/run/gpswrapper, where applications can retrieve the GPS data. The pipe acts as a “fake device”. Then the file starts the python script.

All you need to do: Set the MAC address field “MAC_ADDR=[x]” to the address of your TomTom device.

You can get this address via the command

“hcitool scan”

Be sure to power on your TomTom and the Bluetooth support. If your computer has found your TomTom the command will return the MAC address.

Second, modify the file dumpgps.py:

device='/dev/rfcomm0'
device2='/var/run/gpswrapper'

dumpCommand='cat /var/run/gpspipe' #for TomTom One XL
#dumpCommand='cat /dev/gpsdata' # for other/older TomToms

verbose = True
waitseconds = 6
loginAttempts = 20
commandAttempts = 150

You need to set the proper dump command. I only know that TomTom XL uses ‘cat /var/run/gpspipe’.

Try to keep verbose=true for your first try in order to detect any malfunction. If everything works, you can switch it off.

First run

Then start the file init:

./init

If the program periodically notes that the command prompt does not show up, terminate the program using Strg+C and restart it with:

./dumpgps.py

If everything worked successfully, the program says:

NMEA pipe /var/run/gpswrapper is now accessible by other devices, e.g. gpsd.

The program keeps running now. Do NOT close it, since it works as a service. Put it in background (e.g. with Strg+Z and then “bg”) or start a new shell window (recommended) for further commands.

Try if the GPS returns the appropriate data, type:

cat /var/run/gpswrapper

and look if it returns something like that:

$GPGGA,121619.12,,,,,0,00,1.0,,M,-0.514099,M,-8.5620199,0000*50
$GPRMC,121619.12,V,,,,,,,300109,,,N*79
$GPGSA,A,1,,,,,,,,,,,,,2.2,1.0,2.0*33
$GPGGA,121621.09,,,,,0,00,1.0,,M,-0.514099,M,-8.5620199,0000*51
$GPRMC,121621.09,V,,,,,,,300109,,,N*78
$GPGSA,A,1,,,,,,,,,,,,,2.2,1.0,2.0*33
$GPGGA,121623.07,,,,,0,00,1.0,,M,-0.514099,M,-8.5620199,0000*5D
$GPRMC,121623.07,V,,,,,,,300109,,,N*74
$GPGSA,A,1,,,,,,,,,,,,,2.2,1.0,2.0*33
$GPGGA,121625.13,,,,,0,00,1.0,,M,-0.514099,M,-8.5620199,0000*5E
$GPRMC,121625.13,V,,,,,,,300109,,,N*77
$GPGSA,A,1,,,,,,,,,,,,,2.2,1.0,2.0*33
$GPGGA,121629.11,,,,,0,00,1.0,,M,-0.514099,M,-8.5620199,0000*50
$GPRMC,121629.11,V,,,,,,,300109,,,N*79
$GPGSA,A,1,,,,,,,,,,,,,2.2,1.0,2.0*33
$GPGGA,121631.10,,,,,0,00,1.0,,M,-0.514099,M,-8.5620199,0000*58
$GPRMC,121631.10,V,,,,,,,300109,,,N*71

Close cat with Strg+C. This is NMEA position information of your TomTom GPS receiver. Now everything works as it should.

If nothing or something quite different is dumped, log in manually as described on the btconsole website and try the dump command. Sometimes, if you use /dev/gpsdata as dump command on the tomtom, it will output SiRF binary data. Then you have to switch to dumpCommand=’cat /var/run/gpspipe’. The dump command depends on the TomTom type (One, XL) and the version number. Maybe there are other dump commands for other devices I don’t know. Please post a comment which works for your device, for building a complete list of working dump commands.

xgps

xgps

Then you can start gpsd which is a service for commom Linux GPS applications using the fake device as input:

gpsd -N -D 5 /var/run/gpswrapper

for verbose output, not daemonized, or

gpsd /var/run/gpswrapper

to run it as a service.

Now you can start

xgps, gpsdrive or other common Linux GPS clients and start navigating:

Relevant Music © 2003-2006 Leo Nobach. Blog proudly powered by WordPress