Tuesday, June 18, 2013

RTKLIB on the Raspberry Pi

I've got a workmate. He wants to build an autonomous, electric, rotary hoe. Anyway, he needs to locate  the hoe to within a few centimetres.

I'd been contemplating DGPS for a while as I've found GPS tracks are a bit wandery when logging tracks for OpenStreetMap. I thought it'd be a good capability to have, so I've stepped up to the task of tracking Robohoe.


Background Information

This is basically a link dump of what I've found so far:

RTKLIB : DGPS software
  This is the bees knees for cheap arse DGPS. It can take raw GPS input from 5 or 6 different types of GPS, as well as most variants of the RTCM GPS correction stream. It can combine two data streams, from a reference station and a rover, to produce a high-precision position for the rover, or it can take a single stream from a reference station and produce an RTCM output for other stations.

  It's also got a number of other super handy programs, that do things like convert RTKLIB output into a Google Earth KML file, serve serial input out to multiple processes via Unix sockets etc.

The RTKLIB manual is here.

LEA-4T : GPS hardware
  The U-Blox 'T' series of modules (the LEA-4T, LEA-5T, and NEO-6T) produce data suitable for input to RTKLIB. The link above is the cheapest source I've found for these. I've bought 5 so far, and they've all been OK. Interestingly, this guy sells them on EBay for about three times the price.

 The pinout for this module is (from here):
antenna - SMB male connector
2 4 6 8
1 3 5 7
bottom

1 antenna vcc
2 vcc
3 tx
4
5 rx
6 timepulse
7
8 gnd

Note that Antenna Vcc and Vcc are both 5V, and aren't connected on board, so 5V is needed on both pins. Tx and Rx are both serial at 3.3V levels.

EBay : GPS antenna
  Generic powered GPS antenna with SMB plug, ~$7.00. Works.

EBay : USB serial unit
  Generic FTDI USB serial dongle. Used for GPS configuration on a Windows machine. In final use, the module will send data to the Pi via the 3.3V serial port on the GPIO.

u-center : GPS configuration software
  This is a whizzy Windows application which can be used to configure the modules to output the correct messages for RTKLIB. It can also be used to have a peek at the contents of all the mysterious binary packets that come out of the module.

Geosciences Australia : DGPS correction data
   GA runs a network of reference stations around Australia, and you can get non real-time correction data from their FTP site. This will be handy for post-processing data from my static installation to derive a precise location. I can then use the static station for real-time DGPS.

RNXCMP : file conversion software
  The GA data is in an odd format called the Hatanaka format. This program converts it into a more usable form.


Up To Now

What I've done so far is:

  • By default, Raspbian on the Pi runs a debug console on the GPIO serial port. I've modified the install to not do this and leave the serial port free.
  • Made up an adaptor to power the module from the GPIO, and send and receive data to the GPIO serial port.
  • Installed and (mostly) compiled RTKLIB.
  • Configured the module using u-center on a Windows machine.
  • Installed the module on the Pi, and used str2str (part of the RTKLIB suite) to send the module's serial data over the network.
  • Used the Windows version of RTKLIB to receive the data stream, and convert the raw stream to a position.


Current Status

The current status is:
  • My static antenna is fixed to point under the Laserlite in the porch.
  • Raw data is being collected from the module using the static antenna (~48 hours so far)


The Future

Future plans include:
  • Work out conversion of the GA correction files.
  • Work out how to produce a precise position from the logged static antenna data, and the GA correction data.
  • Work out how to produce real time correction data from the static station and RTKLIB.